summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pkgs/stdenv/cross/default.nix8
-rw-r--r--pkgs/stdenv/custom/default.nix17
-rw-r--r--pkgs/stdenv/default.nix3
-rw-r--r--pkgs/top-level/stdenv.nix15
4 files changed, 29 insertions, 14 deletions
diff --git a/pkgs/stdenv/cross/default.nix b/pkgs/stdenv/cross/default.nix
index d78061db712e..93c5a21d9d5a 100644
--- a/pkgs/stdenv/cross/default.nix
+++ b/pkgs/stdenv/cross/default.nix
@@ -1,9 +1,13 @@
{ system, allPackages, platform, crossSystem, config, ... } @ args:
rec {
- vanillaStdenv = (import ../. (args // {
+ argClobber = {
crossSystem = null;
- allPackages = args: allPackages ({ crossSystem = null; } // args);
+ # Ignore custom stdenvs when cross compiling for compatability
+ config = builtins.removeAttrs config [ "replaceStdenv" ];
+ };
+ vanillaStdenv = (import ../. (args // argClobber // {
+ allPackages = args: allPackages (argClobber // args);
})).stdenv;
# Yeah this isn't so cleanly just build-time packages yet. Notice the
diff --git a/pkgs/stdenv/custom/default.nix b/pkgs/stdenv/custom/default.nix
new file mode 100644
index 000000000000..2f2f495b388b
--- /dev/null
+++ b/pkgs/stdenv/custom/default.nix
@@ -0,0 +1,17 @@
+{ system, allPackages, platform, crossSystem, config, ... } @ args:
+
+rec {
+ vanillaStdenv = (import ../. (args // {
+ # Remove config.replaceStdenv to ensure termination.
+ config = builtins.removeAttrs config [ "replaceStdenv" ];
+ })).stdenv;
+
+ buildPackages = allPackages {
+ # It's OK to change the built-time dependencies
+ allowCustomOverrides = true;
+ bootStdenv = vanillaStdenv;
+ inherit system platform crossSystem config;
+ };
+
+ stdenvCustom = config.replaceStdenv { pkgs = buildPackages; };
+}
diff --git a/pkgs/stdenv/default.nix b/pkgs/stdenv/default.nix
index 59088bfdf3bf..10086ee6a853 100644
--- a/pkgs/stdenv/default.nix
+++ b/pkgs/stdenv/default.nix
@@ -40,9 +40,12 @@ rec {
inherit (import ./cross { inherit system allPackages platform crossSystem config lib; }) stdenvCross;
+ inherit (import ./custom { inherit system allPackages platform crossSystem config lib; }) stdenvCustom;
+
# Select the appropriate stdenv for the platform `system'.
stdenv =
if crossSystem != null then stdenvCross else
+ if config ? replaceStdenv then stdenvCustom else
if system == "i686-linux" then stdenvLinux else
if system == "x86_64-linux" then stdenvLinux else
if system == "armv5tel-linux" then stdenvLinux else
diff --git a/pkgs/top-level/stdenv.nix b/pkgs/top-level/stdenv.nix
index d5d9288907f7..9f485b8c90ef 100644
--- a/pkgs/top-level/stdenv.nix
+++ b/pkgs/top-level/stdenv.nix
@@ -9,16 +9,7 @@ rec {
defaultStdenv = allStdenvs.stdenv // { inherit platform; };
stdenv =
- 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;
+ if bootStdenv != null
+ then (bootStdenv // { inherit platform; })
+ else defaultStdenv;
}