top-level: Only splice as needed for performance

This commit is contained in:
John Ericson 2017-01-15 18:03:59 -05:00
parent 4c17cd555f
commit bfb147b6a8
3 changed files with 20 additions and 12 deletions

View File

@ -63,12 +63,11 @@ stageFuns: let
__bootPackages = finalSoFar;
};
};
self =
if args.__raw or false
then args'
else allPackages ((builtins.removeAttrs args' ["selfBuild"]) // {
buildPackages = if args.selfBuild or true then self else finalSoFar;
});
in self;
in
if args.__raw or false
then args'
else allPackages ((builtins.removeAttrs args' ["selfBuild"]) // {
buildPackages = if args.selfBuild or true then null else finalSoFar;
});
in lib.lists.fold folder {} withAllowCustomOverrides

View File

@ -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

View File

@ -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