summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorpennae <github@quasiparticle.net>2021-10-15 16:30:58 +0200
committerpennae <github@quasiparticle.net>2021-10-15 16:39:10 +0200
commitdc895fb2815032adbcc49f090812fa355074d9be (patch)
tree3e95c4f67892d841c69c4036e12ae51d1ed419a7 /lib
parentdcfa5952754e5cc6cbbf7df40b62aabb3792bdc9 (diff)
downloadnixpkgs-dc895fb2815032adbcc49f090812fa355074d9be.tar
nixpkgs-dc895fb2815032adbcc49f090812fa355074d9be.tar.gz
nixpkgs-dc895fb2815032adbcc49f090812fa355074d9be.tar.bz2
nixpkgs-dc895fb2815032adbcc49f090812fa355074d9be.tar.lz
nixpkgs-dc895fb2815032adbcc49f090812fa355074d9be.tar.xz
nixpkgs-dc895fb2815032adbcc49f090812fa355074d9be.tar.zst
nixpkgs-dc895fb2815032adbcc49f090812fa355074d9be.zip
lib: make extendDerivation lighter on eval
the fix to extendDerivation in #140051 unwittingly worsened eval performance by
quite a bit. set elements alone needed over 1GB extra after the change, which
seems disproportionate to how small it was. if we flip the logic used to
determine which outputs to install around and keep a "this one exactly" flag in
the specific outputs instead of a "all of them" in the root we can avoid most
of that cost.
Diffstat (limited to 'lib')
-rw-r--r--lib/attrsets.nix2
-rw-r--r--lib/customisation.nix5
2 files changed, 3 insertions, 4 deletions
diff --git a/lib/attrsets.nix b/lib/attrsets.nix
index 31fddc59e20..812521ce6d1 100644
--- a/lib/attrsets.nix
+++ b/lib/attrsets.nix
@@ -487,7 +487,7 @@ rec {
        => "/nix/store/9rz8gxhzf8sw4kf2j2f1grr49w8zx5vj-openssl-1.0.1r-dev"
   */
   getOutput = output: pkg:
-    if pkg.outputUnspecified or false
+    if ! pkg ? outputSpecified || ! pkg.outputSpecified
       then pkg.${output} or pkg.out or pkg
       else pkg;
 
diff --git a/lib/customisation.nix b/lib/customisation.nix
index a794b673d70..234a528527d 100644
--- a/lib/customisation.nix
+++ b/lib/customisation.nix
@@ -145,14 +145,14 @@ rec {
     let
       outputs = drv.outputs or [ "out" ];
 
-      commonAttrs = (removeAttrs drv [ "outputUnspecified" ]) //
-        (builtins.listToAttrs outputsList) //
+      commonAttrs = drv // (builtins.listToAttrs outputsList) //
         ({ all = map (x: x.value) outputsList; }) // passthru;
 
       outputToAttrListElement = outputName:
         { name = outputName;
           value = commonAttrs // {
             inherit (drv.${outputName}) type outputName;
+            outputSpecified = true;
             drvPath = assert condition; drv.${outputName}.drvPath;
             outPath = assert condition; drv.${outputName}.outPath;
           };
@@ -160,7 +160,6 @@ rec {
 
       outputsList = map outputToAttrListElement outputs;
     in commonAttrs // {
-      outputUnspecified = true;
       drvPath = assert condition; drv.drvPath;
       outPath = assert condition; drv.outPath;
     };