diff options
author | Felix Buehler <account@buehler.rocks> | 2023-06-24 20:19:19 +0200 |
---|---|---|
committer | Felix Buehler <account@buehler.rocks> | 2023-06-24 20:19:19 +0200 |
commit | f3719756b550113c1acbbab00c89a56fb77256f2 (patch) | |
tree | a94f6678f9b1b25c6773bdd7a35422aabc816032 /pkgs/applications | |
parent | e9e3f2e7362aba3ef709173d1777f0b893fc0ebf (diff) |
treewide: use optionalString instead of 'then ""'
Diffstat (limited to 'pkgs/applications')
9 files changed, 13 insertions, 20 deletions
diff --git a/pkgs/applications/editors/texmacs/darwin.nix b/pkgs/applications/editors/texmacs/darwin.nix index ff090dd3259a..8c74d8c5c8f2 100644 --- a/pkgs/applications/editors/texmacs/darwin.nix +++ b/pkgs/applications/editors/texmacs/darwin.nix @@ -47,10 +47,10 @@ stdenv.mkDerivation { postInstall = "wrapProgram $out/Applications/TeXmacs-${version}/Contents/MacOS/TeXmacs --suffix PATH : " + "${ghostscript}/bin:" + - (if aspell == null then "" else "${aspell}/bin:") + - (if tex == null then "" else "${tex}/bin:") + - (if netpbm == null then "" else "${lib.getBin netpbm}/bin:") + - (if imagemagick == null then "" else "${imagemagick}/bin:"); + (lib.optionalString (aspell != null) "${aspell}/bin:") + + (lib.optionalString (tex != null) "${tex}/bin:") + + (lib.optionalString (netpbm != null) "${lib.getBin netpbm}/bin:") + + (lib.optionalString (imagemagick != null) "${imagemagick}/bin:"); enableParallelBuilding = true; diff --git a/pkgs/applications/editors/vscode/vscodium.nix b/pkgs/applications/editors/vscode/vscodium.nix index 3e66c7e6abd0..b434279621d1 100644 --- a/pkgs/applications/editors/vscode/vscodium.nix +++ b/pkgs/applications/editors/vscode/vscodium.nix @@ -22,7 +22,7 @@ let armv7l-linux = "0m1v24gg2dy79hgrz37gysgrazg8vkr1gkp52j6m6y76vi0l8249"; }.${system} or throwSystem; - sourceRoot = if stdenv.isDarwin then "" else "."; + sourceRoot = lib.optionalString (!stdenv.isDarwin) "."; in callPackage ./generic.nix rec { inherit sourceRoot commandLineArgs useVSCodeRipgrep; diff --git a/pkgs/applications/networking/browsers/chromium/default.nix b/pkgs/applications/networking/browsers/chromium/default.nix index 77f4def41f33..a5e6855e9637 100644 --- a/pkgs/applications/networking/browsers/chromium/default.nix +++ b/pkgs/applications/networking/browsers/chromium/default.nix @@ -134,9 +134,7 @@ let }; }; - suffix = if (channel == "stable" || channel == "ungoogled-chromium") - then "" - else "-" + channel; + suffix = lib.optionalString (channel != "stable" && channel != "ungoogled-chromium") ("-" + channel); sandboxExecutableName = chromium.browser.passthru.sandboxExecutableName; diff --git a/pkgs/applications/networking/browsers/microsoft-edge/browser.nix b/pkgs/applications/networking/browsers/microsoft-edge/browser.nix index 2af28bb8dd06..7f72a42ffe0d 100644 --- a/pkgs/applications/networking/browsers/microsoft-edge/browser.nix +++ b/pkgs/applications/networking/browsers/microsoft-edge/browser.nix @@ -46,13 +46,9 @@ let then baseName else baseName + "-" + channel; - iconSuffix = if channel == "stable" - then "" - else "_${channel}"; + iconSuffix = lib.optionalString (channel != "stable") "_${channel}"; - desktopSuffix = if channel == "stable" - then "" - else "-${channel}"; + desktopSuffix = lib.optionalString (channel != "stable") "-${channel}"; in stdenv.mkDerivation rec { diff --git a/pkgs/applications/office/libreoffice/default.nix b/pkgs/applications/office/libreoffice/default.nix index 25e8f18998e2..518167cb33d1 100644 --- a/pkgs/applications/office/libreoffice/default.nix +++ b/pkgs/applications/office/libreoffice/default.nix @@ -395,7 +395,7 @@ in dontWrapQtApps = true; configureFlags = [ - (if withHelp then "" else "--without-help") + (lib.optionalString (!withHelp) "--without-help") "--with-boost=${getDev boost}" "--with-boost-libdir=${getLib boost}/lib" "--with-beanshell-jar=${bsh}" diff --git a/pkgs/applications/science/logic/hol_light/default.nix b/pkgs/applications/science/logic/hol_light/default.nix index 4c105a40e20d..9f379252fd52 100644 --- a/pkgs/applications/science/logic/hol_light/default.nix +++ b/pkgs/applications/science/logic/hol_light/default.nix @@ -2,8 +2,7 @@ let load_num = - if num == null then "" else - '' + lib.optionalString (num != null) '' -I ${num}/lib/ocaml/${ocaml.version}/site-lib/num \ -I ${num}/lib/ocaml/${ocaml.version}/site-lib/top-num \ -I ${num}/lib/ocaml/${ocaml.version}/site-lib/stublibs \ diff --git a/pkgs/applications/science/math/sage/sage-tests.nix b/pkgs/applications/science/math/sage/sage-tests.nix index 4910f5e8bf1d..1a415ae65e96 100644 --- a/pkgs/applications/science/math/sage/sage-tests.nix +++ b/pkgs/applications/science/math/sage/sage-tests.nix @@ -19,7 +19,7 @@ let runAllTests = files == null; testArgs = if runAllTests then "--all" else testFileList; patienceSpecifier = lib.optionalString longTests "--long"; - timeSpecifier = if timeLimit == null then "" else "--short ${toString timeLimit}"; + timeSpecifier = lib.optionalString (timeLimit != null) "--short ${toString timeLimit}"; relpathToArg = relpath: lib.escapeShellArg "${src}/${relpath}"; # paths need to be absolute testFileList = lib.concatStringsSep " " (map relpathToArg files); in diff --git a/pkgs/applications/version-management/sapling/default.nix b/pkgs/applications/version-management/sapling/default.nix index 0d14d512c5f2..796d76cc6ef8 100644 --- a/pkgs/applications/version-management/sapling/default.nix +++ b/pkgs/applications/version-management/sapling/default.nix @@ -38,7 +38,7 @@ let # # See https://github.com/NixOS/nixpkgs/pull/198311#issuecomment-1326894295 myCargoSetupHook = rustPlatform.cargoSetupHook.overrideAttrs (old: { - cargoConfig = if stdenv.isDarwin then "" else old.cargoConfig; + cargoConfig = lib.optionalString (!stdenv.isDarwin) old.cargoConfig; }); src = fetchFromGitHub { diff --git a/pkgs/applications/window-managers/sway/wrapper.nix b/pkgs/applications/window-managers/sway/wrapper.nix index 42384fa06ae2..e786e1463816 100644 --- a/pkgs/applications/window-managers/sway/wrapper.nix +++ b/pkgs/applications/window-managers/sway/wrapper.nix @@ -28,7 +28,7 @@ let export DBUS_SESSION_BUS_ADDRESS exec ${sway}/bin/sway "$@" else - exec ${if !dbusSupport then "" else "${dbus}/bin/dbus-run-session"} ${sway}/bin/sway "$@" + exec ${lib.optionalString dbusSupport "${dbus}/bin/dbus-run-session"} ${sway}/bin/sway "$@" fi ''; in symlinkJoin { |