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
This commit is contained in:
Matthew Bauer 2018-12-04 21:12:17 -06:00
parent b966d3c583
commit 8726f6a558

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;
};