stdenv/adapters.nix: fixup makeStaticBinaries

- makeStaticBinaries don’t work on Darwin (no stable ABI!)
- Need to make sure NIX_CFLAGS_LINK appends
- isStatic is not used anymore

(cherry picked from commit 8726f6a558)
This commit is contained in:
Matthew Bauer 2018-12-04 21:12:17 -06:00 committed by John Ericson
parent e84255296f
commit 7fcbc52d7d

View File

@ -32,13 +32,15 @@ rec {
# Return a modified stdenv that tries to build statically linked
# binaries.
makeStaticBinaries = stdenv: stdenv //
{ mkDerivation = args: stdenv.mkDerivation (args // {
NIX_CFLAGS_LINK = "-static";
{ mkDerivation = args:
if stdenv.hostPlatform.isDarwin
then throw "Cannot build fully static binaries on Darwin/macOS"
else stdenv.mkDerivation (args // {
NIX_CFLAGS_LINK = toString (args.NIX_CFLAGS_LINK or "") + "-static";
configureFlags = (args.configureFlags or []) ++ [
"--disable-shared" # brrr...
];
});
isStatic = true;
};