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 , system, platform, crossSystem, config
}: }:
assert crossSystem == null;
rec { rec {
vanillaStdenv = import ../. { vanillaStdenv = import ../. {
inherit lib allPackages system platform crossSystem; inherit lib allPackages system platform crossSystem;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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