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

View File

@ -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,