From a6479a6e32120bf4c7ba38dc7dcac88f80527385 Mon Sep 17 00:00:00 2001 From: Ihar Hrachyshka Date: Fri, 4 Sep 2026 23:11:35 -0400 Subject: [PATCH] treewide: remove `optional cond [ ... ]` This pattern is error prone, especially with __structuredAttrs, where nested lists can leave important attributes such as `patches` null. The treewide rewrite was produced with ast-grep, followed by `nix fmt` and manual fixes for two `sema-undefined-variable` violations. Future occurrences will be rejected by nixpkgs-vet once this change is merged: https://github.com/NixOS/nixpkgs-vet/pull/301 --- nixos/modules/services/misc/klipper.nix | 2 +- nixos/modules/services/misc/pinchflat.nix | 3 ++- .../services/monitoring/prometheus/exporters/restic.nix | 4 ++-- nixos/modules/services/monitoring/vmagent.nix | 2 +- nixos/modules/services/web-servers/garage.nix | 2 +- nixos/modules/services/web-servers/nginx/default.nix | 2 +- nixos/modules/services/web-servers/stargazer.nix | 4 ++-- pkgs/applications/gis/qgis/unwrapped-ltr.nix | 2 +- pkgs/applications/gis/qgis/unwrapped.nix | 2 +- pkgs/build-support/teleport/default.nix | 4 ++-- pkgs/by-name/ai/airwin2rack/package.nix | 2 +- pkgs/by-name/ap/apache-orc/package.nix | 2 +- pkgs/by-name/as/astyle/package.nix | 2 +- pkgs/by-name/bo/bowtie2/package.nix | 2 +- pkgs/by-name/cd/cdparanoia-iii/package.nix | 2 +- pkgs/by-name/co/cogl/package.nix | 4 ++-- pkgs/by-name/cr/crispy-doom/package.nix | 2 +- pkgs/by-name/dh/dhtbsign/package.nix | 2 +- pkgs/by-name/fi/fireplace/package.nix | 2 +- pkgs/by-name/fr/frankenphp/package.nix | 2 +- pkgs/by-name/kt/ktls-utils/package.nix | 4 ++-- pkgs/by-name/ma/matrix-tuwunel/package.nix | 2 +- pkgs/by-name/mk/mkbootimg-osm0sis/package.nix | 2 +- pkgs/by-name/mo/monero-cli/package.nix | 2 +- pkgs/by-name/mo/monero-gui/package.nix | 2 +- pkgs/by-name/px/pxa-mkbootimg/package.nix | 2 +- pkgs/by-name/re/refind/package.nix | 2 +- pkgs/by-name/ry/ryubing/package.nix | 2 +- pkgs/by-name/s7/s7/package.nix | 2 +- pkgs/by-name/sf/sfml/package.nix | 2 +- pkgs/by-name/si/simple-completion-language-server/package.nix | 2 +- pkgs/by-name/sp/spla/package.nix | 2 +- pkgs/by-name/te/textadept/package.nix | 4 ++-- pkgs/by-name/vt/vtk-dicom/package.nix | 2 +- pkgs/by-name/xp/xpra/package.nix | 2 +- pkgs/development/compilers/llvm/common/lldb/default.nix | 2 +- pkgs/development/compilers/llvm/common/mlir/default.nix | 2 +- pkgs/development/interpreters/php/generic.nix | 2 +- pkgs/development/libraries/libxmlxx/v3.nix | 2 +- .../libraries/science/astronomy/indilib/default.nix | 2 +- .../libraries/science/astronomy/indilib/indi-3rdparty.nix | 2 +- pkgs/development/python-modules/deal/default.nix | 2 +- .../python-modules/ffmpeg-progress-yield/default.nix | 2 +- pkgs/development/python-modules/inkex/default.nix | 4 ++-- pkgs/development/python-modules/pandas/default.nix | 2 +- pkgs/development/python-modules/pymupdf/default.nix | 2 +- pkgs/development/python-modules/uqbar/default.nix | 4 ++-- pkgs/development/tools/godot/common.nix | 2 +- pkgs/os-specific/cygwin/newlib-cygwin/default.nix | 2 +- pkgs/servers/sql/postgresql/ext/vectorchord/package.nix | 2 +- 50 files changed, 59 insertions(+), 58 deletions(-) diff --git a/nixos/modules/services/misc/klipper.nix b/nixos/modules/services/misc/klipper.nix index 29497c15d22a..55c5a91e63fd 100644 --- a/nixos/modules/services/misc/klipper.nix +++ b/nixos/modules/services/misc/klipper.nix @@ -298,7 +298,7 @@ in popd ''; - restartTriggers = lib.optional (!cfg.mutableConfig) [ printerConfig ]; + restartTriggers = lib.optionals (!cfg.mutableConfig) [ printerConfig ]; serviceConfig = { ExecStart = "${cfg.package}/bin/klippy ${klippyArgs} ${cfg.configDir}/printer.cfg"; diff --git a/nixos/modules/services/misc/pinchflat.nix b/nixos/modules/services/misc/pinchflat.nix index 21b78ecde68e..bbdafc7d9fc1 100644 --- a/nixos/modules/services/misc/pinchflat.nix +++ b/nixos/modules/services/misc/pinchflat.nix @@ -16,6 +16,7 @@ let getExe literalExpression optional + optionals attrValues mapAttrs ; @@ -158,7 +159,7 @@ in "LOG_LEVEL=${cfg.logLevel}" "PHX_SERVER=true" ] - ++ optional cfg.selfhosted [ "RUN_CONTEXT=selfhosted" ] + ++ optionals cfg.selfhosted [ "RUN_CONTEXT=selfhosted" ] ++ optional (!isNull config.time.timeZone) "TZ=${config.time.timeZone}" ++ attrValues (mapAttrs (name: value: name + "=" + toString value) cfg.extraConfig); EnvironmentFile = optional (cfg.secretsFile != null) cfg.secretsFile; diff --git a/nixos/modules/services/monitoring/prometheus/exporters/restic.nix b/nixos/modules/services/monitoring/prometheus/exporters/restic.nix index 79d412bf0458..25f5d7f05373 100644 --- a/nixos/modules/services/monitoring/prometheus/exporters/restic.nix +++ b/nixos/modules/services/monitoring/prometheus/exporters/restic.nix @@ -16,7 +16,7 @@ let mapAttrs' splitString toUpper - optional + optionals optionalAttrs nameValuePair ; @@ -145,7 +145,7 @@ in LoadCredential = [ "RESTIC_PASSWORD_FILE:${cfg.passwordFile}" ] - ++ optional (cfg.repositoryFile != null) [ "RESTIC_REPOSITORY:${cfg.repositoryFile}" ]; + ++ optionals (cfg.repositoryFile != null) [ "RESTIC_REPOSITORY:${cfg.repositoryFile}" ]; }; environment = let diff --git a/nixos/modules/services/monitoring/vmagent.nix b/nixos/modules/services/monitoring/vmagent.nix index 0d451b4b96ed..d93cde0e9515 100644 --- a/nixos/modules/services/monitoring/vmagent.nix +++ b/nixos/modules/services/monitoring/vmagent.nix @@ -152,7 +152,7 @@ in startCLIList ++ lib.optionals (cfg.prometheusConfig != { }) [ "-promscrape.config=${prometheusConfigYml}" ] ); - LoadCredential = lib.optional (cfg.remoteWrite.basicAuthPasswordFile != null) [ + LoadCredential = lib.optionals (cfg.remoteWrite.basicAuthPasswordFile != null) [ "remote_write_basic_auth_password:${cfg.remoteWrite.basicAuthPasswordFile}" ]; }; diff --git a/nixos/modules/services/web-servers/garage.nix b/nixos/modules/services/web-servers/garage.nix index 66996312865c..31149b1d7ff3 100644 --- a/nixos/modules/services/web-servers/garage.nix +++ b/nixos/modules/services/web-servers/garage.nix @@ -133,7 +133,7 @@ in # if data_dir is a list, the actual path will in in the `path` attribute of each item # see https://garagehq.deuxfleurs.fr/documentation/reference-manual/configuration/#data_dir ++ lib.optional (lib.isList data_dir) (map (item: item.path) data_dir) - ++ lib.optional (lib.isString data_dir) [ data_dir ] + ++ lib.optionals (lib.isString data_dir) [ data_dir ] ); isDefault = lib.hasPrefix "/var/lib/garage"; isDefaultStateDirectory = lib.any isDefault paths; diff --git a/nixos/modules/services/web-servers/nginx/default.nix b/nixos/modules/services/web-servers/nginx/default.nix index bf6404ff935c..1d868aa9146d 100644 --- a/nixos/modules/services/web-servers/nginx/default.nix +++ b/nixos/modules/services/web-servers/nginx/default.nix @@ -1642,7 +1642,7 @@ in SystemCallFilter = [ "~@cpu-emulation @debug @keyring @mount @obsolete @privileged @setuid" ] - ++ optional cfg.enableQuicBPF [ "bpf" ]; + ++ optionals cfg.enableQuicBPF [ "bpf" ]; }; }; diff --git a/nixos/modules/services/web-servers/stargazer.nix b/nixos/modules/services/web-servers/stargazer.nix index cc16e0755ced..bd3a97f178a7 100644 --- a/nixos/modules/services/web-servers/stargazer.nix +++ b/nixos/modules/services/web-servers/stargazer.nix @@ -271,7 +271,7 @@ in "~CAP_SYS_BOOT" "~CAP_NET_ADMIN" ] - ++ lib.lists.optional (!cfg.allowCgiUser) [ + ++ lib.lists.optionals (!cfg.allowCgiUser) [ "~CAP_SETGID" "~CAP_SETUID" ]; @@ -279,7 +279,7 @@ in SystemCallFilter = [ "~@cpu-emulation @debug @keyring @mount @obsolete" ] - ++ lib.lists.optional (!cfg.allowCgiUser) [ "@privileged @setuid" ]; + ++ lib.lists.optionals (!cfg.allowCgiUser) [ "@privileged @setuid" ]; }; }; diff --git a/pkgs/applications/gis/qgis/unwrapped-ltr.nix b/pkgs/applications/gis/qgis/unwrapped-ltr.nix index 8a836784edce..0c1289aa9d50 100644 --- a/pkgs/applications/gis/qgis/unwrapped-ltr.nix +++ b/pkgs/applications/gis/qgis/unwrapped-ltr.nix @@ -185,7 +185,7 @@ mkDerivation rec { "-DQGIS_MACAPP_BUNDLE=0" # Don't copy Qt into bundle; we fix paths in postFixup "-DSQLITE3_INCLUDE_DIR=${sqlite.dev}/include" # FindSqlite3.cmake incorrectly assumes framework ] - ++ lib.optional withServer [ + ++ lib.optionals withServer [ "-DWITH_SERVER=True" "-DQGIS_CGIBIN_SUBDIR=${placeholder "out"}/lib/cgi-bin" ] diff --git a/pkgs/applications/gis/qgis/unwrapped.nix b/pkgs/applications/gis/qgis/unwrapped.nix index 82baf6af3594..72055c691f68 100644 --- a/pkgs/applications/gis/qgis/unwrapped.nix +++ b/pkgs/applications/gis/qgis/unwrapped.nix @@ -190,7 +190,7 @@ stdenv.mkDerivation rec { "-DSQLITE3_INCLUDE_DIR=${sqlite.dev}/include" "-DUSE_OPENCL=OFF" ] - ++ lib.optional withServer [ + ++ lib.optionals withServer [ "-DWITH_SERVER=True" "-DQGIS_CGIBIN_SUBDIR=${placeholder "out"}/lib/cgi-bin" ] diff --git a/pkgs/build-support/teleport/default.nix b/pkgs/build-support/teleport/default.nix index 8d51876e536a..22a686eb92f8 100644 --- a/pkgs/build-support/teleport/default.nix +++ b/pkgs/build-support/teleport/default.nix @@ -162,10 +162,10 @@ buildGoModule (finalAttrs: { ++ [ ./rdpclient.patch ] - ++ lib.optional (lib.versionOlder version "18.8.0") [ + ++ lib.optionals (lib.versionOlder version "18.8.0") [ ./0001-fix-add-nix-path-to-exec-env.patch ] - ++ lib.optional (lib.versionAtLeast version "18.8.0") [ + ++ lib.optionals (lib.versionAtLeast version "18.8.0") [ ./0001-fix-add-nix-path-to-exec-env-reexec.patch ]; diff --git a/pkgs/by-name/ai/airwin2rack/package.nix b/pkgs/by-name/ai/airwin2rack/package.nix index 1c330993fd43..14dc3fef16a5 100644 --- a/pkgs/by-name/ai/airwin2rack/package.nix +++ b/pkgs/by-name/ai/airwin2rack/package.nix @@ -192,7 +192,7 @@ stdenv.mkDerivation { license = with lib.licenses; [ mit ] - ++ lib.optional enableVCVRack [ + ++ lib.optionals enableVCVRack [ gpl3Plus cc-by-nc-40 unfreeRedistributable diff --git a/pkgs/by-name/ap/apache-orc/package.nix b/pkgs/by-name/ap/apache-orc/package.nix index 215823a668ac..0f25815a2e33 100644 --- a/pkgs/by-name/ap/apache-orc/package.nix +++ b/pkgs/by-name/ap/apache-orc/package.nix @@ -64,7 +64,7 @@ stdenv.mkDerivation (finalAttrs: { (lib.cmakeBool "STOP_BUILD_ON_WARNING" false) (lib.cmakeBool "INSTALL_VENDORED_LIBS" false) ] - ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) [ + ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ # Fix (RiscV) cross-compilation # See https://github.com/apache/orc/issues/2334 (lib.cmakeFeature "HAS_PRE_1970_EXITCODE" "0") diff --git a/pkgs/by-name/as/astyle/package.nix b/pkgs/by-name/as/astyle/package.nix index 79078dd89637..dbd26c3d3c81 100644 --- a/pkgs/by-name/as/astyle/package.nix +++ b/pkgs/by-name/as/astyle/package.nix @@ -21,7 +21,7 @@ stdenv.mkDerivation (finalAttrs: { # upstream repo includes a build/ directory cmakeBuildDir = "_build"; - cmakeFlags = lib.optional asLibrary [ + cmakeFlags = lib.optionals asLibrary [ "-DBUILD_SHARED_LIBS=ON" ]; diff --git a/pkgs/by-name/bo/bowtie2/package.nix b/pkgs/by-name/bo/bowtie2/package.nix index 5b1f4f3fc2e2..ce0f6e07f98d 100644 --- a/pkgs/by-name/bo/bowtie2/package.nix +++ b/pkgs/by-name/bo/bowtie2/package.nix @@ -42,7 +42,7 @@ stdenv.mkDerivation (finalAttrs: { perl ]; - cmakeFlags = lib.optional (!stdenv.hostPlatform.isx86) [ + cmakeFlags = lib.optionals (!stdenv.hostPlatform.isx86) [ "-DCMAKE_CXX_FLAGS=-I${finalAttrs.src}/third_party" ]; diff --git a/pkgs/by-name/cd/cdparanoia-iii/package.nix b/pkgs/by-name/cd/cdparanoia-iii/package.nix index de38e46763c3..88b11e8aae98 100644 --- a/pkgs/by-name/cd/cdparanoia-iii/package.nix +++ b/pkgs/by-name/cd/cdparanoia-iii/package.nix @@ -65,7 +65,7 @@ stdenv.mkDerivation (finalAttrs: { ./freebsd.patch ] ++ lib.optional stdenv.hostPlatform.isMusl ./utils.patch - ++ lib.optional (!stdenv.hostPlatform.isDarwin) [ + ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ (fetchpatch { url = "https://raw.githubusercontent.com/freebsd/freebsd-ports/42da4cdf2d9161fea8f7cdfc19aefda7707fadf4/audio/cdparanoia/files/patch-interface_low__interface.h"; hash = "sha256-bXrcRFCbU7/7/N+J8VGKGSxIB1m8XwoAlc/KTnt9wN0="; diff --git a/pkgs/by-name/co/cogl/package.nix b/pkgs/by-name/co/cogl/package.nix index 07574e7282ac..95421d038559 100644 --- a/pkgs/by-name/co/cogl/package.nix +++ b/pkgs/by-name/co/cogl/package.nix @@ -116,11 +116,11 @@ stdenv.mkDerivation rec { ); NIX_CFLAGS_COMPILE = toString ( [ ] - ++ lib.optional stdenv.cc.isGNU [ + ++ lib.optionals stdenv.cc.isGNU [ # Fix build with gcc15 "-std=gnu17" ] - ++ lib.optional stdenv.cc.isClang [ + ++ lib.optionals stdenv.cc.isClang [ "-Wno-error=implicit-function-declaration" ] ); diff --git a/pkgs/by-name/cr/crispy-doom/package.nix b/pkgs/by-name/cr/crispy-doom/package.nix index c16b06157b8e..31a013f1ec56 100644 --- a/pkgs/by-name/cr/crispy-doom/package.nix +++ b/pkgs/by-name/cr/crispy-doom/package.nix @@ -30,7 +30,7 @@ stdenv.mkDerivation (finalAttrs: { for script in $(grep -lr '^#!/usr/bin/env python3$'); do patchShebangs $script; done ''; - configureFlags = lib.optional enableTruecolor [ "--enable-truecolor" ]; + configureFlags = lib.optionals enableTruecolor [ "--enable-truecolor" ]; nativeBuildInputs = [ autoreconfHook diff --git a/pkgs/by-name/dh/dhtbsign/package.nix b/pkgs/by-name/dh/dhtbsign/package.nix index 484937ba095c..d08aac80dae5 100644 --- a/pkgs/by-name/dh/dhtbsign/package.nix +++ b/pkgs/by-name/dh/dhtbsign/package.nix @@ -17,7 +17,7 @@ stdenv.mkDerivation { strictDeps = true; env.NIX_CFLAGS_COMPILE = toString ( - lib.optional stdenv.cc.isGNU [ + lib.optionals stdenv.cc.isGNU [ # Required with newer GCC "-Wno-error=stringop-overflow" ] diff --git a/pkgs/by-name/fi/fireplace/package.nix b/pkgs/by-name/fi/fireplace/package.nix index 1a41a09d851a..0d5fff32bc74 100644 --- a/pkgs/by-name/fi/fireplace/package.nix +++ b/pkgs/by-name/fi/fireplace/package.nix @@ -25,7 +25,7 @@ stdenv.mkDerivation { hash = "sha256-2NUE/zaFoGwkZxgvVCYXxToiL23aVUFwFNlQzEq9GEc="; }; - makeFlags = lib.optional stdenv.hostPlatform.isDarwin [ "CC=cc" ]; + makeFlags = lib.optionals stdenv.hostPlatform.isDarwin [ "CC=cc" ]; meta = { description = "Cozy fireplace in your terminal"; diff --git a/pkgs/by-name/fr/frankenphp/package.nix b/pkgs/by-name/fr/frankenphp/package.nix index a8822810d1fb..06aea4fcac31 100644 --- a/pkgs/by-name/fr/frankenphp/package.nix +++ b/pkgs/by-name/fr/frankenphp/package.nix @@ -80,7 +80,7 @@ buildGoModule (finalAttrs: { "-X 'github.com/caddyserver/caddy/v2.CustomVersion=FrankenPHP ${finalAttrs.version} PHP ${phpUnwrapped.version} Caddy'" # pie mode is only available with pkgsMusl, it also automatically add -buildmode=pie to $GOFLAGS ] - ++ (lib.optional pieBuild [ "-static-pie" ]); + ++ (lib.optionals pieBuild [ "-static-pie" ]); preBuild = '' export CGO_CFLAGS="$(${phpConfig} --includes)" diff --git a/pkgs/by-name/kt/ktls-utils/package.nix b/pkgs/by-name/kt/ktls-utils/package.nix index f11dfffa4f47..5c8a02a09236 100644 --- a/pkgs/by-name/kt/ktls-utils/package.nix +++ b/pkgs/by-name/kt/ktls-utils/package.nix @@ -42,9 +42,9 @@ stdenv.mkDerivation (finalAttrs: { "man" ]; - configureFlags = lib.optional withSystemd [ "--with-systemd" ]; + configureFlags = lib.optionals withSystemd [ "--with-systemd" ]; - makeFlags = lib.optional withSystemd [ "unitdir=$(out)/lib/systemd/system" ]; + makeFlags = lib.optionals withSystemd [ "unitdir=$(out)/lib/systemd/system" ]; doCheck = true; diff --git a/pkgs/by-name/ma/matrix-tuwunel/package.nix b/pkgs/by-name/ma/matrix-tuwunel/package.nix index a89b5e00f446..4786e0a62312 100644 --- a/pkgs/by-name/ma/matrix-tuwunel/package.nix +++ b/pkgs/by-name/ma/matrix-tuwunel/package.nix @@ -140,7 +140,7 @@ rustPlatform.buildRustPackage (finalAttrs: { "url_preview" "zstd_compression" ] - ++ lib.optional enableJemalloc [ + ++ lib.optionals enableJemalloc [ "jemalloc" "jemalloc_conf" ] diff --git a/pkgs/by-name/mk/mkbootimg-osm0sis/package.nix b/pkgs/by-name/mk/mkbootimg-osm0sis/package.nix index f6ed4bc7824c..453bc35870d3 100644 --- a/pkgs/by-name/mk/mkbootimg-osm0sis/package.nix +++ b/pkgs/by-name/mk/mkbootimg-osm0sis/package.nix @@ -17,7 +17,7 @@ stdenv.mkDerivation { strictDeps = true; env.NIX_CFLAGS_COMPILE = toString ( - lib.optional stdenv.cc.isGNU [ + lib.optionals stdenv.cc.isGNU [ # Required with newer GCC "-Wstringop-overflow=0" ] diff --git a/pkgs/by-name/mo/monero-cli/package.nix b/pkgs/by-name/mo/monero-cli/package.nix index 1373f0892267..d5507ca1c550 100644 --- a/pkgs/by-name/mo/monero-cli/package.nix +++ b/pkgs/by-name/mo/monero-cli/package.nix @@ -92,7 +92,7 @@ stdenv.mkDerivation rec { "-Wno-dev" ] ++ lib.optional stdenv.hostPlatform.isDarwin "-DBoost_USE_MULTITHREADED=OFF" - ++ lib.optional trezorSupport [ + ++ lib.optionals trezorSupport [ "-DUSE_DEVICE_TREZOR=ON" ]; diff --git a/pkgs/by-name/mo/monero-gui/package.nix b/pkgs/by-name/mo/monero-gui/package.nix index d23e85658c1c..e73627158e07 100644 --- a/pkgs/by-name/mo/monero-gui/package.nix +++ b/pkgs/by-name/mo/monero-gui/package.nix @@ -104,7 +104,7 @@ stdenv.mkDerivation rec { cmakeFlags = [ "-DARCH=default" ] - ++ lib.optional trezorSupport [ + ++ lib.optionals trezorSupport [ # fix build on recent gcc versions "-DCMAKE_CXX_FLAGS=-fpermissive" ]; diff --git a/pkgs/by-name/px/pxa-mkbootimg/package.nix b/pkgs/by-name/px/pxa-mkbootimg/package.nix index 5d0f032a7274..67b99cc13811 100644 --- a/pkgs/by-name/px/pxa-mkbootimg/package.nix +++ b/pkgs/by-name/px/pxa-mkbootimg/package.nix @@ -17,7 +17,7 @@ stdenv.mkDerivation (finalAttrs: { strictDeps = true; env.NIX_CFLAGS_COMPILE = toString ( - lib.optional stdenv.cc.isGNU [ + lib.optionals stdenv.cc.isGNU [ # Required with newer GCC "-Wno-error=stringop-overflow" ] diff --git a/pkgs/by-name/re/refind/package.nix b/pkgs/by-name/re/refind/package.nix index 023bf239d5c5..893b87c66cbf 100644 --- a/pkgs/by-name/re/refind/package.nix +++ b/pkgs/by-name/re/refind/package.nix @@ -88,7 +88,7 @@ stdenv.mkDerivation (finalAttrs: { "HOSTARCH=${hostarch}" "ARCH=${hostarch}" ] - ++ lib.optional stdenv.hostPlatform.isAarch64 [ + ++ lib.optionals stdenv.hostPlatform.isAarch64 [ # aarch64 is special for GNU-EFI, see BUILDING.txt "GNUEFI_ARM64_TARGET_SUPPORT=y" ]; diff --git a/pkgs/by-name/ry/ryubing/package.nix b/pkgs/by-name/ry/ryubing/package.nix index 4551d4c6ffcc..76ce3417e3c2 100644 --- a/pkgs/by-name/ry/ryubing/package.nix +++ b/pkgs/by-name/ry/ryubing/package.nix @@ -100,7 +100,7 @@ buildDotnetModule rec { "Ryujinx" ]; - makeWrapperArgs = lib.optional stdenv.hostPlatform.isLinux [ + makeWrapperArgs = lib.optionals stdenv.hostPlatform.isLinux [ # Without this Ryujinx fails to start on wayland. See https://github.com/Ryujinx/Ryujinx/issues/2714 "--set SDL_VIDEODRIVER x11" ]; diff --git a/pkgs/by-name/s7/s7/package.nix b/pkgs/by-name/s7/s7/package.nix index aa059cd4f5f1..0e32e9da96bb 100644 --- a/pkgs/by-name/s7/s7/package.nix +++ b/pkgs/by-name/s7/s7/package.nix @@ -74,7 +74,7 @@ stdenv.mkDerivation (finalAttrs: { "-lpthread" "--export-all-symbols" ] - ++ lib.optional (!static && stdenv.hostPlatform.isMinGW) [ "--out-implib,libs7dll.a" ] + ++ lib.optionals (!static && stdenv.hostPlatform.isMinGW) [ "--out-implib,libs7dll.a" ] ++ lib.optional withArb "-lflint" ++ lib.optionals withGMP [ "-lgmp" diff --git a/pkgs/by-name/sf/sfml/package.nix b/pkgs/by-name/sf/sfml/package.nix index 9c5991f7801e..be2c10dd5d73 100644 --- a/pkgs/by-name/sf/sfml/package.nix +++ b/pkgs/by-name/sf/sfml/package.nix @@ -35,7 +35,7 @@ stdenv.mkDerivation (finalAttrs: { }; # Only unvendor miniaudio on non-Darwin as Darwin cannot build the miniaudio package. - patches = lib.optional (!stdenv.hostPlatform.isDarwin) [ + patches = lib.optionals (!stdenv.hostPlatform.isDarwin) [ # Not upstreamble in the near future, see https://github.com/SFML/SFML/pull/3555 ./unvendor-miniaudio.patch ]; diff --git a/pkgs/by-name/si/simple-completion-language-server/package.nix b/pkgs/by-name/si/simple-completion-language-server/package.nix index 22602c56ae39..88b48bde42d5 100644 --- a/pkgs/by-name/si/simple-completion-language-server/package.nix +++ b/pkgs/by-name/si/simple-completion-language-server/package.nix @@ -18,7 +18,7 @@ rustPlatform.buildRustPackage { cargoHash = "sha256-RgRmbQVZK/4U37CO8AjNQOqR/SXvL1TQU03LX7LnqPY="; - buildFeatures = lib.optional withCitation [ "citation" ]; + buildFeatures = lib.optionals withCitation [ "citation" ]; meta = { description = "Language server to enable word completion and snippets for Helix editor"; diff --git a/pkgs/by-name/sp/spla/package.nix b/pkgs/by-name/sp/spla/package.nix index cb9948f1b87e..0a42bb9fb10c 100644 --- a/pkgs/by-name/sp/spla/package.nix +++ b/pkgs/by-name/sp/spla/package.nix @@ -79,7 +79,7 @@ stdenv.mkDerivation (finalAttrs: { "-DCMAKE_INSTALL_INCLUDEDIR=include" ] ++ lib.optional (gpuBackend == "cuda") "-DSPLA_GPU_BACKEND=CUDA" - ++ lib.optional (gpuBackend == "rocm") [ "-DSPLA_GPU_BACKEND=ROCM" ]; + ++ lib.optionals (gpuBackend == "rocm") [ "-DSPLA_GPU_BACKEND=ROCM" ]; preFixup = '' substituteInPlace $out/lib/cmake/SPLA/SPLASharedTargets-release.cmake \ diff --git a/pkgs/by-name/te/textadept/package.nix b/pkgs/by-name/te/textadept/package.nix index ef71798e3ab8..3fef036ff200 100644 --- a/pkgs/by-name/te/textadept/package.nix +++ b/pkgs/by-name/te/textadept/package.nix @@ -25,8 +25,8 @@ stdenv.mkDerivation (finalAttrs: { buildInputs = lib.optionals withQt [ libsForQt5.qtbase ] ++ lib.optionals withCurses ncurses; cmakeFlags = - lib.optional withQt [ "-DQT=ON" ] - ++ lib.optional withCurses [ + lib.optionals withQt [ "-DQT=ON" ] + ++ lib.optionals withCurses [ "-DCURSES=ON" "-DQT=OFF" ]; diff --git a/pkgs/by-name/vt/vtk-dicom/package.nix b/pkgs/by-name/vt/vtk-dicom/package.nix index f692db9a227d..dd49a48acc8b 100644 --- a/pkgs/by-name/vt/vtk-dicom/package.nix +++ b/pkgs/by-name/vt/vtk-dicom/package.nix @@ -35,7 +35,7 @@ stdenv.mkDerivation (finalAttrs: { (lib.cmakeFeature "CMAKE_INSTALL_LIBDIR" "lib") (lib.cmakeFeature "CMAKE_INSTALL_INCLUDEDIR" "include") ] - ++ lib.optional finalAttrs.finalPackage.doCheck [ + ++ lib.optionals finalAttrs.finalPackage.doCheck [ # vtkBool does not accept TRUE, we have to use STRING "ON" (lib.cmakeFeature "BUILD_TESTING" "ON") ]; diff --git a/pkgs/by-name/xp/xpra/package.nix b/pkgs/by-name/xp/xpra/package.nix index bcd5776b7d21..5d41edae985c 100644 --- a/pkgs/by-name/xp/xpra/package.nix +++ b/pkgs/by-name/xp/xpra/package.nix @@ -237,7 +237,7 @@ effectiveBuildPythonApplication rec { "--with-pam" "--with-vsock" ] - ++ lib.optional withNvenc [ + ++ lib.optionals withNvenc [ "--with-nvenc" "--with-nvjpeg_encoder" ]; diff --git a/pkgs/development/compilers/llvm/common/lldb/default.nix b/pkgs/development/compilers/llvm/common/lldb/default.nix index 75bdebc71906..cc6a64caf235 100644 --- a/pkgs/development/compilers/llvm/common/lldb/default.nix +++ b/pkgs/development/compilers/llvm/common/lldb/default.nix @@ -73,7 +73,7 @@ stdenv.mkDerivation ( patches = [ ./gnu-install-dirs.patch ] - ++ lib.optional (lib.versions.major release_version == "18") [ + ++ lib.optionals (lib.versions.major release_version == "18") [ # Fix build with gcc15 # https://github.com/llvm/llvm-project/commit/bb59f04e7e75dcbe39f1bf952304a157f0035314 ./lldb-add-include-cstdint.patch diff --git a/pkgs/development/compilers/llvm/common/mlir/default.nix b/pkgs/development/compilers/llvm/common/mlir/default.nix index 40bfddc38ee2..a2ebe41497cf 100644 --- a/pkgs/development/compilers/llvm/common/mlir/default.nix +++ b/pkgs/development/compilers/llvm/common/mlir/default.nix @@ -48,7 +48,7 @@ stdenv.mkDerivation (finalAttrs: { # Upstream issue: https://github.com/llvm/llvm-project/issues/150986 ./mlir-tablegen-imported-target.patch ] - ++ lib.optional (lib.versionOlder release_version "20") [ + ++ lib.optionals (lib.versionOlder release_version "20") [ # Fix build with gcc15 # https://github.com/llvm/llvm-project/commit/41eb186fbb024898bacc2577fa3b88db0510ba1f # https://github.com/llvm/llvm-project/commit/101109fc5460d5bb9bb597c6ec77f998093a6687 diff --git a/pkgs/development/interpreters/php/generic.nix b/pkgs/development/interpreters/php/generic.nix index 7e37b0dab5bd..98d73b639e79 100644 --- a/pkgs/development/interpreters/php/generic.nix +++ b/pkgs/development/interpreters/php/generic.nix @@ -292,7 +292,7 @@ let ++ lib.optional valgrindSupport "--with-valgrind=${valgrind.dev}" ++ lib.optional ztsSupport "--enable-zts" ++ lib.optional staticSupport "--enable-static" - ++ lib.optional (!zendSignalsSupport) [ "--disable-zend-signals" ] + ++ lib.optionals (!zendSignalsSupport) [ "--disable-zend-signals" ] ++ lib.optional zendMaxExecutionTimersSupport "--enable-zend-max-execution-timers" # Sendmail diff --git a/pkgs/development/libraries/libxmlxx/v3.nix b/pkgs/development/libraries/libxmlxx/v3.nix index 9794a16da5b0..aac2d74fc326 100644 --- a/pkgs/development/libraries/libxmlxx/v3.nix +++ b/pkgs/development/libraries/libxmlxx/v3.nix @@ -56,7 +56,7 @@ stdenv.mkDerivation rec { docbook5 docbook-xsl-ns ] - ++ lib.lists.optional withPDF [ + ++ lib.lists.optionals withPDF [ fop dblatex ]; diff --git a/pkgs/development/libraries/science/astronomy/indilib/default.nix b/pkgs/development/libraries/science/astronomy/indilib/default.nix index 3a98610d894c..40584308c4c4 100644 --- a/pkgs/development/libraries/science/astronomy/indilib/default.nix +++ b/pkgs/development/libraries/science/astronomy/indilib/default.nix @@ -66,7 +66,7 @@ stdenv.mkDerivation (finalAttrs: { "-DCMAKE_INSTALL_LIBDIR=lib" "-DUDEVRULES_INSTALL_DIR=lib/udev/rules.d" ] - ++ lib.optional finalAttrs.finalPackage.doCheck [ + ++ lib.optionals finalAttrs.finalPackage.doCheck [ "-DINDI_BUILD_UNITTESTS=ON" "-DINDI_BUILD_INTEGTESTS=ON" ]; diff --git a/pkgs/development/libraries/science/astronomy/indilib/indi-3rdparty.nix b/pkgs/development/libraries/science/astronomy/indilib/indi-3rdparty.nix index a6ecb929538a..1ec080945db4 100644 --- a/pkgs/development/libraries/science/astronomy/indilib/indi-3rdparty.nix +++ b/pkgs/development/libraries/science/astronomy/indilib/indi-3rdparty.nix @@ -77,7 +77,7 @@ let "-DRULES_INSTALL_DIR=lib/udev/rules.d" "-DINDI_DATA_DIR=share/indi/" ] - ++ lib.optional doCheck [ + ++ lib.optionals doCheck [ "-DINDI_BUILD_UNITTESTS=ON" "-DINDI_BUILD_INTEGTESTS=ON" ] diff --git a/pkgs/development/python-modules/deal/default.nix b/pkgs/development/python-modules/deal/default.nix index 6b09fba641e8..b9addc5c7d55 100644 --- a/pkgs/development/python-modules/deal/default.nix +++ b/pkgs/development/python-modules/deal/default.nix @@ -72,7 +72,7 @@ buildPythonPackage rec { # assert basically correct but fails in string match due to '' removed "test_unknown_command" ] - ++ lib.optional (pythonAtLeast "3.13") [ + ++ lib.optionals (pythonAtLeast "3.13") [ # assert basically correct but string match fails in due to # ('pathlib._local', 'Path.write_text') != ('pathlib', 'Path.write_text') "test_infer" diff --git a/pkgs/development/python-modules/ffmpeg-progress-yield/default.nix b/pkgs/development/python-modules/ffmpeg-progress-yield/default.nix index e62703501685..99578f5919dc 100644 --- a/pkgs/development/python-modules/ffmpeg-progress-yield/default.nix +++ b/pkgs/development/python-modules/ffmpeg-progress-yield/default.nix @@ -37,7 +37,7 @@ buildPythonPackage rec { procps ]; - disabledTests = lib.optional stdenv.hostPlatform.isDarwin [ + disabledTests = lib.optionals stdenv.hostPlatform.isDarwin [ # cannot access /usr/bin/pgrep from the sandbox "test_context_manager" "test_context_manager_with_exception" diff --git a/pkgs/development/python-modules/inkex/default.nix b/pkgs/development/python-modules/inkex/default.nix index 6ac22fb3f76c..8b1a9e5a2f05 100644 --- a/pkgs/development/python-modules/inkex/default.nix +++ b/pkgs/development/python-modules/inkex/default.nix @@ -78,12 +78,12 @@ buildPythonPackage { "test_extract_multiple" "test_lookup_and" ] - ++ lib.optional stdenv.hostPlatform.isDarwin [ + ++ lib.optionals stdenv.hostPlatform.isDarwin [ "test_image_extract" "test_path_number_nodes" "test_plotter" # Hangs ] - ++ lib.optional stdenv.hostPlatform.isMusl [ + ++ lib.optionals stdenv.hostPlatform.isMusl [ "test_ellipse_arc" ]; diff --git a/pkgs/development/python-modules/pandas/default.nix b/pkgs/development/python-modules/pandas/default.nix index ddc10d53eb8f..1b3520df7820 100644 --- a/pkgs/development/python-modules/pandas/default.nix +++ b/pkgs/development/python-modules/pandas/default.nix @@ -224,7 +224,7 @@ let # These tests are unreliable on aarch64-darwin. See https://github.com/pandas-dev/pandas/issues/38921. "test_rolling" ] - ++ lib.optional stdenv.hostPlatform.is32bit [ + ++ lib.optionals stdenv.hostPlatform.is32bit [ # https://github.com/pandas-dev/pandas/issues/37398 "test_rolling_var_numerical_issues" ]; diff --git a/pkgs/development/python-modules/pymupdf/default.nix b/pkgs/development/python-modules/pymupdf/default.nix index f5f81a8ef752..4fb535176598 100644 --- a/pkgs/development/python-modules/pymupdf/default.nix +++ b/pkgs/development/python-modules/pymupdf/default.nix @@ -152,7 +152,7 @@ buildPythonPackage (finalAttrs: { # Do not lint code "tests/test_typing.py" ] - ++ lib.optional stdenv.hostPlatform.isDarwin [ + ++ lib.optionals stdenv.hostPlatform.isDarwin [ # Trace/BPT trap: 5 when getting widget options "tests/test_4505.py" "tests/test_widgets.py" diff --git a/pkgs/development/python-modules/uqbar/default.nix b/pkgs/development/python-modules/uqbar/default.nix index f0df9aaed8f2..3e2be97dc0c7 100644 --- a/pkgs/development/python-modules/uqbar/default.nix +++ b/pkgs/development/python-modules/uqbar/default.nix @@ -63,11 +63,11 @@ buildPythonPackage (finalAttrs: { # https://github.com/supriya-project/uqbar/issues/107 "SummarizingRootDocumenter" ] - ++ lib.optional (pythonAtLeast "3.11") [ + ++ lib.optionals (pythonAtLeast "3.11") [ # assert not '\x1b[91m/build/uqbar-0.7.0/tests/fake_package/enums.py:docstring "test_sphinx_style" ] - ++ lib.optional (pythonAtLeast "3.12") [ + ++ lib.optionals (pythonAtLeast "3.12") [ # https://github.com/supriya-project/uqbar/issues/93 "objects.get_vars" ] diff --git a/pkgs/development/tools/godot/common.nix b/pkgs/development/tools/godot/common.nix index a0cba15c4584..30416a828ad9 100644 --- a/pkgs/development/tools/godot/common.nix +++ b/pkgs/development/tools/godot/common.nix @@ -325,7 +325,7 @@ let # stripping dlls results in: # Failed to load System.Private.CoreLib.dll (error code 0x8007000B) - stripExclude = lib.optional withMono [ "*.dll" ]; + stripExclude = lib.optionals withMono [ "*.dll" ]; runtimeDependencies = prev.runtimeDependencies or [ ] diff --git a/pkgs/os-specific/cygwin/newlib-cygwin/default.nix b/pkgs/os-specific/cygwin/newlib-cygwin/default.nix index c647a1999f19..511cef4b8aa4 100644 --- a/pkgs/os-specific/cygwin/newlib-cygwin/default.nix +++ b/pkgs/os-specific/cygwin/newlib-cygwin/default.nix @@ -41,7 +41,7 @@ # declared. Backport of https://cygwin.com/cgit/newlib-cygwin/commit/?id=73600d68227e125af24b7de7c3fccbd4eb66ee03 ./fix-winsize.patch ] - ++ lib.optional (!headersOnly) [ + ++ lib.optionals (!headersOnly) [ # https://cygwin.com/pipermail/cygwin-developers/2020-September/011970.html # This is required for boost coroutines to work. After we get to the point # where nix runs on cygwin, we can attempt to upstream this again. diff --git a/pkgs/servers/sql/postgresql/ext/vectorchord/package.nix b/pkgs/servers/sql/postgresql/ext/vectorchord/package.nix index 4df95e952937..31c8ea50ed76 100644 --- a/pkgs/servers/sql/postgresql/ext/vectorchord/package.nix +++ b/pkgs/servers/sql/postgresql/ext/vectorchord/package.nix @@ -26,7 +26,7 @@ buildPgrxExtension (finalAttrs: { cargoHash = "sha256-IXOCzKJArNOcb/2TcJbLz1XdCquUpyF/cLHYU5vmlko="; patches = - lib.optional (lib.versionOlder rustc.llvm.version "22.0.0" && stdenv.hostPlatform.isx86_64) + lib.optionals (lib.versionOlder rustc.llvm.version "22.0.0" && stdenv.hostPlatform.isx86_64) [ # Due to a bug in LLVM 21, build fails on x86_64 with: # `rustc-LLVM ERROR: Cannot select: intrinsic %llvm.x86.avx512.vpdpbusd.512`.