Remove platform suffix from binary produced by default flake target

This commit is contained in:
Brian Picciano 2024-01-15 17:07:55 +01:00
parent 4009f0da48
commit 43502f82f9

View File

@ -57,7 +57,7 @@
{} {}
supportedSystems; supportedSystems;
# eachCrossSystem [system] (buildSystem: targetSystem: ...) # eachCrossSystem [system] ({buildSystem, targetSystem, isDefault }: ...)
# #
# Returns an attrset with a key "$buildSystem.cross-$targetSystem" for # Returns an attrset with a key "$buildSystem.cross-$targetSystem" for
# every combination of the elements of the array of system strings. The # every combination of the elements of the array of system strings. The
@ -72,13 +72,20 @@
pkgs = mkPkgs buildSystem null; pkgs = mkPkgs buildSystem null;
crosses = builtins.foldl' crosses = builtins.foldl'
(inner: targetSystem: inner // { (inner: targetSystem: inner // {
"cross-${targetSystem}" = callback buildSystem targetSystem; "cross-${targetSystem}" = callback {
inherit buildSystem targetSystem;
isDefault = false;
};
}) })
{ default = callback buildSystem buildSystem; } {}
supportedSystems; supportedSystems;
in in
crosses // (rec { crosses // (rec {
default = callback buildSystem buildSystem; default = callback {
inherit buildSystem;
targetSystem = buildSystem;
isDefault = true;
};
release = let release = let
bins = pkgs.symlinkJoin { bins = pkgs.symlinkJoin {
name = "${default.name}-all-bins"; name = "${default.name}-all-bins";
@ -164,7 +171,7 @@
packages = eachCrossSystem packages = eachCrossSystem
(builtins.attrNames buildTargets) (builtins.attrNames buildTargets)
(buildSystem: targetSystem: let ({ buildSystem, targetSystem, isDefault }: let
pkgs = mkPkgs buildSystem null; pkgs = mkPkgs buildSystem null;
toolchain = mkToolchain buildSystem targetSystem; toolchain = mkToolchain buildSystem targetSystem;
naersk-lib = pkgs.callPackage naersk { naersk-lib = pkgs.callPackage naersk {
@ -177,7 +184,7 @@
strictDeps = true; strictDeps = true;
doCheck = false; doCheck = false;
release = true; release = true;
postInstall = '' postInstall = if isDefault then "" else ''
cd "$out"/bin cd "$out"/bin
for f in "$(ls)"; do for f in "$(ls)"; do
if ext="$(echo "$f" | grep -oP '\.[a-z]+$')"; then if ext="$(echo "$f" | grep -oP '\.[a-z]+$')"; then
@ -193,7 +200,7 @@
devShells = eachCrossSystem devShells = eachCrossSystem
(builtins.attrNames buildTargets) (builtins.attrNames buildTargets)
(buildSystem: targetSystem: let ({ buildSystem, targetSystem, isDefault }: let
pkgs = mkPkgs buildSystem null; pkgs = mkPkgs buildSystem null;
toolchain = mkToolchain buildSystem targetSystem; toolchain = mkToolchain buildSystem targetSystem;
in in