top-level: Close over fewer arguments for stdenv stages
This makes the flow of data easier to understand. There's little downside because the args in question are already inspected by the stdenvs. cross-compiling in particular is simpler because we don't need to worry about overriding the config closed over by `allPackages`.
This commit is contained in:
parent
d240a0da1a
commit
39753f5360
|
@ -1,14 +1,14 @@
|
||||||
{ system, allPackages, platform, crossSystem, config, ... } @ args:
|
{ lib, allPackages
|
||||||
|
, system, platform, crossSystem, config
|
||||||
|
}:
|
||||||
|
|
||||||
rec {
|
rec {
|
||||||
argClobber = {
|
vanillaStdenv = (import ../. {
|
||||||
|
inherit lib allPackages system platform;
|
||||||
crossSystem = null;
|
crossSystem = null;
|
||||||
# Ignore custom stdenvs when cross compiling for compatability
|
# Ignore custom stdenvs when cross compiling for compatability
|
||||||
config = builtins.removeAttrs config [ "replaceStdenv" ];
|
config = builtins.removeAttrs config [ "replaceStdenv" ];
|
||||||
};
|
}) // {
|
||||||
vanillaStdenv = (import ../. (args // argClobber // {
|
|
||||||
allPackages = args: allPackages (argClobber // args);
|
|
||||||
})) // {
|
|
||||||
# Needed elsewhere as a hacky way to pass the target
|
# Needed elsewhere as a hacky way to pass the target
|
||||||
cross = crossSystem;
|
cross = crossSystem;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
{ system, allPackages, platform, crossSystem, config, ... } @ args:
|
{ lib, allPackages
|
||||||
|
, system, platform, crossSystem, config
|
||||||
|
}:
|
||||||
|
|
||||||
rec {
|
rec {
|
||||||
vanillaStdenv = import ../. (args // {
|
vanillaStdenv = import ../. {
|
||||||
|
inherit lib allPackages system platform crossSystem;
|
||||||
# Remove config.replaceStdenv to ensure termination.
|
# Remove config.replaceStdenv to ensure termination.
|
||||||
config = builtins.removeAttrs config [ "replaceStdenv" ];
|
config = builtins.removeAttrs config [ "replaceStdenv" ];
|
||||||
});
|
};
|
||||||
|
|
||||||
buildPackages = allPackages {
|
buildPackages = allPackages {
|
||||||
inherit system platform crossSystem config;
|
inherit system platform crossSystem config;
|
||||||
|
|
|
@ -100,7 +100,7 @@ in rec {
|
||||||
};
|
};
|
||||||
|
|
||||||
thisPkgs = allPackages {
|
thisPkgs = allPackages {
|
||||||
inherit system platform;
|
inherit system platform config;
|
||||||
allowCustomOverrides = false;
|
allowCustomOverrides = false;
|
||||||
stdenv = thisStdenv;
|
stdenv = thisStdenv;
|
||||||
};
|
};
|
||||||
|
|
|
@ -5,12 +5,13 @@
|
||||||
# Posix utilities, the GNU C compiler, and so on. On other systems,
|
# Posix utilities, the GNU C compiler, and so on. On other systems,
|
||||||
# we use the native C library.
|
# we use the native C library.
|
||||||
|
|
||||||
{ system, allPackages ? import ../top-level, platform, config, crossSystem, lib }:
|
{ # Args just for stdenvs' usage
|
||||||
|
lib, allPackages
|
||||||
|
# Args to pass on to `allPacakges` too
|
||||||
|
, system, platform, crossSystem, config
|
||||||
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
|
|
||||||
# The native (i.e., impure) build environment. This one uses the
|
# The native (i.e., impure) build environment. This one uses the
|
||||||
# tools installed on the system outside of the Nix environment,
|
# tools installed on the system outside of the Nix environment,
|
||||||
# i.e., the stuff in /bin, /usr/bin, etc. This environment should
|
# i.e., the stuff in /bin, /usr/bin, etc. This environment should
|
||||||
|
@ -19,6 +20,7 @@ let
|
||||||
inherit (import ./native { inherit system allPackages config; }) stdenvNative;
|
inherit (import ./native { inherit system allPackages config; }) stdenvNative;
|
||||||
|
|
||||||
stdenvNativePkgs = allPackages {
|
stdenvNativePkgs = allPackages {
|
||||||
|
inherit system platform crossSystem config;
|
||||||
allowCustomOverrides = false;
|
allowCustomOverrides = false;
|
||||||
stdenv = stdenvNative;
|
stdenv = stdenvNative;
|
||||||
noSysDirs = false;
|
noSysDirs = false;
|
||||||
|
|
|
@ -106,7 +106,7 @@ rec {
|
||||||
};
|
};
|
||||||
|
|
||||||
thisPkgs = allPackages {
|
thisPkgs = allPackages {
|
||||||
inherit system platform;
|
inherit system platform config;
|
||||||
allowCustomOverrides = false;
|
allowCustomOverrides = false;
|
||||||
stdenv = thisStdenv;
|
stdenv = thisStdenv;
|
||||||
};
|
};
|
||||||
|
|
|
@ -126,7 +126,7 @@ rec {
|
||||||
} // {inherit fetchurl;};
|
} // {inherit fetchurl;};
|
||||||
|
|
||||||
stdenvBoot1Pkgs = allPackages {
|
stdenvBoot1Pkgs = allPackages {
|
||||||
inherit system;
|
inherit system platform config;
|
||||||
allowCustomOverrides = false;
|
allowCustomOverrides = false;
|
||||||
stdenv = stdenvBoot1;
|
stdenv = stdenvBoot1;
|
||||||
};
|
};
|
||||||
|
|
|
@ -69,9 +69,10 @@ in let
|
||||||
# deterministically inferred the same way.
|
# deterministically inferred the same way.
|
||||||
nixpkgsFun = newArgs: import ./. (args // newArgs);
|
nixpkgsFun = newArgs: import ./. (args // newArgs);
|
||||||
|
|
||||||
# Partially apply some args for building bootstraping stage pkgs sets
|
# Partially apply some arguments for building bootstraping stage pkgs
|
||||||
|
# sets. Only apply arguments which no stdenv would want to override.
|
||||||
allPackages = newArgs: import ./stage.nix ({
|
allPackages = newArgs: import ./stage.nix ({
|
||||||
inherit lib nixpkgsFun config;
|
inherit lib nixpkgsFun;
|
||||||
} // newArgs);
|
} // newArgs);
|
||||||
|
|
||||||
stdenv = import ../stdenv {
|
stdenv = import ../stdenv {
|
||||||
|
|
Loading…
Reference in a new issue