about summary refs log tree commit diff
path: root/pkgs/stdenv/nix
diff options
context:
space:
mode:
authorJohn Ericson <Ericson2314@Yahoo.com>2016-12-16 05:22:02 -0800
committerJohn Ericson <Ericson2314@Yahoo.com>2017-01-13 13:23:23 -0500
commit3e197f7d81130defacfe5bdad71ca5ebe63324ff (patch)
treed06650289f9729f647814eff912e8d39bdd523a8 /pkgs/stdenv/nix
parent0ef8b69d12d1ab1574568f5660b44feba1f44179 (diff)
top-level: Normalize stdenv booting
Introduce new abstraction, `stdenv/booter.nix` for composing bootstraping
stages, and use it everywhere for consistency. See that file for more doc.

Stdenvs besides Linux and Darwin are completely refactored to utilize this.
Those two, due to their size and complexity, are minimally edited for
easier reviewing.

No hashes should be changed.
Diffstat (limited to 'pkgs/stdenv/nix')
-rw-r--r--pkgs/stdenv/nix/default.nix92
1 files changed, 53 insertions, 39 deletions
diff --git a/pkgs/stdenv/nix/default.nix b/pkgs/stdenv/nix/default.nix
index 21ee29ad5af95..a5f0a18464c17 100644
--- a/pkgs/stdenv/nix/default.nix
+++ b/pkgs/stdenv/nix/default.nix
@@ -1,39 +1,53 @@
-{ stdenv, pkgs, config, lib }:
-
-import ../generic rec {
-  inherit config;
-
-  preHook =
-    ''
-      export NIX_ENFORCE_PURITY="''${NIX_ENFORCE_PURITY-1}"
-      export NIX_ENFORCE_NO_NATIVE="''${NIX_ENFORCE_NO_NATIVE-1}"
-      export NIX_IGNORE_LD_THROUGH_GCC=1
-    '';
-
-  initialPath = (import ../common-path.nix) {pkgs = pkgs;};
-
-  system = stdenv.system;
-
-  cc = import ../../build-support/cc-wrapper {
-    nativeTools = false;
-    nativePrefix = stdenv.lib.optionalString stdenv.isSunOS "/usr";
-    nativeLibc = true;
-    inherit stdenv;
-    inherit (pkgs) binutils coreutils gnugrep;
-    cc = pkgs.gcc.cc;
-    isGNU = true;
-    shell = pkgs.bash + "/bin/sh";
-  };
-
-  shell = pkgs.bash + "/bin/sh";
-
-  fetchurlBoot = stdenv.fetchurlBoot;
-
-  overrides = self: super: {
-    inherit cc;
-    inherit (cc) binutils;
-    inherit (pkgs)
-      gzip bzip2 xz bash coreutils diffutils findutils gawk
-      gnumake gnused gnutar gnugrep gnupatch perl;
-  };
-}
+{ lib
+, crossSystem, config
+, bootStages
+, ...
+}:
+
+assert crossSystem == null;
+
+bootStages ++ [
+  (prevStage: let
+    inherit (prevStage) stdenv;
+    inherit (stdenv) system platform;
+  in {
+    inherit system platform crossSystem config;
+
+    stdenv = import ../generic rec {
+      inherit config;
+
+      preHook = ''
+        export NIX_ENFORCE_PURITY="''${NIX_ENFORCE_PURITY-1}"
+        export NIX_ENFORCE_NO_NATIVE="''${NIX_ENFORCE_NO_NATIVE-1}"
+        export NIX_IGNORE_LD_THROUGH_GCC=1
+      '';
+
+      initialPath = (import ../common-path.nix) { pkgs = prevStage; };
+
+      system = stdenv.system;
+
+      cc = import ../../build-support/cc-wrapper {
+        nativeTools = false;
+        nativePrefix = stdenv.lib.optionalString stdenv.isSunOS "/usr";
+        nativeLibc = true;
+        inherit stdenv;
+        inherit (prevStage) binutils coreutils gnugrep;
+        cc = prevStage.gcc.cc;
+        isGNU = true;
+        shell = prevStage.bash + "/bin/sh";
+      };
+
+      shell = prevStage.bash + "/bin/sh";
+
+      fetchurlBoot = stdenv.fetchurlBoot;
+
+      overrides = self: super: {
+        inherit cc;
+        inherit (cc) binutils;
+        inherit (prevStage)
+          gzip bzip2 xz bash coreutils diffutils findutils gawk
+          gnumake gnused gnutar gnugrep gnupatch perl;
+      };
+    };
+  })
+]