diff --git a/lib/options.nix b/lib/options.nix index 71e02db58f6..ecbd81cd997 100644 --- a/lib/options.nix +++ b/lib/options.nix @@ -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; diff --git a/pkgs/stdenv/generic/default.nix b/pkgs/stdenv/generic/default.nix index 29e4455f7cb..399843c2760 100644 --- a/pkgs/stdenv/generic/default.nix +++ b/pkgs/stdenv/generic/default.nix @@ -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,