about summary refs log tree commit diff
path: root/pkgs/top-level
diff options
context:
space:
mode:
authorJohn Ericson <Ericson2314@Yahoo.com>2017-01-15 18:03:59 -0500
committerJohn Ericson <Ericson2314@Yahoo.com>2017-01-24 11:37:56 -0500
commitbfb147b6a8c4a3ddc581aab0b8a29b418db3b7a6 (patch)
tree54ccd6f0c81711c847da2da8798802edd31c3dad /pkgs/top-level
parent4c17cd555f6443207144da9af6e1c2b1304afd8b (diff)
top-level: Only splice as needed for performance
Diffstat (limited to 'pkgs/top-level')
-rw-r--r--pkgs/top-level/splice.nix11
-rw-r--r--pkgs/top-level/stage.nix8
2 files changed, 14 insertions, 5 deletions
diff --git a/pkgs/top-level/splice.nix b/pkgs/top-level/splice.nix
index f57f42020c27a..7afbd956d5bb6 100644
--- a/pkgs/top-level/splice.nix
+++ b/pkgs/top-level/splice.nix
@@ -17,7 +17,11 @@
 # `mkDerivation` knows how to pull out the right ones for `buildDepends` and
 # friends, but a few packages use them directly, so it seemed efficient (to
 # @Ericson2314) to reuse those names, at least initially, to minimize breakage.
-lib: pkgs:
+#
+# For performance reasons, rather than uniformally splice in all cases, we only
+# do so when `pkgs` and `buildPackages` are distinct. The `actuallySplice`
+# parameter there the boolean value of that equality check.
+lib: pkgs: actuallySplice:
 
 let
   defaultBuildScope = pkgs.buildPackages // pkgs.buildPackages.xorg;
@@ -58,7 +62,10 @@ let
     };
   in lib.listToAttrs (map merge (lib.attrNames mash));
 
-  splicedPackages = splicer defaultBuildScope defaultRunScope;
+  splicedPackages =
+    if actuallySplice
+    then splicer defaultBuildScope defaultRunScope
+    else pkgs // pkgs.xorg;
 
 in
 
diff --git a/pkgs/top-level/stage.nix b/pkgs/top-level/stage.nix
index 0f3d967a0914c..6febedb79f3d9 100644
--- a/pkgs/top-level/stage.nix
+++ b/pkgs/top-level/stage.nix
@@ -45,7 +45,8 @@
   ## Other parameters
   ##
 
-, # The package set used at build-time
+, # The package set used at build-time. If null, `buildPackages` will
+  # be defined internally as the produced package set as itself.
   buildPackages
 
 , # The standard environment to use for building packages.
@@ -84,7 +85,8 @@ let
     };
 
   stdenvBootstappingAndPlatforms = self: super: {
-    buildPackages = buildPackages // { recurseForDerivations = false; };
+    buildPackages = (if buildPackages == null then self else buildPackages)
+      // { recurseForDerivations = false; };
     inherit stdenv
       buildPlatform hostPlatform targetPlatform;
   };
@@ -103,7 +105,7 @@ let
     inherit (buildPlatform) system platform;
   };
 
-  splice = self: super: import ./splice.nix lib self;
+  splice = self: super: import ./splice.nix lib self (buildPackages != null);
 
   allPackages = self: super:
     let res = import ./all-packages.nix