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.
main
pennae 3 years ago
parent dcfa595275
commit dc895fb281
  1. 2
      lib/attrsets.nix
  2. 5
      lib/customisation.nix
  3. 2
      pkgs/build-support/buildenv/default.nix
  4. 6
      pkgs/development/compilers/llvm/10/default.nix
  5. 8
      pkgs/development/compilers/llvm/11/default.nix
  6. 6
      pkgs/development/compilers/llvm/12/default.nix
  7. 6
      pkgs/development/compilers/llvm/13/default.nix
  8. 8
      pkgs/development/compilers/llvm/5/default.nix
  9. 8
      pkgs/development/compilers/llvm/6/default.nix
  10. 8
      pkgs/development/compilers/llvm/7/default.nix
  11. 8
      pkgs/development/compilers/llvm/8/default.nix
  12. 8
      pkgs/development/compilers/llvm/9/default.nix
  13. 6
      pkgs/development/compilers/llvm/git/default.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;

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

@ -62,7 +62,7 @@ runCommand name
# and otherwise use `meta.outputsToInstall`. The attribute is guaranteed
# to exist in mkDerivation-created cases. The other cases (e.g. runCommand)
# aren't expected to have multiple outputs.
(if drv.outputUnspecified or false
(if (! drv ? outputSpecified || ! drv.outputSpecified)
&& drv.meta.outputsToInstall or null != null
then map (outName: drv.${outName}) drv.meta.outputsToInstall
else [ drv ])

@ -63,14 +63,14 @@ let
};
# `llvm` historically had the binaries. When choosing an output explicitly,
# we need to reintroduce `outputUnspecified` to get the expected behavior e.g. of lib.get*
llvm = tools.libllvm.out // { outputUnspecified = true; };
# we need to reintroduce `outputSpecified` to get the expected behavior e.g. of lib.get*
llvm = tools.libllvm.out // { outputSpecified = false; };
libclang = callPackage ./clang {
inherit clang-tools-extra_src llvm_meta;
};
clang-unwrapped = tools.libclang.out // { outputUnspecified = true; };
clang-unwrapped = tools.libclang.out // { outputSpecified = false; };
# disabled until recommonmark supports sphinx 3
#Llvm-manpages = lowPrio (tools.libllvm.override {

@ -65,21 +65,21 @@ let
};
# `llvm` historically had the binaries. When choosing an output explicitly,
# we need to reintroduce `outputUnspecified` to get the expected behavior e.g. of lib.get*
llvm = tools.libllvm.out // { outputUnspecified = true; };
# we need to reintroduce `outputSpecified` to get the expected behavior e.g. of lib.get*
llvm = tools.libllvm.out // { outputSpecified = false; };
libllvm-polly = callPackage ./llvm {
inherit llvm_meta;
enablePolly = true;
};
llvm-polly = tools.libllvm-polly.lib // { outputUnspecified = true; };
llvm-polly = tools.libllvm-polly.lib // { outputSpecified = false; };
libclang = callPackage ./clang {
inherit clang-tools-extra_src llvm_meta;
};
clang-unwrapped = tools.libclang.out // { outputUnspecified = true; };
clang-unwrapped = tools.libclang.out // { outputSpecified = false; };
clang-polly-unwrapped = callPackage ./clang {
inherit llvm_meta;

@ -66,14 +66,14 @@ let
};
# `llvm` historically had the binaries. When choosing an output explicitly,
# we need to reintroduce `outputUnspecified` to get the expected behavior e.g. of lib.get*
llvm = tools.libllvm.out // { outputUnspecified = true; };
# we need to reintroduce `outputSpecified` to get the expected behavior e.g. of lib.get*
llvm = tools.libllvm.out // { outputSpecified = false; };
libclang = callPackage ./clang {
inherit clang-tools-extra_src llvm_meta;
};
clang-unwrapped = tools.libclang.out // { outputUnspecified = true; };
clang-unwrapped = tools.libclang.out // { outputSpecified = false; };
# disabled until recommonmark supports sphinx 3
#Llvm-manpages = lowPrio (tools.libllvm.override {

@ -68,14 +68,14 @@ let
};
# `llvm` historically had the binaries. When choosing an output explicitly,
# we need to reintroduce `outputUnspecified` to get the expected behavior e.g. of lib.get*
llvm = tools.libllvm.out // { outputUnspecified = true; };
# we need to reintroduce `outputSpecified` to get the expected behavior e.g. of lib.get*
llvm = tools.libllvm.out // { outputSpecified = false; };
libclang = callPackage ./clang {
inherit llvm_meta;
};
clang-unwrapped = tools.libclang.out // { outputUnspecified = true; };
clang-unwrapped = tools.libclang.out // { outputSpecified = false; };
llvm-manpages = lowPrio (tools.libllvm.override {
enableManpages = true;

@ -39,21 +39,21 @@ let
};
# `llvm` historically had the binaries. When choosing an output explicitly,
# we need to reintroduce `outputUnspecified` to get the expected behavior e.g. of lib.get*
llvm = tools.libllvm.out // { outputUnspecified = true; };
# we need to reintroduce `outputSpecified` to get the expected behavior e.g. of lib.get*
llvm = tools.libllvm.out // { outputSpecified = false; };
libllvm-polly = callPackage ./llvm {
inherit llvm_meta;
enablePolly = true;
};
llvm-polly = tools.libllvm-polly.lib // { outputUnspecified = true; };
llvm-polly = tools.libllvm-polly.lib // { outputSpecified = false; };
libclang = callPackage ./clang {
inherit clang-tools-extra_src llvm_meta;
};
clang-unwrapped = tools.libclang.out // { outputUnspecified = true; };
clang-unwrapped = tools.libclang.out // { outputSpecified = false; };
llvm-manpages = lowPrio (tools.libllvm.override {
enableManpages = true;

@ -39,21 +39,21 @@ let
};
# `llvm` historically had the binaries. When choosing an output explicitly,
# we need to reintroduce `outputUnspecified` to get the expected behavior e.g. of lib.get*
llvm = tools.libllvm.out // { outputUnspecified = true; };
# we need to reintroduce `outputSpecified` to get the expected behavior e.g. of lib.get*
llvm = tools.libllvm.out // { outputSpecified = false; };
libllvm-polly = callPackage ./llvm {
inherit llvm_meta;
enablePolly = true;
};
llvm-polly = tools.libllvm-polly.lib // { outputUnspecified = true; };
llvm-polly = tools.libllvm-polly.lib // { outputSpecified = false; };
libclang = callPackage ./clang {
inherit clang-tools-extra_src llvm_meta;
};
clang-unwrapped = tools.libclang.out // { outputUnspecified = true; };
clang-unwrapped = tools.libclang.out // { outputSpecified = false; };
llvm-manpages = lowPrio (tools.libllvm.override {
enableManpages = true;

@ -63,21 +63,21 @@ let
};
# `llvm` historically had the binaries. When choosing an output explicitly,
# we need to reintroduce `outputUnspecified` to get the expected behavior e.g. of lib.get*
llvm = tools.libllvm.out // { outputUnspecified = true; };
# we need to reintroduce `outputSpecified` to get the expected behavior e.g. of lib.get*
llvm = tools.libllvm.out // { outputSpecified = false; };
libllvm-polly = callPackage ./llvm {
inherit llvm_meta;
enablePolly = true;
};
llvm-polly = tools.libllvm-polly.lib // { outputUnspecified = true; };
llvm-polly = tools.libllvm-polly.lib // { outputSpecified = false; };
libclang = callPackage ./clang {
inherit clang-tools-extra_src llvm_meta;
};
clang-unwrapped = tools.libclang.out // { outputUnspecified = true; };
clang-unwrapped = tools.libclang.out // { outputSpecified = false; };
clang-polly-unwrapped = callPackage ./clang {
inherit llvm_meta;

@ -63,21 +63,21 @@ let
};
# `llvm` historically had the binaries. When choosing an output explicitly,
# we need to reintroduce `outputUnspecified` to get the expected behavior e.g. of lib.get*
llvm = tools.libllvm.out // { outputUnspecified = true; };
# we need to reintroduce `outputSpecified` to get the expected behavior e.g. of lib.get*
llvm = tools.libllvm.out // { outputSpecified = false; };
libllvm-polly = callPackage ./llvm {
inherit llvm_meta;
enablePolly = true;
};
llvm-polly = tools.libllvm-polly.lib // { outputUnspecified = true; };
llvm-polly = tools.libllvm-polly.lib // { outputSpecified = false; };
libclang = callPackage ./clang {
inherit clang-tools-extra_src llvm_meta;
};
clang-unwrapped = tools.libclang.out // { outputUnspecified = true; };
clang-unwrapped = tools.libclang.out // { outputSpecified = false; };
clang-polly-unwrapped = callPackage ./clang {
inherit llvm_meta;

@ -63,21 +63,21 @@ let
};
# `llvm` historically had the binaries. When choosing an output explicitly,
# we need to reintroduce `outputUnspecified` to get the expected behavior e.g. of lib.get*
llvm = tools.libllvm.out // { outputUnspecified = true; };
# we need to reintroduce `outputSpecified` to get the expected behavior e.g. of lib.get*
llvm = tools.libllvm.out // { outputSpecified = false; };
libllvm-polly = callPackage ./llvm {
inherit llvm_meta;
enablePolly = true;
};
llvm-polly = tools.libllvm-polly.lib // { outputUnspecified = true; };
llvm-polly = tools.libllvm-polly.lib // { outputSpecified = false; };
libclang = callPackage ./clang {
inherit clang-tools-extra_src llvm_meta;
};
clang-unwrapped = tools.libclang.out // { outputUnspecified = true; };
clang-unwrapped = tools.libclang.out // { outputSpecified = false; };
clang-polly-unwrapped = callPackage ./clang {
inherit llvm_meta;

@ -68,14 +68,14 @@ let
};
# `llvm` historically had the binaries. When choosing an output explicitly,
# we need to reintroduce `outputUnspecified` to get the expected behavior e.g. of lib.get*
llvm = tools.libllvm.out // { outputUnspecified = true; };
# we need to reintroduce `outputSpecified` to get the expected behavior e.g. of lib.get*
llvm = tools.libllvm.out // { outputSpecified = false; };
libclang = callPackage ./clang {
inherit llvm_meta;
};
clang-unwrapped = tools.libclang.out // { outputUnspecified = true; };
clang-unwrapped = tools.libclang.out // { outputSpecified = false; };
llvm-manpages = lowPrio (tools.libllvm.override {
enableManpages = true;

Loading…
Cancel
Save