forked from mirrors/nixpkgs
Eliminate some optionals/optionalAttrs calls on the hot path
This commit is contained in:
parent
97220c973f
commit
ce61353a9f
|
@ -80,9 +80,9 @@ rec {
|
||||||
internal = opt.internal or false;
|
internal = opt.internal or false;
|
||||||
visible = opt.visible or true;
|
visible = opt.visible or true;
|
||||||
}
|
}
|
||||||
// optionalAttrs (opt ? example) { example = scrubOptionValue opt.example; }
|
// (if opt ? example then { example = scrubOptionValue opt.example; } else {})
|
||||||
// optionalAttrs (opt ? default) { default = scrubOptionValue opt.default; }
|
// (if opt ? default then { default = scrubOptionValue opt.default; } else {})
|
||||||
// optionalAttrs (opt ? defaultText) { default = opt.defaultText; };
|
// (if opt ? defaultText then { default = opt.defaultText; } else {});
|
||||||
|
|
||||||
subOptions =
|
subOptions =
|
||||||
let ss = opt.type.getSubOptions opt.loc;
|
let ss = opt.type.getSubOptions opt.loc;
|
||||||
|
|
|
@ -115,12 +115,12 @@ let
|
||||||
__ignoreNulls = true;
|
__ignoreNulls = true;
|
||||||
|
|
||||||
# Inputs built by the cross compiler.
|
# Inputs built by the cross compiler.
|
||||||
buildInputs = lib.optionals (crossConfig != null) (buildInputs ++ extraBuildInputs);
|
buildInputs = if crossConfig != null then buildInputs ++ extraBuildInputs else [];
|
||||||
propagatedBuildInputs = lib.optionals (crossConfig != null) propagatedBuildInputs;
|
propagatedBuildInputs = if crossConfig != null then propagatedBuildInputs else [];
|
||||||
# Inputs built by the usual native compiler.
|
# Inputs built by the usual native compiler.
|
||||||
nativeBuildInputs = nativeBuildInputs ++ lib.optionals (crossConfig == null) (buildInputs ++ extraBuildInputs);
|
nativeBuildInputs = nativeBuildInputs ++ (if crossConfig == null then buildInputs ++ extraBuildInputs else []);
|
||||||
propagatedNativeBuildInputs = propagatedNativeBuildInputs ++
|
propagatedNativeBuildInputs = propagatedNativeBuildInputs ++
|
||||||
lib.optionals (crossConfig == null) propagatedBuildInputs;
|
(if crossConfig == null then propagatedBuildInputs else []);
|
||||||
}))) (
|
}))) (
|
||||||
{
|
{
|
||||||
# The meta attribute is passed in the resulting attribute set,
|
# The meta attribute is passed in the resulting attribute set,
|
||||||
|
|
Loading…
Reference in a new issue