mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-18 03:30:45 +00:00
Merge pull request #331964 from adisbladis/stdenv-adapters-env-cflags-link
stdenv: Take nested env.NIX_CFLAGS_LINK into account when making static binaries
This commit is contained in:
commit
36f51bc719
|
@ -99,8 +99,12 @@ rec {
|
|||
mkDerivationFromStdenv = withOldMkDerivation old (stdenv: mkDerivationSuper: args:
|
||||
if stdenv.hostPlatform.isDarwin
|
||||
then throw "Cannot build fully static binaries on Darwin/macOS"
|
||||
else (mkDerivationSuper args).overrideAttrs (args: {
|
||||
NIX_CFLAGS_LINK = toString (args.NIX_CFLAGS_LINK or "") + " -static";
|
||||
else (mkDerivationSuper args).overrideAttrs (args: if args ? env.NIX_CFLAGS_LINK then {
|
||||
env = args.env // {
|
||||
NIX_CFLAGS_LINK = toString args.env.NIX_CFLAGS_LINK + " -static";
|
||||
};
|
||||
} else {
|
||||
NIX_CFLAGS_LINK = toString (args.env.NIX_CFLAGS_LINK or "") + " -static";
|
||||
} // lib.optionalAttrs (!(args.dontAddStaticConfigureFlags or false)) {
|
||||
configureFlags = (args.configureFlags or []) ++ [
|
||||
"--disable-shared" # brrr...
|
||||
|
|
Loading…
Reference in a new issue