Replace hasAttr/getAttr calls with the ? and . operators
For NixOS evaluation, this gives a ~21% reduction in the number of values allocated and a ~4% speedup. It's also more readable.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
let lib = import ./default.nix;
|
||||
inherit (builtins) getAttr attrNames isFunction;
|
||||
|
||||
let
|
||||
lib = import ./default.nix;
|
||||
inherit (builtins) attrNames isFunction;
|
||||
in
|
||||
|
||||
rec {
|
||||
@@ -107,10 +107,10 @@ rec {
|
||||
outputToAttrListElement = outputName:
|
||||
{ name = outputName;
|
||||
value = commonAttrs // {
|
||||
inherit (builtins.getAttr outputName drv) outPath drvPath type outputName;
|
||||
inherit (drv.${outputName}) outPath drvPath type outputName;
|
||||
};
|
||||
};
|
||||
|
||||
outputsList = map outputToAttrListElement outputs;
|
||||
in builtins.getAttr drv.outputName commonAttrs;
|
||||
in commonAttrs.${drv.outputName};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user