git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #106115 from matthewbauer/static-nix-darwin

Improve static Nix Darwin support

commit1fb6bb97910a035544943a2e1f636d4ebbd3ff89 authorMatthew Bauer <mjbauer95@gmail.com> dateTue 8 Dec 2020, 15:55 (6 years ago) parentd84bd74805c9d4
1 file changed+10−5
pkgs/top-level/static.nix+10−5
pkgs/top-level/static.nix+10−5
@@ -34,14 +34,18 @@ self: super: let
3434 });
3535 };
3636
37− staticAdapters = [ makeStaticLibraries propagateBuildInputs ]
37+ staticAdapters =
38+ # makeStaticDarwin must go first so that the extraBuildInputs
39+ # override does not recreate mkDerivation, removing subsequent
40+ # adapters.
41+ optional super.stdenv.hostPlatform.isDarwin makeStaticDarwin
42+
43+ ++ [ makeStaticLibraries propagateBuildInputs ]
3844
3945 # Apple does not provide a static version of libSystem or crt0.o
4046 # So we can’t build static binaries without extensive hacks.
4147 ++ optional (!super.stdenv.hostPlatform.isDarwin) makeStaticBinaries
4248
43− ++ optional super.stdenv.hostPlatform.isDarwin makeStaticDarwin
44−
4549 # Glibc doesn’t come with static runtimes by default.
4650 # ++ optional (super.stdenv.hostPlatform.libc == "glibc") ((flip overrideInStdenv) [ self.stdenv.glibc.static ])
4751 ;
@@ -163,6 +167,7 @@ in {
163167 };
164168 mkl = super.mkl.override { enableStatic = true; };
165169 nix = super.nix.override { enableStatic = true; };
170+ nixUnstable = super.nixUnstable.override { enableStatic = true; };
166171 openssl = (super.openssl_1_1.override { static = true; }).overrideAttrs (o: {
167172 # OpenSSL doesn't like the `--enable-static` / `--disable-shared` flags.
168173 configureFlags = (removeUnknownConfigureFlags o.configureFlags);
@@ -281,8 +286,8 @@ in {
281286 python39 = super.python39.override { static = true; };
282287 python3Minimal = super.python3Minimal.override { static = true; };
283288
284−
285− libev = super.libev.override { static = true; };
289+ # Note: -static doesn’t work on darwin
290+ libev = super.libev.override { static = !super.stdenv.hostPlatform.isDarwin; };
286291
287292 libexecinfo = super.libexecinfo.override { enableShared = false; };
288293