3
0
Fork 0
forked from mirrors/nixpkgs

Eliminate some optionals/optionalAttrs calls on the hot path

This commit is contained in:
Eelco Dolstra 2014-10-05 01:54:34 +02:00
parent 97220c973f
commit ce61353a9f
2 changed files with 7 additions and 7 deletions

View file

@ -80,9 +80,9 @@ rec {
internal = opt.internal or false;
visible = opt.visible or true;
}
// optionalAttrs (opt ? example) { example = scrubOptionValue opt.example; }
// optionalAttrs (opt ? default) { default = scrubOptionValue opt.default; }
// optionalAttrs (opt ? defaultText) { default = opt.defaultText; };
// (if opt ? example then { example = scrubOptionValue opt.example; } else {})
// (if opt ? default then { default = scrubOptionValue opt.default; } else {})
// (if opt ? defaultText then { default = opt.defaultText; } else {});
subOptions =
let ss = opt.type.getSubOptions opt.loc;

View file

@ -115,12 +115,12 @@ let
__ignoreNulls = true;
# Inputs built by the cross compiler.
buildInputs = lib.optionals (crossConfig != null) (buildInputs ++ extraBuildInputs);
propagatedBuildInputs = lib.optionals (crossConfig != null) propagatedBuildInputs;
buildInputs = if crossConfig != null then buildInputs ++ extraBuildInputs else [];
propagatedBuildInputs = if crossConfig != null then propagatedBuildInputs else [];
# 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 ++
lib.optionals (crossConfig == null) propagatedBuildInputs;
(if crossConfig == null then propagatedBuildInputs else []);
}))) (
{
# The meta attribute is passed in the resulting attribute set,