diff options
author | Alyssa Ross <hi@alyssa.is> | 2021-06-11 18:42:26 +0000 |
---|---|---|
committer | Jonathan Ringer <jonringer@users.noreply.github.com> | 2021-06-11 14:16:05 -0700 |
commit | b0b5ef7286dca098f40f5075175105c3c0dfbe05 (patch) | |
tree | 072ca704392f8968f06410a1e996192cfd939586 /pkgs/stdenv/adapters.nix | |
parent | 8f3ead7190b97ce1f0458766105832d5a6e02dcf (diff) | |
download | nixlib-b0b5ef7286dca098f40f5075175105c3c0dfbe05.tar nixlib-b0b5ef7286dca098f40f5075175105c3c0dfbe05.tar.gz nixlib-b0b5ef7286dca098f40f5075175105c3c0dfbe05.tar.bz2 nixlib-b0b5ef7286dca098f40f5075175105c3c0dfbe05.tar.lz nixlib-b0b5ef7286dca098f40f5075175105c3c0dfbe05.tar.xz nixlib-b0b5ef7286dca098f40f5075175105c3c0dfbe05.tar.zst nixlib-b0b5ef7286dca098f40f5075175105c3c0dfbe05.zip |
stdenv: introduce dontAddStaticConfigureFlags
With removeUnknownConfigureFlags, it's impossible to express a package that needs --enable-static, but will not accept --disable-shared, without overriding the result of removeUnknownConfigureFlags _again_ in pkgs/top-level/static.nix. It would be much better (and more in line with the rest of Nixpkgs) if we encoded changes needed for static builds in package definitions themselves, rather than in an ever-expanding list in static.nix. This is especially true when doing it in static.nix is going to require multiple overrides to express what could be expressed with stdenv options. So as a step in that direction, and to fix the problem described above, here I replace removeUnknownConfigureFlags with a new stdenv option, dontAddStaticConfigureFlags. With this mechanism, a package that needs one but not both of the flags just needs to set dontAddStaticConfigureFlags and then set up configureFlags manually based on stdenv.hostPlatform.isStatic.
Diffstat (limited to 'pkgs/stdenv/adapters.nix')
-rw-r--r-- | pkgs/stdenv/adapters.nix | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/pkgs/stdenv/adapters.nix b/pkgs/stdenv/adapters.nix index d8f73d5a7e3e..a8e984d61743 100644 --- a/pkgs/stdenv/adapters.nix +++ b/pkgs/stdenv/adapters.nix @@ -44,6 +44,7 @@ rec { then throw "Cannot build fully static binaries on Darwin/macOS" else stdenv'.mkDerivation (args // { NIX_CFLAGS_LINK = toString (args.NIX_CFLAGS_LINK or "") + " -static"; + } // pkgs.lib.optionalAttrs (!(args.dontAddStaticConfigureFlags or false)) { configureFlags = (args.configureFlags or []) ++ [ "--disable-shared" # brrr... ]; @@ -56,6 +57,7 @@ rec { makeStaticLibraries = stdenv: stdenv // { mkDerivation = args: stdenv.mkDerivation (args // { dontDisableStatic = true; + } // pkgs.lib.optionalAttrs (!(args.dontAddStaticConfigureFlags or false)) { configureFlags = (args.configureFlags or []) ++ [ "--enable-static" "--disable-shared" |