forked from mirrors/nixpkgs
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.
This commit is contained in:
parent
dcfa595275
commit
dc895fb281
|
@ -487,7 +487,7 @@ rec {
|
||||||
=> "/nix/store/9rz8gxhzf8sw4kf2j2f1grr49w8zx5vj-openssl-1.0.1r-dev"
|
=> "/nix/store/9rz8gxhzf8sw4kf2j2f1grr49w8zx5vj-openssl-1.0.1r-dev"
|
||||||
*/
|
*/
|
||||||
getOutput = output: pkg:
|
getOutput = output: pkg:
|
||||||
if pkg.outputUnspecified or false
|
if ! pkg ? outputSpecified || ! pkg.outputSpecified
|
||||||
then pkg.${output} or pkg.out or pkg
|
then pkg.${output} or pkg.out or pkg
|
||||||
else pkg;
|
else pkg;
|
||||||
|
|
||||||
|
|
|
@ -145,14 +145,14 @@ rec {
|
||||||
let
|
let
|
||||||
outputs = drv.outputs or [ "out" ];
|
outputs = drv.outputs or [ "out" ];
|
||||||
|
|
||||||
commonAttrs = (removeAttrs drv [ "outputUnspecified" ]) //
|
commonAttrs = drv // (builtins.listToAttrs outputsList) //
|
||||||
(builtins.listToAttrs outputsList) //
|
|
||||||
({ all = map (x: x.value) outputsList; }) // passthru;
|
({ all = map (x: x.value) outputsList; }) // passthru;
|
||||||
|
|
||||||
outputToAttrListElement = outputName:
|
outputToAttrListElement = outputName:
|
||||||
{ name = outputName;
|
{ name = outputName;
|
||||||
value = commonAttrs // {
|
value = commonAttrs // {
|
||||||
inherit (drv.${outputName}) type outputName;
|
inherit (drv.${outputName}) type outputName;
|
||||||
|
outputSpecified = true;
|
||||||
drvPath = assert condition; drv.${outputName}.drvPath;
|
drvPath = assert condition; drv.${outputName}.drvPath;
|
||||||
outPath = assert condition; drv.${outputName}.outPath;
|
outPath = assert condition; drv.${outputName}.outPath;
|
||||||
};
|
};
|
||||||
|
@ -160,7 +160,6 @@ rec {
|
||||||
|
|
||||||
outputsList = map outputToAttrListElement outputs;
|
outputsList = map outputToAttrListElement outputs;
|
||||||
in commonAttrs // {
|
in commonAttrs // {
|
||||||
outputUnspecified = true;
|
|
||||||
drvPath = assert condition; drv.drvPath;
|
drvPath = assert condition; drv.drvPath;
|
||||||
outPath = assert condition; drv.outPath;
|
outPath = assert condition; drv.outPath;
|
||||||
};
|
};
|
||||||
|
|
|
@ -62,7 +62,7 @@ runCommand name
|
||||||
# and otherwise use `meta.outputsToInstall`. The attribute is guaranteed
|
# and otherwise use `meta.outputsToInstall`. The attribute is guaranteed
|
||||||
# to exist in mkDerivation-created cases. The other cases (e.g. runCommand)
|
# to exist in mkDerivation-created cases. The other cases (e.g. runCommand)
|
||||||
# aren't expected to have multiple outputs.
|
# aren't expected to have multiple outputs.
|
||||||
(if drv.outputUnspecified or false
|
(if (! drv ? outputSpecified || ! drv.outputSpecified)
|
||||||
&& drv.meta.outputsToInstall or null != null
|
&& drv.meta.outputsToInstall or null != null
|
||||||
then map (outName: drv.${outName}) drv.meta.outputsToInstall
|
then map (outName: drv.${outName}) drv.meta.outputsToInstall
|
||||||
else [ drv ])
|
else [ drv ])
|
||||||
|
|
|
@ -63,14 +63,14 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
# `llvm` historically had the binaries. When choosing an output explicitly,
|
# `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*
|
# we need to reintroduce `outputSpecified` to get the expected behavior e.g. of lib.get*
|
||||||
llvm = tools.libllvm.out // { outputUnspecified = true; };
|
llvm = tools.libllvm.out // { outputSpecified = false; };
|
||||||
|
|
||||||
libclang = callPackage ./clang {
|
libclang = callPackage ./clang {
|
||||||
inherit clang-tools-extra_src llvm_meta;
|
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
|
# disabled until recommonmark supports sphinx 3
|
||||||
#Llvm-manpages = lowPrio (tools.libllvm.override {
|
#Llvm-manpages = lowPrio (tools.libllvm.override {
|
||||||
|
|
|
@ -65,21 +65,21 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
# `llvm` historically had the binaries. When choosing an output explicitly,
|
# `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*
|
# we need to reintroduce `outputSpecified` to get the expected behavior e.g. of lib.get*
|
||||||
llvm = tools.libllvm.out // { outputUnspecified = true; };
|
llvm = tools.libllvm.out // { outputSpecified = false; };
|
||||||
|
|
||||||
libllvm-polly = callPackage ./llvm {
|
libllvm-polly = callPackage ./llvm {
|
||||||
inherit llvm_meta;
|
inherit llvm_meta;
|
||||||
enablePolly = true;
|
enablePolly = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
llvm-polly = tools.libllvm-polly.lib // { outputUnspecified = true; };
|
llvm-polly = tools.libllvm-polly.lib // { outputSpecified = false; };
|
||||||
|
|
||||||
libclang = callPackage ./clang {
|
libclang = callPackage ./clang {
|
||||||
inherit clang-tools-extra_src llvm_meta;
|
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 {
|
clang-polly-unwrapped = callPackage ./clang {
|
||||||
inherit llvm_meta;
|
inherit llvm_meta;
|
||||||
|
|
|
@ -66,14 +66,14 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
# `llvm` historically had the binaries. When choosing an output explicitly,
|
# `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*
|
# we need to reintroduce `outputSpecified` to get the expected behavior e.g. of lib.get*
|
||||||
llvm = tools.libllvm.out // { outputUnspecified = true; };
|
llvm = tools.libllvm.out // { outputSpecified = false; };
|
||||||
|
|
||||||
libclang = callPackage ./clang {
|
libclang = callPackage ./clang {
|
||||||
inherit clang-tools-extra_src llvm_meta;
|
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
|
# disabled until recommonmark supports sphinx 3
|
||||||
#Llvm-manpages = lowPrio (tools.libllvm.override {
|
#Llvm-manpages = lowPrio (tools.libllvm.override {
|
||||||
|
|
|
@ -68,14 +68,14 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
# `llvm` historically had the binaries. When choosing an output explicitly,
|
# `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*
|
# we need to reintroduce `outputSpecified` to get the expected behavior e.g. of lib.get*
|
||||||
llvm = tools.libllvm.out // { outputUnspecified = true; };
|
llvm = tools.libllvm.out // { outputSpecified = false; };
|
||||||
|
|
||||||
libclang = callPackage ./clang {
|
libclang = callPackage ./clang {
|
||||||
inherit llvm_meta;
|
inherit llvm_meta;
|
||||||
};
|
};
|
||||||
|
|
||||||
clang-unwrapped = tools.libclang.out // { outputUnspecified = true; };
|
clang-unwrapped = tools.libclang.out // { outputSpecified = false; };
|
||||||
|
|
||||||
llvm-manpages = lowPrio (tools.libllvm.override {
|
llvm-manpages = lowPrio (tools.libllvm.override {
|
||||||
enableManpages = true;
|
enableManpages = true;
|
||||||
|
|
|
@ -39,21 +39,21 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
# `llvm` historically had the binaries. When choosing an output explicitly,
|
# `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*
|
# we need to reintroduce `outputSpecified` to get the expected behavior e.g. of lib.get*
|
||||||
llvm = tools.libllvm.out // { outputUnspecified = true; };
|
llvm = tools.libllvm.out // { outputSpecified = false; };
|
||||||
|
|
||||||
libllvm-polly = callPackage ./llvm {
|
libllvm-polly = callPackage ./llvm {
|
||||||
inherit llvm_meta;
|
inherit llvm_meta;
|
||||||
enablePolly = true;
|
enablePolly = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
llvm-polly = tools.libllvm-polly.lib // { outputUnspecified = true; };
|
llvm-polly = tools.libllvm-polly.lib // { outputSpecified = false; };
|
||||||
|
|
||||||
libclang = callPackage ./clang {
|
libclang = callPackage ./clang {
|
||||||
inherit clang-tools-extra_src llvm_meta;
|
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 {
|
llvm-manpages = lowPrio (tools.libllvm.override {
|
||||||
enableManpages = true;
|
enableManpages = true;
|
||||||
|
|
|
@ -39,21 +39,21 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
# `llvm` historically had the binaries. When choosing an output explicitly,
|
# `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*
|
# we need to reintroduce `outputSpecified` to get the expected behavior e.g. of lib.get*
|
||||||
llvm = tools.libllvm.out // { outputUnspecified = true; };
|
llvm = tools.libllvm.out // { outputSpecified = false; };
|
||||||
|
|
||||||
libllvm-polly = callPackage ./llvm {
|
libllvm-polly = callPackage ./llvm {
|
||||||
inherit llvm_meta;
|
inherit llvm_meta;
|
||||||
enablePolly = true;
|
enablePolly = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
llvm-polly = tools.libllvm-polly.lib // { outputUnspecified = true; };
|
llvm-polly = tools.libllvm-polly.lib // { outputSpecified = false; };
|
||||||
|
|
||||||
libclang = callPackage ./clang {
|
libclang = callPackage ./clang {
|
||||||
inherit clang-tools-extra_src llvm_meta;
|
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 {
|
llvm-manpages = lowPrio (tools.libllvm.override {
|
||||||
enableManpages = true;
|
enableManpages = true;
|
||||||
|
|
|
@ -63,21 +63,21 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
# `llvm` historically had the binaries. When choosing an output explicitly,
|
# `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*
|
# we need to reintroduce `outputSpecified` to get the expected behavior e.g. of lib.get*
|
||||||
llvm = tools.libllvm.out // { outputUnspecified = true; };
|
llvm = tools.libllvm.out // { outputSpecified = false; };
|
||||||
|
|
||||||
libllvm-polly = callPackage ./llvm {
|
libllvm-polly = callPackage ./llvm {
|
||||||
inherit llvm_meta;
|
inherit llvm_meta;
|
||||||
enablePolly = true;
|
enablePolly = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
llvm-polly = tools.libllvm-polly.lib // { outputUnspecified = true; };
|
llvm-polly = tools.libllvm-polly.lib // { outputSpecified = false; };
|
||||||
|
|
||||||
libclang = callPackage ./clang {
|
libclang = callPackage ./clang {
|
||||||
inherit clang-tools-extra_src llvm_meta;
|
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 {
|
clang-polly-unwrapped = callPackage ./clang {
|
||||||
inherit llvm_meta;
|
inherit llvm_meta;
|
||||||
|
|
|
@ -63,21 +63,21 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
# `llvm` historically had the binaries. When choosing an output explicitly,
|
# `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*
|
# we need to reintroduce `outputSpecified` to get the expected behavior e.g. of lib.get*
|
||||||
llvm = tools.libllvm.out // { outputUnspecified = true; };
|
llvm = tools.libllvm.out // { outputSpecified = false; };
|
||||||
|
|
||||||
libllvm-polly = callPackage ./llvm {
|
libllvm-polly = callPackage ./llvm {
|
||||||
inherit llvm_meta;
|
inherit llvm_meta;
|
||||||
enablePolly = true;
|
enablePolly = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
llvm-polly = tools.libllvm-polly.lib // { outputUnspecified = true; };
|
llvm-polly = tools.libllvm-polly.lib // { outputSpecified = false; };
|
||||||
|
|
||||||
libclang = callPackage ./clang {
|
libclang = callPackage ./clang {
|
||||||
inherit clang-tools-extra_src llvm_meta;
|
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 {
|
clang-polly-unwrapped = callPackage ./clang {
|
||||||
inherit llvm_meta;
|
inherit llvm_meta;
|
||||||
|
|
|
@ -63,21 +63,21 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
# `llvm` historically had the binaries. When choosing an output explicitly,
|
# `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*
|
# we need to reintroduce `outputSpecified` to get the expected behavior e.g. of lib.get*
|
||||||
llvm = tools.libllvm.out // { outputUnspecified = true; };
|
llvm = tools.libllvm.out // { outputSpecified = false; };
|
||||||
|
|
||||||
libllvm-polly = callPackage ./llvm {
|
libllvm-polly = callPackage ./llvm {
|
||||||
inherit llvm_meta;
|
inherit llvm_meta;
|
||||||
enablePolly = true;
|
enablePolly = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
llvm-polly = tools.libllvm-polly.lib // { outputUnspecified = true; };
|
llvm-polly = tools.libllvm-polly.lib // { outputSpecified = false; };
|
||||||
|
|
||||||
libclang = callPackage ./clang {
|
libclang = callPackage ./clang {
|
||||||
inherit clang-tools-extra_src llvm_meta;
|
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 {
|
clang-polly-unwrapped = callPackage ./clang {
|
||||||
inherit llvm_meta;
|
inherit llvm_meta;
|
||||||
|
|
|
@ -68,14 +68,14 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
# `llvm` historically had the binaries. When choosing an output explicitly,
|
# `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*
|
# we need to reintroduce `outputSpecified` to get the expected behavior e.g. of lib.get*
|
||||||
llvm = tools.libllvm.out // { outputUnspecified = true; };
|
llvm = tools.libllvm.out // { outputSpecified = false; };
|
||||||
|
|
||||||
libclang = callPackage ./clang {
|
libclang = callPackage ./clang {
|
||||||
inherit llvm_meta;
|
inherit llvm_meta;
|
||||||
};
|
};
|
||||||
|
|
||||||
clang-unwrapped = tools.libclang.out // { outputUnspecified = true; };
|
clang-unwrapped = tools.libclang.out // { outputSpecified = false; };
|
||||||
|
|
||||||
llvm-manpages = lowPrio (tools.libllvm.override {
|
llvm-manpages = lowPrio (tools.libllvm.override {
|
||||||
enableManpages = true;
|
enableManpages = true;
|
||||||
|
|
Loading…
Reference in a new issue