diff options
author | Felix Bühler <Stunkymonkey@users.noreply.github.com> | 2023-07-22 13:02:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-22 13:02:47 +0200 |
commit | 0a2745684e8e97340d947d56b0ba778056c10395 (patch) | |
tree | c258179185eefafddef480949e84046d3bb50b2e /pkgs/build-support/bintools-wrapper/default.nix | |
parent | 4448ec5cd84f00350969934deb4d9ac9055c411c (diff) | |
parent | e770737241360cdfd09b421eea83160dce02c212 (diff) |
Merge pull request #239624 from Stunkymonkey/use-optionalString-then
treewide: use optionalString instead of 'then ""'
Diffstat (limited to 'pkgs/build-support/bintools-wrapper/default.nix')
-rw-r--r-- | pkgs/build-support/bintools-wrapper/default.nix | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/pkgs/build-support/bintools-wrapper/default.nix b/pkgs/build-support/bintools-wrapper/default.nix index adaf80dcd916..9ed4f5886f61 100644 --- a/pkgs/build-support/bintools-wrapper/default.nix +++ b/pkgs/build-support/bintools-wrapper/default.nix @@ -59,12 +59,12 @@ let bintoolsVersion = lib.getVersion bintools; bintoolsName = lib.removePrefix targetPrefix (lib.getName bintools); - 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; - bintools_bin = if nativeTools then "" else getBin bintools; + libc_bin = lib.optionalString (libc != null) (getBin libc); + libc_dev = lib.optionalString (libc != null) (getDev libc); + libc_lib = lib.optionalString (libc != null) (getLib libc); + bintools_bin = lib.optionalString (!nativeTools) (getBin bintools); # The wrapper scripts use 'cat' and 'grep', so we may need coreutils. - coreutils_bin = if nativeTools then "" else getBin coreutils; + coreutils_bin = lib.optionalString (!nativeTools) (getBin coreutils); # See description in cc-wrapper. suffixSalt = replaceStrings ["-" "."] ["_" "_"] targetPlatform.config; @@ -103,7 +103,7 @@ in stdenv.mkDerivation { pname = targetPrefix + (if name != "" then name else "${bintoolsName}-wrapper"); - version = if bintools == null then "" else bintoolsVersion; + version = lib.optionalString (bintools != null) bintoolsVersion; preferLocalBuild = true; @@ -265,7 +265,7 @@ stdenv.mkDerivation { # install the wrapper, you get tools like objdump (same for any # binaries of libc). + optionalString (!nativeTools) '' - printWords ${bintools_bin} ${if libc == null then "" else libc_bin} > $out/nix-support/propagated-user-env-packages + printWords ${bintools_bin} ${lib.optionalString (libc != null) libc_bin} > $out/nix-support/propagated-user-env-packages '' ## @@ -381,7 +381,7 @@ 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 = lib.optionalString (!nativeTools) gnugrep; wrapperName = "BINTOOLS_WRAPPER"; inherit dynamicLinker targetPrefix suffixSalt coreutils_bin; inherit bintools_bin libc_bin libc_dev libc_lib; |