top-level: turn the screw

- Non-cross stdenvs are honest and assert that `crossSystem` is null

 - `crossSystem` is a mandatory argument to top-level/stage.nix, just like
   `system` and `platform`

 - Broken default arguments on stdenvs for testing are gone.

 - All stdenvs (but little-used stdenvNix) take the same arguments for easy
   testing.
This commit is contained in:
John Ericson 2016-11-30 18:51:13 -05:00
parent a55d1ecc90
commit 4751d9e5ad
7 changed files with 31 additions and 25 deletions

View file

@ -2,6 +2,8 @@
, system, platform, crossSystem, config
}:
assert crossSystem == null;
rec {
vanillaStdenv = import ../. {
inherit lib allPackages system platform crossSystem;

View file

@ -1,7 +1,5 @@
{ system ? builtins.currentSystem
, allPackages ? import ../../..
, platform ? null
, config ? {}
{ lib, allPackages
, system, platform, crossSystem, config
# Allow passing in bootstrap files directly so we can test the stdenv bootstrap process when changing the bootstrap tools
, bootstrapFiles ? let
@ -17,6 +15,8 @@
}
}:
assert crossSystem == null;
let
libSystemProfile = ''
(import "${./standard-sandbox.sb}")
@ -100,7 +100,7 @@ in rec {
};
thisPkgs = allPackages {
inherit system platform config;
inherit system platform crossSystem config;
allowCustomOverrides = false;
stdenv = thisStdenv;
};

View file

@ -9,7 +9,7 @@
lib, allPackages
# Args to pass on to `allPacakges` too
, system, platform, crossSystem, config
}:
} @ args:
let
# The native (i.e., impure) build environment. This one uses the
@ -17,7 +17,7 @@ let
# i.e., the stuff in /bin, /usr/bin, etc. This environment should
# be used with care, since many Nix packages will not build properly
# with it (e.g., because they require GNU Make).
inherit (import ./native { inherit system allPackages config; }) stdenvNative;
inherit (import ./native args) stdenvNative;
stdenvNativePkgs = allPackages {
inherit system platform crossSystem config;
@ -28,22 +28,22 @@ let
# The Nix build environment.
stdenvNix = import ./nix {
stdenvNix = assert crossSystem == null; import ./nix {
inherit config lib;
stdenv = stdenvNative;
pkgs = stdenvNativePkgs;
};
inherit (import ./freebsd { inherit system allPackages platform config; }) stdenvFreeBSD;
inherit (import ./freebsd args) stdenvFreeBSD;
# Linux standard environment.
inherit (import ./linux { inherit system allPackages platform config lib; }) stdenvLinux;
inherit (import ./linux args) stdenvLinux;
inherit (import ./darwin { inherit system allPackages platform config; }) stdenvDarwin;
inherit (import ./darwin args) stdenvDarwin;
inherit (import ./cross { inherit system allPackages platform crossSystem config lib; }) stdenvCross stdenvCrossiOS;
inherit (import ./cross args) stdenvCross stdenvCrossiOS;
inherit (import ./custom { inherit system allPackages platform crossSystem config lib; }) stdenvCustom;
inherit (import ./custom args) stdenvCustom;
# Select the appropriate stdenv for the platform `system'.
in

View file

@ -1,9 +1,9 @@
{ system ? builtins.currentSystem
, allPackages ? import ../../..
, platform ? null
, config ? {}
{ lib, allPackages
, system, platform, crossSystem, config
}:
assert crossSystem == null;
rec {
inherit allPackages;

View file

@ -3,11 +3,9 @@
# external (non-Nix) tools, such as /usr/bin/gcc, and it contains a C
# compiler and linker that do not search in default locations,
# ensuring purity of components produced by it.
{ lib, allPackages
, system, platform, crossSystem, config
# The function defaults are for easy testing.
{ system ? builtins.currentSystem
, allPackages ? import ../../..
, platform ? null, config ? {}, lib ? (import ../../../lib)
, bootstrapFiles ?
if system == "i686-linux" then import ./bootstrap/i686.nix
else if system == "x86_64-linux" then import ./bootstrap/x86_64.nix
@ -18,6 +16,8 @@
else abort "unsupported platform for the pure Linux stdenv"
}:
assert crossSystem == null;
rec {
commonPreHook =
@ -106,7 +106,7 @@ rec {
};
thisPkgs = allPackages {
inherit system platform config;
inherit system platform crossSystem config;
allowCustomOverrides = false;
stdenv = thisStdenv;
};

View file

@ -1,4 +1,8 @@
{ system, allPackages ? import ../../.., config }:
{ lib, allPackages
, system, platform, crossSystem, config
}:
assert crossSystem == null;
rec {
@ -126,7 +130,7 @@ rec {
} // {inherit fetchurl;};
stdenvBoot1Pkgs = allPackages {
inherit system platform config;
inherit system platform crossSystem config;
allowCustomOverrides = false;
stdenv = stdenvBoot1;
};

View file

@ -30,7 +30,7 @@
, # The configuration attribute set
config
, crossSystem ? null
, crossSystem
, platform
, lib
, nixpkgsFun