summary refs log tree commit diff
path: root/pkgs/stdenv
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2019-03-13 13:34:38 -0400
committerJohn Ericson <git@JohnEricson.me>2019-03-24 22:12:15 -0400
commit70d71bbbe46eecfefc920bb1a919960d5feb9fc4 (patch)
tree5b65648837c13163f04829c492c1d3f08b898c35 /pkgs/stdenv
parentceb27efde0532bb663e3d8c4fe20f82ee4dc22e3 (diff)
downloadnixpkgs-70d71bbbe46eecfefc920bb1a919960d5feb9fc4.tar
nixpkgs-70d71bbbe46eecfefc920bb1a919960d5feb9fc4.tar.gz
nixpkgs-70d71bbbe46eecfefc920bb1a919960d5feb9fc4.tar.bz2
nixpkgs-70d71bbbe46eecfefc920bb1a919960d5feb9fc4.tar.lz
nixpkgs-70d71bbbe46eecfefc920bb1a919960d5feb9fc4.tar.xz
nixpkgs-70d71bbbe46eecfefc920bb1a919960d5feb9fc4.tar.zst
nixpkgs-70d71bbbe46eecfefc920bb1a919960d5feb9fc4.zip
top-level: Create `pkgs{Build,Host,Target}{Build,Host,Target}`
This is needed to avoid confusing and repeated boilerplate for
`fooForTarget`.  The vast majority of use-cases can still use
`buildPackages or `targetPackages`, which are now defined in terms of
these.
Diffstat (limited to 'pkgs/stdenv')
-rw-r--r--pkgs/stdenv/booter.nix26
1 files changed, 19 insertions, 7 deletions
diff --git a/pkgs/stdenv/booter.nix b/pkgs/stdenv/booter.nix
index 668dcabc049..1df05099fbf 100644
--- a/pkgs/stdenv/booter.nix
+++ b/pkgs/stdenv/booter.nix
@@ -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