From f3719756b550113c1acbbab00c89a56fb77256f2 Mon Sep 17 00:00:00 2001 From: Felix Buehler Date: Sat, 24 Jun 2023 20:19:19 +0200 Subject: treewide: use optionalString instead of 'then ""' --- pkgs/build-support/cc-wrapper/default.nix | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'pkgs/build-support/cc-wrapper') diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix index ffde44c538e3a..a843e64402025 100644 --- a/pkgs/build-support/cc-wrapper/default.nix +++ b/pkgs/build-support/cc-wrapper/default.nix @@ -75,14 +75,14 @@ let ccVersion = lib.getVersion cc; ccName = lib.removePrefix targetPrefix (lib.getName cc); - libc_bin = if libc == null then "" else getBin libc; - libc_dev = if libc == null then "" else getDev libc; - libc_lib = if libc == null then "" else getLib libc; + libc_bin = optionalString (libc != null) (getBin libc); + libc_dev = optionalString (libc != null) (getDev libc); + libc_lib = optionalString (libc != null) (getLib libc); cc_solib = getLib cc + optionalString (targetPlatform != hostPlatform) "/${targetPlatform.config}"; # The wrapper scripts use 'cat' and 'grep', so we may need coreutils. - coreutils_bin = if nativeTools then "" else getBin coreutils; + coreutils_bin = optionalString (!nativeTools) (getBin coreutils); # The "suffix salt" is a arbitrary string added in the end of env vars # defined by cc-wrapper's hooks so that multiple cc-wrappers can be used @@ -164,7 +164,7 @@ assert nativePrefix == bintools.nativePrefix; stdenv.mkDerivation { pname = targetPrefix + (if name != "" then name else "${ccName}-wrapper"); - version = if cc == null then "" else ccVersion; + version = optionalString (cc != null) ccVersion; preferLocalBuild = true; @@ -600,10 +600,10 @@ stdenv.mkDerivation { # for substitution in utils.bash expandResponseParams = "${expand-response-params}/bin/expand-response-params"; shell = getBin shell + shell.shellPath or ""; - gnugrep_bin = if nativeTools then "" else gnugrep; + gnugrep_bin = optionalString (!nativeTools) gnugrep; # stdenv.cc.cc should not be null and we have nothing better for now. # if the native impure bootstrap is gotten rid of this can become `inherit cc;` again. - cc = if nativeTools then "" else cc; + cc = optionalString (!nativeTools) cc; wrapperName = "CC_WRAPPER"; inherit suffixSalt coreutils_bin bintools; inherit libc_bin libc_dev libc_lib; -- cgit 1.4.1