top-level: Make config-overriden stdenv bootstrap more normally

This commit is contained in:
John Ericson 2016-04-27 09:09:27 -07:00
parent ea7bf02268
commit 6bfe04277f
4 changed files with 29 additions and 14 deletions

View file

@ -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

View file

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

View file

@ -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

View file

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