diff options
author | John Ericson <Ericson2314@Yahoo.com> | 2016-11-06 21:27:38 -0800 |
---|---|---|
committer | John Ericson <Ericson2314@Yahoo.com> | 2016-11-06 21:27:38 -0800 |
commit | e22346c35ee8cb872d0587320083ba44230bd44b (patch) | |
tree | 9a3d7d72b09a13bc195e03389a80e51642f95b65 /pkgs/top-level | |
parent | eed34bd214d6f513a859f3cfc52b266a9d19898b (diff) |
top-level: Make stdenvCross which appears at first glance normal...
...but actually is weird just like the original
Diffstat (limited to 'pkgs/top-level')
-rw-r--r-- | pkgs/top-level/default.nix | 7 | ||||
-rw-r--r-- | pkgs/top-level/stdenv.nix | 33 |
2 files changed, 20 insertions, 20 deletions
diff --git a/pkgs/top-level/default.nix b/pkgs/top-level/default.nix index baf314edece73..73fe58ca7f345 100644 --- a/pkgs/top-level/default.nix +++ b/pkgs/top-level/default.nix @@ -12,6 +12,11 @@ # null, the default standard environment is used. bootStdenv ? null +, # This is used because stdenv replacement and the stdenvCross do benefit from + # the overridden configuration provided by the user, as opposed to the normal + # bootstrapping stdenvs. + allowCustomOverrides ? (bootStdenv == null) + , # Non-GNU/Linux OSes are currently "impure" platforms, with their libc # outside of the store. Thus, GCC, GFortran, & co. must always look for # files in standard system directories (/usr/include, etc.) @@ -109,7 +114,7 @@ let # attributes to refer to the original attributes (e.g. "foo = # ... pkgs.foo ..."). configOverrides = self: super: - lib.optionalAttrs (bootStdenv == null) + lib.optionalAttrs allowCustomOverrides ((config.packageOverrides or (super: {})) super); # The complete chain of package set builders, applied from top to bottom diff --git a/pkgs/top-level/stdenv.nix b/pkgs/top-level/stdenv.nix index f9ba5e7516ef8..20f201869594e 100644 --- a/pkgs/top-level/stdenv.nix +++ b/pkgs/top-level/stdenv.nix @@ -2,28 +2,23 @@ rec { allStdenvs = import ../stdenv { - inherit system platform config lib; - # TODO(@Ericson2314): hack for cross-compiling until I clean that in follow-up PR - allPackages = args: nixpkgsFun (args // { crossSystem = null; }); + inherit system platform config crossSystem lib; + allPackages = nixpkgsFun; }; defaultStdenv = allStdenvs.stdenv // { inherit platform; }; stdenv = - if bootStdenv != null then (bootStdenv // {inherit platform;}) else - if crossSystem != null then - pkgs.stdenvCross - else - let - changer = config.replaceStdenv or null; - in if changer != null then - changer { - # We import again all-packages to avoid recursivities. - pkgs = nixpkgsFun { - # We remove packageOverrides to avoid recursivities - config = removeAttrs config [ "replaceStdenv" ]; - }; - } - else - defaultStdenv; + if bootStdenv != null then + (bootStdenv // { inherit platform; }) + else if crossSystem == null && config ? replaceStdenv then + config.replaceStdenv { + # We import again all-packages to avoid recursivities. + pkgs = nixpkgsFun { + # We remove packageOverrides to avoid recursivities + config = removeAttrs config [ "replaceStdenv" ]; + }; + } + else + defaultStdenv; } |