summary refs log tree commit diff
path: root/pkgs/stdenv/linux
diff options
context:
space:
mode:
authorJohn Ericson <Ericson2314@Yahoo.com>2016-12-24 10:55:11 -0800
committerJohn Ericson <Ericson2314@Yahoo.com>2017-01-24 11:37:56 -0500
commit92edcb7ebbf5b4b324288ec62bebbc58a3f96ef6 (patch)
tree810ca0e0f429364adcf030867095fffe655cb3ab /pkgs/stdenv/linux
parent5b88f09ec4d6b3ac953cd9d252ebfd6663205c57 (diff)
downloadnixlib-92edcb7ebbf5b4b324288ec62bebbc58a3f96ef6.tar
nixlib-92edcb7ebbf5b4b324288ec62bebbc58a3f96ef6.tar.gz
nixlib-92edcb7ebbf5b4b324288ec62bebbc58a3f96ef6.tar.bz2
nixlib-92edcb7ebbf5b4b324288ec62bebbc58a3f96ef6.tar.lz
nixlib-92edcb7ebbf5b4b324288ec62bebbc58a3f96ef6.tar.xz
nixlib-92edcb7ebbf5b4b324288ec62bebbc58a3f96ef6.tar.zst
nixlib-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/linux')
-rw-r--r--pkgs/stdenv/linux/default.nix32
1 files changed, 20 insertions, 12 deletions
diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix
index 12da007f2a76..611628b35aba 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;