Unverified Commit 6977b4cd authored by Artturin's avatar Artturin Committed by GitHub
Browse files

splice.nix: improve performance with early cut-off (#350295)

parents e9a5ef67 ea7c2e29
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -128,6 +128,15 @@ let
    "packages"
  ];

  packagesWithXorg = pkgs // builtins.removeAttrs pkgs.xorg [
    "callPackage"
    "newScope"
    "overrideScope"
    "packages"
  ];

  pkgsForCall = if actuallySplice then splicedPackagesWithXorg else packagesWithXorg;

in

{
@@ -138,9 +147,9 @@ in
  # `newScope' for sets of packages in `pkgs' (see e.g. `gnome' below).
  callPackage = pkgs.newScope { };

  callPackages = lib.callPackagesWith splicedPackagesWithXorg;
  callPackages = lib.callPackagesWith pkgsForCall;

  newScope = extra: lib.callPackageWith (splicedPackagesWithXorg // extra);
  newScope = extra: lib.callPackageWith (pkgsForCall // extra);

  # prefill 2 fields of the function for convenience
  makeScopeWithSplicing = lib.makeScopeWithSplicing splicePackages pkgs.newScope;
@@ -169,5 +178,5 @@ in

  # Haskell package sets need this because they reimplement their own
  # `newScope`.
  __splicedPackages = splicedPackages // { recurseForDerivations = false; };
  __splicedPackages = if actuallySplice then splicedPackages // { recurseForDerivations = false; } else pkgs;
}