summary refs log tree commit diff
path: root/pkgs/top-level/stage.nix
diff options
context:
space:
mode:
authorJohn Ericson <Ericson2314@Yahoo.com>2017-02-06 18:13:02 -0500
committerJohn Ericson <Ericson2314@Yahoo.com>2017-04-23 14:01:12 -0400
commit863d79b36446bb2dbcc34d4f57c832ac2dc57f68 (patch)
tree76683d4a723783f27f64b7bdd73c6a9e107167e0 /pkgs/top-level/stage.nix
parentd59e4fbb75e307fd1a0e98c44627f38bab504aeb (diff)
downloadnixpkgs-863d79b36446bb2dbcc34d4f57c832ac2dc57f68.tar
nixpkgs-863d79b36446bb2dbcc34d4f57c832ac2dc57f68.tar.gz
nixpkgs-863d79b36446bb2dbcc34d4f57c832ac2dc57f68.tar.bz2
nixpkgs-863d79b36446bb2dbcc34d4f57c832ac2dc57f68.tar.lz
nixpkgs-863d79b36446bb2dbcc34d4f57c832ac2dc57f68.tar.xz
nixpkgs-863d79b36446bb2dbcc34d4f57c832ac2dc57f68.tar.zst
nixpkgs-863d79b36446bb2dbcc34d4f57c832ac2dc57f68.zip
top-level: Introduce targetPackages and a "double link fold"
Each bootstrapping stage ought to just depend on the previous stage, but
poorly-written compilers break this elegence. This provides an easy-enough
way to depend on the next stage: targetPackages. PLEASE DO NOT USE IT
UNLESS YOU MUST!

I'm hoping someday in a pleasant future I can revert this commit :)
Diffstat (limited to 'pkgs/top-level/stage.nix')
-rw-r--r--pkgs/top-level/stage.nix10
1 files changed, 10 insertions, 0 deletions
diff --git a/pkgs/top-level/stage.nix b/pkgs/top-level/stage.nix
index ead6ec18fb3..d8e190cfd4b 100644
--- a/pkgs/top-level/stage.nix
+++ b/pkgs/top-level/stage.nix
@@ -50,6 +50,14 @@
   # us to avoid expensive splicing.
   buildPackages
 
+, # The package set used in the next stage. If null, `__targetPackages` will be
+  # defined internally as the final produced package set itself, just like with
+  # `buildPackages` and for the same reasons.
+  #
+  # THIS IS A HACK for compilers that don't think critically about cross-
+  # compilation. Please do *not* use unless you really know what you are doing.
+  __targetPackages
+
 , # The standard environment to use for building packages.
   stdenv
 
@@ -88,6 +96,8 @@ let
   stdenvBootstappingAndPlatforms = self: super: {
     buildPackages = (if buildPackages == null then self else buildPackages)
       // { recurseForDerivations = false; };
+    __targetPackages = (if __targetPackages == null then self else __targetPackages)
+      // { recurseForDerivations = false; };
     inherit stdenv
       buildPlatform hostPlatform targetPlatform;
   };