makeStaticDarwin: handle when env.NIX_CFLAGS_LINK is set

This commit is contained in:
Randy Eckenrode 2024-08-31 23:52:05 -04:00
parent 66fcbb94e7
commit 1c26a2fabc
No known key found for this signature in database
GPG Key ID: 64C1CD4EC2A600D9

View File

@ -138,11 +138,16 @@ rec {
# but more portable than Nix store binaries. # but more portable than Nix store binaries.
makeStaticDarwin = stdenv: stdenv.override (old: { makeStaticDarwin = stdenv: stdenv.override (old: {
mkDerivationFromStdenv = withOldMkDerivation old (stdenv: mkDerivationSuper: args: mkDerivationFromStdenv = withOldMkDerivation old (stdenv: mkDerivationSuper: args:
(mkDerivationSuper args).overrideAttrs (prevAttrs: { (mkDerivationSuper args).overrideAttrs (prevAttrs:
NIX_CFLAGS_LINK = toString (prevAttrs.NIX_CFLAGS_LINK or "") if prevAttrs ? env.NIX_CFLAGS_LINK then {
+ lib.optionalString (stdenv.cc.isGNU or false) " -static-libgcc"; env = prevAttrs.env // {
nativeBuildInputs = (prevAttrs.nativeBuildInputs or []); NIX_CFLAGS_LINK = toString args.env.NIX_CFLAGS_LINK
})); + lib.optionalString (stdenv.cc.isGNU or false) " -static-libgcc";
};
} else {
NIX_CFLAGS_LINK = toString (prevAttrs.NIX_CFLAGS_LINK or "")
+ lib.optionalString (stdenv.cc.isGNU or false) " -static-libgcc";
}));
}); });
# Puts all the other ones together # Puts all the other ones together