From 863d79b36446bb2dbcc34d4f57c832ac2dc57f68 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Mon, 6 Feb 2017 18:13:02 -0500 Subject: 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 :) --- pkgs/top-level/splice.nix | 2 +- pkgs/top-level/stage.nix | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'pkgs/top-level') diff --git a/pkgs/top-level/splice.nix b/pkgs/top-level/splice.nix index bb6fc47b1d2..43951100de3 100644 --- a/pkgs/top-level/splice.nix +++ b/pkgs/top-level/splice.nix @@ -66,7 +66,7 @@ let if actuallySplice then splicer defaultBuildScope defaultRunScope // { # These should never be spliced under any circumstances - inherit (pkgs) pkgs buildPackages + inherit (pkgs) pkgs buildPackages __targetPackages buildPlatform targetPlatform hostPlatform; } else pkgs // pkgs.xorg; 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; }; -- cgit 1.4.1