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