diff options
author | John Ericson <Ericson2314@Yahoo.com> | 2016-12-24 10:55:11 -0800 |
---|---|---|
committer | John Ericson <Ericson2314@Yahoo.com> | 2017-01-24 11:37:56 -0500 |
commit | 92edcb7ebbf5b4b324288ec62bebbc58a3f96ef6 (patch) | |
tree | 810ca0e0f429364adcf030867095fffe655cb3ab /pkgs/stdenv | |
parent | 5b88f09ec4d6b3ac953cd9d252ebfd6663205c57 (diff) | |
download | nixpkgs-92edcb7ebbf5b4b324288ec62bebbc58a3f96ef6.tar nixpkgs-92edcb7ebbf5b4b324288ec62bebbc58a3f96ef6.tar.gz nixpkgs-92edcb7ebbf5b4b324288ec62bebbc58a3f96ef6.tar.bz2 nixpkgs-92edcb7ebbf5b4b324288ec62bebbc58a3f96ef6.tar.lz nixpkgs-92edcb7ebbf5b4b324288ec62bebbc58a3f96ef6.tar.xz nixpkgs-92edcb7ebbf5b4b324288ec62bebbc58a3f96ef6.tar.zst nixpkgs-92edcb7ebbf5b4b324288ec62bebbc58a3f96ef6.zip |
top-level: Lay the groundwork for `{build,host,target}Platform`
The long term goal is a big replace: { inherit system platform; } => buildPlatform crossSystem => hostPlatform stdenv.cross => targetPlatform And additionally making sure each is defined even when not cross compiling. This commit refactors the bootstrapping code along that vision, but leaves the old identifiers with their null semantics in place so packages can be modernized incrementally.
Diffstat (limited to 'pkgs/stdenv')
-rw-r--r-- | pkgs/stdenv/adapters.nix | 2 | ||||
-rw-r--r-- | pkgs/stdenv/cross/default.nix | 16 | ||||
-rw-r--r-- | pkgs/stdenv/custom/default.nix | 9 | ||||
-rw-r--r-- | pkgs/stdenv/darwin/default.nix | 17 | ||||
-rw-r--r-- | pkgs/stdenv/default.nix | 4 | ||||
-rw-r--r-- | pkgs/stdenv/freebsd/default.nix | 8 | ||||
-rw-r--r-- | pkgs/stdenv/linux/default.nix | 32 | ||||
-rw-r--r-- | pkgs/stdenv/native/default.nix | 13 | ||||
-rw-r--r-- | pkgs/stdenv/nix/default.nix | 4 |
9 files changed, 70 insertions, 35 deletions
diff --git a/pkgs/stdenv/adapters.nix b/pkgs/stdenv/adapters.nix index daa180c644f..5d66db266c7 100644 --- a/pkgs/stdenv/adapters.nix +++ b/pkgs/stdenv/adapters.nix @@ -108,7 +108,7 @@ rec { crossConfig = cross.config; } // args.crossAttrs or {}); } // { - inherit cross gccCross binutilsCross; + inherit gccCross binutilsCross; ccCross = gccCross; }; diff --git a/pkgs/stdenv/cross/default.nix b/pkgs/stdenv/cross/default.nix index e684c14da4a..37f403acee9 100644 --- a/pkgs/stdenv/cross/default.nix +++ b/pkgs/stdenv/cross/default.nix @@ -1,10 +1,10 @@ { lib -, system, platform, crossSystem, config, overlays +, localSystem, crossSystem, config, overlays }: let bootStages = import ../. { - inherit lib system platform overlays; + inherit lib localSystem overlays; crossSystem = null; # Ignore custom stdenvs when cross compiling for compatability config = builtins.removeAttrs config [ "replaceStdenv" ]; @@ -14,21 +14,25 @@ in bootStages ++ [ # Build Packages (vanillaPackages: { - inherit system platform crossSystem config overlays; + buildPlatform = localSystem; + hostPlatform = localSystem; + targetPlatform = crossSystem; + inherit config overlays; # Should be false, but we're trying to preserve hashes for now selfBuild = true; # It's OK to change the built-time dependencies allowCustomOverrides = true; stdenv = vanillaPackages.stdenv // { - # Needed elsewhere as a hacky way to pass the target - cross = crossSystem; overrides = _: _: {}; }; }) # Run Packages (buildPackages: { - inherit system platform crossSystem config overlays; + buildPlatform = localSystem; + hostPlatform = crossSystem; + targetPlatform = crossSystem; + inherit config overlays; selfBuild = false; stdenv = if crossSystem.useiOSCross or false then let diff --git a/pkgs/stdenv/custom/default.nix b/pkgs/stdenv/custom/default.nix index d7e9bf53bed..d5dc977b37a 100644 --- a/pkgs/stdenv/custom/default.nix +++ b/pkgs/stdenv/custom/default.nix @@ -1,12 +1,12 @@ { lib -, system, platform, crossSystem, config, overlays +, localSystem, crossSystem, config, overlays }: assert crossSystem == null; let bootStages = import ../. { - inherit lib system platform crossSystem overlays; + inherit lib localSystem crossSystem overlays; # Remove config.replaceStdenv to ensure termination. config = builtins.removeAttrs config [ "replaceStdenv" ]; }; @@ -15,7 +15,10 @@ in bootStages ++ [ # Additional stage, built using custom stdenv (vanillaPackages: { - inherit system platform crossSystem config overlays; + buildPlatform = localSystem; + hostPlatform = localSystem; + targetPlatform = localSystem; + inherit config overlays; stdenv = config.replaceStdenv { pkgs = vanillaPackages; }; }) diff --git a/pkgs/stdenv/darwin/default.nix b/pkgs/stdenv/darwin/default.nix index e3a87ea078f..e647c81890e 100644 --- a/pkgs/stdenv/darwin/default.nix +++ b/pkgs/stdenv/darwin/default.nix @@ -1,11 +1,12 @@ { lib -, system, platform, crossSystem, config, overlays +, localSystem, crossSystem, config, overlays # Allow passing in bootstrap files directly so we can test the stdenv bootstrap process when changing the bootstrap tools , bootstrapFiles ? let fetch = { file, sha256, executable ? true }: import <nix/fetchurl.nix> { url = "http://tarballs.nixos.org/stdenv-darwin/x86_64/33f59c9d11b8d5014dfd18cc11a425f6393c884a/${file}"; - inherit sha256 system executable; + inherit (localSystem) system; + inherit sha256 executable; }; in { sh = fetch { file = "sh"; sha256 = "1rx4kg6358xdj05z0m139a0zn4f4zfmq4n4vimlmnwyfiyn4x7wk"; }; bzip2 = fetch { file = "bzip2"; sha256 = "104qnhzk79vkbp2yi0kci6lszgfppvrwk3rgxhry842ly1xz2r7l"; }; @@ -18,6 +19,8 @@ assert crossSystem == null; let + inherit (localSystem) system platform; + libSystemProfile = '' (import "${./standard-sandbox.sb}") ''; @@ -98,7 +101,10 @@ in rec { }; in { - inherit system platform crossSystem config overlays; + buildPlatform = localSystem; + hostPlatform = localSystem; + targetPlatform = localSystem; + inherit config overlays; stdenv = thisStdenv; }; @@ -316,7 +322,10 @@ in rec { stage3 stage4 (prevStage: { - inherit system crossSystem platform config overlays; + buildPlatform = localSystem; + hostPlatform = localSystem; + targetPlatform = localSystem; + inherit config overlays; stdenv = stdenvDarwin prevStage; }) ]; diff --git a/pkgs/stdenv/default.nix b/pkgs/stdenv/default.nix index f60ffec4b56..78dbde13b89 100644 --- a/pkgs/stdenv/default.nix +++ b/pkgs/stdenv/default.nix @@ -7,7 +7,7 @@ { # Args just for stdenvs' usage lib # Args to pass on to the pkgset builder, too -, system, platform, crossSystem, config, overlays +, localSystem, crossSystem, config, overlays } @ args: let @@ -51,4 +51,4 @@ in "i686-cygwin" = stagesNative; "x86_64-cygwin" = stagesNative; "x86_64-freebsd" = stagesFreeBSD; - }.${system} or stagesNative + }.${localSystem.system} or stagesNative diff --git a/pkgs/stdenv/freebsd/default.nix b/pkgs/stdenv/freebsd/default.nix index 2cb059deb34..b926c6bdd90 100644 --- a/pkgs/stdenv/freebsd/default.nix +++ b/pkgs/stdenv/freebsd/default.nix @@ -1,8 +1,9 @@ { lib -, system, platform, crossSystem, config, overlays +, localSystem, crossSystem, config, overlays }: assert crossSystem == null; +let inherit (localSystem) system; in [ @@ -58,7 +59,10 @@ assert crossSystem == null; }) (prevStage: { - inherit system crossSystem platform config overlays; + buildPlatform = localSystem; + hostPlatform = localSystem; + targetPlatform = localSystem; + inherit config overlays; stdenv = import ../generic { name = "stdenv-freebsd-boot-3"; inherit system config; diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix index 12da007f2a7..611628b35ab 100644 --- a/pkgs/stdenv/linux/default.nix +++ b/pkgs/stdenv/linux/default.nix @@ -4,21 +4,23 @@ # compiler and linker that do not search in default locations, # ensuring purity of components produced by it. { lib -, system, platform, crossSystem, config, overlays - -, bootstrapFiles ? - if system == "i686-linux" then import ./bootstrap-files/i686.nix - else if system == "x86_64-linux" then import ./bootstrap-files/x86_64.nix - else if system == "armv5tel-linux" then import ./bootstrap-files/armv5tel.nix - else if system == "armv6l-linux" then import ./bootstrap-files/armv6l.nix - else if system == "armv7l-linux" then import ./bootstrap-files/armv7l.nix - else if system == "mips64el-linux" then import ./bootstrap-files/loongson2f.nix - else abort "unsupported platform for the pure Linux stdenv" +, localSystem, crossSystem, config, overlays + +, bootstrapFiles ? { # switch + "i686-linux" = import ./bootstrap-files/i686.nix; + "x86_64-linux" = import ./bootstrap-files/x86_64.nix; + "armv5tel-linux" = import ./bootstrap-files/armv5tel.nix; + "armv6l-linux" = import ./bootstrap-files/armv6l.nix; + "armv7l-linux" = import ./bootstrap-files/armv7l.nix; + "mips64el-linux" = import ./bootstrap-files/loongson2f.nix; + }.${localSystem.system} + or (abort "unsupported platform for the pure Linux stdenv") }: assert crossSystem == null; let + inherit (localSystem) system platform; commonPreHook = '' @@ -91,7 +93,10 @@ let }; in { - inherit system platform crossSystem config overlays; + buildPlatform = localSystem; + hostPlatform = localSystem; + targetPlatform = localSystem; + inherit config overlays; stdenv = thisStdenv; }; @@ -246,7 +251,10 @@ in # dependency (`nix-store -qR') on bootstrapTools or the first # binutils built. (prevStage: { - inherit system crossSystem platform config overlays; + buildPlatform = localSystem; + hostPlatform = localSystem; + targetPlatform = localSystem; + inherit config overlays; stdenv = import ../generic rec { inherit system config; diff --git a/pkgs/stdenv/native/default.nix b/pkgs/stdenv/native/default.nix index 4028638009e..f5c0976bf93 100644 --- a/pkgs/stdenv/native/default.nix +++ b/pkgs/stdenv/native/default.nix @@ -1,10 +1,11 @@ { lib -, system, platform, crossSystem, config, overlays +, localSystem, crossSystem, config, overlays }: assert crossSystem == null; let + inherit (localSystem) system platform; shell = if system == "i686-freebsd" || system == "x86_64-freebsd" then "/usr/local/bin/bash" @@ -134,7 +135,10 @@ in # First build a stdenv based only on tools outside the store. (prevStage: { - inherit system crossSystem platform config overlays; + buildPlatform = localSystem; + hostPlatform = localSystem; + targetPlatform = localSystem; + inherit config overlays; stdenv = makeStdenv { inherit (prevStage) cc fetchurl; } // { inherit (prevStage) fetchurl; }; @@ -143,7 +147,10 @@ in # Using that, build a stdenv that adds the ‘xz’ command (which most systems # don't have, so we mustn't rely on the native environment providing it). (prevStage: { - inherit system crossSystem platform config overlays; + buildPlatform = localSystem; + hostPlatform = localSystem; + targetPlatform = localSystem; + inherit config overlays; stdenv = makeStdenv { inherit (prevStage.stdenv) cc fetchurl; extraPath = [ prevStage.xz ]; diff --git a/pkgs/stdenv/nix/default.nix b/pkgs/stdenv/nix/default.nix index a5f0a18464c..9aece3ce829 100644 --- a/pkgs/stdenv/nix/default.nix +++ b/pkgs/stdenv/nix/default.nix @@ -9,9 +9,9 @@ assert crossSystem == null; bootStages ++ [ (prevStage: let inherit (prevStage) stdenv; - inherit (stdenv) system platform; in { - inherit system platform crossSystem config; + inherit (prevStage) buildPlatform hostPlatform targetPlatform; + inherit config overlays; stdenv = import ../generic rec { inherit config; |