summary refs log tree commit diff
path: root/pkgs/stdenv/booter.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/stdenv/booter.nix')
-rw-r--r--pkgs/stdenv/booter.nix28
1 files changed, 20 insertions, 8 deletions
diff --git a/pkgs/stdenv/booter.nix b/pkgs/stdenv/booter.nix
index 7364a586fc2..1df05099fbf 100644
--- a/pkgs/stdenv/booter.nix
+++ b/pkgs/stdenv/booter.nix
@@ -43,7 +43,7 @@ stageFuns: let
 
   /* "dfold" a ternary function `op' between successive elements of `list' as if
      it was a doubly-linked list with `lnul' and `rnul` base cases at either
-     end. In precise terms, `fold op lnul rnul [x_0 x_1 x_2 ... x_n-1]` is the
+     end. In precise terms, `dfold op lnul rnul [x_0 x_1 x_2 ... x_n-1]` is the
      same as
 
        let
@@ -95,13 +95,25 @@ stageFuns: let
         __hatPackages = nextStage;
       };
     };
-  in
-    if args.__raw or false
-    then args'
-    else allPackages ((builtins.removeAttrs args' ["selfBuild"]) // {
-      buildPackages = if args.selfBuild or true then null else prevStage;
-      targetPackages = if args.selfBuild or true then null else nextStage;
-    });
+    thisStage =
+      if args.__raw or false
+      then args'
+      else allPackages ((builtins.removeAttrs args' ["selfBuild"]) // {
+        adjacentPackages = if args.selfBuild or true then null else rec {
+          pkgsBuildBuild = prevStage.buildPackages;
+          pkgsBuildHost = prevStage;
+          pkgsBuildTarget =
+            if args.stdenv.targetPlatform == args.stdenv.hostPlatform
+            then pkgsBuildHost
+            else assert args.stdenv.hostPlatform == args.stdenv.buildPlatform; thisStage;
+          pkgsHostHost =
+            if args.stdenv.hostPlatform == args.stdenv.targetPlatform
+            then thisStage
+            else assert args.stdenv.buildPlatform == args.stdenv.hostPlatform; pkgsBuildHost;
+          pkgsTargetTarget = nextStage;
+        };
+      });
+  in thisStage;
 
   # This is a hack for resolving cross-compiled compilers' run-time
   # deps. (That is, compilers that are themselves cross-compiled, as