about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/applications/audio/chuck/default.nix2
-rw-r--r--pkgs/applications/audio/grandorgue/default.nix2
-rw-r--r--pkgs/applications/audio/snapcast/default.nix2
-rw-r--r--pkgs/applications/blockchains/openethereum/default.nix2
-rw-r--r--pkgs/applications/blockchains/polkadot/default.nix2
-rw-r--r--pkgs/applications/editors/rstudio/default.nix4
-rw-r--r--pkgs/applications/editors/vim/configurable.nix2
-rw-r--r--pkgs/applications/editors/vscode/generic.nix2
-rw-r--r--pkgs/applications/emulators/retroarch/cores.nix2
-rw-r--r--pkgs/applications/file-managers/nnn/default.nix4
-rw-r--r--pkgs/applications/gis/gmt/default.nix2
-rw-r--r--pkgs/applications/graphics/kcc/default.nix2
-rw-r--r--pkgs/applications/graphics/xournalpp/default.nix2
-rw-r--r--pkgs/applications/misc/audio/sox/default.nix2
-rw-r--r--pkgs/applications/misc/blender/default.nix2
-rw-r--r--pkgs/applications/networking/browsers/links2/default.nix2
-rw-r--r--pkgs/applications/networking/cluster/hadoop/default.nix2
-rw-r--r--pkgs/applications/networking/firehol/default.nix2
-rw-r--r--pkgs/applications/networking/instant-messengers/pantalaimon/default.nix2
-rw-r--r--pkgs/applications/networking/irc/convos/default.nix2
-rw-r--r--pkgs/applications/networking/mailreaders/alot/default.nix2
-rw-r--r--pkgs/applications/networking/mailreaders/meli/default.nix2
-rw-r--r--pkgs/applications/networking/mpop/default.nix4
-rw-r--r--pkgs/applications/networking/sync/lsyncd/default.nix2
-rw-r--r--pkgs/applications/networking/znc/default.nix4
-rw-r--r--pkgs/applications/radio/rtl-sdr/default.nix2
-rw-r--r--pkgs/applications/science/biology/megahit/default.nix2
-rw-r--r--pkgs/applications/science/biology/neuron/default.nix2
-rw-r--r--pkgs/applications/science/biology/samtools/default.nix2
-rw-r--r--pkgs/applications/science/logic/fast-downward/default.nix2
-rw-r--r--pkgs/applications/science/math/ratpoints/default.nix2
-rw-r--r--pkgs/applications/terminal-emulators/x3270/default.nix2
-rw-r--r--pkgs/applications/version-management/datalad/default.nix4
-rw-r--r--pkgs/applications/version-management/dvc/default.nix8
-rw-r--r--pkgs/applications/version-management/git-and-tools/tig/default.nix2
-rw-r--r--pkgs/applications/version-management/gitlab/default.nix2
-rw-r--r--pkgs/applications/version-management/subversion/default.nix2
-rw-r--r--pkgs/applications/video/kodi/unwrapped.nix6
-rw-r--r--pkgs/build-support/release/default.nix2
-rw-r--r--pkgs/build-support/release/maven-build.nix7
-rw-r--r--pkgs/build-support/skaware/build-skaware-package.nix2
-rw-r--r--pkgs/data/fonts/iosevka/default.nix2
-rw-r--r--pkgs/desktops/gnome-2/platform/GConf/default.nix2
-rw-r--r--pkgs/development/compilers/dmd/default.nix2
-rw-r--r--pkgs/development/compilers/edk2/default.nix2
-rw-r--r--pkgs/development/compilers/gforth/boot-forth.nix2
-rw-r--r--pkgs/development/compilers/ghdl/default.nix2
-rw-r--r--pkgs/development/compilers/idris2/default.nix2
-rw-r--r--pkgs/development/compilers/idris2/tests.nix2
-rw-r--r--pkgs/development/compilers/llvm/10/libcxx/default.nix2
-rw-r--r--pkgs/development/compilers/llvm/11/libcxx/default.nix2
-rw-r--r--pkgs/development/compilers/llvm/12/libcxx/default.nix2
-rw-r--r--pkgs/development/compilers/llvm/8/libcxx/default.nix2
-rw-r--r--pkgs/development/compilers/llvm/9/libcxx/default.nix2
-rw-r--r--pkgs/development/compilers/manticore/default.nix2
-rw-r--r--pkgs/development/compilers/orc/default.nix2
-rw-r--r--pkgs/development/compilers/p4c/default.nix4
-rw-r--r--pkgs/development/compilers/sbcl/2.x.nix2
-rw-r--r--pkgs/development/coq-modules/coq-record-update/default.nix2
-rw-r--r--pkgs/development/interpreters/acl2/default.nix2
-rw-r--r--pkgs/development/interpreters/kerf/default.nix6
-rw-r--r--pkgs/development/interpreters/php/generic.nix4
-rw-r--r--pkgs/development/interpreters/python-cosmopolitan/default.nix2
-rw-r--r--pkgs/development/interpreters/python/cpython/2.7/default.nix2
-rw-r--r--pkgs/development/interpreters/python/rustpython/default.nix2
-rw-r--r--pkgs/development/interpreters/racket/default.nix4
-rw-r--r--pkgs/development/interpreters/racket/racket_7_9.nix4
-rw-r--r--pkgs/development/interpreters/spidermonkey/common.nix2
-rw-r--r--pkgs/development/libraries/ada/gnatcoll/db.nix2
-rw-r--r--pkgs/development/libraries/apr/default.nix2
-rw-r--r--pkgs/development/libraries/cosmopolitan/default.nix2
-rw-r--r--pkgs/development/libraries/cxxopts/default.nix4
-rw-r--r--pkgs/development/libraries/cyrus-sasl/default.nix2
-rw-r--r--pkgs/development/libraries/drogon/default.nix2
-rw-r--r--pkgs/development/libraries/galario/default.nix4
-rw-r--r--pkgs/development/libraries/gnutls/default.nix2
-rw-r--r--pkgs/development/libraries/gstreamer/base/default.nix2
-rw-r--r--pkgs/development/libraries/hunspell/default.nix2
-rw-r--r--pkgs/development/libraries/json-glib/default.nix2
-rw-r--r--pkgs/development/libraries/kerberos/krb5.nix2
-rw-r--r--pkgs/development/libraries/libav/default.nix4
-rw-r--r--pkgs/development/libraries/libdaemon/default.nix2
-rw-r--r--pkgs/development/libraries/libdeflate/default.nix2
-rw-r--r--pkgs/development/libraries/libeatmydata/default.nix2
-rw-r--r--pkgs/development/libraries/libff/default.nix2
-rw-r--r--pkgs/development/libraries/libmcrypt/default.nix2
-rw-r--r--pkgs/development/libraries/libpam-wrapper/default.nix2
-rw-r--r--pkgs/development/libraries/libvdpau/default.nix2
-rw-r--r--pkgs/development/libraries/libvncserver/default.nix2
-rw-r--r--pkgs/development/libraries/libxslt/default.nix2
-rw-r--r--pkgs/development/libraries/mimalloc/default.nix2
-rw-r--r--pkgs/development/libraries/nng/default.nix2
-rw-r--r--pkgs/development/libraries/openbsm/default.nix2
-rw-r--r--pkgs/development/libraries/opencv/3.x.nix2
-rw-r--r--pkgs/development/libraries/openmpi/default.nix2
-rw-r--r--pkgs/development/libraries/openvino/default.nix4
-rw-r--r--pkgs/development/libraries/pangomm/2.48.nix2
-rw-r--r--pkgs/development/libraries/poppler/default.nix2
-rw-r--r--pkgs/development/libraries/precice/default.nix2
-rw-r--r--pkgs/development/libraries/qt-5/modules/qtlocation.nix2
-rw-r--r--pkgs/development/libraries/redis-plus-plus/default.nix4
-rw-r--r--pkgs/development/libraries/rustc-demangle/default.nix2
-rw-r--r--pkgs/development/libraries/science/math/faiss/default.nix2
-rw-r--r--pkgs/development/libraries/science/networking/ns-3/default.nix4
-rw-r--r--pkgs/development/libraries/speechd/default.nix16
-rw-r--r--pkgs/development/libraries/vtk/generic.nix2
-rw-r--r--pkgs/development/mobile/androidenv/cmake.nix2
-rw-r--r--pkgs/development/mobile/androidenv/ndk-bundle/default.nix2
-rw-r--r--pkgs/development/mobile/androidenv/tools/25.nix2
-rw-r--r--pkgs/development/node-packages/overrides.nix2
-rw-r--r--pkgs/development/ocaml-modules/bz2/default.nix2
-rw-r--r--pkgs/development/ocaml-modules/cudf/default.nix2
-rw-r--r--pkgs/development/python-modules/aiodns/default.nix2
-rw-r--r--pkgs/development/python-modules/ansible-runner/default.nix2
-rw-r--r--pkgs/development/python-modules/aspy-refactor-imports/default.nix2
-rw-r--r--pkgs/development/python-modules/asyncio_mqtt/default.nix2
-rw-r--r--pkgs/development/python-modules/azure-core/default.nix2
-rw-r--r--pkgs/development/python-modules/betterproto/default.nix2
-rw-r--r--pkgs/development/python-modules/catboost/default.nix2
-rw-r--r--pkgs/development/python-modules/ciso8601/default.nix2
-rw-r--r--pkgs/development/python-modules/deprecation/default.nix2
-rw-r--r--pkgs/development/python-modules/dnspython/default.nix2
-rw-r--r--pkgs/development/python-modules/enlighten/default.nix2
-rw-r--r--pkgs/development/python-modules/fixtures/default.nix2
-rw-r--r--pkgs/development/python-modules/funcsigs/default.nix2
-rw-r--r--pkgs/development/python-modules/glymur/default.nix2
-rw-r--r--pkgs/development/python-modules/hupper/default.nix2
-rw-r--r--pkgs/development/python-modules/importlib-resources/default.nix2
-rw-r--r--pkgs/development/python-modules/jaraco_text/default.nix4
-rw-r--r--pkgs/development/python-modules/jaxlib/default.nix6
-rw-r--r--pkgs/development/python-modules/lightgbm/default.nix2
-rw-r--r--pkgs/development/python-modules/markdown-it-py/default.nix2
-rw-r--r--pkgs/development/python-modules/matplotlib/default.nix4
-rw-r--r--pkgs/development/python-modules/nipy/default.nix2
-rw-r--r--pkgs/development/python-modules/notebook/default.nix2
-rw-r--r--pkgs/development/python-modules/numba/default.nix2
-rw-r--r--pkgs/development/python-modules/paho-mqtt/default.nix2
-rw-r--r--pkgs/development/python-modules/peewee/default.nix4
-rw-r--r--pkgs/development/python-modules/pygit2/default.nix4
-rw-r--r--pkgs/development/python-modules/pyls-mypy/default.nix2
-rw-r--r--pkgs/development/python-modules/python-csxcad/default.nix2
-rw-r--r--pkgs/development/python-modules/python-miio/default.nix2
-rw-r--r--pkgs/development/python-modules/python-openems/default.nix2
-rw-r--r--pkgs/development/python-modules/python-telegram-bot/default.nix2
-rw-r--r--pkgs/development/python-modules/qutip/default.nix2
-rw-r--r--pkgs/development/python-modules/rdflib/default.nix2
-rw-r--r--pkgs/development/python-modules/rich/default.nix4
-rw-r--r--pkgs/development/python-modules/simple-di/default.nix2
-rw-r--r--pkgs/development/python-modules/spacy/default.nix2
-rw-r--r--pkgs/development/python-modules/sphinx/default.nix2
-rw-r--r--pkgs/development/python-modules/starlette/default.nix2
-rw-r--r--pkgs/development/python-modules/tensorflow/bin.nix2
-rw-r--r--pkgs/development/python-modules/tensorflow/default.nix2
-rw-r--r--pkgs/development/python-modules/thinc/default.nix4
-rw-r--r--pkgs/development/python-modules/tzdata/default.nix2
-rw-r--r--pkgs/development/python-modules/wandb/default.nix2
-rw-r--r--pkgs/development/python-modules/web3/default.nix2
-rw-r--r--pkgs/development/python-modules/yamllint/default.nix2
-rw-r--r--pkgs/development/tools/analysis/radare2/default.nix8
-rw-r--r--pkgs/development/tools/analysis/rr/zen_workaround.nix2
-rw-r--r--pkgs/development/tools/analysis/sparse/default.nix2
-rw-r--r--pkgs/development/tools/database/prisma-engines/default.nix8
-rw-r--r--pkgs/development/tools/godot/default.nix2
-rw-r--r--pkgs/development/tools/godot/export-templates.nix2
-rw-r--r--pkgs/development/tools/godot/headless.nix2
-rw-r--r--pkgs/development/tools/godot/server.nix2
-rw-r--r--pkgs/development/tools/misc/bashdb/default.nix2
-rw-r--r--pkgs/development/tools/misc/pahole/default.nix2
-rw-r--r--pkgs/development/tools/misc/pkg-config/default.nix4
-rw-r--r--pkgs/development/tools/ocaml/dune/2.nix2
-rw-r--r--pkgs/development/tools/ocaml/dune/3.nix2
-rw-r--r--pkgs/development/tools/parsing/ragel/default.nix2
-rw-r--r--pkgs/development/tools/poetry2nix/poetry2nix/overrides/default.nix10
-rw-r--r--pkgs/development/tools/summon/default.nix2
-rw-r--r--pkgs/games/anki/default.nix2
-rw-r--r--pkgs/games/blightmud/default.nix2
-rw-r--r--pkgs/games/darkplaces/default.nix2
-rw-r--r--pkgs/games/freeciv/default.nix4
-rw-r--r--pkgs/games/gimx/default.nix2
-rw-r--r--pkgs/games/xonotic/default.nix4
-rw-r--r--pkgs/misc/jackaudio/default.nix2
-rw-r--r--pkgs/os-specific/darwin/apple-source-releases/ICU/default.nix2
-rw-r--r--pkgs/os-specific/darwin/apple-source-releases/xnu/default.nix2
-rw-r--r--pkgs/os-specific/darwin/libtapi/default.nix4
-rw-r--r--pkgs/os-specific/linux/exfat/default.nix2
-rw-r--r--pkgs/os-specific/linux/gobi_loader/default.nix2
-rw-r--r--pkgs/os-specific/linux/kernel-headers/default.nix2
-rw-r--r--pkgs/os-specific/linux/nvidia-x11/generic.nix2
-rw-r--r--pkgs/os-specific/linux/rtl8812au/default.nix2
-rw-r--r--pkgs/servers/dante/default.nix2
-rw-r--r--pkgs/servers/dns/knot-dns/default.nix2
-rw-r--r--pkgs/servers/foundationdb/cmake.nix2
-rw-r--r--pkgs/servers/foundationdb/vsmake.nix4
-rw-r--r--pkgs/servers/geospatial/mapserver/default.nix2
-rw-r--r--pkgs/servers/matrix-conduit/default.nix2
-rw-r--r--pkgs/servers/misc/oven-media-engine/default.nix2
-rw-r--r--pkgs/servers/nosql/dragonflydb/default.nix2
-rw-r--r--pkgs/servers/nosql/redis/default.nix2
-rw-r--r--pkgs/servers/samba/4.x.nix2
-rw-r--r--pkgs/servers/sql/mariadb/default.nix12
-rw-r--r--pkgs/shells/bash/5.1.nix2
-rw-r--r--pkgs/shells/ion/default.nix2
-rw-r--r--pkgs/tools/X11/find-cursor/default.nix2
-rw-r--r--pkgs/tools/X11/xmousepasteblock/default.nix2
-rw-r--r--pkgs/tools/cd-dvd/dvdisaster/default.nix2
-rw-r--r--pkgs/tools/compression/bsdiff/default.nix2
-rw-r--r--pkgs/tools/graphics/mangohud/default.nix2
-rw-r--r--pkgs/tools/misc/hiksink/default.nix2
-rw-r--r--pkgs/tools/misc/jsonwatch/default.nix2
-rw-r--r--pkgs/tools/misc/less/default.nix2
-rw-r--r--pkgs/tools/misc/man-db/default.nix2
-rw-r--r--pkgs/tools/misc/otfcc/default.nix2
-rw-r--r--pkgs/tools/misc/pre-commit/default.nix4
-rw-r--r--pkgs/tools/misc/rust-motd/default.nix2
-rw-r--r--pkgs/tools/misc/sheldon/default.nix2
-rw-r--r--pkgs/tools/misc/ttwatch/default.nix2
-rw-r--r--pkgs/tools/networking/bore-cli/default.nix2
-rw-r--r--pkgs/tools/networking/bore/default.nix2
-rw-r--r--pkgs/tools/networking/eternal-terminal/default.nix2
-rw-r--r--pkgs/tools/networking/ipv6calc/default.nix6
-rw-r--r--pkgs/tools/networking/rathole/default.nix2
-rw-r--r--pkgs/tools/networking/termscp/default.nix2
-rw-r--r--pkgs/tools/networking/toxvpn/default.nix2
-rw-r--r--pkgs/tools/networking/unbound/default.nix2
-rw-r--r--pkgs/tools/networking/vde2/default.nix2
-rw-r--r--pkgs/tools/networking/wg-netmanager/default.nix2
-rw-r--r--pkgs/tools/package-management/nix/common.nix2
-rw-r--r--pkgs/tools/security/asc-key-to-qr-code-gif/default.nix2
-rw-r--r--pkgs/tools/security/chipsec/default.nix2
-rw-r--r--pkgs/tools/security/rhash/default.nix2
-rw-r--r--pkgs/tools/security/sudo/default.nix4
-rw-r--r--pkgs/tools/system/chase/default.nix3
-rw-r--r--pkgs/tools/system/fio/default.nix2
-rw-r--r--pkgs/tools/system/netdata/default.nix4
-rw-r--r--pkgs/tools/system/tre-command/default.nix2
-rw-r--r--pkgs/top-level/perl-packages.nix52
236 files changed, 334 insertions, 318 deletions
diff --git a/pkgs/applications/audio/chuck/default.nix b/pkgs/applications/audio/chuck/default.nix
index a6509256881b3..21d58eccb741a 100644
--- a/pkgs/applications/audio/chuck/default.nix
+++ b/pkgs/applications/audio/chuck/default.nix
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ libsndfile ]
     ++ lib.optional (!stdenv.isDarwin) alsa-lib
-    ++ lib.optional stdenv.isDarwin [ AppKit Carbon CoreAudio CoreMIDI CoreServices Kernel ];
+    ++ lib.optionals stdenv.isDarwin [ AppKit Carbon CoreAudio CoreMIDI CoreServices Kernel ];
 
   patches = [ ./darwin-limits.patch ];
 
diff --git a/pkgs/applications/audio/grandorgue/default.nix b/pkgs/applications/audio/grandorgue/default.nix
index 954a2265312e4..5940e353042cb 100644
--- a/pkgs/applications/audio/grandorgue/default.nix
+++ b/pkgs/applications/audio/grandorgue/default.nix
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
   buildInputs = [ fftwFloat alsa-lib zlib wavpack wxGTK31 udev ]
     ++ lib.optional jackaudioSupport libjack2;
 
-  cmakeFlags = lib.optional (!jackaudioSupport) [
+  cmakeFlags = lib.optionals (!jackaudioSupport) [
     "-DRTAUDIO_USE_JACK=OFF"
     "-DRTMIDI_USE_JACK=OFF"
   ] ++ lib.optional (!includeDemo) "-DINSTALL_DEMO=OFF";
diff --git a/pkgs/applications/audio/snapcast/default.nix b/pkgs/applications/audio/snapcast/default.nix
index bbaa3fe839b1a..612d18f13571a 100644
--- a/pkgs/applications/audio/snapcast/default.nix
+++ b/pkgs/applications/audio/snapcast/default.nix
@@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
     aixlog popl soxr
   ] ++ lib.optional pulseaudioSupport libpulseaudio
   ++ lib.optional stdenv.isLinux alsa-lib
-  ++ lib.optional stdenv.isDarwin [darwin.apple_sdk.frameworks.IOKit darwin.apple_sdk.frameworks.AudioToolbox];
+  ++ lib.optionals stdenv.isDarwin [darwin.apple_sdk.frameworks.IOKit darwin.apple_sdk.frameworks.AudioToolbox];
 
   TARGET=lib.optionalString stdenv.isDarwin "MACOS";
 
diff --git a/pkgs/applications/blockchains/openethereum/default.nix b/pkgs/applications/blockchains/openethereum/default.nix
index a1b9f8348b6a1..865cd3b8a7193 100644
--- a/pkgs/applications/blockchains/openethereum/default.nix
+++ b/pkgs/applications/blockchains/openethereum/default.nix
@@ -38,7 +38,7 @@ rustPlatform.buildRustPackage rec {
 
   # Exclude some tests that don't work in the sandbox
   # - Nat test requires network access
-  checkFlags = "--skip configuration::tests::should_resolve_external_nat_hosts";
+  checkFlags = [ "--skip" "configuration::tests::should_resolve_external_nat_hosts" ];
 
   meta = with lib; {
     broken = stdenv.isDarwin;
diff --git a/pkgs/applications/blockchains/polkadot/default.nix b/pkgs/applications/blockchains/polkadot/default.nix
index 92342bfda7856..22d2f05112ca2 100644
--- a/pkgs/applications/blockchains/polkadot/default.nix
+++ b/pkgs/applications/blockchains/polkadot/default.nix
@@ -34,7 +34,7 @@ rustPlatform.buildRustPackage rec {
 
   cargoSha256 = "sha256-mI8VvTlM9ynstDBC0ubQkzg3D2ZXuWqJGS/Y23D6dU0=";
 
-  buildInputs = lib.optional stdenv.isDarwin [ Security ];
+  buildInputs = lib.optionals stdenv.isDarwin [ Security ];
 
   nativeBuildInputs = [ clang ];
 
diff --git a/pkgs/applications/editors/rstudio/default.nix b/pkgs/applications/editors/rstudio/default.nix
index 50f69300aa04f..70e69503749b9 100644
--- a/pkgs/applications/editors/rstudio/default.nix
+++ b/pkgs/applications/editors/rstudio/default.nix
@@ -85,7 +85,7 @@ in
       makeWrapper
       pandoc
       nodejs
-    ] ++ lib.optional (!server) [
+    ] ++ lib.optionals (!server) [
       copyDesktopItems
     ];
 
@@ -118,7 +118,7 @@ in
       "-DQUARTO_ENABLED=FALSE"
       "-DPANDOC_VERSION=${pandoc.version}"
       "-DCMAKE_INSTALL_PREFIX=${placeholder "out"}/lib/rstudio"
-    ] ++ lib.optional (!server) [
+    ] ++ lib.optionals (!server) [
       "-DQT_QMAKE_EXECUTABLE=${qmake}/bin/qmake"
     ];
 
diff --git a/pkgs/applications/editors/vim/configurable.nix b/pkgs/applications/editors/vim/configurable.nix
index d5dd00b4aa603..11ddddaefc24c 100644
--- a/pkgs/applications/editors/vim/configurable.nix
+++ b/pkgs/applications/editors/vim/configurable.nix
@@ -109,7 +109,7 @@ in stdenv.mkDerivation rec {
   ++ lib.optionals luaSupport [
     "--with-lua-prefix=${lua}"
     "--enable-luainterp"
-  ] ++ lib.optional lua.pkgs.isLuaJIT [
+  ] ++ lib.optionals lua.pkgs.isLuaJIT [
     "--with-luajit"
   ]
   ++ lib.optionals pythonSupport [
diff --git a/pkgs/applications/editors/vscode/generic.nix b/pkgs/applications/editors/vscode/generic.nix
index 71c0f3bb55e3b..f8808e033ed4d 100644
--- a/pkgs/applications/editors/vscode/generic.nix
+++ b/pkgs/applications/editors/vscode/generic.nix
@@ -66,7 +66,7 @@ let
     buildInputs = [ libsecret libXScrnSaver libxshmfence ]
       ++ lib.optionals (!stdenv.isDarwin) ([ at-spi2-atk ] ++ atomEnv.packages);
 
-    runtimeDependencies = lib.optional stdenv.isLinux [ (lib.getLib systemd) fontconfig.lib libdbusmenu ];
+    runtimeDependencies = lib.optionals stdenv.isLinux [ (lib.getLib systemd) fontconfig.lib libdbusmenu ];
 
     nativeBuildInputs = [ unzip ]
       ++ lib.optionals stdenv.isLinux [
diff --git a/pkgs/applications/emulators/retroarch/cores.nix b/pkgs/applications/emulators/retroarch/cores.nix
index 57ae88dbd42ce..1224aa74f29cc 100644
--- a/pkgs/applications/emulators/retroarch/cores.nix
+++ b/pkgs/applications/emulators/retroarch/cores.nix
@@ -676,7 +676,7 @@ in
     description = "Fast MegaDrive/MegaCD/32X emulator";
     license = "MAME";
     dontConfigure = true;
-    makeFlags = lib.optional stdenv.hostPlatform.isAarch64 [ "platform=aarch64" ];
+    makeFlags = lib.optionals stdenv.hostPlatform.isAarch64 [ "platform=aarch64" ];
   };
 
   play = mkLibRetroCore {
diff --git a/pkgs/applications/file-managers/nnn/default.nix b/pkgs/applications/file-managers/nnn/default.nix
index 85c372f004068..05f65df87b951 100644
--- a/pkgs/applications/file-managers/nnn/default.nix
+++ b/pkgs/applications/file-managers/nnn/default.nix
@@ -40,8 +40,8 @@ stdenv.mkDerivation rec {
   NIX_LDFLAGS = lib.optionalString stdenv.hostPlatform.isMusl "-lfts";
 
   makeFlags = [ "PREFIX=${placeholder "out"}" ]
-    ++ lib.optional withIcons [ "O_ICONS=1" ]
-    ++ lib.optional withNerdIcons [ "O_NERD=1" ];
+    ++ lib.optionals withIcons [ "O_ICONS=1" ]
+    ++ lib.optionals withNerdIcons [ "O_NERD=1" ];
 
   binPath = lib.makeBinPath [ file which ];
 
diff --git a/pkgs/applications/gis/gmt/default.nix b/pkgs/applications/gis/gmt/default.nix
index c6e0846e54dc3..3cc04e3744400 100644
--- a/pkgs/applications/gis/gmt/default.nix
+++ b/pkgs/applications/gis/gmt/default.nix
@@ -47,7 +47,7 @@ stdenv.mkDerivation rec {
     "-DGMT_INSTALL_MODULE_LINKS:BOOL=FALSE"
     "-DLICENSE_RESTRICTED=LGPL" # "GPL" and "no" also valid
   ] ++ (with stdenv;
-    lib.optional (!isDarwin) [
+    lib.optionals (!isDarwin) [
       "-DFFTW3_ROOT=${fftwSinglePrec.dev}"
       "-DLAPACK_LIBRARY=${lapack}/lib/liblapack.so"
       "-DBLAS_LIBRARY=${blas}/lib/libblas.so"
diff --git a/pkgs/applications/graphics/kcc/default.nix b/pkgs/applications/graphics/kcc/default.nix
index bbbd4ed351bc2..2f481252d881d 100644
--- a/pkgs/applications/graphics/kcc/default.nix
+++ b/pkgs/applications/graphics/kcc/default.nix
@@ -23,7 +23,7 @@ mkDerivationWith python3Packages.buildPythonApplication rec {
     raven
   ];
 
-  qtWrapperArgs = lib.optional archiveSupport [ "--prefix" "PATH" ":" "${ lib.makeBinPath [ p7zip ] }" ];
+  qtWrapperArgs = lib.optionals archiveSupport [ "--prefix" "PATH" ":" "${ lib.makeBinPath [ p7zip ] }" ];
 
   postFixup =  ''
     wrapProgram $out/bin/kcc "''${qtWrapperArgs[@]}"
diff --git a/pkgs/applications/graphics/xournalpp/default.nix b/pkgs/applications/graphics/xournalpp/default.nix
index 5fd139b8de4a7..db9e2e71ed143 100644
--- a/pkgs/applications/graphics/xournalpp/default.nix
+++ b/pkgs/applications/graphics/xournalpp/default.nix
@@ -48,7 +48,7 @@ stdenv.mkDerivation rec {
     ]
     ++ lib.optional withLua lua;
 
-  buildFlags = "translations";
+  buildFlags = [ "translations" ];
 
   hardeningDisable = [ "format" ];
 
diff --git a/pkgs/applications/misc/audio/sox/default.nix b/pkgs/applications/misc/audio/sox/default.nix
index d82658f529e44..9ddcdc92c5bda 100644
--- a/pkgs/applications/misc/audio/sox/default.nix
+++ b/pkgs/applications/misc/audio/sox/default.nix
@@ -47,7 +47,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [
     autoreconfHook
     autoconf-archive
-  ] ++ lib.optional enableOpusfile [
+  ] ++ lib.optionals enableOpusfile [
     # configure.ac uses pkg-config only to locate libopusfile
     pkg-config
   ];
diff --git a/pkgs/applications/misc/blender/default.nix b/pkgs/applications/misc/blender/default.nix
index c6f16733cc21c..e6bdd340c9795 100644
--- a/pkgs/applications/misc/blender/default.nix
+++ b/pkgs/applications/misc/blender/default.nix
@@ -127,7 +127,7 @@ stdenv.mkDerivation rec {
     # Clang doesn't support "-export-dynamic"
     ++ optional stdenv.cc.isClang "-DPYTHON_LINKFLAGS="
     ++ optional jackaudioSupport "-DWITH_JACK=ON"
-    ++ optional cudaSupport [
+    ++ optionals cudaSupport [
       "-DWITH_CYCLES_CUDA_BINARIES=ON"
       "-DWITH_CYCLES_DEVICE_OPTIX=ON"
       "-DOPTIX_ROOT_DIR=${optix}"
diff --git a/pkgs/applications/networking/browsers/links2/default.nix b/pkgs/applications/networking/browsers/links2/default.nix
index e01131e193e09..4dc06cd466b50 100644
--- a/pkgs/applications/networking/browsers/links2/default.nix
+++ b/pkgs/applications/networking/browsers/links2/default.nix
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
     [ libev librsvg libpng libjpeg libtiff openssl xz bzip2 zlib ]
     ++ optionals stdenv.isLinux [ gpm ]
     ++ optionals enableX11 [ libX11 libXau libXt ]
-    ++ optional enableDirectFB [ directfb ];
+    ++ optionals enableDirectFB [ directfb ];
 
   nativeBuildInputs = [ pkg-config bzip2 ];
 
diff --git a/pkgs/applications/networking/cluster/hadoop/default.nix b/pkgs/applications/networking/cluster/hadoop/default.nix
index 365cac59f41ad..ebe21a2da45ea 100644
--- a/pkgs/applications/networking/cluster/hadoop/default.nix
+++ b/pkgs/applications/networking/cluster/hadoop/default.nix
@@ -37,7 +37,7 @@ let
       doCheck = true;
 
       nativeBuildInputs = [ makeWrapper ]
-        ++ optional (stdenv.isLinux && (nativeLibs != [ ] || libPatches != "")) [ autoPatchelfHook ];
+        ++ optionals (stdenv.isLinux && (nativeLibs != [ ] || libPatches != "")) [ autoPatchelfHook ];
       buildInputs = [ openssl ] ++ nativeLibs;
 
       installPhase = ''
diff --git a/pkgs/applications/networking/firehol/default.nix b/pkgs/applications/networking/firehol/default.nix
index 145fae2553a20..81c82dcbe1b0f 100644
--- a/pkgs/applications/networking/firehol/default.nix
+++ b/pkgs/applications/networking/firehol/default.nix
@@ -43,7 +43,7 @@ stdenv.mkDerivation rec {
   configureFlags = [ "--localstatedir=/var"
                      "--disable-doc" "--disable-man"
                      "--disable-update-ipsets" ] ++
-                   lib.optional onlyQOS [ "--disable-firehol" ];
+                   lib.optionals onlyQOS [ "--disable-firehol" ];
 
   meta = with lib; {
     description = "A firewall for humans";
diff --git a/pkgs/applications/networking/instant-messengers/pantalaimon/default.nix b/pkgs/applications/networking/instant-messengers/pantalaimon/default.nix
index 41eef4e204570..49114903a59ac 100644
--- a/pkgs/applications/networking/instant-messengers/pantalaimon/default.nix
+++ b/pkgs/applications/networking/instant-messengers/pantalaimon/default.nix
@@ -34,7 +34,7 @@ buildPythonApplication rec {
     peewee
     prompt-toolkit
     setuptools
-  ] ++ lib.optional enableDbusUi [
+  ] ++ lib.optionals enableDbusUi [
       dbus-python
       notify2
       pygobject3
diff --git a/pkgs/applications/networking/irc/convos/default.nix b/pkgs/applications/networking/irc/convos/default.nix
index 7b2a8c3f24707..30aac1cb11787 100644
--- a/pkgs/applications/networking/irc/convos/default.nix
+++ b/pkgs/applications/networking/irc/convos/default.nix
@@ -16,7 +16,7 @@ perlPackages.buildPerlPackage rec {
   };
 
   nativeBuildInputs = [ makeWrapper ]
-    ++ optional stdenv.isDarwin [ shortenPerlShebang ];
+    ++ optionals stdenv.isDarwin [ shortenPerlShebang ];
 
   buildInputs = with perlPackages; [
     CryptPassphrase CryptPassphraseArgon2 CryptPassphraseBcrypt
diff --git a/pkgs/applications/networking/mailreaders/alot/default.nix b/pkgs/applications/networking/mailreaders/alot/default.nix
index d8a4d1066ecb2..889b893ea9cff 100644
--- a/pkgs/applications/networking/mailreaders/alot/default.nix
+++ b/pkgs/applications/networking/mailreaders/alot/default.nix
@@ -15,7 +15,7 @@ with python3.pkgs; buildPythonApplication rec {
 
   outputs = [
     "out"
-  ] ++ lib.optional withManpage [
+  ] ++ lib.optionals withManpage [
     "man"
   ];
 
diff --git a/pkgs/applications/networking/mailreaders/meli/default.nix b/pkgs/applications/networking/mailreaders/meli/default.nix
index f998a4366b39e..e3da77531a114 100644
--- a/pkgs/applications/networking/mailreaders/meli/default.nix
+++ b/pkgs/applications/networking/mailreaders/meli/default.nix
@@ -31,7 +31,7 @@ rustPlatform.buildRustPackage rec {
 
   checkInputs = [ file ];
 
-  buildFeatures = lib.optional withNotmuch [ "notmuch" ];
+  buildFeatures = lib.optionals withNotmuch [ "notmuch" ];
 
   postInstall = ''
     mkdir -p $out/share/man/man1
diff --git a/pkgs/applications/networking/mpop/default.nix b/pkgs/applications/networking/mpop/default.nix
index 21d9d19e03b3e..7e89603827456 100644
--- a/pkgs/applications/networking/mpop/default.nix
+++ b/pkgs/applications/networking/mpop/default.nix
@@ -25,11 +25,11 @@ stdenv.mkDerivation rec {
     gnutls
     gsasl
     libidn
-  ] ++ lib.optional stdenv.isDarwin [
+  ] ++ lib.optionals stdenv.isDarwin [
     Security
   ];
 
-  configureFlags = lib.optional stdenv.isDarwin [
+  configureFlags = lib.optionals stdenv.isDarwin [
     "--with-macosx-keyring"
   ];
 
diff --git a/pkgs/applications/networking/sync/lsyncd/default.nix b/pkgs/applications/networking/sync/lsyncd/default.nix
index 3e52d664d5265..ed4de44049d3b 100644
--- a/pkgs/applications/networking/sync/lsyncd/default.nix
+++ b/pkgs/applications/networking/sync/lsyncd/default.nix
@@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
 
   # Special flags needed on Darwin:
   # https://github.com/axkibe/lsyncd/blob/42413cabbedca429d55a5378f6e830f191f3cc86/INSTALL#L51
-  cmakeFlags = lib.optional stdenv.isDarwin [ "-DWITH_INOTIFY=OFF" "-DWITH_FSEVENTS=ON" ];
+  cmakeFlags = lib.optionals stdenv.isDarwin [ "-DWITH_INOTIFY=OFF" "-DWITH_FSEVENTS=ON" ];
 
   dontUseCmakeBuildDir = true;
 
diff --git a/pkgs/applications/networking/znc/default.nix b/pkgs/applications/networking/znc/default.nix
index e5aec9117068b..f73bb1c4bf73e 100644
--- a/pkgs/applications/networking/znc/default.nix
+++ b/pkgs/applications/networking/znc/default.nix
@@ -36,8 +36,8 @@ stdenv.mkDerivation rec {
     (lib.enableFeature withTcl "tcl")
     (lib.withFeatureAs withTcl "tcl" "${tcl}/lib")
     (lib.enableFeature withCyrus "cyrus")
-  ] ++ optional (!withIPv6) [ "--disable-ipv6" ]
-    ++ optional withDebug [ "--enable-debug" ];
+  ] ++ optionals (!withIPv6) [ "--disable-ipv6" ]
+    ++ optionals withDebug [ "--enable-debug" ];
 
   enableParallelBuilding = true;
 
diff --git a/pkgs/applications/radio/rtl-sdr/default.nix b/pkgs/applications/radio/rtl-sdr/default.nix
index e7fbb50cfd086..d8180750c7a1c 100644
--- a/pkgs/applications/radio/rtl-sdr/default.nix
+++ b/pkgs/applications/radio/rtl-sdr/default.nix
@@ -29,7 +29,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ libusb1 ];
 
-  cmakeFlags = lib.optional stdenv.isLinux [
+  cmakeFlags = lib.optionals stdenv.isLinux [
     "-DINSTALL_UDEV_RULES=ON"
     "-DWITH_RPC=ON"
   ];
diff --git a/pkgs/applications/science/biology/megahit/default.nix b/pkgs/applications/science/biology/megahit/default.nix
index 45cb7560502dc..7f054a51d5e05 100644
--- a/pkgs/applications/science/biology/megahit/default.nix
+++ b/pkgs/applications/science/biology/megahit/default.nix
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ cmake ];
   buildInputs = [ zlib ];
 
-  cmakeFlags = lib.optional stdenv.hostPlatform.isStatic [
+  cmakeFlags = lib.optionals stdenv.hostPlatform.isStatic [
     "-DSTATIC_BUILD=ON"
     ];
   meta = with lib; {
diff --git a/pkgs/applications/science/biology/neuron/default.nix b/pkgs/applications/science/biology/neuron/default.nix
index 36f1b4c699a82..a35d586b9ac3f 100644
--- a/pkgs/applications/science/biology/neuron/default.nix
+++ b/pkgs/applications/science/biology/neuron/default.nix
@@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
     sha256 = "0f26v3qvzblcdjg7isq0m9j2q8q7x3vhmkfllv8lsr3gyj44lljf";
   };
 
-  patches = (lib.optional (stdenv.isDarwin) [ ./neuron-carbon-disable.patch ]);
+  patches = (lib.optionals (stdenv.isDarwin) [ ./neuron-carbon-disable.patch ]);
 
   # With LLVM 3.8 and above, clang (really libc++) gets upset if you attempt to redefine these...
   postPatch = lib.optionalString stdenv.cc.isClang ''
diff --git a/pkgs/applications/science/biology/samtools/default.nix b/pkgs/applications/science/biology/samtools/default.nix
index 29ba667b05527..41129a667e914 100644
--- a/pkgs/applications/science/biology/samtools/default.nix
+++ b/pkgs/applications/science/biology/samtools/default.nix
@@ -32,7 +32,7 @@ stdenv.mkDerivation rec {
 
   configureFlags = [ "--with-htslib=${htslib}" ]
     ++ lib.optional (ncurses == null) "--without-curses"
-    ++ lib.optional stdenv.hostPlatform.isStatic ["--without-curses" ]
+    ++ lib.optionals stdenv.hostPlatform.isStatic ["--without-curses" ]
     ;
 
   preCheck = ''
diff --git a/pkgs/applications/science/logic/fast-downward/default.nix b/pkgs/applications/science/logic/fast-downward/default.nix
index 1d7c51e64e9d4..ba0f3ee2e255f 100644
--- a/pkgs/applications/science/logic/fast-downward/default.nix
+++ b/pkgs/applications/science/logic/fast-downward/default.nix
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ cmake python3.pkgs.wrapPython ];
   buildInputs = [ python3 osi ];
 
-  cmakeFlags = lib.optional osi.withCplex [ "-DDOWNWARD_CPLEX_ROOT=${cplex}/cplex" ];
+  cmakeFlags = lib.optionals osi.withCplex [ "-DDOWNWARD_CPLEX_ROOT=${cplex}/cplex" ];
 
   configurePhase = ''
     python build.py release
diff --git a/pkgs/applications/science/math/ratpoints/default.nix b/pkgs/applications/science/math/ratpoints/default.nix
index dd8258a3456d7..44c68ebcdceaf 100644
--- a/pkgs/applications/science/math/ratpoints/default.nix
+++ b/pkgs/applications/science/math/ratpoints/default.nix
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
   buildInputs = [ gmp ];
 
   makeFlags = [ "CC=${stdenv.cc.targetPrefix}cc" ];
-  buildFlags = lib.optional stdenv.isDarwin ["CCFLAGS2=-lgmp -lc -lm" "CCFLAGS=-UUSE_SSE"];
+  buildFlags = lib.optionals stdenv.isDarwin ["CCFLAGS2=-lgmp -lc -lm" "CCFLAGS=-UUSE_SSE"];
   installFlags = [ "INSTALL_DIR=$(out)" ];
 
   preInstall = ''mkdir -p "$out"/{bin,share,lib,include}'';
diff --git a/pkgs/applications/terminal-emulators/x3270/default.nix b/pkgs/applications/terminal-emulators/x3270/default.nix
index 7bc4941caf195..3c9b31258e783 100644
--- a/pkgs/applications/terminal-emulators/x3270/default.nix
+++ b/pkgs/applications/terminal-emulators/x3270/default.nix
@@ -18,7 +18,7 @@ in stdenv.mkDerivation rec {
     sha256 = "0km24rgll0s4ji6iz8lvy5ra76ds162s95y33w5px6697cwqkp9j";
   };
 
-  buildFlags = "unix";
+  buildFlags = [ "unix" ];
 
   postConfigure = ''
     pushd c3270 ; ./configure ; popd
diff --git a/pkgs/applications/version-management/datalad/default.nix b/pkgs/applications/version-management/datalad/default.nix
index 65561aded31fe..cd2c26ea8d422 100644
--- a/pkgs/applications/version-management/datalad/default.nix
+++ b/pkgs/applications/version-management/datalad/default.nix
@@ -59,8 +59,8 @@ python3.pkgs.buildPythonApplication rec {
 
     # python>=3.8
     distro
-  ] ++ lib.optional stdenv.hostPlatform.isWindows [ colorama ]
-    ++ lib.optional (python3.pythonOlder "3.10") [ importlib-metadata ];
+  ] ++ lib.optionals stdenv.hostPlatform.isWindows [ colorama ]
+    ++ lib.optionals (python3.pythonOlder "3.10") [ importlib-metadata ];
 
   postInstall = ''
     installShellCompletion --cmd datalad \
diff --git a/pkgs/applications/version-management/dvc/default.nix b/pkgs/applications/version-management/dvc/default.nix
index 6f1c4fe185773..40b550cb9e389 100644
--- a/pkgs/applications/version-management/dvc/default.nix
+++ b/pkgs/applications/version-management/dvc/default.nix
@@ -72,17 +72,17 @@ python3.pkgs.buildPythonApplication rec {
     typing-extensions
     voluptuous
     zc_lockfile
-  ] ++ lib.optional enableGoogle [
+  ] ++ lib.optionals enableGoogle [
     gcsfs
     google-cloud-storage
-  ] ++ lib.optional enableAWS [
+  ] ++ lib.optionals enableAWS [
     aiobotocore
     boto3
     s3fs
-  ] ++ lib.optional enableAzure [
+  ] ++ lib.optionals enableAzure [
     azure-identity
     knack
-  ] ++ lib.optional enableSSH [
+  ] ++ lib.optionals enableSSH [
     bcrypt
   ] ++ lib.optionals (pythonOlder "3.8") [
     importlib-metadata
diff --git a/pkgs/applications/version-management/git-and-tools/tig/default.nix b/pkgs/applications/version-management/git-and-tools/tig/default.nix
index 344a10cf2ec56..cfce8a35f9e12 100644
--- a/pkgs/applications/version-management/git-and-tools/tig/default.nix
+++ b/pkgs/applications/version-management/git-and-tools/tig/default.nix
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ makeWrapper autoreconfHook asciidoc xmlto docbook_xsl docbook_xml_dtd_45 findXMLCatalogs pkg-config ];
 
-  autoreconfFlags = "-I tools -v";
+  autoreconfFlags = [ "-I" "tools" "-v" ];
 
   buildInputs = [ ncurses readline git ]
     ++ lib.optionals stdenv.isDarwin [ libiconv ];
diff --git a/pkgs/applications/version-management/gitlab/default.nix b/pkgs/applications/version-management/gitlab/default.nix
index 47ca0f4f48d3c..88f2a5f4cd0e1 100644
--- a/pkgs/applications/version-management/gitlab/default.nix
+++ b/pkgs/applications/version-management/gitlab/default.nix
@@ -37,7 +37,7 @@ let
         railties = x.railties // {
           dontBuild = false;
           patches = [ ./railties-remove-yarn-install-enhancement.patch ];
-          patchFlags = "-p2";
+          patchFlags = [ "-p2" ];
         };
       };
     groups = [
diff --git a/pkgs/applications/version-management/subversion/default.nix b/pkgs/applications/version-management/subversion/default.nix
index 5731ef59deb79..69a2bce490606 100644
--- a/pkgs/applications/version-management/subversion/default.nix
+++ b/pkgs/applications/version-management/subversion/default.nix
@@ -40,7 +40,7 @@ let
       ++ lib.optionals pythonBindings [ python3 py3c ]
       ++ lib.optional perlBindings perl
       ++ lib.optional saslSupport sasl
-      ++ lib.optional stdenv.hostPlatform.isDarwin [ CoreServices Security ];
+      ++ lib.optionals stdenv.hostPlatform.isDarwin [ CoreServices Security ];
 
     patches = [ ./apr-1.patch ] ++ extraPatches;
 
diff --git a/pkgs/applications/video/kodi/unwrapped.nix b/pkgs/applications/video/kodi/unwrapped.nix
index a272f90bd3334..6eadd06af0fb1 100644
--- a/pkgs/applications/video/kodi/unwrapped.nix
+++ b/pkgs/applications/video/kodi/unwrapped.nix
@@ -138,7 +138,7 @@ in stdenv.mkDerivation {
       lirc
       mesa # for libEGL
     ]
-    ++ lib.optional x11Support [
+    ++ lib.optionals x11Support [
       libX11 xorgproto libXt libXmu libXext.dev libXdmcp
       libXinerama libXrandr.dev libXtst libXfixes
     ]
@@ -158,7 +158,7 @@ in stdenv.mkDerivation {
       # Not sure why ".dev" is needed here, but CMake doesn't find libxkbcommon otherwise
       libxkbcommon.dev
     ]
-    ++ lib.optional gbmSupport [
+    ++ lib.optionals gbmSupport [
       libxkbcommon.dev
       mesa.dev
       libinput.dev
@@ -200,7 +200,7 @@ in stdenv.mkDerivation {
       # whitelisted directories). This adds the entire nix store to the Kodi
       # webserver whitelist to avoid this problem.
       "-DKODI_WEBSERVER_EXTRA_WHITELIST=${builtins.storeDir}"
-    ] ++ lib.optional waylandSupport [
+    ] ++ lib.optionals waylandSupport [
       "-DWAYLANDPP_SCANNER=${buildPackages.waylandpp}/bin/wayland-scanner++"
     ];
 
diff --git a/pkgs/build-support/release/default.nix b/pkgs/build-support/release/default.nix
index d593ec81197e4..da1078369a584 100644
--- a/pkgs/build-support/release/default.nix
+++ b/pkgs/build-support/release/default.nix
@@ -15,7 +15,7 @@ rec {
     } // args);
 
   mvnBuild = args: import ./maven-build.nix (
-    { inherit stdenv;
+    { inherit lib stdenv;
     } // args);
 
   nixBuild = args: import ./nix-build.nix (
diff --git a/pkgs/build-support/release/maven-build.nix b/pkgs/build-support/release/maven-build.nix
index eaa47647287c6..daee44b85accd 100644
--- a/pkgs/build-support/release/maven-build.nix
+++ b/pkgs/build-support/release/maven-build.nix
@@ -1,4 +1,5 @@
 { stdenv
+, lib
 , name
 , src
 , doTest ? true
@@ -12,7 +13,11 @@
 } @ args :
 
 let
-  mvnFlags = "-Dmaven.repo.local=$M2_REPO ${if doTest then "" else "-Dmaven.test.skip.exec=true"} ${extraMvnFlags}";
+  mvnFlags = lib.escapeShellArgs [
+    "-Dmaven.repo.local=$M2_REPO"
+    (lib.optionalString (!doTest) "-Dmaven.test.skip.exec=true")
+    "${extraMvnFlags}"
+  ];
 in
 
 stdenv.mkDerivation ( {
diff --git a/pkgs/build-support/skaware/build-skaware-package.nix b/pkgs/build-support/skaware/build-skaware-package.nix
index 1988d95212c30..3ae9b7ce8aac2 100644
--- a/pkgs/build-support/skaware/build-skaware-package.nix
+++ b/pkgs/build-support/skaware/build-skaware-package.nix
@@ -87,7 +87,7 @@ stdenv.mkDerivation {
 
   inherit postConfigure;
 
-  makeFlags = lib.optional stdenv.cc.isClang [ "AR=${stdenv.cc.targetPrefix}ar" "RANLIB=${stdenv.cc.targetPrefix}ranlib" ];
+  makeFlags = lib.optionals stdenv.cc.isClang [ "AR=${stdenv.cc.targetPrefix}ar" "RANLIB=${stdenv.cc.targetPrefix}ranlib" ];
 
   # TODO(Profpatsch): ensure that there is always a $doc output!
   postInstall = ''
diff --git a/pkgs/data/fonts/iosevka/default.nix b/pkgs/data/fonts/iosevka/default.nix
index 53e5b4a3db767..d9efb0eedcd7d 100644
--- a/pkgs/data/fonts/iosevka/default.nix
+++ b/pkgs/data/fonts/iosevka/default.nix
@@ -86,7 +86,7 @@ stdenv.mkDerivation rec {
   inherit extraParameters;
   passAsFile = [
     "extraParameters"
-  ] ++ lib.optional (! (builtins.isString privateBuildPlan && lib.hasPrefix builtins.storeDir privateBuildPlan)) [
+  ] ++ lib.optionals (! (builtins.isString privateBuildPlan && lib.hasPrefix builtins.storeDir privateBuildPlan)) [
     "buildPlan"
   ];
 
diff --git a/pkgs/desktops/gnome-2/platform/GConf/default.nix b/pkgs/desktops/gnome-2/platform/GConf/default.nix
index ec8deb537d08a..8419c1a7d730e 100644
--- a/pkgs/desktops/gnome-2/platform/GConf/default.nix
+++ b/pkgs/desktops/gnome-2/platform/GConf/default.nix
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
 
   configureFlags =
     # fixes the "libgconfbackend-oldxml.so is not portable" error on darwin
-    lib.optional stdenv.isDarwin [ "--enable-static" ];
+    lib.optionals stdenv.isDarwin [ "--enable-static" ];
 
   postPatch = ''
     2to3 --write --nobackup gsettings/gsettings-schema-convert
diff --git a/pkgs/development/compilers/dmd/default.nix b/pkgs/development/compilers/dmd/default.nix
index 1c15e8b970b70..b29190b9b8342 100644
--- a/pkgs/development/compilers/dmd/default.nix
+++ b/pkgs/development/compilers/dmd/default.nix
@@ -129,7 +129,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ makeWrapper unzip which git ];
 
   buildInputs = [ gdb curl tzdata ]
-    ++ lib.optional stdenv.isDarwin [ Foundation gdb ];
+    ++ lib.optionals stdenv.isDarwin [ Foundation gdb ];
 
 
   osname = if stdenv.isDarwin then
diff --git a/pkgs/development/compilers/edk2/default.nix b/pkgs/development/compilers/edk2/default.nix
index 90e570f7da408..d516014048684 100644
--- a/pkgs/development/compilers/edk2/default.nix
+++ b/pkgs/development/compilers/edk2/default.nix
@@ -61,7 +61,7 @@ edk2 = buildStdenv.mkDerivation {
   ${"GCC5_${targetArch}_PREFIX"}=stdenv.cc.targetPrefix;
 
   makeFlags = [ "-C BaseTools" ]
-    ++ lib.optional (stdenv.cc.isClang) [ "BUILD_CC=clang BUILD_CXX=clang++ BUILD_AS=clang" ];
+    ++ lib.optionals (stdenv.cc.isClang) [ "BUILD_CC=clang BUILD_CXX=clang++ BUILD_AS=clang" ];
 
   NIX_CFLAGS_COMPILE = "-Wno-return-type" + lib.optionalString (stdenv.cc.isGNU) " -Wno-error=stringop-truncation";
 
diff --git a/pkgs/development/compilers/gforth/boot-forth.nix b/pkgs/development/compilers/gforth/boot-forth.nix
index fc7b5ffa982d7..74a267687b8f2 100644
--- a/pkgs/development/compilers/gforth/boot-forth.nix
+++ b/pkgs/development/compilers/gforth/boot-forth.nix
@@ -13,7 +13,7 @@ stdenv.mkDerivation {
 
   buildInputs = [ m4 ];
 
-  configureFlags = lib.optional stdenv.isDarwin [ "--build=x86_64-apple-darwin" ];
+  configureFlags = lib.optionals stdenv.isDarwin [ "--build=x86_64-apple-darwin" ];
 
   meta = {
     description = "The Forth implementation of the GNU project (outdated version used to bootstrap)";
diff --git a/pkgs/development/compilers/ghdl/default.nix b/pkgs/development/compilers/ghdl/default.nix
index 383fec786b916..0e11c703d7b6c 100644
--- a/pkgs/development/compilers/ghdl/default.nix
+++ b/pkgs/development/compilers/ghdl/default.nix
@@ -38,7 +38,7 @@ stdenv.mkDerivation rec {
   ];
   buildInputs = [
     zlib
-  ] ++ lib.optional (backend == "llvm") [
+  ] ++ lib.optionals (backend == "llvm") [
     llvm
   ];
   propagatedBuildInputs = [
diff --git a/pkgs/development/compilers/idris2/default.nix b/pkgs/development/compilers/idris2/default.nix
index 9c7a9e53a2e6a..bb7d7a7a131c8 100644
--- a/pkgs/development/compilers/idris2/default.nix
+++ b/pkgs/development/compilers/idris2/default.nix
@@ -34,7 +34,7 @@ in stdenv.mkDerivation rec {
 
   strictDeps = true;
   nativeBuildInputs = [ makeWrapper clang platformChez ]
-    ++ lib.optional stdenv.isDarwin [ zsh ];
+    ++ lib.optionals stdenv.isDarwin [ zsh ];
   buildInputs = [ platformChez gmp ];
 
   prePatch = ''
diff --git a/pkgs/development/compilers/idris2/tests.nix b/pkgs/development/compilers/idris2/tests.nix
index a8d48c26ca6f5..54bb6d29eeef0 100644
--- a/pkgs/development/compilers/idris2/tests.nix
+++ b/pkgs/development/compilers/idris2/tests.nix
@@ -11,7 +11,7 @@ let
       # is not the case with pure nix environments. Thus, we need to include zsh
       # when we build for darwin in tests. While this is impure, this is also what
       # we find in real darwin hosts.
-      nativeBuildInputs = lib.optional stdenv.isDarwin [ zsh ];
+      nativeBuildInputs = lib.optionals stdenv.isDarwin [ zsh ];
 
       buildCommand = ''
         set -eo pipefail
diff --git a/pkgs/development/compilers/llvm/10/libcxx/default.nix b/pkgs/development/compilers/llvm/10/libcxx/default.nix
index d438294bdd0b6..6a4e645bb3004 100644
--- a/pkgs/development/compilers/llvm/10/libcxx/default.nix
+++ b/pkgs/development/compilers/llvm/10/libcxx/default.nix
@@ -45,7 +45,7 @@ stdenv.mkDerivation {
     "-DLIBCXX_CXX_ABI=libcxxabi"
   ] ++ lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) "-DLIBCXX_HAS_MUSL_LIBC=1"
     ++ lib.optional (stdenv.hostPlatform.useLLVM or false) "-DLIBCXX_USE_COMPILER_RT=ON"
-    ++ lib.optional stdenv.hostPlatform.isWasm [
+    ++ lib.optionals stdenv.hostPlatform.isWasm [
       "-DLIBCXX_ENABLE_THREADS=OFF"
       "-DLIBCXX_ENABLE_FILESYSTEM=OFF"
       "-DLIBCXX_ENABLE_EXCEPTIONS=OFF"
diff --git a/pkgs/development/compilers/llvm/11/libcxx/default.nix b/pkgs/development/compilers/llvm/11/libcxx/default.nix
index 9aa49c9a009e6..2a83b36fc4252 100644
--- a/pkgs/development/compilers/llvm/11/libcxx/default.nix
+++ b/pkgs/development/compilers/llvm/11/libcxx/default.nix
@@ -48,7 +48,7 @@ stdenv.mkDerivation {
     "-DLIBCXX_CXX_ABI=libcxxabi"
   ] ++ lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) "-DLIBCXX_HAS_MUSL_LIBC=1"
     ++ lib.optional (stdenv.hostPlatform.useLLVM or false) "-DLIBCXX_USE_COMPILER_RT=ON"
-    ++ lib.optional stdenv.hostPlatform.isWasm [
+    ++ lib.optionals stdenv.hostPlatform.isWasm [
       "-DLIBCXX_ENABLE_THREADS=OFF"
       "-DLIBCXX_ENABLE_FILESYSTEM=OFF"
       "-DLIBCXX_ENABLE_EXCEPTIONS=OFF"
diff --git a/pkgs/development/compilers/llvm/12/libcxx/default.nix b/pkgs/development/compilers/llvm/12/libcxx/default.nix
index 3ddcb79975050..1386d3680f916 100644
--- a/pkgs/development/compilers/llvm/12/libcxx/default.nix
+++ b/pkgs/development/compilers/llvm/12/libcxx/default.nix
@@ -36,7 +36,7 @@ stdenv.mkDerivation {
     "-DLIBCXX_CXX_ABI=libcxxabi"
   ] ++ lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) "-DLIBCXX_HAS_MUSL_LIBC=1"
     ++ lib.optional (stdenv.hostPlatform.useLLVM or false) "-DLIBCXX_USE_COMPILER_RT=ON"
-    ++ lib.optional stdenv.hostPlatform.isWasm [
+    ++ lib.optionals stdenv.hostPlatform.isWasm [
       "-DLIBCXX_ENABLE_THREADS=OFF"
       "-DLIBCXX_ENABLE_FILESYSTEM=OFF"
       "-DLIBCXX_ENABLE_EXCEPTIONS=OFF"
diff --git a/pkgs/development/compilers/llvm/8/libcxx/default.nix b/pkgs/development/compilers/llvm/8/libcxx/default.nix
index 87cd734899fa2..5368011292186 100644
--- a/pkgs/development/compilers/llvm/8/libcxx/default.nix
+++ b/pkgs/development/compilers/llvm/8/libcxx/default.nix
@@ -49,7 +49,7 @@ stdenv.mkDerivation {
     "-DLIBCXX_CXX_ABI=libcxxabi"
   ] ++ lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) "-DLIBCXX_HAS_MUSL_LIBC=1"
     ++ lib.optional (stdenv.hostPlatform.useLLVM or false) "-DLIBCXX_USE_COMPILER_RT=ON"
-    ++ lib.optional stdenv.hostPlatform.isWasm [
+    ++ lib.optionals stdenv.hostPlatform.isWasm [
       "-DLIBCXX_ENABLE_THREADS=OFF"
       "-DLIBCXX_ENABLE_FILESYSTEM=OFF"
       "-DLIBCXX_ENABLE_EXCEPTIONS=OFF"
diff --git a/pkgs/development/compilers/llvm/9/libcxx/default.nix b/pkgs/development/compilers/llvm/9/libcxx/default.nix
index 2719711031070..31a00ba548591 100644
--- a/pkgs/development/compilers/llvm/9/libcxx/default.nix
+++ b/pkgs/development/compilers/llvm/9/libcxx/default.nix
@@ -45,7 +45,7 @@ stdenv.mkDerivation {
     "-DLIBCXX_CXX_ABI=libcxxabi"
   ] ++ lib.optional (stdenv.hostPlatform.isMusl || stdenv.hostPlatform.isWasi) "-DLIBCXX_HAS_MUSL_LIBC=1"
     ++ lib.optional (stdenv.hostPlatform.useLLVM or false) "-DLIBCXX_USE_COMPILER_RT=ON"
-    ++ lib.optional stdenv.hostPlatform.isWasm [
+    ++ lib.optionals stdenv.hostPlatform.isWasm [
       "-DLIBCXX_ENABLE_THREADS=OFF"
       "-DLIBCXX_ENABLE_FILESYSTEM=OFF"
       "-DLIBCXX_ENABLE_EXCEPTIONS=OFF"
diff --git a/pkgs/development/compilers/manticore/default.nix b/pkgs/development/compilers/manticore/default.nix
index 1919f99980586..b767ccf150a69 100644
--- a/pkgs/development/compilers/manticore/default.nix
+++ b/pkgs/development/compilers/manticore/default.nix
@@ -19,7 +19,7 @@ in stdenv.mkDerivation {
 
   buildInputs = [ coreutils smlnj ];
 
-  autoreconfFlags = "-Iconfig -vfi";
+  autoreconfFlags = [ "-Iconfig" "-vfi" ];
 
   unpackPhase = ''
     mkdir -p $out
diff --git a/pkgs/development/compilers/orc/default.nix b/pkgs/development/compilers/orc/default.nix
index fa4bf686a2aca..5ea72781e41f8 100644
--- a/pkgs/development/compilers/orc/default.nix
+++ b/pkgs/development/compilers/orc/default.nix
@@ -26,7 +26,7 @@ in stdenv.mkDerivation rec {
   outputBin = "dev"; # compilation tools
 
   mesonFlags =
-    optional (!buildDevDoc) [ "-Dgtk_doc=disabled" ]
+    optionals (!buildDevDoc) [ "-Dgtk_doc=disabled" ]
   ;
 
   nativeBuildInputs = [ meson ninja ]
diff --git a/pkgs/development/compilers/p4c/default.nix b/pkgs/development/compilers/p4c/default.nix
index 9233489b06aeb..cf02a656b770b 100644
--- a/pkgs/development/compilers/p4c/default.nix
+++ b/pkgs/development/compilers/p4c/default.nix
@@ -66,8 +66,8 @@ stdenv.mkDerivation rec {
     flex
     cmake
   ]
-  ++ lib.optional enableDocumentation [ doxygen graphviz ]
-  ++ lib.optional enableBPF [ libllvm libbpf ];
+  ++ lib.optionals enableDocumentation [ doxygen graphviz ]
+  ++ lib.optionals enableBPF [ libllvm libbpf ];
 
   buildInputs = [
     protobuf
diff --git a/pkgs/development/compilers/sbcl/2.x.nix b/pkgs/development/compilers/sbcl/2.x.nix
index cfc9d34a4da81..ec12ccf17b722 100644
--- a/pkgs/development/compilers/sbcl/2.x.nix
+++ b/pkgs/development/compilers/sbcl/2.x.nix
@@ -153,7 +153,7 @@ stdenv.mkDerivation rec {
     optional (!threadSupport) "sb-thread" ++
     optionals disableImmobileSpace [ "immobile-space" "immobile-code" "compact-instance-header" ];
 
-  NIX_CFLAGS_COMPILE = lib.optional (lib.versionOlder version "2.1.10") [
+  NIX_CFLAGS_COMPILE = lib.optionals (lib.versionOlder version "2.1.10") [
     # Workaround build failure on -fno-common toolchains like upstream
     # clang-13. Without the change build fails as:
     #   duplicate symbol '_static_code_space_free_pointer' in: alloc.o traceroot.o
diff --git a/pkgs/development/coq-modules/coq-record-update/default.nix b/pkgs/development/coq-modules/coq-record-update/default.nix
index fcc7b0362a0b6..77c42fb48d4eb 100644
--- a/pkgs/development/coq-modules/coq-record-update/default.nix
+++ b/pkgs/development/coq-modules/coq-record-update/default.nix
@@ -10,7 +10,7 @@ with lib; mkCoqDerivation rec {
   release."0.3.1".sha256 = "sha256-DyGxO2tqmYZZluXN6Oy5Tw6fuLMyuyxonj8CCToWKkk=";
   release."0.3.0".sha256 = "1ffr21dd6hy19gxnvcd4if2450iksvglvkd6q5713fajd72hmc0z";
   releaseRev = v: "v${v}";
-  buildFlags = "NO_TEST=1";
+  buildFlags = [ "NO_TEST=1" ];
   meta = {
     description = "Library to create Coq record update functions";
     maintainers = with maintainers; [ ineol ];
diff --git a/pkgs/development/interpreters/acl2/default.nix b/pkgs/development/interpreters/acl2/default.nix
index 1ca3742e737b6..e42f26f0bdaf7 100644
--- a/pkgs/development/interpreters/acl2/default.nix
+++ b/pkgs/development/interpreters/acl2/default.nix
@@ -77,7 +77,7 @@ in stdenv.mkDerivation rec {
   '';
 
   preBuild = "mkdir -p $HOME";
-  makeFlags = "LISP=${sbcl}/bin/sbcl ACL2_MAKE_LOG=NONE";
+  makeFlags = [ "LISP=${sbcl}/bin/sbcl" "ACL2_MAKE_LOG=NONE" ];
 
   doCheck = true;
   checkTarget = "mini-proveall";
diff --git a/pkgs/development/interpreters/kerf/default.nix b/pkgs/development/interpreters/kerf/default.nix
index 5b605c6564b3b..96db9bbaeb137 100644
--- a/pkgs/development/interpreters/kerf/default.nix
+++ b/pkgs/development/interpreters/kerf/default.nix
@@ -18,9 +18,9 @@ stdenv.mkDerivation rec {
 
   sourceRoot = "source/src";
   buildInputs = [ libedit zlib ncurses ]
-    ++ lib.optional stdenv.isDarwin ([
+    ++ lib.optionals stdenv.isDarwin ([
       Accelerate
-    ] ++ lib.optional stdenv.isx86_64 /* && isDarwin */ [
+    ] ++ lib.optionals stdenv.isx86_64 /* && isDarwin */ [
       CoreGraphics CoreVideo
     ]);
 
@@ -36,7 +36,7 @@ stdenv.mkDerivation rec {
     "implicit-function-declaration"
     "gnu-variable-sized-type-not-at-end"
     "unused-result"
-  ] ++ lib.optional stdenv.isDarwin [ "-fcommon" ];
+  ] ++ lib.optionals stdenv.isDarwin [ "-fcommon" ];
 
   patchPhase = ''
     substituteInPlace ./Makefile \
diff --git a/pkgs/development/interpreters/php/generic.nix b/pkgs/development/interpreters/php/generic.nix
index 5984113574c26..d1b7c68295578 100644
--- a/pkgs/development/interpreters/php/generic.nix
+++ b/pkgs/development/interpreters/php/generic.nix
@@ -206,7 +206,7 @@ let
             [ pcre2 ]
 
             # Enable sapis
-            ++ lib.optional pearSupport [ libxml2.dev ]
+            ++ lib.optionals pearSupport [ libxml2.dev ]
 
             # Misc deps
             ++ lib.optional apxs2Support apacheHttpd
@@ -230,7 +230,7 @@ let
             ++ lib.optional (!cgiSupport) "--disable-cgi"
             ++ lib.optional (!cliSupport) "--disable-cli"
             ++ lib.optional fpmSupport "--enable-fpm"
-            ++ lib.optional pearSupport [ "--with-pear" "--enable-xml" "--with-libxml" ]
+            ++ lib.optionals pearSupport [ "--with-pear" "--enable-xml" "--with-libxml" ]
             ++ lib.optional pharSupport "--enable-phar"
             ++ lib.optional (!phpdbgSupport) "--disable-phpdbg"
 
diff --git a/pkgs/development/interpreters/python-cosmopolitan/default.nix b/pkgs/development/interpreters/python-cosmopolitan/default.nix
index a2a512b9cdf0d..a513c097fbcbe 100644
--- a/pkgs/development/interpreters/python-cosmopolitan/default.nix
+++ b/pkgs/development/interpreters/python-cosmopolitan/default.nix
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ bintools-unwrapped unzip ];
 
   # slashes are significant because upstream uses o/$(MODE)/foo.o
-  buildFlags = "o//third_party/python";
+  buildFlags = [ "o//third_party/python" ];
   checkTarget = "o//third_party/python/test";
   enableParallelBuilding = true;
 
diff --git a/pkgs/development/interpreters/python/cpython/2.7/default.nix b/pkgs/development/interpreters/python/cpython/2.7/default.nix
index 25446f5fca899..7da2a0047f331 100644
--- a/pkgs/development/interpreters/python/cpython/2.7/default.nix
+++ b/pkgs/development/interpreters/python/cpython/2.7/default.nix
@@ -166,7 +166,7 @@ let
       # only works for GCC and Apple Clang. This makes distutils to call C++
       # compiler when needed.
       ./python-2.7-distutils-C++.patch
-    ] ++ optional (stdenv.hostPlatform != stdenv.buildPlatform) [
+    ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
       ./cross-compile.patch
     ];
 
diff --git a/pkgs/development/interpreters/python/rustpython/default.nix b/pkgs/development/interpreters/python/rustpython/default.nix
index ad4382203223f..bbc2fef46cf28 100644
--- a/pkgs/development/interpreters/python/rustpython/default.nix
+++ b/pkgs/development/interpreters/python/rustpython/default.nix
@@ -20,7 +20,7 @@ rustPlatform.buildRustPackage rec {
   cargoHash = "sha256-T85kiPG80oZ4mwpb8Ag40wDHKx2Aens+gM7NGXan5lM=";
 
   # freeze the stdlib into the rustpython binary
-  cargoBuildFlags = "--features=freeze-stdlib";
+  cargoBuildFlags = [ "--features=freeze-stdlib" ];
 
   buildInputs = lib.optionals stdenv.isDarwin [ SystemConfiguration ];
 
diff --git a/pkgs/development/interpreters/racket/default.nix b/pkgs/development/interpreters/racket/default.nix
index 67609132c80d6..479557e0890f0 100644
--- a/pkgs/development/interpreters/racket/default.nix
+++ b/pkgs/development/interpreters/racket/default.nix
@@ -128,8 +128,8 @@ stdenv.mkDerivation rec {
 
   shared = if stdenv.isDarwin then "dylib" else "shared";
   configureFlags = [ "--enable-${shared}"  "--enable-lt=${libtool}/bin/libtool" ]
-                   ++ lib.optional disableDocs [ "--disable-docs" ]
-                   ++ lib.optional stdenv.isDarwin [ "--enable-xonx" ];
+                   ++ lib.optionals disableDocs [ "--disable-docs" ]
+                   ++ lib.optionals stdenv.isDarwin [ "--enable-xonx" ];
 
   configureScript = "../configure";
 
diff --git a/pkgs/development/interpreters/racket/racket_7_9.nix b/pkgs/development/interpreters/racket/racket_7_9.nix
index 07c0376b42aa7..ac4b6b5ba1800 100644
--- a/pkgs/development/interpreters/racket/racket_7_9.nix
+++ b/pkgs/development/interpreters/racket/racket_7_9.nix
@@ -83,8 +83,8 @@ stdenv.mkDerivation rec {
 
   shared = if stdenv.isDarwin then "dylib" else "shared";
   configureFlags = [ "--enable-${shared}"  "--enable-lt=${libtool}/bin/libtool" ]
-                   ++ lib.optional disableDocs [ "--disable-docs" ]
-                   ++ lib.optional stdenv.isDarwin [ "--enable-xonx" ];
+                   ++ lib.optionals disableDocs [ "--disable-docs" ]
+                   ++ lib.optionals stdenv.isDarwin [ "--enable-xonx" ];
 
   configureScript = "../configure";
 
diff --git a/pkgs/development/interpreters/spidermonkey/common.nix b/pkgs/development/interpreters/spidermonkey/common.nix
index 1272e061b0d90..d12396396da4b 100644
--- a/pkgs/development/interpreters/spidermonkey/common.nix
+++ b/pkgs/development/interpreters/spidermonkey/common.nix
@@ -42,7 +42,7 @@ stdenv.mkDerivation (finalAttrs: rec {
     inherit hash;
   };
 
-  patches = lib.optional (lib.versionOlder version "91") [
+  patches = lib.optionals (lib.versionOlder version "91") [
     # Fix build failure on armv7l using Debian patch
     # Upstream bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1526653
     (fetchpatch {
diff --git a/pkgs/development/libraries/ada/gnatcoll/db.nix b/pkgs/development/libraries/ada/gnatcoll/db.nix
index 0c597f199c34d..6c87d63063fac 100644
--- a/pkgs/development/libraries/ada/gnatcoll/db.nix
+++ b/pkgs/development/libraries/ada/gnatcoll/db.nix
@@ -95,7 +95,7 @@ stdenv.mkDerivation rec {
     # confusingly, for gprbuild --target is autoconf --host
     "TARGET=${stdenv.hostPlatform.config}"
     "prefix=${placeholder "out"}"
-  ] ++ lib.optional (component == "sqlite") [
+  ] ++ lib.optionals (component == "sqlite") [
     # link against packaged, not vendored libsqlite3
     "GNATCOLL_SQLITE=external"
   ];
diff --git a/pkgs/development/libraries/apr/default.nix b/pkgs/development/libraries/apr/default.nix
index 536c8a5613a9e..0d980db9b5a8b 100644
--- a/pkgs/development/libraries/apr/default.nix
+++ b/pkgs/development/libraries/apr/default.nix
@@ -49,7 +49,7 @@ stdenv.mkDerivation rec {
       configureFlagsArray+=("--with-installbuilddir=$dev/share/build")
     '';
 
-  configureFlags = lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) [
+  configureFlags = lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
     # For cross builds, provide answers to the configure time tests.
     # These answers are valid on x86_64-linux and aarch64-linux.
     "ac_cv_file__dev_zero=yes"
diff --git a/pkgs/development/libraries/cosmopolitan/default.nix b/pkgs/development/libraries/cosmopolitan/default.nix
index 63f45f62fd145..88e5bcf5d9d7b 100644
--- a/pkgs/development/libraries/cosmopolitan/default.nix
+++ b/pkgs/development/libraries/cosmopolitan/default.nix
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
   outputs = [ "out" "dist" ];
 
   # slashes are significant because upstream uses o/$(MODE)/foo.o
-  buildFlags = "o/cosmopolitan.h o//cosmopolitan.a o//libc/crt/crt.o o//ape/ape.o o//ape/ape.lds";
+  buildFlags = [ "o/cosmopolitan.h" "o//cosmopolitan.a" "o//libc/crt/crt.o" "o//ape/ape.o" "o//ape/ape.lds" ];
   checkTarget = "o//test";
   enableParallelBuilding = true;
 
diff --git a/pkgs/development/libraries/cxxopts/default.nix b/pkgs/development/libraries/cxxopts/default.nix
index cf36a88a35be9..a24127ab56d8b 100644
--- a/pkgs/development/libraries/cxxopts/default.nix
+++ b/pkgs/development/libraries/cxxopts/default.nix
@@ -21,10 +21,10 @@ stdenv.mkDerivation rec {
   # CMake does not set CMAKE_LIBRARY_ARCHITECTURE variable in Nix, which breaks architecture-independent library path generation
   patches = [ ./fix-install-path.patch ];
 
-  buildInputs = lib.optional enableUnicodeHelp [ icu.dev ];
+  buildInputs = lib.optionals enableUnicodeHelp [ icu.dev ];
   cmakeFlags = [ "-DCXXOPTS_BUILD_EXAMPLES=OFF" ]
     ++ lib.optional enableUnicodeHelp "-DCXXOPTS_USE_UNICODE_HELP=TRUE";
-  nativeBuildInputs = [ cmake ] ++ lib.optional enableUnicodeHelp [ pkg-config ];
+  nativeBuildInputs = [ cmake ] ++ lib.optionals enableUnicodeHelp [ pkg-config ];
 
   doCheck = true;
 
diff --git a/pkgs/development/libraries/cyrus-sasl/default.nix b/pkgs/development/libraries/cyrus-sasl/default.nix
index 170b9a0fba4a2..632c8427e4db6 100644
--- a/pkgs/development/libraries/cyrus-sasl/default.nix
+++ b/pkgs/development/libraries/cyrus-sasl/default.nix
@@ -39,7 +39,7 @@ stdenv.mkDerivation rec {
     "--enable-shared"
   ] ++ lib.optional enableLdap "--with-ldap=${openldap.dev}";
 
-  installFlags = lib.optional stdenv.isDarwin [ "framedir=$(out)/Library/Frameworks/SASL2.framework" ];
+  installFlags = lib.optionals stdenv.isDarwin [ "framedir=$(out)/Library/Frameworks/SASL2.framework" ];
 
   passthru.tests = {
     inherit (nixosTests) parsedmarc postfix;
diff --git a/pkgs/development/libraries/drogon/default.nix b/pkgs/development/libraries/drogon/default.nix
index 9cc3503acd6e2..de4aaf32d980b 100644
--- a/pkgs/development/libraries/drogon/default.nix
+++ b/pkgs/development/libraries/drogon/default.nix
@@ -37,7 +37,7 @@ stdenv.mkDerivation rec {
     ++ lib.optional postgresSupport postgresql
     ++ lib.optional redisSupport hiredis
     # drogon uses mariadb for mysql (see https://github.com/drogonframework/drogon/wiki/ENG-02-Installation#Library-Dependencies)
-    ++ lib.optional mysqlSupport [ libmysqlclient mariadb ];
+    ++ lib.optionals mysqlSupport [ libmysqlclient mariadb ];
 
   patches = [
     # this part of the test would normally fail because it attempts to configure a CMake project that uses find_package on itself
diff --git a/pkgs/development/libraries/galario/default.nix b/pkgs/development/libraries/galario/default.nix
index ac7e4f4255e84..7f757fd48197f 100644
--- a/pkgs/development/libraries/galario/default.nix
+++ b/pkgs/development/libraries/galario/default.nix
@@ -34,13 +34,13 @@ stdenv.mkDerivation rec {
   ++ lib.optional stdenv.isDarwin llvmPackages.openmp
   ;
 
-  propagatedBuildInputs = lib.optional enablePython [
+  propagatedBuildInputs = lib.optionals enablePython [
     pythonPackages.numpy
     pythonPackages.cython
     pythonPackages.pytest
   ];
 
-  checkInputs = lib.optional enablePython [ pythonPackages.scipy pythonPackages.pytest-cov ];
+  checkInputs = lib.optionals enablePython [ pythonPackages.scipy pythonPackages.pytest-cov ];
 
   preConfigure = ''
     mkdir -p build/external/src
diff --git a/pkgs/development/libraries/gnutls/default.nix b/pkgs/development/libraries/gnutls/default.nix
index d04fda98c7fe5..f1ec87ba008db 100644
--- a/pkgs/development/libraries/gnutls/default.nix
+++ b/pkgs/development/libraries/gnutls/default.nix
@@ -65,7 +65,7 @@ stdenv.mkDerivation rec {
     "--with-unbound-root-key-file=${dns-root-data}/root.key"
     (lib.withFeature withP11-kit "p11-kit")
     (lib.enableFeature cxxBindings "cxx")
-  ] ++ lib.optional guileBindings [
+  ] ++ lib.optionals guileBindings [
     "--enable-guile"
     "--with-guile-site-dir=\${out}/share/guile/site"
     "--with-guile-site-ccache-dir=\${out}/share/guile/site"
diff --git a/pkgs/development/libraries/gstreamer/base/default.nix b/pkgs/development/libraries/gstreamer/base/default.nix
index a53ffb4f1b3a5..dac712e823877 100644
--- a/pkgs/development/libraries/gstreamer/base/default.nix
+++ b/pkgs/development/libraries/gstreamer/base/default.nix
@@ -79,7 +79,7 @@ stdenv.mkDerivation rec {
     libjpeg
     tremor
     libGL
-  ] ++ lib.optional (!stdenv.isDarwin) [
+  ] ++ lib.optionals (!stdenv.isDarwin) [
     libvisual
   ] ++ lib.optionals stdenv.isDarwin [
     pango
diff --git a/pkgs/development/libraries/hunspell/default.nix b/pkgs/development/libraries/hunspell/default.nix
index baaa07d7e7ea7..8b82af586704e 100644
--- a/pkgs/development/libraries/hunspell/default.nix
+++ b/pkgs/development/libraries/hunspell/default.nix
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
     patchShebangs tests
   '';
 
-  autoreconfFlags = "-vfi";
+  autoreconfFlags = [ "-vfi" ];
 
   configureFlags = [ "--with-ui" "--with-readline" ];
 
diff --git a/pkgs/development/libraries/json-glib/default.nix b/pkgs/development/libraries/json-glib/default.nix
index e095945dabaac..9885384e00e19 100644
--- a/pkgs/development/libraries/json-glib/default.nix
+++ b/pkgs/development/libraries/json-glib/default.nix
@@ -45,7 +45,7 @@ stdenv.mkDerivation rec {
     libxslt
     gobject-introspection
     gi-docgen
-  ] ++ lib.optional stdenv.hostPlatform.isDarwin [
+  ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
     fixDarwinDylibNames
   ];
 
diff --git a/pkgs/development/libraries/kerberos/krb5.nix b/pkgs/development/libraries/kerberos/krb5.nix
index a7197f9ff9846..fc8fb73987017 100644
--- a/pkgs/development/libraries/kerberos/krb5.nix
+++ b/pkgs/development/libraries/kerberos/krb5.nix
@@ -31,7 +31,7 @@ stdenv.mkDerivation rec {
   configureFlags = [ "--localstatedir=/var/lib" ]
     # krb5's ./configure does not allow passing --enable-shared and --enable-static at the same time.
     # See https://bbs.archlinux.org/viewtopic.php?pid=1576737#p1576737
-    ++ lib.optional staticOnly [ "--enable-static" "--disable-shared" ]
+    ++ lib.optionals staticOnly [ "--enable-static" "--disable-shared" ]
     ++ lib.optional stdenv.isFreeBSD ''WARN_CFLAGS=""''
     ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform)
        [ "krb5_cv_attr_constructor_destructor=yes,yes"
diff --git a/pkgs/development/libraries/libav/default.nix b/pkgs/development/libraries/libav/default.nix
index a3de9225d1cef..283c2034be7e4 100644
--- a/pkgs/development/libraries/libav/default.nix
+++ b/pkgs/development/libraries/libav/default.nix
@@ -17,7 +17,7 @@
 
 assert faacSupport -> enableUnfree;
 
-let inherit (lib) optional hasPrefix enableFeature; in
+let inherit (lib) optional optionals hasPrefix enableFeature; in
 
 /* ToDo:
     - more deps, inspiration: https://packages.ubuntu.com/raring/libav-tools
@@ -77,7 +77,7 @@ let
       (enableFeature vaapiSupport "vaapi")
       (enableFeature vdpauSupport "vdpau")
       (enableFeature freetypeSupport "libfreetype")
-    ] ++ optional (stdenv.hostPlatform != stdenv.buildPlatform) [
+    ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
       "--cross-prefix=${stdenv.cc.targetPrefix}"
       "--enable-cross-compile"
     ];
diff --git a/pkgs/development/libraries/libdaemon/default.nix b/pkgs/development/libraries/libdaemon/default.nix
index 51df458097890..581cc723dc414 100644
--- a/pkgs/development/libraries/libdaemon/default.nix
+++ b/pkgs/development/libraries/libdaemon/default.nix
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
   patches = [ ./fix-includes.patch ];
 
   configureFlags = [ "--disable-lynx" ]
-    ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform)
+    ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform)
     [ # Can't run this test while cross-compiling
       "ac_cv_func_setpgrp_void=yes"
     ];
diff --git a/pkgs/development/libraries/libdeflate/default.nix b/pkgs/development/libraries/libdeflate/default.nix
index 449a3d309cd17..39b80238b7191 100644
--- a/pkgs/development/libraries/libdeflate/default.nix
+++ b/pkgs/development/libraries/libdeflate/default.nix
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
     substituteInPlace Makefile --replace /usr/local $out
   '';
 
-  makeFlags = lib.optional stdenv.hostPlatform.isStatic [ "DISABLE_SHARED=1"];
+  makeFlags = lib.optionals stdenv.hostPlatform.isStatic [ "DISABLE_SHARED=1"];
 
   nativeBuildInputs = lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
 
diff --git a/pkgs/development/libraries/libeatmydata/default.nix b/pkgs/development/libraries/libeatmydata/default.nix
index 3a3abdc5e9ac1..886caaada47b2 100644
--- a/pkgs/development/libraries/libeatmydata/default.nix
+++ b/pkgs/development/libraries/libeatmydata/default.nix
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   patches = [ ./find-shell-lib.patch ];
 
-  patchFlags = "-p0";
+  patchFlags = [ "-p0" ];
 
   postPatch = ''
     substituteInPlace eatmydata.in \
diff --git a/pkgs/development/libraries/libff/default.nix b/pkgs/development/libraries/libff/default.nix
index 35b7a33cc38f8..36e8bb78c8398 100644
--- a/pkgs/development/libraries/libff/default.nix
+++ b/pkgs/development/libraries/libff/default.nix
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
   };
 
   cmakeFlags = [ "-DWITH_PROCPS=Off" ]
-    ++ lib.optional stdenv.isAarch64 [ "-DCURVE=ALT_BN128" "-DUSE_ASM=OFF" ];
+    ++ lib.optionals stdenv.isAarch64 [ "-DCURVE=ALT_BN128" "-DUSE_ASM=OFF" ];
 
   # CMake is hardcoded to always build static library which causes linker
   # failure for Haskell applications depending on haskellPackages.hevm on macOS.
diff --git a/pkgs/development/libraries/libmcrypt/default.nix b/pkgs/development/libraries/libmcrypt/default.nix
index 50bbf8383e610..953a6d03e5e6c 100644
--- a/pkgs/development/libraries/libmcrypt/default.nix
+++ b/pkgs/development/libraries/libmcrypt/default.nix
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = optional stdenv.isDarwin darwin.cctools;
 
-  configureFlags = optional disablePosixThreads
+  configureFlags = optionals disablePosixThreads
     [ "--disable-posix-threads" ];
 
   meta = {
diff --git a/pkgs/development/libraries/libpam-wrapper/default.nix b/pkgs/development/libraries/libpam-wrapper/default.nix
index 10d5c98b6687c..0701ae0fc55f5 100644
--- a/pkgs/development/libraries/libpam-wrapper/default.nix
+++ b/pkgs/development/libraries/libpam-wrapper/default.nix
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
     sha256 = "00mqhsashx7njrvxz085d0b88nizhdy7m3x17ip5yhvwsl63km6p";
   };
 
-  nativeBuildInputs = [ cmake ] ++ lib.optional enablePython [ python ];
+  nativeBuildInputs = [ cmake ] ++ lib.optionals enablePython [ python ];
 
   # We must use linux-pam, using openpam will result in broken fprintd.
   buildInputs = [ linux-pam ];
diff --git a/pkgs/development/libraries/libvdpau/default.nix b/pkgs/development/libraries/libvdpau/default.nix
index e3be4db26cd84..906a3c59234a3 100644
--- a/pkgs/development/libraries/libvdpau/default.nix
+++ b/pkgs/development/libraries/libvdpau/default.nix
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
 
   propagatedBuildInputs = [ xorg.libX11 ];
 
-  mesonFlags = lib.optional stdenv.isLinux
+  mesonFlags = lib.optionals stdenv.isLinux
     [ "-Dmoduledir=${mesa.drivers.driverLink}/lib/vdpau" ];
 
   NIX_LDFLAGS = lib.optionalString stdenv.isDarwin "-lX11";
diff --git a/pkgs/development/libraries/libvncserver/default.nix b/pkgs/development/libraries/libvncserver/default.nix
index b9da7135f92e5..c111a81b0ccb5 100644
--- a/pkgs/development/libraries/libvncserver/default.nix
+++ b/pkgs/development/libraries/libvncserver/default.nix
@@ -36,7 +36,7 @@ stdenv.mkDerivation rec {
     libpng
   ] ++ lib.optionals stdenv.isLinux [
     systemd
-  ] ++ lib.optional stdenv.isDarwin [
+  ] ++ lib.optionals stdenv.isDarwin [
     Carbon
   ];
 
diff --git a/pkgs/development/libraries/libxslt/default.nix b/pkgs/development/libraries/libxslt/default.nix
index a3bb7128c0f10..5e520c315f7df 100644
--- a/pkgs/development/libraries/libxslt/default.nix
+++ b/pkgs/development/libraries/libxslt/default.nix
@@ -36,7 +36,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [
     libxml2.dev libxcrypt
-  ] ++ lib.optional stdenv.isDarwin [
+  ] ++ lib.optionals stdenv.isDarwin [
     gettext
   ] ++ lib.optionals pythonSupport [
     libxml2.py
diff --git a/pkgs/development/libraries/mimalloc/default.nix b/pkgs/development/libraries/mimalloc/default.nix
index cc67e2070949a..6dcf1978edcfb 100644
--- a/pkgs/development/libraries/mimalloc/default.nix
+++ b/pkgs/development/libraries/mimalloc/default.nix
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
   '';
 
   nativeBuildInputs = [ cmake ninja ];
-  cmakeFlags = [ "-DMI_INSTALL_TOPLEVEL=ON" ] ++ lib.optional secureBuild [ "-DMI_SECURE=ON" ];
+  cmakeFlags = [ "-DMI_INSTALL_TOPLEVEL=ON" ] ++ lib.optionals secureBuild [ "-DMI_SECURE=ON" ];
 
   postInstall = let
     rel = lib.versions.majorMinor version;
diff --git a/pkgs/development/libraries/nng/default.nix b/pkgs/development/libraries/nng/default.nix
index 9acc64fea6423..7f0bd15aa542e 100644
--- a/pkgs/development/libraries/nng/default.nix
+++ b/pkgs/development/libraries/nng/default.nix
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ cmake ninja ]
     ++ lib.optionals mbedtlsSupport [ mbedtls ];
 
-  buildInputs = lib.optional mbedtlsSupport [ mbedtls ];
+  buildInputs = lib.optionals mbedtlsSupport [ mbedtls ];
 
   cmakeFlags = [ "-G Ninja" "-DNNG_ENABLE_TLS=ON" ]
     ++ lib.optionals mbedtlsSupport [ "-DMBEDTLS_ROOT_DIR=${mbedtls}" ];
diff --git a/pkgs/development/libraries/openbsm/default.nix b/pkgs/development/libraries/openbsm/default.nix
index 4719b7fb74704..627e9b830714c 100644
--- a/pkgs/development/libraries/openbsm/default.nix
+++ b/pkgs/development/libraries/openbsm/default.nix
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
     sha256 = "0b98359hd8mm585sh145ss828pg2y8vgz38lqrb7nypapiyqdnd1";
   };
 
-  patches = lib.optional stdenv.isDarwin [ ./bsm-add-audit_token_to_pid.patch ];
+  patches = lib.optionals stdenv.isDarwin [ ./bsm-add-audit_token_to_pid.patch ];
 
   preConfigure = lib.optionalString (lib.versionAtLeast stdenv.hostPlatform.darwinMinVersion "11") ''
     MACOSX_DEPLOYMENT_TARGET=10.16
diff --git a/pkgs/development/libraries/opencv/3.x.nix b/pkgs/development/libraries/opencv/3.x.nix
index 550a7f39373a0..56b022d03b9b5 100644
--- a/pkgs/development/libraries/opencv/3.x.nix
+++ b/pkgs/development/libraries/opencv/3.x.nix
@@ -248,7 +248,7 @@ stdenv.mkDerivation {
     "-DBUILD_opencv_videoio=OFF"
   ] ++ lib.optionals enablePython [
     "-DOPENCV_SKIP_PYTHON_LOADER=ON"
-  ] ++ lib.optional enableEigen [
+  ] ++ lib.optionals enableEigen [
     # Autodetection broken by https://github.com/opencv/opencv/pull/13337
     "-DEIGEN_INCLUDE_PATH=${eigen}/include/eigen3"
   ];
diff --git a/pkgs/development/libraries/openmpi/default.nix b/pkgs/development/libraries/openmpi/default.nix
index 723f1848c6a06..f2392bb00726a 100644
--- a/pkgs/development/libraries/openmpi/default.nix
+++ b/pkgs/development/libraries/openmpi/default.nix
@@ -50,7 +50,7 @@ in stdenv.mkDerivation rec {
     ++ lib.optionals cudaSupport [ cudatoolkit ]
     ++ [ libevent hwloc ]
     ++ lib.optional (stdenv.isLinux || stdenv.isFreeBSD) rdma-core
-    ++ lib.optional fabricSupport [ libpsm2 libfabric ];
+    ++ lib.optionals fabricSupport [ libpsm2 libfabric ];
 
   nativeBuildInputs = [ perl ]
     ++ lib.optionals fortranSupport [ gfortran ];
diff --git a/pkgs/development/libraries/openvino/default.nix b/pkgs/development/libraries/openvino/default.nix
index dabf56d9056b1..e3ebb97cbdff4 100644
--- a/pkgs/development/libraries/openvino/default.nix
+++ b/pkgs/development/libraries/openvino/default.nix
@@ -68,7 +68,7 @@ stdenv.mkDerivation rec {
     "-DNGRAPH_UNIT_TEST_ENABLE:BOOL=OFF"
     "-DENABLE_SAMPLES:BOOL=OFF"
     "-DENABLE_CPPLINT:BOOL=OFF"
-  ] ++ lib.optional enablePython [
+  ] ++ lib.optionals enablePython [
     "-DENABLE_PYTHON:BOOL=ON"
   ];
 
@@ -106,7 +106,7 @@ stdenv.mkDerivation rec {
     python
     tbb
     shellcheck
-  ] ++ lib.optional enablePython (with python.pkgs; [
+  ] ++ lib.optionals enablePython (with python.pkgs; [
     cython
     pybind11
   ]);
diff --git a/pkgs/development/libraries/pangomm/2.48.nix b/pkgs/development/libraries/pangomm/2.48.nix
index cdc644ec9cd9f..12aec5bd68eab 100644
--- a/pkgs/development/libraries/pangomm/2.48.nix
+++ b/pkgs/development/libraries/pangomm/2.48.nix
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
     meson
     ninja
     python3
-  ] ++ lib.optional stdenv.isDarwin [
+  ] ++ lib.optionals stdenv.isDarwin [
     ApplicationServices
   ];
 
diff --git a/pkgs/development/libraries/poppler/default.nix b/pkgs/development/libraries/poppler/default.nix
index cba1af7046079..8ff218b79316c 100644
--- a/pkgs/development/libraries/poppler/default.nix
+++ b/pkgs/development/libraries/poppler/default.nix
@@ -77,7 +77,7 @@ stdenv.mkDerivation (finalAttrs: rec {
     pcre
     libiconv
     libintl
-  ] ++ lib.optional withData [
+  ] ++ lib.optionals withData [
     poppler_data
   ];
 
diff --git a/pkgs/development/libraries/precice/default.nix b/pkgs/development/libraries/precice/default.nix
index bc6a9359e614f..01ab32577cb26 100644
--- a/pkgs/development/libraries/precice/default.nix
+++ b/pkgs/development/libraries/precice/default.nix
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
     "-DPYTHON_INCLUDE_DIR=${python3}/include/${python3.libPrefix}"
   ];
 
-  NIX_CFLAGS_COMPILE = lib.optional stdenv.isDarwin [ "-D_GNU_SOURCE" ];
+  NIX_CFLAGS_COMPILE = lib.optionals stdenv.isDarwin [ "-D_GNU_SOURCE" ];
 
   nativeBuildInputs = [ cmake gcc ];
   buildInputs = [ boost eigen libxml2 mpi python3 python3.pkgs.numpy ];
diff --git a/pkgs/development/libraries/qt-5/modules/qtlocation.nix b/pkgs/development/libraries/qt-5/modules/qtlocation.nix
index 687571f18d296..b5fdc918dc69a 100644
--- a/pkgs/development/libraries/qt-5/modules/qtlocation.nix
+++ b/pkgs/development/libraries/qt-5/modules/qtlocation.nix
@@ -4,7 +4,7 @@ qtModule {
   pname = "qtlocation";
   qtInputs = [ qtbase qtmultimedia ];
   outputs = [ "bin" "out" "dev" ];
-  qmakeFlags = lib.optional stdenv.isDarwin [
+  qmakeFlags = lib.optionals stdenv.isDarwin [
      # boost uses std::auto_ptr which has been disabled in clang with libcxx
      # This flag re-enables this feature
      # https://libcxx.llvm.org/docs/UsingLibcxx.html#c-17-specific-configuration-macros
diff --git a/pkgs/development/libraries/redis-plus-plus/default.nix b/pkgs/development/libraries/redis-plus-plus/default.nix
index 7d3d7d486714e..61e593d28c930 100644
--- a/pkgs/development/libraries/redis-plus-plus/default.nix
+++ b/pkgs/development/libraries/redis-plus-plus/default.nix
@@ -22,9 +22,9 @@ stdenv.mkDerivation rec {
 
   cmakeFlags = [
     "-DREDIS_PLUS_PLUS_BUILD_TEST=OFF"
-  ] ++ lib.optional (!enableShared) [
+  ] ++ lib.optionals (!enableShared) [
     "-DREDIS_PLUS_PLUS_BUILD_SHARED=OFF"
-  ] ++ lib.optional (!enableStatic) [
+  ] ++ lib.optionals (!enableStatic) [
     "-DREDIS_PLUS_PLUS_BUILD_STATIC=OFF"
   ];
 
diff --git a/pkgs/development/libraries/rustc-demangle/default.nix b/pkgs/development/libraries/rustc-demangle/default.nix
index be02fedfde717..e0329085bd56e 100644
--- a/pkgs/development/libraries/rustc-demangle/default.nix
+++ b/pkgs/development/libraries/rustc-demangle/default.nix
@@ -16,7 +16,7 @@ rustPlatform.buildRustPackage rec {
     ./add-Cargo.lock.patch
   ];
   cargoSha256 = "sha256-1tW5TOap5MstxTXAFij3IB8TIpI+FryEX9TXlVXjRl4=";
-  cargoBuildFlags = "-p rustc-demangle-capi";
+  cargoBuildFlags = [ "-p" "rustc-demangle-capi" ];
   postInstall = ''
     mkdir -p $out/lib
     cp target/${rust.toRustTargetSpec stdenv.hostPlatform}/release/librustc_demangle.so $out/lib
diff --git a/pkgs/development/libraries/science/math/faiss/default.nix b/pkgs/development/libraries/science/math/faiss/default.nix
index f2d5e29f6a4a7..9c83a1220e461 100644
--- a/pkgs/development/libraries/science/math/faiss/default.nix
+++ b/pkgs/development/libraries/science/math/faiss/default.nix
@@ -56,7 +56,7 @@ stdenv.mkDerivation {
   nativeBuildInputs = [ cmake ] ++ lib.optionals cudaSupport [
     cudatoolkit
     addOpenGLRunpath
-  ] ++ lib.optional pythonSupport [
+  ] ++ lib.optionals pythonSupport [
     pythonPackages.python
   ];
 
diff --git a/pkgs/development/libraries/science/networking/ns-3/default.nix b/pkgs/development/libraries/science/networking/ns-3/default.nix
index b9f7946f71611..9f80470eff2c6 100644
--- a/pkgs/development/libraries/science/networking/ns-3/default.nix
+++ b/pkgs/development/libraries/science/networking/ns-3/default.nix
@@ -53,8 +53,8 @@ stdenv.mkDerivation rec {
 
   # ncurses is a hidden dependency of waf when checking python
   buildInputs = lib.optionals pythonSupport [ castxml ncurses ]
-    ++ lib.optional enableDoxygen [ doxygen graphviz imagemagick ]
-    ++ lib.optional withManual [ dia tetex ghostscript texlive.combined.scheme-medium ];
+    ++ lib.optionals enableDoxygen [ doxygen graphviz imagemagick ]
+    ++ lib.optionals withManual [ dia tetex ghostscript texlive.combined.scheme-medium ];
 
   propagatedBuildInputs = [ pythonEnv ];
 
diff --git a/pkgs/development/libraries/speechd/default.nix b/pkgs/development/libraries/speechd/default.nix
index d27eabecf4651..021246d73028f 100644
--- a/pkgs/development/libraries/speechd/default.nix
+++ b/pkgs/development/libraries/speechd/default.nix
@@ -69,9 +69,9 @@ in stdenv.mkDerivation rec {
     espeak
     sonic
     pcaudiolib
-  ] ++ lib.optional withFlite [
+  ] ++ lib.optionals withFlite [
     flite
-  ] ++ lib.optional withPico [
+  ] ++ lib.optionals withPico [
     svox
   ];
 
@@ -83,17 +83,17 @@ in stdenv.mkDerivation rec {
     # Audio method falls back from left to right.
     "--with-default-audio-method=\"libao,pulse,alsa,oss\""
     "--with-systemdsystemunitdir=${placeholder "out"}/lib/systemd/system"
-  ] ++ lib.optional withPulse [
+  ] ++ lib.optionals withPulse [
   "--with-pulse"
-  ] ++ lib.optional withAlsa [
+  ] ++ lib.optionals withAlsa [
     "--with-alsa"
-  ] ++ lib.optional withLibao [
+  ] ++ lib.optionals withLibao [
     "--with-libao"
-  ] ++ lib.optional withOss [
+  ] ++ lib.optionals withOss [
     "--with-oss"
-  ] ++ lib.optional withEspeak [
+  ] ++ lib.optionals withEspeak [
     "--with-espeak-ng"
-  ] ++ lib.optional withPico [
+  ] ++ lib.optionals withPico [
     "--with-pico"
   ];
 
diff --git a/pkgs/development/libraries/vtk/generic.nix b/pkgs/development/libraries/vtk/generic.nix
index b88ddee6b249b..555e7d0a45de6 100644
--- a/pkgs/development/libraries/vtk/generic.nix
+++ b/pkgs/development/libraries/vtk/generic.nix
@@ -48,7 +48,7 @@ in stdenv.mkDerivation rec {
       ImageIO
       OpenGL
       GLUT
-    ] ++ optional enablePython [
+    ] ++ optionals enablePython [
       pythonInterpreter
     ];
   propagatedBuildInputs = optionals stdenv.isDarwin [ libobjc ];
diff --git a/pkgs/development/mobile/androidenv/cmake.nix b/pkgs/development/mobile/androidenv/cmake.nix
index 3abad6b41f626..7df24ad4cc223 100644
--- a/pkgs/development/mobile/androidenv/cmake.nix
+++ b/pkgs/development/mobile/androidenv/cmake.nix
@@ -3,7 +3,7 @@
 deployAndroidPackage {
   inherit package os;
   nativeBuildInputs = lib.optionals stdenv.isLinux [ autoPatchelfHook ];
-  buildInputs = lib.optional (os == "linux") [ pkgs.stdenv.cc.libc pkgs.stdenv.cc.cc pkgs.ncurses5 ];
+  buildInputs = lib.optionals (os == "linux") [ pkgs.stdenv.cc.libc pkgs.stdenv.cc.cc pkgs.ncurses5 ];
   patchInstructions = lib.optionalString (os == "linux") ''
     autoPatchelf $packageBaseDir/bin
   '';
diff --git a/pkgs/development/mobile/androidenv/ndk-bundle/default.nix b/pkgs/development/mobile/androidenv/ndk-bundle/default.nix
index 0f3e7e4faa231..ad729e24fb8aa 100644
--- a/pkgs/development/mobile/androidenv/ndk-bundle/default.nix
+++ b/pkgs/development/mobile/androidenv/ndk-bundle/default.nix
@@ -12,7 +12,7 @@ deployAndroidPackage {
   nativeBuildInputs = [ makeWrapper ]
     ++ lib.optionals stdenv.isLinux [ autoPatchelfHook ];
   autoPatchelfIgnoreMissingDeps = true;
-  buildInputs = lib.optional (os == "linux") [ pkgs.zlib ];
+  buildInputs = lib.optionals (os == "linux") [ pkgs.zlib ];
   patchInstructions = lib.optionalString (os == "linux") (''
     patchShebangs .
 
diff --git a/pkgs/development/mobile/androidenv/tools/25.nix b/pkgs/development/mobile/androidenv/tools/25.nix
index 28ea249df25c1..82642e04280b6 100644
--- a/pkgs/development/mobile/androidenv/tools/25.nix
+++ b/pkgs/development/mobile/androidenv/tools/25.nix
@@ -3,7 +3,7 @@
 deployAndroidPackage {
   name = "androidsdk";
   nativeBuildInputs = [ autoPatchelfHook makeWrapper ];
-  buildInputs = lib.optional (os == "linux") [ pkgs.glibc pkgs.xorg.libX11 pkgs.xorg.libXext pkgs.xorg.libXdamage pkgs.xorg.libxcb pkgs.xorg.libXfixes pkgs.xorg.libXrender pkgs.fontconfig.lib pkgs.freetype pkgs.libGL pkgs.zlib pkgs.ncurses5 pkgs.libpulseaudio pkgs_i686.glibc pkgs_i686.xorg.libX11 pkgs_i686.xorg.libXrender pkgs_i686.fontconfig pkgs_i686.freetype pkgs_i686.zlib ];
+  buildInputs = lib.optionals (os == "linux") [ pkgs.glibc pkgs.xorg.libX11 pkgs.xorg.libXext pkgs.xorg.libXdamage pkgs.xorg.libxcb pkgs.xorg.libXfixes pkgs.xorg.libXrender pkgs.fontconfig.lib pkgs.freetype pkgs.libGL pkgs.zlib pkgs.ncurses5 pkgs.libpulseaudio pkgs_i686.glibc pkgs_i686.xorg.libX11 pkgs_i686.xorg.libXrender pkgs_i686.fontconfig pkgs_i686.freetype pkgs_i686.zlib ];
   inherit package os;
 
   patchInstructions = ''
diff --git a/pkgs/development/node-packages/overrides.nix b/pkgs/development/node-packages/overrides.nix
index a66eada91b48e..57cb62dc52d1d 100644
--- a/pkgs/development/node-packages/overrides.nix
+++ b/pkgs/development/node-packages/overrides.nix
@@ -423,7 +423,7 @@ final: prev: {
 
   pulp = prev.pulp.override {
     # tries to install purescript
-    npmFlags = "--ignore-scripts";
+    npmFlags = builtins.toString [ "--ignore-scripts" ];
 
     nativeBuildInputs = [ pkgs.buildPackages.makeWrapper ];
     postInstall =  ''
diff --git a/pkgs/development/ocaml-modules/bz2/default.nix b/pkgs/development/ocaml-modules/bz2/default.nix
index 6d8b56ae232dd..835570dc9ab6b 100644
--- a/pkgs/development/ocaml-modules/bz2/default.nix
+++ b/pkgs/development/ocaml-modules/bz2/default.nix
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
     sha256 = "sha256-jBFEkLN2fbC3LxTu7C0iuhvNg64duuckBHWZoBxrV/U=";
   };
 
-  autoreconfFlags = "-I .";
+  autoreconfFlags = [ "-I" "." ];
 
   nativeBuildInputs = [
     autoreconfHook
diff --git a/pkgs/development/ocaml-modules/cudf/default.nix b/pkgs/development/ocaml-modules/cudf/default.nix
index fe9793ea532f6..54e96e047e5d4 100644
--- a/pkgs/development/ocaml-modules/cudf/default.nix
+++ b/pkgs/development/ocaml-modules/cudf/default.nix
@@ -38,7 +38,7 @@ stdenv.mkDerivation {
   doCheck = true;
 
   preInstall = "mkdir -p $OCAMLFIND_DESTDIR";
-  installFlags = "BINDIR=$(out)/bin";
+  installFlags = [ "BINDIR=$(out)/bin" ];
 
   meta = with lib; {
     description = "A library for CUDF format";
diff --git a/pkgs/development/python-modules/aiodns/default.nix b/pkgs/development/python-modules/aiodns/default.nix
index 9c626618ff0a9..a5cf035aa0602 100644
--- a/pkgs/development/python-modules/aiodns/default.nix
+++ b/pkgs/development/python-modules/aiodns/default.nix
@@ -20,7 +20,7 @@ buildPythonPackage rec {
 
   propagatedBuildInputs = [
     pycares
-  ] ++ lib.optional (pythonOlder "3.7") [
+  ] ++ lib.optionals (pythonOlder "3.7") [
     typing
   ];
 
diff --git a/pkgs/development/python-modules/ansible-runner/default.nix b/pkgs/development/python-modules/ansible-runner/default.nix
index c261e5b163b73..14dfb65cfea8b 100644
--- a/pkgs/development/python-modules/ansible-runner/default.nix
+++ b/pkgs/development/python-modules/ansible-runner/default.nix
@@ -65,7 +65,7 @@ buildPythonPackage rec {
     "test_large_stdout_blob"
     # Failed: DID NOT RAISE <class 'RuntimeError'>
     "test_validate_pattern"
-  ] ++ lib.optional stdenv.isDarwin [
+  ] ++ lib.optionals stdenv.isDarwin [
     # test_process_isolation_settings is currently broken on Darwin Catalina
     # https://github.com/ansible/ansible-runner/issues/413
     "process_isolation_settings"
diff --git a/pkgs/development/python-modules/aspy-refactor-imports/default.nix b/pkgs/development/python-modules/aspy-refactor-imports/default.nix
index cfe935e16e808..a19002449dfaf 100644
--- a/pkgs/development/python-modules/aspy-refactor-imports/default.nix
+++ b/pkgs/development/python-modules/aspy-refactor-imports/default.nix
@@ -27,7 +27,7 @@ buildPythonPackage rec {
   ];
 
   # fails on darwin due to case-insensitive file system
-  disabledTests = lib.optional stdenv.isDarwin ["test_application_directory_case"];
+  disabledTests = lib.optionals stdenv.isDarwin ["test_application_directory_case"];
 
   meta = with lib; {
     description = "Utilities for refactoring imports in python-like syntax.";
diff --git a/pkgs/development/python-modules/asyncio_mqtt/default.nix b/pkgs/development/python-modules/asyncio_mqtt/default.nix
index c0ae1cea95f72..a87bca4396433 100644
--- a/pkgs/development/python-modules/asyncio_mqtt/default.nix
+++ b/pkgs/development/python-modules/asyncio_mqtt/default.nix
@@ -19,7 +19,7 @@ buildPythonPackage rec {
 
   propagatedBuildInputs = [
     paho-mqtt
-  ] ++ lib.optional (pythonOlder "3.7") [
+  ] ++ lib.optionals (pythonOlder "3.7") [
     async_generator
   ];
 
diff --git a/pkgs/development/python-modules/azure-core/default.nix b/pkgs/development/python-modules/azure-core/default.nix
index 5237130f59f80..75cf395876153 100644
--- a/pkgs/development/python-modules/azure-core/default.nix
+++ b/pkgs/development/python-modules/azure-core/default.nix
@@ -63,7 +63,7 @@ buildPythonPackage rec {
   # disable 8 tests failing on some darwin machines with errors:
   # azure.core.polling.base_polling.BadStatus: Invalid return status 403 for 'GET' operation
   # azure.core.exceptions.HttpResponseError: Operation returned an invalid status 'Forbidden'
-  ] ++ lib.optional stdenv.isDarwin [
+  ] ++ lib.optionals stdenv.isDarwin [
     "location_polling_fail"
   ];
   disabledTestPaths = [
diff --git a/pkgs/development/python-modules/betterproto/default.nix b/pkgs/development/python-modules/betterproto/default.nix
index 2f6ba2e29a236..b49204ee8c440 100644
--- a/pkgs/development/python-modules/betterproto/default.nix
+++ b/pkgs/development/python-modules/betterproto/default.nix
@@ -35,7 +35,7 @@ buildPythonPackage rec {
   propagatedBuildInputs = [
     grpclib
     python-dateutil
-  ] ++ lib.optional (pythonOlder "3.7") [
+  ] ++ lib.optionals (pythonOlder "3.7") [
     dataclasses
   ];
 
diff --git a/pkgs/development/python-modules/catboost/default.nix b/pkgs/development/python-modules/catboost/default.nix
index 02e107f27e19c..9a395bc6c98e2 100644
--- a/pkgs/development/python-modules/catboost/default.nix
+++ b/pkgs/development/python-modules/catboost/default.nix
@@ -19,7 +19,7 @@ buildPythonPackage rec {
   nativeBuildInputs = [ clang_12 python2 ];
 
   propagatedBuildInputs = [ graphviz matplotlib numpy pandas scipy plotly six ]
-    ++ lib.optional withCuda [ cudatoolkit ];
+    ++ lib.optionals withCuda [ cudatoolkit ];
 
   patches = [
     ./nix-support.patch
diff --git a/pkgs/development/python-modules/ciso8601/default.nix b/pkgs/development/python-modules/ciso8601/default.nix
index e210e974414d4..79afe8500072d 100644
--- a/pkgs/development/python-modules/ciso8601/default.nix
+++ b/pkgs/development/python-modules/ciso8601/default.nix
@@ -19,7 +19,7 @@ buildPythonPackage rec {
 
   checkInputs = [
     pytz
-  ] ++ lib.optional (isPy27) [
+  ] ++ lib.optionals (isPy27) [
     unittest2
   ];
 
diff --git a/pkgs/development/python-modules/deprecation/default.nix b/pkgs/development/python-modules/deprecation/default.nix
index 441971fa6e709..0e15f2d74c612 100644
--- a/pkgs/development/python-modules/deprecation/default.nix
+++ b/pkgs/development/python-modules/deprecation/default.nix
@@ -30,7 +30,7 @@ buildPythonPackage rec {
 
   # avoiding mass rebuilds for python3.9, but no longer
   # needed with patch
-  checkInputs = [ unittestCheckHook ] ++ lib.optional (pythonOlder "3.10") [
+  checkInputs = [ unittestCheckHook ] ++ lib.optionals (pythonOlder "3.10") [
     unittest2
   ];
 
diff --git a/pkgs/development/python-modules/dnspython/default.nix b/pkgs/development/python-modules/dnspython/default.nix
index 1dbbba48b1048..4b71485964920 100644
--- a/pkgs/development/python-modules/dnspython/default.nix
+++ b/pkgs/development/python-modules/dnspython/default.nix
@@ -21,7 +21,7 @@ buildPythonPackage rec {
 
   checkInputs = [
     pytestCheckHook
-  ] ++ lib.optional stdenv.isDarwin [
+  ] ++ lib.optionals stdenv.isDarwin [
     cacert
   ];
 
diff --git a/pkgs/development/python-modules/enlighten/default.nix b/pkgs/development/python-modules/enlighten/default.nix
index b6d31ddaf9478..e970aaee3375d 100644
--- a/pkgs/development/python-modules/enlighten/default.nix
+++ b/pkgs/development/python-modules/enlighten/default.nix
@@ -36,7 +36,7 @@ buildPythonPackage rec {
   disabledTests = [
     # AssertionError: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'> is not...
     "test_init"
-  ] ++ lib.optional stdenv.isDarwin [
+  ] ++ lib.optionals stdenv.isDarwin [
     # https://github.com/Rockhopper-Technologies/enlighten/issues/44
     "test_autorefresh"
   ];
diff --git a/pkgs/development/python-modules/fixtures/default.nix b/pkgs/development/python-modules/fixtures/default.nix
index 3e9f9943327d5..2bc6612ba70d4 100644
--- a/pkgs/development/python-modules/fixtures/default.nix
+++ b/pkgs/development/python-modules/fixtures/default.nix
@@ -19,7 +19,7 @@ buildPythonPackage rec {
     sha256 = "fcf0d60234f1544da717a9738325812de1f42c2fa085e2d9252d8fff5712b2ef";
   };
 
-  patches = lib.optional (pythonAtLeast "3.9") [
+  patches = lib.optionals (pythonAtLeast "3.9") [
     # drop tests that try to monkeypatch a classmethod, which fails on python3.9
     # https://github.com/testing-cabal/fixtures/issues/44
     (fetchpatch {
diff --git a/pkgs/development/python-modules/funcsigs/default.nix b/pkgs/development/python-modules/funcsigs/default.nix
index 115d358cb7869..a59b6f33b5f69 100644
--- a/pkgs/development/python-modules/funcsigs/default.nix
+++ b/pkgs/development/python-modules/funcsigs/default.nix
@@ -12,7 +12,7 @@ buildPythonPackage rec {
   };
 
   # https://github.com/testing-cabal/funcsigs/issues/10
-  patches = lib.optional (isPyPy && isPy3k) [ ./fix-pypy3-tests.patch ];
+  patches = lib.optionals (isPyPy && isPy3k) [ ./fix-pypy3-tests.patch ];
 
   # requires, unittest2 and package hasn't been maintained since 2013
   doCheck = false;
diff --git a/pkgs/development/python-modules/glymur/default.nix b/pkgs/development/python-modules/glymur/default.nix
index 40748f86954e1..9c652994a8c3d 100644
--- a/pkgs/development/python-modules/glymur/default.nix
+++ b/pkgs/development/python-modules/glymur/default.nix
@@ -26,7 +26,7 @@ buildPythonPackage rec {
 
   propagatedBuildInputs = [
     numpy
-  ] ++ lib.optional isPy27 [ contextlib2 mock importlib-resources ];
+  ] ++ lib.optionals isPy27 [ contextlib2 mock importlib-resources ];
 
   checkInputs = [
     scikitimage
diff --git a/pkgs/development/python-modules/hupper/default.nix b/pkgs/development/python-modules/hupper/default.nix
index 9726069746023..a9e8bd112163e 100644
--- a/pkgs/development/python-modules/hupper/default.nix
+++ b/pkgs/development/python-modules/hupper/default.nix
@@ -19,7 +19,7 @@ buildPythonPackage rec {
   # segfaults in the testsuite that end up failing the tests in a background thread (in myapp)
   checkInputs = [
     pytestCheckHook
-  ] ++ lib.optional (!stdenv.isDarwin) [
+  ] ++ lib.optionals (!stdenv.isDarwin) [
     watchdog
   ];
 
diff --git a/pkgs/development/python-modules/importlib-resources/default.nix b/pkgs/development/python-modules/importlib-resources/default.nix
index 7e5d7e1448acb..1247335687237 100644
--- a/pkgs/development/python-modules/importlib-resources/default.nix
+++ b/pkgs/development/python-modules/importlib-resources/default.nix
@@ -27,7 +27,7 @@ buildPythonPackage rec {
 
   propagatedBuildInputs = [
     importlib-metadata
-  ] ++ lib.optional (pythonOlder "3.5") [
+  ] ++ lib.optionals (pythonOlder "3.5") [
     typing
   ];
 
diff --git a/pkgs/development/python-modules/jaraco_text/default.nix b/pkgs/development/python-modules/jaraco_text/default.nix
index 341c744a42934..4891b2ea38c5f 100644
--- a/pkgs/development/python-modules/jaraco_text/default.nix
+++ b/pkgs/development/python-modules/jaraco_text/default.nix
@@ -37,13 +37,13 @@ buildPythonPackage rec {
     jaraco-context
     jaraco_functools
     inflect
-  ] ++ lib.optional (pythonOlder "3.9") [
+  ] ++ lib.optionals (pythonOlder "3.9") [
     importlib-resources
   ];
 
   checkInputs = [
     pytestCheckHook
-  ] ++ lib.optional (pythonOlder "3.10") [
+  ] ++ lib.optionals (pythonOlder "3.10") [
     pathlib2
   ];
 
diff --git a/pkgs/development/python-modules/jaxlib/default.nix b/pkgs/development/python-modules/jaxlib/default.nix
index 12ba67b712446..c745737d35235 100644
--- a/pkgs/development/python-modules/jaxlib/default.nix
+++ b/pkgs/development/python-modules/jaxlib/default.nix
@@ -219,11 +219,11 @@ let
     # relevant dependencies can be downloaded.
     bazelFlags = [
       "-c opt"
-    ] ++ lib.optional (stdenv.targetPlatform.isx86_64 && stdenv.targetPlatform.isUnix) [
+    ] ++ lib.optionals (stdenv.targetPlatform.isx86_64 && stdenv.targetPlatform.isUnix) [
       "--config=avx_posix"
-    ] ++ lib.optional cudaSupport [
+    ] ++ lib.optionals cudaSupport [
       "--config=cuda"
-    ] ++ lib.optional mklSupport [
+    ] ++ lib.optionals mklSupport [
       "--config=mkl_open_source_only"
     ] ++ lib.optionals stdenv.cc.isClang [
       # bazel depends on the compiler frontend automatically selecting these flags based on file
diff --git a/pkgs/development/python-modules/lightgbm/default.nix b/pkgs/development/python-modules/lightgbm/default.nix
index 015417151b7a2..ad54268c8cf59 100644
--- a/pkgs/development/python-modules/lightgbm/default.nix
+++ b/pkgs/development/python-modules/lightgbm/default.nix
@@ -23,7 +23,7 @@ buildPythonPackage rec {
 
   dontUseCmakeConfigure = true;
 
-  buildInputs = lib.optional stdenv.cc.isClang [ llvmPackages.openmp ];
+  buildInputs = lib.optionals stdenv.cc.isClang [ llvmPackages.openmp ];
   propagatedBuildInputs = [
     numpy
     scipy
diff --git a/pkgs/development/python-modules/markdown-it-py/default.nix b/pkgs/development/python-modules/markdown-it-py/default.nix
index f4c83d5df3486..d408c00710037 100644
--- a/pkgs/development/python-modules/markdown-it-py/default.nix
+++ b/pkgs/development/python-modules/markdown-it-py/default.nix
@@ -35,7 +35,7 @@ buildPythonPackage rec {
     attrs
     linkify-it-py
     mdurl
-  ] ++ lib.optional (pythonOlder "3.8") [
+  ] ++ lib.optionals (pythonOlder "3.8") [
     typing-extensions
   ];
 
diff --git a/pkgs/development/python-modules/matplotlib/default.nix b/pkgs/development/python-modules/matplotlib/default.nix
index ad32c3db7eb60..6a507d01ef3b0 100644
--- a/pkgs/development/python-modules/matplotlib/default.nix
+++ b/pkgs/development/python-modules/matplotlib/default.nix
@@ -39,9 +39,9 @@ buildPythonPackage rec {
   buildInputs = [
     which
     sphinx
-  ] ++ lib.optional enableGhostscript [
+  ] ++ lib.optionals enableGhostscript [
     ghostscript
-  ] ++ lib.optional stdenv.isDarwin [
+  ] ++ lib.optionals stdenv.isDarwin [
     Cocoa
   ];
 
diff --git a/pkgs/development/python-modules/nipy/default.nix b/pkgs/development/python-modules/nipy/default.nix
index 5bdf6fdcd4436..d5e399701dc86 100644
--- a/pkgs/development/python-modules/nipy/default.nix
+++ b/pkgs/development/python-modules/nipy/default.nix
@@ -21,7 +21,7 @@ buildPythonPackage rec {
     sha256 = "a8a2c97ce854fece4aced5a6394b9fdca5846150ad6d2a36b86590924af3c848";
   };
 
-  buildInputs = lib.optional doCheck [ nose ];
+  buildInputs = lib.optionals doCheck [ nose ];
   propagatedBuildInputs = [ matplotlib nibabel numpy scipy sympy ];
 
   checkPhase = ''    # wants to be run in a different directory
diff --git a/pkgs/development/python-modules/notebook/default.nix b/pkgs/development/python-modules/notebook/default.nix
index 4efaaf3f9ec94..fdb599466ff2b 100644
--- a/pkgs/development/python-modules/notebook/default.nix
+++ b/pkgs/development/python-modules/notebook/default.nix
@@ -68,7 +68,7 @@ buildPythonPackage rec {
     "sock_server"
     "test_list_formats" # tries to find python MIME type
     "KernelCullingTest" # has a race condition failing on slower hardware
-  ] ++ lib.optional stdenv.isDarwin [
+  ] ++ lib.optionals stdenv.isDarwin [
     "test_delete"
     "test_checkpoints_follow_file"
   ];
diff --git a/pkgs/development/python-modules/numba/default.nix b/pkgs/development/python-modules/numba/default.nix
index 2ca0e08ba5b1a..965130658c444 100644
--- a/pkgs/development/python-modules/numba/default.nix
+++ b/pkgs/development/python-modules/numba/default.nix
@@ -40,7 +40,7 @@ in buildPythonPackage rec {
 
   NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin "-I${lib.getDev libcxx}/include/c++/v1";
 
-  nativeBuildInputs = lib.optional cudaSupport [
+  nativeBuildInputs = lib.optionals cudaSupport [
     addOpenGLRunpath
   ];
 
diff --git a/pkgs/development/python-modules/paho-mqtt/default.nix b/pkgs/development/python-modules/paho-mqtt/default.nix
index fb249acf63333..e25f54748685a 100644
--- a/pkgs/development/python-modules/paho-mqtt/default.nix
+++ b/pkgs/development/python-modules/paho-mqtt/default.nix
@@ -22,7 +22,7 @@ buildPythonPackage rec {
   checkInputs = [
     pytestCheckHook
     six
-  ] ++ lib.optional (!isPy3k) [
+  ] ++ lib.optionals (!isPy3k) [
     mock
   ];
 
diff --git a/pkgs/development/python-modules/peewee/default.nix b/pkgs/development/python-modules/peewee/default.nix
index 86fcd3948a6c7..bb1370fe07376 100644
--- a/pkgs/development/python-modules/peewee/default.nix
+++ b/pkgs/development/python-modules/peewee/default.nix
@@ -34,9 +34,9 @@ buildPythonPackage rec {
 
   propagatedBuildInputs = [
     apsw
-  ] ++ lib.optional withPostgres [
+  ] ++ lib.optionals withPostgres [
     psycopg2
-  ] ++ lib.optional withMysql [
+  ] ++ lib.optionals withMysql [
     mysql-connector
   ];
 
diff --git a/pkgs/development/python-modules/pygit2/default.nix b/pkgs/development/python-modules/pygit2/default.nix
index 565cd6d67ec9d..413b79c562b1b 100644
--- a/pkgs/development/python-modules/pygit2/default.nix
+++ b/pkgs/development/python-modules/pygit2/default.nix
@@ -35,11 +35,11 @@ buildPythonPackage rec {
   propagatedBuildInputs = [
     cached-property
     pycparser
-  ] ++ lib.optional (!isPyPy) [
+  ] ++ lib.optionals (!isPyPy) [
     cffi
   ];
 
-  propagatedNativeBuildInputs = lib.optional (!isPyPy) [
+  propagatedNativeBuildInputs = lib.optionals (!isPyPy) [
     cffi
   ];
 
diff --git a/pkgs/development/python-modules/pyls-mypy/default.nix b/pkgs/development/python-modules/pyls-mypy/default.nix
index acce4469eed4d..ad387106e8854 100644
--- a/pkgs/development/python-modules/pyls-mypy/default.nix
+++ b/pkgs/development/python-modules/pyls-mypy/default.nix
@@ -38,7 +38,7 @@ buildPythonPackage rec {
 
   propagatedBuildInputs = [
     mypy python-language-server configparser
-  ] ++ lib.optional (isPy27) [
+  ] ++ lib.optionals (isPy27) [
     future
   ];
 
diff --git a/pkgs/development/python-modules/python-csxcad/default.nix b/pkgs/development/python-modules/python-csxcad/default.nix
index e6f22d37b55dd..66c1939c7edc1 100644
--- a/pkgs/development/python-modules/python-csxcad/default.nix
+++ b/pkgs/development/python-modules/python-csxcad/default.nix
@@ -32,7 +32,7 @@ buildPythonPackage rec {
     matplotlib
   ];
 
-  setupPyBuildFlags = "-I${openems}/include -L${openems}/lib -R${openems}/lib";
+  setupPyBuildFlags = [ "-I${openems}/include" "-L${openems}/lib" "-R${openems}/lib" ];
 
   meta = with lib; {
     description = "Python interface to CSXCAD";
diff --git a/pkgs/development/python-modules/python-miio/default.nix b/pkgs/development/python-modules/python-miio/default.nix
index d1497c43bcb73..32d5d542c30ae 100644
--- a/pkgs/development/python-modules/python-miio/default.nix
+++ b/pkgs/development/python-modules/python-miio/default.nix
@@ -54,7 +54,7 @@ buildPythonPackage rec {
     pyyaml
     tqdm
     zeroconf
-  ] ++ lib.optional (pythonOlder "3.8") [
+  ] ++ lib.optionals (pythonOlder "3.8") [
     importlib-metadata
   ];
 
diff --git a/pkgs/development/python-modules/python-openems/default.nix b/pkgs/development/python-modules/python-openems/default.nix
index dd669cf547545..348f10b3aeede 100644
--- a/pkgs/development/python-modules/python-openems/default.nix
+++ b/pkgs/development/python-modules/python-openems/default.nix
@@ -36,7 +36,7 @@ buildPythonPackage rec {
     h5py
   ];
 
-  setupPyBuildFlags = "-I${openems}/include -L${openems}/lib -R${openems}/lib";
+  setupPyBuildFlags = [ "-I${openems}/include" "-L${openems}/lib" "-R${openems}/lib" ];
   pythonImportsCheck = [ "openEMS" ];
 
   meta = with lib; {
diff --git a/pkgs/development/python-modules/python-telegram-bot/default.nix b/pkgs/development/python-modules/python-telegram-bot/default.nix
index 677322fc50d12..47d716d1c8685 100644
--- a/pkgs/development/python-modules/python-telegram-bot/default.nix
+++ b/pkgs/development/python-modules/python-telegram-bot/default.nix
@@ -43,7 +43,7 @@ buildPythonPackage rec {
       --replace "tornado==6.1" "tornado"
   '';
 
-  setupPyGlobalFlags = "--with-upstream-urllib3";
+  setupPyGlobalFlags = [ "--with-upstream-urllib3" ];
 
   # tests not included with release
   doCheck = false;
diff --git a/pkgs/development/python-modules/qutip/default.nix b/pkgs/development/python-modules/qutip/default.nix
index e99deef489f32..519cb9957bcc8 100644
--- a/pkgs/development/python-modules/qutip/default.nix
+++ b/pkgs/development/python-modules/qutip/default.nix
@@ -46,7 +46,7 @@ buildPythonPackage rec {
   ] ++ passthru.optional-dependencies.graphics;
 
   # Disabling OpenMP support on Darwin.
-  setupPyGlobalFlags = lib.optional (!stdenv.isDarwin) [
+  setupPyGlobalFlags = lib.optionals (!stdenv.isDarwin) [
     "--with-openmp"
   ];
 
diff --git a/pkgs/development/python-modules/rdflib/default.nix b/pkgs/development/python-modules/rdflib/default.nix
index 1aa995d85d772..27356390cfdab 100644
--- a/pkgs/development/python-modules/rdflib/default.nix
+++ b/pkgs/development/python-modules/rdflib/default.nix
@@ -68,7 +68,7 @@ buildPythonPackage rec {
     # Requires network access
     "test_service"
     "testGuessFormatForParse"
-  ] ++ lib.optional stdenv.isDarwin [
+  ] ++ lib.optionals stdenv.isDarwin [
     # Require loopback network access
     "TestGraphHTTP"
   ];
diff --git a/pkgs/development/python-modules/rich/default.nix b/pkgs/development/python-modules/rich/default.nix
index 36e7ca24fbdb1..c2cd935c651f0 100644
--- a/pkgs/development/python-modules/rich/default.nix
+++ b/pkgs/development/python-modules/rich/default.nix
@@ -35,9 +35,9 @@ buildPythonPackage rec {
   propagatedBuildInputs = [
     CommonMark
     pygments
-  ] ++ lib.optional (pythonOlder "3.7") [
+  ] ++ lib.optionals (pythonOlder "3.7") [
     dataclasses
-  ] ++ lib.optional (pythonOlder "3.9") [
+  ] ++ lib.optionals (pythonOlder "3.9") [
     typing-extensions
   ];
 
diff --git a/pkgs/development/python-modules/simple-di/default.nix b/pkgs/development/python-modules/simple-di/default.nix
index c79b58f8a6296..150eb52f8d4ed 100644
--- a/pkgs/development/python-modules/simple-di/default.nix
+++ b/pkgs/development/python-modules/simple-di/default.nix
@@ -23,7 +23,7 @@ buildPythonPackage rec {
   propagatedBuildInputs = [
     setuptools
     typing-extensions
-  ] ++ lib.optional (pythonOlder "3.7") [
+  ] ++ lib.optionals (pythonOlder "3.7") [
     dataclasses
   ];
 
diff --git a/pkgs/development/python-modules/spacy/default.nix b/pkgs/development/python-modules/spacy/default.nix
index cc1c01adf288e..f197b1080fb3e 100644
--- a/pkgs/development/python-modules/spacy/default.nix
+++ b/pkgs/development/python-modules/spacy/default.nix
@@ -63,7 +63,7 @@ buildPythonPackage rec {
     tqdm
     typer
     wasabi
-  ] ++ lib.optional (pythonOlder "3.8") [
+  ] ++ lib.optionals (pythonOlder "3.8") [
     typing-extensions
   ];
 
diff --git a/pkgs/development/python-modules/sphinx/default.nix b/pkgs/development/python-modules/sphinx/default.nix
index 0983fb7e7a738..5a27f04bd0ee0 100644
--- a/pkgs/development/python-modules/sphinx/default.nix
+++ b/pkgs/development/python-modules/sphinx/default.nix
@@ -107,7 +107,7 @@ buildPythonPackage rec {
     # requires imagemagick (increases build closure size), doesn't
     # test anything substantial
     "test_ext_imgconverter"
-  ] ++ lib.optional stdenv.isDarwin [
+  ] ++ lib.optionals stdenv.isDarwin [
     # Due to lack of network sandboxing can't guarantee port 7777 isn't bound
     "test_inspect_main_url"
     "test_auth_header_uses_first_match"
diff --git a/pkgs/development/python-modules/starlette/default.nix b/pkgs/development/python-modules/starlette/default.nix
index d1e8f789fc38c..78a428a2a724c 100644
--- a/pkgs/development/python-modules/starlette/default.nix
+++ b/pkgs/development/python-modules/starlette/default.nix
@@ -50,7 +50,7 @@ buildPythonPackage rec {
     typing-extensions
   ] ++ lib.optionals (pythonOlder "3.7") [
     contextlib2
-  ] ++ lib.optional stdenv.isDarwin [
+  ] ++ lib.optionals stdenv.isDarwin [
     ApplicationServices
   ];
 
diff --git a/pkgs/development/python-modules/tensorflow/bin.nix b/pkgs/development/python-modules/tensorflow/bin.nix
index b266f837f8499..ca3c818d34afa 100644
--- a/pkgs/development/python-modules/tensorflow/bin.nix
+++ b/pkgs/development/python-modules/tensorflow/bin.nix
@@ -82,7 +82,7 @@ in buildPythonPackage {
     ++ lib.optionals (pythonOlder "3.4") [ backports_weakref ];
 
   # remove patchelfUnstable once patchelf 0.14 with https://github.com/NixOS/patchelf/pull/256 becomes the default
-  nativeBuildInputs = [ wheel ] ++ lib.optional cudaSupport [ addOpenGLRunpath patchelfUnstable ];
+  nativeBuildInputs = [ wheel ] ++ lib.optionals cudaSupport [ addOpenGLRunpath patchelfUnstable ];
 
   preConfigure = ''
     unset SOURCE_DATE_EPOCH
diff --git a/pkgs/development/python-modules/tensorflow/default.nix b/pkgs/development/python-modules/tensorflow/default.nix
index 31fff4832052e..c8308b2f80ac1 100644
--- a/pkgs/development/python-modules/tensorflow/default.nix
+++ b/pkgs/development/python-modules/tensorflow/default.nix
@@ -483,7 +483,7 @@ in buildPythonPackage {
   ];
 
   # remove patchelfUnstable once patchelf 0.14 with https://github.com/NixOS/patchelf/pull/256 becomes the default
-  nativeBuildInputs = lib.optional cudaSupport [ addOpenGLRunpath patchelfUnstable ];
+  nativeBuildInputs = lib.optionals cudaSupport [ addOpenGLRunpath patchelfUnstable ];
 
   postFixup = lib.optionalString cudaSupport ''
     find $out -type f \( -name '*.so' -or -name '*.so.*' \) | while read lib; do
diff --git a/pkgs/development/python-modules/thinc/default.nix b/pkgs/development/python-modules/thinc/default.nix
index 51ee2803f3cfd..6da1ae8944508 100644
--- a/pkgs/development/python-modules/thinc/default.nix
+++ b/pkgs/development/python-modules/thinc/default.nix
@@ -66,9 +66,9 @@ buildPythonPackage rec {
     tqdm
     pydantic
     wasabi
-  ] ++ lib.optional (pythonOlder "3.8") [
+  ] ++ lib.optionals (pythonOlder "3.8") [
     typing-extensions
-  ] ++ lib.optional (pythonOlder "3.7") [
+  ] ++ lib.optionals (pythonOlder "3.7") [
     contextvars
     dataclasses
   ];
diff --git a/pkgs/development/python-modules/tzdata/default.nix b/pkgs/development/python-modules/tzdata/default.nix
index c701d3683cdb5..d1fed0b21fa96 100644
--- a/pkgs/development/python-modules/tzdata/default.nix
+++ b/pkgs/development/python-modules/tzdata/default.nix
@@ -25,7 +25,7 @@ buildPythonPackage rec {
   checkInputs = [
     pytestCheckHook
     pytest-subtests
-  ] ++ lib.optional (pythonOlder "3.7") [
+  ] ++ lib.optionals (pythonOlder "3.7") [
     importlib-resources
   ];
 
diff --git a/pkgs/development/python-modules/wandb/default.nix b/pkgs/development/python-modules/wandb/default.nix
index b1ad380f04b96..090b7a247651a 100644
--- a/pkgs/development/python-modules/wandb/default.nix
+++ b/pkgs/development/python-modules/wandb/default.nix
@@ -157,7 +157,7 @@ buildPythonPackage rec {
 
   # Disable test that fails on darwin due to issue with python3Packages.psutil:
   # https://github.com/giampaolo/psutil/issues/1219
-  disabledTests = lib.optional stdenv.isDarwin [
+  disabledTests = lib.optionals stdenv.isDarwin [
     "test_tpu_system_stats"
   ];
 
diff --git a/pkgs/development/python-modules/web3/default.nix b/pkgs/development/python-modules/web3/default.nix
index b07bc9cee9d75..8515ccda36254 100644
--- a/pkgs/development/python-modules/web3/default.nix
+++ b/pkgs/development/python-modules/web3/default.nix
@@ -56,7 +56,7 @@ buildPythonPackage rec {
     protobuf
     requests
     websockets
-  ] ++ lib.optional (pythonOlder "3.8") [
+  ] ++ lib.optionals (pythonOlder "3.8") [
     typing-extensions
   ] ++ eth-hash.optional-dependencies.pycryptodome;
 
diff --git a/pkgs/development/python-modules/yamllint/default.nix b/pkgs/development/python-modules/yamllint/default.nix
index 58d47d1fff9ca..ca092cef8c72e 100644
--- a/pkgs/development/python-modules/yamllint/default.nix
+++ b/pkgs/development/python-modules/yamllint/default.nix
@@ -30,7 +30,7 @@ buildPythonPackage rec {
   disabledTests = [
     # test failure reported upstream: https://github.com/adrienverge/yamllint/issues/373
     "test_find_files_recursively"
-  ] ++ lib.optional stdenv.isDarwin [
+  ] ++ lib.optionals stdenv.isDarwin [
     # locale tests are broken on BSDs; see https://github.com/adrienverge/yamllint/issues/307
     "test_locale_accents"
     "test_locale_case"
diff --git a/pkgs/development/tools/analysis/radare2/default.nix b/pkgs/development/tools/analysis/radare2/default.nix
index 63594300e835d..905e78fd76554 100644
--- a/pkgs/development/tools/analysis/radare2/default.nix
+++ b/pkgs/development/tools/analysis/radare2/default.nix
@@ -97,10 +97,10 @@ stdenv.mkDerivation rec {
     zlib
     openssl
     libuv
-  ] ++ lib.optional useX11 [ gtkdialog vte gtk2 ]
-    ++ lib.optional rubyBindings [ ruby ]
-    ++ lib.optional pythonBindings [ python3 ]
-    ++ lib.optional luaBindings [ lua ];
+  ] ++ lib.optionals useX11 [ gtkdialog vte gtk2 ]
+    ++ lib.optionals rubyBindings [ ruby ]
+    ++ lib.optionals pythonBindings [ python3 ]
+    ++ lib.optionals luaBindings [ lua ];
 
   propagatedBuildInputs = [
     # radare2 exposes r_lib which depends on these libraries
diff --git a/pkgs/development/tools/analysis/rr/zen_workaround.nix b/pkgs/development/tools/analysis/rr/zen_workaround.nix
index 193e70d0d95dc..3ec69aabf8d2c 100644
--- a/pkgs/development/tools/analysis/rr/zen_workaround.nix
+++ b/pkgs/development/tools/analysis/rr/zen_workaround.nix
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
   postConfigure = ''
     makeFlags="$makeFlags M=$(pwd)"
   '';
-  buildFlags = "modules";
+  buildFlags = [ "modules" ];
 
   installPhase = let
     modDestDir = "$out/lib/modules/${kernel.modDirVersion}/kernel"; #TODO: longer path?
diff --git a/pkgs/development/tools/analysis/sparse/default.nix b/pkgs/development/tools/analysis/sparse/default.nix
index ecc57a58b4b2b..7842954cde6a7 100644
--- a/pkgs/development/tools/analysis/sparse/default.nix
+++ b/pkgs/development/tools/analysis/sparse/default.nix
@@ -20,7 +20,7 @@ in stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkg-config ];
   buildInputs = [ gtk3 libxml2 llvm perl sqlite ];
   doCheck = true;
-  buildFlags = "GCC_BASE:=${GCC_BASE}";
+  buildFlags = [ "GCC_BASE:=${GCC_BASE}" ];
 
   passthru.tests = {
     simple-execution = callPackage ./tests.nix { };
diff --git a/pkgs/development/tools/database/prisma-engines/default.nix b/pkgs/development/tools/database/prisma-engines/default.nix
index fd25a497dc003..984b94cdc107c 100644
--- a/pkgs/development/tools/database/prisma-engines/default.nix
+++ b/pkgs/development/tools/database/prisma-engines/default.nix
@@ -45,7 +45,13 @@ rustPlatform.buildRustPackage rec {
     export SQLITE_MAX_EXPR_DEPTH=10000
   '';
 
-  cargoBuildFlags = "-p query-engine -p query-engine-node-api -p migration-engine-cli -p introspection-core -p prisma-fmt";
+  cargoBuildFlags = [
+    "-p" "query-engine"
+    "-p" "query-engine-node-api"
+    "-p" "migration-engine-cli"
+    "-p" "introspection-core"
+    "-p" "prisma-fmt"
+  ];
 
   postInstall = ''
     mv $out/lib/libquery_engine${stdenv.hostPlatform.extensions.sharedLibrary} $out/lib/libquery_engine.node
diff --git a/pkgs/development/tools/godot/default.nix b/pkgs/development/tools/godot/default.nix
index f04d4e9ab7c32..97c9786e8fd22 100644
--- a/pkgs/development/tools/godot/default.nix
+++ b/pkgs/development/tools/godot/default.nix
@@ -67,7 +67,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  sconsFlags = "target=release_debug platform=x11";
+  sconsFlags = [ "target=release_debug" "platform=x11" ];
   preConfigure = ''
     sconsFlags+=" ${
       lib.concatStringsSep " "
diff --git a/pkgs/development/tools/godot/export-templates.nix b/pkgs/development/tools/godot/export-templates.nix
index 9d306365f1901..74a78573a9837 100644
--- a/pkgs/development/tools/godot/export-templates.nix
+++ b/pkgs/development/tools/godot/export-templates.nix
@@ -3,7 +3,7 @@
 # https://docs.godotengine.org/en/stable/development/compiling/compiling_for_x11.html#building-export-templates
 godot.overrideAttrs (oldAttrs: rec {
   pname = "godot-export-templates";
-  sconsFlags = "target=release platform=x11 tools=no";
+  sconsFlags = [ "target=release" "platform=x11" "tools=no" ];
   installPhase = ''
     # The godot export command expects the export templates at
     # .../share/godot/templates/3.2.3.stable with 3.2.3 being the godot version.
diff --git a/pkgs/development/tools/godot/headless.nix b/pkgs/development/tools/godot/headless.nix
index a8d640eba1aa8..3e43a4f27f0c9 100644
--- a/pkgs/development/tools/godot/headless.nix
+++ b/pkgs/development/tools/godot/headless.nix
@@ -1,7 +1,7 @@
 { godot, lib }:
 godot.overrideAttrs (oldAttrs: rec {
   pname = "godot-headless";
-  sconsFlags = "target=release_debug platform=server tools=yes";
+  sconsFlags = [ "target=release_debug" "platform=server" "tools=yes" ];
   installPhase = ''
     mkdir -p "$out/bin"
     cp bin/godot_server.* $out/bin/godot-headless
diff --git a/pkgs/development/tools/godot/server.nix b/pkgs/development/tools/godot/server.nix
index 4254dc746b66c..06adf1bbfeb7f 100644
--- a/pkgs/development/tools/godot/server.nix
+++ b/pkgs/development/tools/godot/server.nix
@@ -1,7 +1,7 @@
 { godot, lib }:
 godot.overrideAttrs (oldAttrs: rec {
   pname = "godot-server";
-  sconsFlags = "target=release platform=server tools=no";
+  sconsFlags = [ "target=release" "platform=server" "tools=no" ];
   installPhase = ''
     mkdir -p "$out/bin"
     cp bin/godot_server.* $out/bin/godot-server
diff --git a/pkgs/development/tools/misc/bashdb/default.nix b/pkgs/development/tools/misc/bashdb/default.nix
index 918dd90aa83fe..c7d261e6f5ac8 100644
--- a/pkgs/development/tools/misc/bashdb/default.nix
+++ b/pkgs/development/tools/misc/bashdb/default.nix
@@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
       sha256 = "19zfzcnxavndyn6kfxp775kjcd0gigsm4y3bnh6fz5ilhnnbbbgr";
     })
   ];
-  patchFlags = "-p0";
+  patchFlags = [ "-p0" ];
 
   nativeBuildInputs = [
     makeWrapper
diff --git a/pkgs/development/tools/misc/pahole/default.nix b/pkgs/development/tools/misc/pahole/default.nix
index 1e923c380d6d8..7a60da1e53a3c 100644
--- a/pkgs/development/tools/misc/pahole/default.nix
+++ b/pkgs/development/tools/misc/pahole/default.nix
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake pkg-config ];
   buildInputs = [ elfutils zlib libbpf ]
-    ++ lib.optional stdenv.hostPlatform.isMusl [
+    ++ lib.optionals stdenv.hostPlatform.isMusl [
     argp-standalone
     musl-obstack
   ];
diff --git a/pkgs/development/tools/misc/pkg-config/default.nix b/pkgs/development/tools/misc/pkg-config/default.nix
index 70370e421261b..f2721ab952c64 100644
--- a/pkgs/development/tools/misc/pkg-config/default.nix
+++ b/pkgs/development/tools/misc/pkg-config/default.nix
@@ -28,9 +28,9 @@ stdenv.mkDerivation rec {
   buildInputs = optional (stdenv.isCygwin || stdenv.isDarwin || stdenv.isSunOS) libiconv;
 
   configureFlags = [ "--with-internal-glib" ]
-    ++ optional (stdenv.isSunOS) [ "--with-libiconv=gnu" "--with-system-library-path" "--with-system-include-path" "CFLAGS=-DENABLE_NLS" ]
+    ++ optionals (stdenv.isSunOS) [ "--with-libiconv=gnu" "--with-system-library-path" "--with-system-include-path" "CFLAGS=-DENABLE_NLS" ]
        # Can't run these tests while cross-compiling
-    ++ optional (stdenv.hostPlatform != stdenv.buildPlatform)
+    ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform)
        [ "glib_cv_stack_grows=no"
          "glib_cv_uscore=no"
          "ac_cv_func_posix_getpwuid_r=yes"
diff --git a/pkgs/development/tools/ocaml/dune/2.nix b/pkgs/development/tools/ocaml/dune/2.nix
index 30962eeba3113..65f8c7eda3ca1 100644
--- a/pkgs/development/tools/ocaml/dune/2.nix
+++ b/pkgs/development/tools/ocaml/dune/2.nix
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ ocaml findlib ];
   strictDeps = true;
 
-  buildFlags = "release";
+  buildFlags = [ "release" ];
 
   dontAddPrefix = true;
   dontAddStaticConfigureFlags = true;
diff --git a/pkgs/development/tools/ocaml/dune/3.nix b/pkgs/development/tools/ocaml/dune/3.nix
index 2917a4905bda0..01145e0237cb5 100644
--- a/pkgs/development/tools/ocaml/dune/3.nix
+++ b/pkgs/development/tools/ocaml/dune/3.nix
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
 
   strictDeps = true;
 
-  buildFlags = "release";
+  buildFlags = [ "release" ];
 
   dontAddPrefix = true;
   dontAddStaticConfigureFlags = true;
diff --git a/pkgs/development/tools/parsing/ragel/default.nix b/pkgs/development/tools/parsing/ragel/default.nix
index 81d7d9f0b35e2..0e8777e9f3f92 100644
--- a/pkgs/development/tools/parsing/ragel/default.nix
+++ b/pkgs/development/tools/parsing/ragel/default.nix
@@ -13,7 +13,7 @@ let
         inherit sha256;
       };
 
-      buildInputs = lib.optional build-manual [ fig2dev ghostscript tex ];
+      buildInputs = lib.optionals build-manual [ fig2dev ghostscript tex ];
 
       preConfigure = lib.optionalString build-manual ''
         sed -i "s/build_manual=no/build_manual=yes/g" DIST
diff --git a/pkgs/development/tools/poetry2nix/poetry2nix/overrides/default.nix b/pkgs/development/tools/poetry2nix/poetry2nix/overrides/default.nix
index a3204dd014773..d1a009f32c3ff 100644
--- a/pkgs/development/tools/poetry2nix/poetry2nix/overrides/default.nix
+++ b/pkgs/development/tools/poetry2nix/poetry2nix/overrides/default.nix
@@ -385,7 +385,7 @@ lib.composeManyExtensions [
           (
             old: {
               nativeBuildInputs = (old.nativeBuildInputs or [ ])
-                ++ lib.optional (lib.versionAtLeast old.version "3.4") [ self.setuptools-rust ]
+                ++ lib.optionals (lib.versionAtLeast old.version "3.4") [ self.setuptools-rust ]
                 ++ lib.optional (!self.isPyPy) pyBuildPackages.cffi
                 ++ lib.optional (lib.versionAtLeast old.version "3.5" && !isWheel)
                 (with pkgs.rustPlatform; [ cargoSetupHook rust.cargo rust.rustc ]);
@@ -1061,9 +1061,9 @@ lib.composeManyExtensions [
 
           buildInputs = old.buildInputs or [ ] ++ [
             pkgs.which
-          ] ++ lib.optional enableGhostscript [
+          ] ++ lib.optionals enableGhostscript [
             pkgs.ghostscript
-          ] ++ lib.optional stdenv.isDarwin [
+          ] ++ lib.optionals stdenv.isDarwin [
             Cocoa
           ];
 
@@ -1080,7 +1080,7 @@ lib.composeManyExtensions [
 
           nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [
             pkg-config
-          ] ++ lib.optional (lib.versionAtLeast super.matplotlib.version "3.5.0") [
+          ] ++ lib.optionals (lib.versionAtLeast super.matplotlib.version "3.5.0") [
             self.setuptools-scm
             self.setuptools-scm-git-archive
           ];
@@ -2029,7 +2029,7 @@ lib.composeManyExtensions [
         if old.format != "wheel" then {
           nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++
             [ pkgs.gfortran ] ++
-            lib.optional (lib.versionAtLeast super.scipy.version "1.7.0") [ self.pythran ];
+            lib.optionals (lib.versionAtLeast super.scipy.version "1.7.0") [ self.pythran ];
           propagatedBuildInputs = (old.propagatedBuildInputs or [ ]) ++ [ self.pybind11 ];
           setupPyBuildFlags = [ "--fcompiler='gnu95'" ];
           enableParallelBuilding = true;
diff --git a/pkgs/development/tools/summon/default.nix b/pkgs/development/tools/summon/default.nix
index 5c811aaf23912..2ed17061c2198 100644
--- a/pkgs/development/tools/summon/default.nix
+++ b/pkgs/development/tools/summon/default.nix
@@ -19,7 +19,7 @@ buildGoModule rec {
 
   # Patches provider resolver to support resolving unqualified names
   # from $PATH, e.g. `summon -p gopass` instead of `summon -p $(which gopass)`
-  patches = optional patchResolver [ ./resolve-paths.patch ];
+  patches = optionals patchResolver [ ./resolve-paths.patch ];
 
   postInstall = ''
     mv $out/bin/cmd $out/bin/summon
diff --git a/pkgs/games/anki/default.nix b/pkgs/games/anki/default.nix
index 3796741f96ca2..71575c35fd37d 100644
--- a/pkgs/games/anki/default.nix
+++ b/pkgs/games/anki/default.nix
@@ -101,7 +101,7 @@ buildPythonApplication rec {
     setuptools
   ]
   ++ lib.optional plotsSupport matplotlib
-  ++ lib.optional stdenv.isDarwin [ CoreAudio ]
+  ++ lib.optionals stdenv.isDarwin [ CoreAudio ]
   ;
 
   checkInputs = [ pytest glibcLocales nose ];
diff --git a/pkgs/games/blightmud/default.nix b/pkgs/games/blightmud/default.nix
index 32c9ddb653472..d737c4c282d21 100644
--- a/pkgs/games/blightmud/default.nix
+++ b/pkgs/games/blightmud/default.nix
@@ -18,7 +18,7 @@ rustPlatform.buildRustPackage rec {
 
   nativeBuildInputs = [ pkg-config ];
 
-  buildInputs = [ alsa-lib openssl ] ++ lib.optional withTTS [ speechd ];
+  buildInputs = [ alsa-lib openssl ] ++ lib.optionals withTTS [ speechd ];
 
   # Building the speech-dispatcher-sys crate for TTS support requires setting
   # LIBCLANG_PATH.
diff --git a/pkgs/games/darkplaces/default.nix b/pkgs/games/darkplaces/default.nix
index e7b70036cdff8..86e2a57274709 100644
--- a/pkgs/games/darkplaces/default.nix
+++ b/pkgs/games/darkplaces/default.nix
@@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
     SDL2
   ];
 
-  buildFlags = "release";
+  buildFlags = [ "release" ];
 
   installPhase = ''
     runHook preInstall
diff --git a/pkgs/games/freeciv/default.nix b/pkgs/games/freeciv/default.nix
index abe8aff15806a..4c18190e4fcc8 100644
--- a/pkgs/games/freeciv/default.nix
+++ b/pkgs/games/freeciv/default.nix
@@ -27,8 +27,8 @@ stdenv.mkDerivation rec {
   '';
 
   nativeBuildInputs = [ autoreconfHook pkg-config ]
-    ++ lib.optional qtClient [ qt5.wrapQtAppsHook ]
-    ++ lib.optional gtkClient [ wrapGAppsHook ];
+    ++ lib.optionals qtClient [ qt5.wrapQtAppsHook ]
+    ++ lib.optionals gtkClient [ wrapGAppsHook ];
 
   buildInputs = [ lua5_3 zlib bzip2 curl xz gettext libiconv icu ]
     ++ [ SDL2 SDL2_mixer SDL2_image SDL2_ttf SDL2_gfx freetype fluidsynth ]
diff --git a/pkgs/games/gimx/default.nix b/pkgs/games/gimx/default.nix
index 2728afe2c4920..785d38a759a02 100644
--- a/pkgs/games/gimx/default.nix
+++ b/pkgs/games/gimx/default.nix
@@ -37,7 +37,7 @@ in stdenv.mkDerivation rec {
       --replace "5E048E021001" "6F0E13020001"
   '';
 
-  makeFlags = "build-core";
+  makeFlags = [ "build-core" ];
   installPhase = ''
     runHook preInstall
 
diff --git a/pkgs/games/xonotic/default.nix b/pkgs/games/xonotic/default.nix
index d29e43850fbd3..cad021ff57051 100644
--- a/pkgs/games/xonotic/default.nix
+++ b/pkgs/games/xonotic/default.nix
@@ -66,8 +66,8 @@ let
 
     nativeBuildInputs = [ unzip ];
     buildInputs = [ libjpeg zlib libvorbis curl gmp ]
-      ++ lib.optional withGLX [ libX11.dev libGLU.dev libGL.dev libXpm.dev libXext.dev libXxf86vm.dev alsa-lib.dev ]
-      ++ lib.optional withSDL [ SDL2.dev ];
+      ++ lib.optionals withGLX [ libX11.dev libGLU.dev libGL.dev libXpm.dev libXext.dev libXxf86vm.dev alsa-lib.dev ]
+      ++ lib.optionals withSDL [ SDL2.dev ];
 
     sourceRoot = "Xonotic/source/darkplaces";
 
diff --git a/pkgs/misc/jackaudio/default.nix b/pkgs/misc/jackaudio/default.nix
index 2f7ffeb89f32a..441f3ccb37f4e 100644
--- a/pkgs/misc/jackaudio/default.nix
+++ b/pkgs/misc/jackaudio/default.nix
@@ -48,7 +48,7 @@ stdenv.mkDerivation rec {
         --replace /bin/bash ${bash}/bin/bash
   '';
 
-  dontAddWafCrossFlags = "true";
+  dontAddWafCrossFlags = true;
   wafConfigureFlags = [
     "--classic"
     "--autostart=${if (optDbus != null) then "dbus" else "classic"}"
diff --git a/pkgs/os-specific/darwin/apple-source-releases/ICU/default.nix b/pkgs/os-specific/darwin/apple-source-releases/ICU/default.nix
index cdebfe6d2f727..ed5e998714afe 100644
--- a/pkgs/os-specific/darwin/apple-source-releases/ICU/default.nix
+++ b/pkgs/os-specific/darwin/apple-source-releases/ICU/default.nix
@@ -13,7 +13,7 @@ in
 appleDerivation {
   nativeBuildInputs = [ python3 ];
 
-  depsBuildBuild = lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) [ buildPackages.stdenv.cc ];
+  depsBuildBuild = lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ buildPackages.stdenv.cc ];
 
   postPatch = ''
     substituteInPlace makefile \
diff --git a/pkgs/os-specific/darwin/apple-source-releases/xnu/default.nix b/pkgs/os-specific/darwin/apple-source-releases/xnu/default.nix
index 8b0d2054d58af..266c2ef4dfef5 100644
--- a/pkgs/os-specific/darwin/apple-source-releases/xnu/default.nix
+++ b/pkgs/os-specific/darwin/apple-source-releases/xnu/default.nix
@@ -12,7 +12,7 @@ appleDerivation' (if headersOnly then stdenvNoCC else stdenv) (
 
   nativeBuildInputs = [ bootstrap_cmds bison flex gnum4 unifdef perl python3 ];
 
-  patches = lib.optional stdenv.isx86_64 [ ./python3.patch ];
+  patches = lib.optionals stdenv.isx86_64 [ ./python3.patch ];
 
   postPatch = ''
     substituteInPlace Makefile \
diff --git a/pkgs/os-specific/darwin/libtapi/default.nix b/pkgs/os-specific/darwin/libtapi/default.nix
index eba61a15ccb95..d109e0edcbd81 100644
--- a/pkgs/os-specific/darwin/libtapi/default.nix
+++ b/pkgs/os-specific/darwin/libtapi/default.nix
@@ -17,7 +17,7 @@ stdenv.mkDerivation {
   # Also means we don't have to manually fix the result with install_name_tool.
   patches = [
     ./disable-rpath.patch
-  ] ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) [
+  ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
     # TODO: make unconditional and rebuild the world
     # TODO: send upstream
     ./native-clang-tblgen.patch
@@ -30,7 +30,7 @@ stdenv.mkDerivation {
   buildInputs = [ ncurses ];
 
   cmakeFlags = [ "-DLLVM_INCLUDE_TESTS=OFF" ]
-    ++ lib.optional (stdenv.buildPlatform != stdenv.hostPlatform) [
+    ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
       "-DCMAKE_CROSSCOMPILING=True"
       # This package could probably have a llvm_6 llvm-tblgen and clang-tblgen
       # provided to reduce some building. This package seems intended to
diff --git a/pkgs/os-specific/linux/exfat/default.nix b/pkgs/os-specific/linux/exfat/default.nix
index d459d24084427..ee6f448112d88 100644
--- a/pkgs/os-specific/linux/exfat/default.nix
+++ b/pkgs/os-specific/linux/exfat/default.nix
@@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
   makeFlags = [
     "KDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
     "ARCH=${stdenv.hostPlatform.linuxArch}"
-  ] ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) [
+  ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
     "CROSS_COMPILE=${stdenv.cc.targetPrefix}"
   ];
 
diff --git a/pkgs/os-specific/linux/gobi_loader/default.nix b/pkgs/os-specific/linux/gobi_loader/default.nix
index b7972007719c9..2b251242119c8 100644
--- a/pkgs/os-specific/linux/gobi_loader/default.nix
+++ b/pkgs/os-specific/linux/gobi_loader/default.nix
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
     substituteInPlace 60-gobi.rules --replace "/lib/firmware" "/run/current-system/firmware"
   '';
 
-  makeFlags = "prefix=${placeholder "out"}";
+  makeFlags = [ "prefix=${placeholder "out"}" ];
 
   meta = with lib; {
     description = "Firmware loader for Qualcomm Gobi USB chipsets";
diff --git a/pkgs/os-specific/linux/kernel-headers/default.nix b/pkgs/os-specific/linux/kernel-headers/default.nix
index 7e148b9145c65..ebf20a015c046 100644
--- a/pkgs/os-specific/linux/kernel-headers/default.nix
+++ b/pkgs/os-specific/linux/kernel-headers/default.nix
@@ -27,7 +27,7 @@ let
       flex bison python rsync
     ];
 
-    extraIncludeDirs = lib.optional (with stdenvNoCC.hostPlatform; isPower && is32bit && isBigEndian) ["ppc"];
+    extraIncludeDirs = lib.optionals (with stdenvNoCC.hostPlatform; isPower && is32bit && isBigEndian) ["ppc"];
 
     inherit patches;
 
diff --git a/pkgs/os-specific/linux/nvidia-x11/generic.nix b/pkgs/os-specific/linux/nvidia-x11/generic.nix
index 351d71ab8e2d4..ea9dbcabd0e90 100644
--- a/pkgs/os-specific/linux/nvidia-x11/generic.nix
+++ b/pkgs/os-specific/linux/nvidia-x11/generic.nix
@@ -101,7 +101,7 @@ let
     nativeBuildInputs = [ perl nukeReferences ]
       ++ optionals (!libsOnly) kernel.moduleBuildDependencies;
 
-    disallowedReferences = optional (!libsOnly) [ kernel.dev ];
+    disallowedReferences = optionals (!libsOnly) [ kernel.dev ];
 
     passthru = {
       open = mapNullable (hash: callPackage ./open.nix {
diff --git a/pkgs/os-specific/linux/rtl8812au/default.nix b/pkgs/os-specific/linux/rtl8812au/default.nix
index 03a5c0f4aeb41..6a1c4fc80daeb 100644
--- a/pkgs/os-specific/linux/rtl8812au/default.nix
+++ b/pkgs/os-specific/linux/rtl8812au/default.nix
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
     "KSRC=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
     ("CONFIG_PLATFORM_I386_PC=" + (if stdenv.hostPlatform.isx86 then "y" else "n"))
     ("CONFIG_PLATFORM_ARM_RPI=" + (if stdenv.hostPlatform.isAarch then "y" else "n"))
-  ] ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) [
+  ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
     "CROSS_COMPILE=${stdenv.cc.targetPrefix}"
   ];
 
diff --git a/pkgs/servers/dante/default.nix b/pkgs/servers/dante/default.nix
index 742ee2a0e684c..f5b2e5a785fc2 100644
--- a/pkgs/servers/dante/default.nix
+++ b/pkgs/servers/dante/default.nix
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
 
   dontAddDisableDepTrack = stdenv.isDarwin;
 
-  patches = lib.optional stdenv.hostPlatform.isMips64 [
+  patches = lib.optionals stdenv.hostPlatform.isMips64 [
     (fetchpatch {
       name = "0002-osdep-m4-Remove-getaddrinfo-too-low-checks.patch";
       url = "https://raw.githubusercontent.com/buildroot/buildroot/master/package/dante/0002-osdep-m4-Remove-getaddrinfo-too-low-checks.patch";
diff --git a/pkgs/servers/dns/knot-dns/default.nix b/pkgs/servers/dns/knot-dns/default.nix
index 6ed706c537868..286d2f2e93e0c 100644
--- a/pkgs/servers/dns/knot-dns/default.nix
+++ b/pkgs/servers/dns/knot-dns/default.nix
@@ -49,7 +49,7 @@ stdenv.mkDerivation rec {
   CFLAGS = [ "-O2" "-DNDEBUG" ];
 
   doCheck = true;
-  checkFlags = "V=1"; # verbose output in case some test fails
+  checkFlags = [ "V=1" ]; # verbose output in case some test fails
   doInstallCheck = true;
 
   postInstall = ''
diff --git a/pkgs/servers/foundationdb/cmake.nix b/pkgs/servers/foundationdb/cmake.nix
index 98fd6ca79813e..9d65198c8cef3 100644
--- a/pkgs/servers/foundationdb/cmake.nix
+++ b/pkgs/servers/foundationdb/cmake.nix
@@ -33,7 +33,7 @@ let
 
         buildInputs = [ libressl boost ];
         nativeBuildInputs = [ cmake ninja python3 openjdk mono ]
-          ++ lib.optional useClang [ llvmPackages.lld ];
+          ++ lib.optionals useClang [ llvmPackages.lld ];
 
         separateDebugInfo = true;
         dontFixCmake = true;
diff --git a/pkgs/servers/foundationdb/vsmake.nix b/pkgs/servers/foundationdb/vsmake.nix
index 284dc9fb3bd51..21ee2e4f8485e 100644
--- a/pkgs/servers/foundationdb/vsmake.nix
+++ b/pkgs/servers/foundationdb/vsmake.nix
@@ -84,11 +84,11 @@ let
         makeFlags = [ "all" "fdb_java" "fdb_python" ]
           # Don't compile FDBLibTLS if we don't need it in 6.0 or later;
           # it gets statically linked in
-          ++ lib.optional (lib.versionOlder version "6.0") [ "fdb_c" ]
+          ++ lib.optionals (lib.versionOlder version "6.0") [ "fdb_c" ]
           # Needed environment overrides
           ++ [ "KVRELEASE=1"
                "NOSTRIP=1"
-             ] ++ lib.optional officialRelease [ "RELEASE=true" ];
+             ] ++ lib.optionals officialRelease [ "RELEASE=true" ];
 
         # on 6.0 and later, we can specify all this information manually
         configurePhase = lib.optionalString (lib.versionAtLeast version "6.0") ''
diff --git a/pkgs/servers/geospatial/mapserver/default.nix b/pkgs/servers/geospatial/mapserver/default.nix
index d7012af0ffeea..ac8af5b7de0c6 100644
--- a/pkgs/servers/geospatial/mapserver/default.nix
+++ b/pkgs/servers/geospatial/mapserver/default.nix
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [
     cmake
     pkg-config
-  ] ++ lib.optional withPython [ swig python3.pkgs.setuptools ];
+  ] ++ lib.optionals withPython [ swig python3.pkgs.setuptools ];
 
   buildInputs = [
     cairo
diff --git a/pkgs/servers/matrix-conduit/default.nix b/pkgs/servers/matrix-conduit/default.nix
index de6ce56072c91..a3d4267b259f0 100644
--- a/pkgs/servers/matrix-conduit/default.nix
+++ b/pkgs/servers/matrix-conduit/default.nix
@@ -22,7 +22,7 @@ rustPlatform.buildRustPackage rec {
     rocksdb
   ];
 
-  cargoBuildFlags = "--bin conduit";
+  cargoBuildFlags = [ "--bin" "conduit" ];
 
   meta = with lib; {
     broken = stdenv.isDarwin;
diff --git a/pkgs/servers/misc/oven-media-engine/default.nix b/pkgs/servers/misc/oven-media-engine/default.nix
index 2c49da6846168..bcba5ce243aae 100644
--- a/pkgs/servers/misc/oven-media-engine/default.nix
+++ b/pkgs/servers/misc/oven-media-engine/default.nix
@@ -29,7 +29,7 @@ stdenv.mkDerivation rec {
   };
 
   sourceRoot = "source/src";
-  makeFlags = "release CONFIG_LIBRARY_PATHS= CONFIG_PKG_PATHS= GLOBAL_CC=$(CC) GLOBAL_CXX=$(CXX) GLOBAL_LD=$(CXX) SHELL=${stdenv.shell}";
+  makeFlags = [ "release" "CONFIG_LIBRARY_PATHS=" "CONFIG_PKG_PATHS=" "GLOBAL_CC=$(CC)" "GLOBAL_CXX=$(CXX)" "GLOBAL_LD=$(CXX)" "SHELL=${stdenv.shell}" ];
   enableParallelBuilding = true;
 
   nativeBuildInputs = [ bc pkg-config perl ];
diff --git a/pkgs/servers/nosql/dragonflydb/default.nix b/pkgs/servers/nosql/dragonflydb/default.nix
index ff4833cfaa603..db00061348018 100644
--- a/pkgs/servers/nosql/dragonflydb/default.nix
+++ b/pkgs/servers/nosql/dragonflydb/default.nix
@@ -87,7 +87,7 @@ stdenv.mkDerivation {
     "-DCMAKE_RANLIB=${gcc-unwrapped}/bin/gcc-ranlib"
   ];
 
-  ninjaFlags = "dragonfly";
+  ninjaFlags = [ "dragonfly" ];
 
   doCheck = false;
   dontUseNinjaInstall = true;
diff --git a/pkgs/servers/nosql/redis/default.nix b/pkgs/servers/nosql/redis/default.nix
index ab5a5672af692..d10d8b8c073d0 100644
--- a/pkgs/servers/nosql/redis/default.nix
+++ b/pkgs/servers/nosql/redis/default.nix
@@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
   # It's weird that the build isn't failing because of failure to compile dependencies, it's from failure to link them!
   makeFlags = [ "PREFIX=${placeholder "out"}" ]
     ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [ "AR=${stdenv.cc.targetPrefix}ar" "RANLIB=${stdenv.cc.targetPrefix}ranlib" "MALLOC=libc" ]
-    ++ lib.optional withSystemd [ "USE_SYSTEMD=yes" ]
+    ++ lib.optionals withSystemd [ "USE_SYSTEMD=yes" ]
     ++ lib.optionals tlsSupport [ "BUILD_TLS=yes" ];
 
   enableParallelBuilding = true;
diff --git a/pkgs/servers/samba/4.x.nix b/pkgs/servers/samba/4.x.nix
index e86527440cf44..c5607b4d037ed 100644
--- a/pkgs/servers/samba/4.x.nix
+++ b/pkgs/servers/samba/4.x.nix
@@ -141,7 +141,7 @@ stdenv.mkDerivation rec {
     ++ optional (!enablePam) "--without-pam"
     ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
     "--bundled-libraries=!asn1_compile,!compile_et"
-  ] ++ optional stdenv.isAarch32 [
+  ] ++ optionals stdenv.isAarch32 [
     # https://bugs.gentoo.org/683148
     "--jobs 1"
   ];
diff --git a/pkgs/servers/sql/mariadb/default.nix b/pkgs/servers/sql/mariadb/default.nix
index 7190f1209e08d..f75fada0d8a02 100644
--- a/pkgs/servers/sql/mariadb/default.nix
+++ b/pkgs/servers/sql/mariadb/default.nix
@@ -44,7 +44,7 @@ commonOptions = packageSettings: rec { # attributes common to both builds
     ++ lib.optionals stdenv.hostPlatform.isLinux ([ libkrb5 systemd ]
     ++ (if (lib.versionOlder version "10.6") then [ libaio ] else [ liburing ]))
     ++ lib.optionals stdenv.hostPlatform.isDarwin [ CoreServices cctools perl libedit ]
-    ++ lib.optional (!stdenv.hostPlatform.isDarwin) [ jemalloc ]
+    ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ jemalloc ]
     ++ (if (lib.versionOlder version "10.5") then [ pcre ] else [ pcre2 ])
     ++ (if (lib.versionOlder version "10.6")
       then [ openssl_1_1 (curl.override { openssl = openssl_1_1; }) ]
@@ -203,15 +203,15 @@ in stdenv.mkDerivation (common // {
     "-DWITHOUT_EXAMPLE=1"
     "-DWITHOUT_FEDERATED=1"
     "-DWITHOUT_TOKUDB=1"
-  ] ++ lib.optional (stdenv.hostPlatform.isLinux && !stdenv.hostPlatform.isAarch32) [
+  ] ++ lib.optionals (stdenv.hostPlatform.isLinux && !stdenv.hostPlatform.isAarch32) [
     "-DWITH_NUMA=ON"
-  ] ++ lib.optional (!withStorageMroonga) [
+  ] ++ lib.optionals (!withStorageMroonga) [
     "-DWITHOUT_MROONGA=1"
-  ] ++ lib.optional (!withStorageRocks) [
+  ] ++ lib.optionals (!withStorageRocks) [
     "-DWITHOUT_ROCKSDB=1"
-  ] ++ lib.optional (!stdenv.hostPlatform.isDarwin && withStorageRocks) [
+  ] ++ lib.optionals (!stdenv.hostPlatform.isDarwin && withStorageRocks) [
     "-DWITH_ROCKSDB_JEMALLOC=ON"
-  ] ++ lib.optional (!stdenv.hostPlatform.isDarwin) [
+  ] ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [
     "-DWITH_JEMALLOC=yes"
   ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
     "-DPLUGIN_AUTH_PAM=NO"
diff --git a/pkgs/shells/bash/5.1.nix b/pkgs/shells/bash/5.1.nix
index 390dab12c9476..0f50c72f5da0d 100644
--- a/pkgs/shells/bash/5.1.nix
+++ b/pkgs/shells/bash/5.1.nix
@@ -86,7 +86,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  makeFlags = optional stdenv.hostPlatform.isCygwin [
+  makeFlags = optionals stdenv.hostPlatform.isCygwin [
     "LOCAL_LDFLAGS=-Wl,--export-all,--out-implib,libbash.dll.a"
     "SHOBJ_LIBS=-lbash"
   ];
diff --git a/pkgs/shells/ion/default.nix b/pkgs/shells/ion/default.nix
index f20c80810a0bc..ce15dbf2d2556 100644
--- a/pkgs/shells/ion/default.nix
+++ b/pkgs/shells/ion/default.nix
@@ -20,7 +20,7 @@ rustPlatform.buildRustPackage rec {
     maintainers = with maintainers; [ dywedir ];
   };
 
-  buildInputs = lib.optional stdenv.hostPlatform.isDarwin [
+  buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [
     Security
     libiconv
   ];
diff --git a/pkgs/tools/X11/find-cursor/default.nix b/pkgs/tools/X11/find-cursor/default.nix
index c99c86a714e25..44a7c7662152c 100644
--- a/pkgs/tools/X11/find-cursor/default.nix
+++ b/pkgs/tools/X11/find-cursor/default.nix
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ installShellFiles git ];
   buildInputs = [ libX11 libXdamage libXrender libXcomposite libXext ];
   preInstall = "mkdir -p $out/share/man/man1";
-  installFlags = "PREFIX=${placeholder "out"}";
+  installFlags = [ "PREFIX=${placeholder "out"}" ];
 
   meta = with lib; {
     description = "Simple XLib program to highlight the cursor position";
diff --git a/pkgs/tools/X11/xmousepasteblock/default.nix b/pkgs/tools/X11/xmousepasteblock/default.nix
index 35db8a133a23c..984f6ac70a6b7 100644
--- a/pkgs/tools/X11/xmousepasteblock/default.nix
+++ b/pkgs/tools/X11/xmousepasteblock/default.nix
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
     sha256 = "0vidckfp277cg2gsww8a8q5b18m10iy4ppyp2qipr89771nrcmns";
     rev = version;
   };
-  makeFlags = "PREFIX=$(out)";
+  makeFlags = [ "PREFIX=$(out)" ];
   buildInputs = with xorg; [ libX11 libXext libXi libev ];
   nativeBuildInputs = [ pkg-config ];
   meta = with lib; {
diff --git a/pkgs/tools/cd-dvd/dvdisaster/default.nix b/pkgs/tools/cd-dvd/dvdisaster/default.nix
index 72f8cc0be2e98..55e0e51e5f448 100644
--- a/pkgs/tools/cd-dvd/dvdisaster/default.nix
+++ b/pkgs/tools/cd-dvd/dvdisaster/default.nix
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ gettext pkg-config which ];
   buildInputs = [ glib gtk2 ];
 
-  patches = lib.optional enableSoftening [
+  patches = lib.optionals enableSoftening [
     ./encryption.patch
     ./dvdrom.patch
   ];
diff --git a/pkgs/tools/compression/bsdiff/default.nix b/pkgs/tools/compression/bsdiff/default.nix
index b8a86eae89bde..6db5d99246771 100644
--- a/pkgs/tools/compression/bsdiff/default.nix
+++ b/pkgs/tools/compression/bsdiff/default.nix
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
     })
     ./CVE-2020-14315.patch
     ./include-systypes.patch
-  ] ++ lib.optional stdenv.hostPlatform.isLinux [
+  ] ++ lib.optionals stdenv.hostPlatform.isLinux [
     (fetchpatch {
       url = "https://sources.debian.org/data/main/b/bsdiff/4.3-22/debian/patches/30-bug-632585-mmap-src-file-instead-of-malloc-read-it.patch";
       sha256 = "sha256-esbhz2/efUiuQDuF7LGfSeEn3/f1WbqCxQpTs2A0ulI=";
diff --git a/pkgs/tools/graphics/mangohud/default.nix b/pkgs/tools/graphics/mangohud/default.nix
index 7202f9f8b5628..9639a7881f0f4 100644
--- a/pkgs/tools/graphics/mangohud/default.nix
+++ b/pkgs/tools/graphics/mangohud/default.nix
@@ -108,7 +108,7 @@ in stdenv.mkDerivation rec {
       libdbus = dbus.lib;
       inherit hwdata libX11;
     })
-  ] ++ lib.optional (stdenv.hostPlatform.system == "x86_64-linux") [
+  ] ++ lib.optionals (stdenv.hostPlatform.system == "x86_64-linux") [
     # Support 32bit OpenGL applications by appending the mangohud32
     # lib path to LD_LIBRARY_PATH.
     #
diff --git a/pkgs/tools/misc/hiksink/default.nix b/pkgs/tools/misc/hiksink/default.nix
index 9cc91035afe05..05d7e1c9f44ea 100644
--- a/pkgs/tools/misc/hiksink/default.nix
+++ b/pkgs/tools/misc/hiksink/default.nix
@@ -26,7 +26,7 @@ rustPlatform.buildRustPackage rec {
 
   buildInputs = [
     openssl
-  ] ++ lib.optional stdenv.isDarwin [
+  ] ++ lib.optionals stdenv.isDarwin [
     Security
   ];
 
diff --git a/pkgs/tools/misc/jsonwatch/default.nix b/pkgs/tools/misc/jsonwatch/default.nix
index 3fe4f5008fd69..6f11e7d97e5da 100644
--- a/pkgs/tools/misc/jsonwatch/default.nix
+++ b/pkgs/tools/misc/jsonwatch/default.nix
@@ -18,7 +18,7 @@ rustPlatform.buildRustPackage rec {
 
   cargoSha256 = "sha256-Gjb7v3kz11iOml3Ykxhy43KNxzaprgMbb5DpPNChLTc=";
 
-  buildInputs = lib.optional stdenv.isDarwin [
+  buildInputs = lib.optionals stdenv.isDarwin [
     Security
   ];
 
diff --git a/pkgs/tools/misc/less/default.nix b/pkgs/tools/misc/less/default.nix
index df8d9eef22ac5..a7212ccf7648a 100644
--- a/pkgs/tools/misc/less/default.nix
+++ b/pkgs/tools/misc/less/default.nix
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
   };
 
   configureFlags = [ "--sysconfdir=/etc" ] # Look for ‘sysless’ in /etc.
-    ++ lib.optional lessSecure [ "--with-secure" ];
+    ++ lib.optionals lessSecure [ "--with-secure" ];
 
   buildInputs = [ ncurses ];
 
diff --git a/pkgs/tools/misc/man-db/default.nix b/pkgs/tools/misc/man-db/default.nix
index 3e34a81cd4f82..4c23143b103ee 100644
--- a/pkgs/tools/misc/man-db/default.nix
+++ b/pkgs/tools/misc/man-db/default.nix
@@ -53,7 +53,7 @@ stdenv.mkDerivation rec {
     "--with-systemdtmpfilesdir=${placeholder "out"}/lib/tmpfiles.d"
     "--with-systemdsystemunitdir=${placeholder "out"}/lib/systemd/system"
     "--with-pager=less"
-  ] ++ lib.optional stdenv.hostPlatform.isDarwin [
+  ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
     "ac_cv_func__set_invalid_parameter_handler=no"
     "ac_cv_func_posix_fadvise=no"
     "ac_cv_func_mempcpy=no"
diff --git a/pkgs/tools/misc/otfcc/default.nix b/pkgs/tools/misc/otfcc/default.nix
index b233e94f4f60f..b6c971dd3c2ef 100644
--- a/pkgs/tools/misc/otfcc/default.nix
+++ b/pkgs/tools/misc/otfcc/default.nix
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
     ./move-makefiles.patch
   ];
 
-  buildFlags = lib.optional stdenv.isAarch64 [ "config=release_arm" ];
+  buildFlags = lib.optionals stdenv.isAarch64 [ "config=release_arm" ];
 
   installPhase = ''
     mkdir -p $out/bin
diff --git a/pkgs/tools/misc/pre-commit/default.nix b/pkgs/tools/misc/pre-commit/default.nix
index 4c455d6fb2d7b..1d475ead4605a 100644
--- a/pkgs/tools/misc/pre-commit/default.nix
+++ b/pkgs/tools/misc/pre-commit/default.nix
@@ -37,9 +37,9 @@ buildPythonPackage rec {
     pyyaml
     toml
     virtualenv
-  ] ++ lib.optional (pythonOlder "3.8") [
+  ] ++ lib.optionals (pythonOlder "3.8") [
     importlib-metadata
-  ] ++ lib.optional (pythonOlder "3.7") [
+  ] ++ lib.optionals (pythonOlder "3.7") [
     importlib-resources
   ];
 
diff --git a/pkgs/tools/misc/rust-motd/default.nix b/pkgs/tools/misc/rust-motd/default.nix
index a2c7710984ea9..b881d94438cd7 100644
--- a/pkgs/tools/misc/rust-motd/default.nix
+++ b/pkgs/tools/misc/rust-motd/default.nix
@@ -26,7 +26,7 @@ rustPlatform.buildRustPackage rec {
 
   buildInputs = [
     openssl
-  ] ++ lib.optional stdenv.isDarwin [
+  ] ++ lib.optionals stdenv.isDarwin [
     Security
   ];
 
diff --git a/pkgs/tools/misc/sheldon/default.nix b/pkgs/tools/misc/sheldon/default.nix
index db6aa9d8f1708..8f2c458fe1d6f 100644
--- a/pkgs/tools/misc/sheldon/default.nix
+++ b/pkgs/tools/misc/sheldon/default.nix
@@ -20,7 +20,7 @@ rustPlatform.buildRustPackage rec {
 
   cargoSha256 = "sha256-uRcaHuDLQm6OYqt01kLbW/mfZnL4HaDabaweaw1EOfs=";
 
-  buildInputs = [ openssl ] ++ lib.optional stdenv.isDarwin [ Security curl ];
+  buildInputs = [ openssl ] ++ lib.optionals stdenv.isDarwin [ Security curl ];
   nativeBuildInputs = [ installShellFiles pkg-config ];
 
   # Needs network connection
diff --git a/pkgs/tools/misc/ttwatch/default.nix b/pkgs/tools/misc/ttwatch/default.nix
index ecfc40bdf6f34..273d34ffdb8e4 100644
--- a/pkgs/tools/misc/ttwatch/default.nix
+++ b/pkgs/tools/misc/ttwatch/default.nix
@@ -17,7 +17,7 @@ stdenv.mkDerivation {
   nativeBuildInputs = [ cmake perl pkg-config ];
   buildInputs = [ openssl curl libusb1 protobufc ];
 
-  cmakeFlags = lib.optional enableUnsafe [ "-Dunsafe=on" ];
+  cmakeFlags = lib.optionals enableUnsafe [ "-Dunsafe=on" ];
 
   preFixup = ''
     chmod +x $out/bin/ttbin2mysports
diff --git a/pkgs/tools/networking/bore-cli/default.nix b/pkgs/tools/networking/bore-cli/default.nix
index 5ca16499fe823..ae39bfb6204fd 100644
--- a/pkgs/tools/networking/bore-cli/default.nix
+++ b/pkgs/tools/networking/bore-cli/default.nix
@@ -18,7 +18,7 @@ rustPlatform.buildRustPackage rec {
 
   cargoSha256 = "sha256-ZnEVTFiPo3AFyo1BoV88X2nCqYzRK6PkcbawiR+QnV0=";
 
-  buildInputs = lib.optional stdenv.isDarwin [
+  buildInputs = lib.optionals stdenv.isDarwin [
     Security
   ];
 
diff --git a/pkgs/tools/networking/bore/default.nix b/pkgs/tools/networking/bore/default.nix
index 66334e0621034..e7934428a958d 100644
--- a/pkgs/tools/networking/bore/default.nix
+++ b/pkgs/tools/networking/bore/default.nix
@@ -12,7 +12,7 @@ rustPlatform.buildRustPackage rec {
   };
 
   cargoSha256 = "1xlbfzmy0wjyz3jpr17r4ma4i79d9b32yqwwi10vrcjzr7vsyhmx";
-  cargoBuildFlags = "-p ${pname}";
+  cargoBuildFlags = [ "-p" pname ];
 
   # FIXME can’t test --all-targets and --doc in a single invocation
   cargoTestFlags = [ "--all-targets" "--workspace" ];
diff --git a/pkgs/tools/networking/eternal-terminal/default.nix b/pkgs/tools/networking/eternal-terminal/default.nix
index 05e3152bec192..96315e305ad56 100644
--- a/pkgs/tools/networking/eternal-terminal/default.nix
+++ b/pkgs/tools/networking/eternal-terminal/default.nix
@@ -43,7 +43,7 @@ stdenv.mkDerivation rec {
     "-DDISABLE_CRASH_LOG=TRUE"
   ];
 
-  CXXFLAGS = lib.optional stdenv.cc.isClang [
+  CXXFLAGS = lib.optionals stdenv.cc.isClang [
     "-std=c++17"
   ];
 
diff --git a/pkgs/tools/networking/ipv6calc/default.nix b/pkgs/tools/networking/ipv6calc/default.nix
index 6df96e268effa..8489ffd6f7074 100644
--- a/pkgs/tools/networking/ipv6calc/default.nix
+++ b/pkgs/tools/networking/ipv6calc/default.nix
@@ -43,11 +43,11 @@ stdenv.mkDerivation rec {
     "--disable-bundled-md5"
     "--disable-dynamic-load"
     "--enable-shared"
-  ] ++ lib.optional (libmaxminddb != null) [
+  ] ++ lib.optionals (libmaxminddb != null) [
     "--enable-mmdb"
-  ] ++ lib.optional (geolite-legacy != null) [
+  ] ++ lib.optionals (geolite-legacy != null) [
     "--with-geoip-db=${geolite-legacy}/share/GeoIP"
-  ] ++ lib.optional (ip2location-c != null) [
+  ] ++ lib.optionals (ip2location-c != null) [
     "--enable-ip2location"
   ];
 
diff --git a/pkgs/tools/networking/rathole/default.nix b/pkgs/tools/networking/rathole/default.nix
index ceaf89ef92e96..cb392114e0627 100644
--- a/pkgs/tools/networking/rathole/default.nix
+++ b/pkgs/tools/networking/rathole/default.nix
@@ -21,7 +21,7 @@ rustPlatform.buildRustPackage rec {
 
   nativeBuildInputs = [ pkg-config ];
 
-  buildInputs = [ openssl ] ++ lib.optional stdenv.isDarwin [ CoreServices ];
+  buildInputs = [ openssl ] ++ lib.optionals stdenv.isDarwin [ CoreServices ];
 
   __darwinAllowLocalNetworking = true;
 
diff --git a/pkgs/tools/networking/termscp/default.nix b/pkgs/tools/networking/termscp/default.nix
index 7fbf30614e7ac..70e1643199400 100644
--- a/pkgs/tools/networking/termscp/default.nix
+++ b/pkgs/tools/networking/termscp/default.nix
@@ -33,7 +33,7 @@ rustPlatform.buildRustPackage rec {
     dbus
     libssh
     openssl
-  ] ++ lib.optional stdenv.isDarwin [
+  ] ++ lib.optionals stdenv.isDarwin [
     AppKit
     Cocoa
     Foundation
diff --git a/pkgs/tools/networking/toxvpn/default.nix b/pkgs/tools/networking/toxvpn/default.nix
index 57a5510bd4306..633ecf654924e 100644
--- a/pkgs/tools/networking/toxvpn/default.nix
+++ b/pkgs/tools/networking/toxvpn/default.nix
@@ -26,7 +26,7 @@ stdenv.mkDerivation {
 
   nativeBuildInputs = [ cmake ];
 
-  cmakeFlags = lib.optional stdenv.isLinux [ "-DSYSTEMD=1" ];
+  cmakeFlags = lib.optionals stdenv.isLinux [ "-DSYSTEMD=1" ];
 
   postInstall = "$out/bin/toxvpn -h";
 
diff --git a/pkgs/tools/networking/unbound/default.nix b/pkgs/tools/networking/unbound/default.nix
index 25fcc1bcc397e..5e44eb0dabf58 100644
--- a/pkgs/tools/networking/unbound/default.nix
+++ b/pkgs/tools/networking/unbound/default.nix
@@ -75,7 +75,7 @@ stdenv.mkDerivation rec {
     "--with-rootkey-file=${dns-root-data}/root.key"
     "--enable-pie"
     "--enable-relro-now"
-  ] ++ lib.optional stdenv.hostPlatform.isStatic [
+  ] ++ lib.optionals stdenv.hostPlatform.isStatic [
     "--disable-flto"
   ] ++ lib.optionals withSystemd [
     "--enable-systemd"
diff --git a/pkgs/tools/networking/vde2/default.nix b/pkgs/tools/networking/vde2/default.nix
index c14aa8bb3c13b..83cee2e466af5 100644
--- a/pkgs/tools/networking/vde2/default.nix
+++ b/pkgs/tools/networking/vde2/default.nix
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
     sha256 = "sha256-Yf6QB7j5lYld2XtqhYspK4037lTtimoFc7nCavCP+mU=";
   };
 
-  patches = lib.optional stdenv.hostPlatform.isMusl [
+  patches = lib.optionals stdenv.hostPlatform.isMusl [
     (fetchpatch {
       url = "https://git.alpinelinux.org/aports/plain/main/vde2/musl-build-fix.patch?id=ddee2f86a48e087867d4a2c12849b2e3baccc238";
       sha256 = "0b5382v541bkxhqylilcy34bh83ag96g71f39m070jzvi84kx8af";
diff --git a/pkgs/tools/networking/wg-netmanager/default.nix b/pkgs/tools/networking/wg-netmanager/default.nix
index 0c74fe4ad04c9..15dc7b163b573 100644
--- a/pkgs/tools/networking/wg-netmanager/default.nix
+++ b/pkgs/tools/networking/wg-netmanager/default.nix
@@ -17,7 +17,7 @@ rustPlatform.buildRustPackage rec {
 
   # Test 01 tries to create a wireguard interface, which requires sudo.
   doCheck = true;
-  checkFlags = "--skip device";
+  checkFlags = [ "--skip" "device" ];
 
   meta = with lib; {
     description = "Wireguard network manager";
diff --git a/pkgs/tools/package-management/nix/common.nix b/pkgs/tools/package-management/nix/common.nix
index f69ee083af1f5..95fbd0782b798 100644
--- a/pkgs/tools/package-management/nix/common.nix
+++ b/pkgs/tools/package-management/nix/common.nix
@@ -113,7 +113,7 @@ self = stdenv.mkDerivation {
 
   propagatedBuildInputs = [
     boehmgc
-  ] ++ lib.optional (atLeast27) [
+  ] ++ lib.optionals (atLeast27) [
     nlohmann_json
   ];
 
diff --git a/pkgs/tools/security/asc-key-to-qr-code-gif/default.nix b/pkgs/tools/security/asc-key-to-qr-code-gif/default.nix
index 13327a84fff00..28913c685778b 100644
--- a/pkgs/tools/security/asc-key-to-qr-code-gif/default.nix
+++ b/pkgs/tools/security/asc-key-to-qr-code-gif/default.nix
@@ -23,7 +23,7 @@ stdenv.mkDerivation {
     substitutions = [
       ''--replace "convert" "${imagemagick}/bin/convert"''
       ''--replace "qrencode" "${qrencode.bin}/bin/qrencode"''
-    ] ++ lib.optional testQR [
+    ] ++ lib.optionals testQR [
       ''--replace "hash zbarimg" "true"'' # hash does not work on NixOS
       ''--replace "$(zbarimg --raw" "$(${zbar.out}/bin/zbarimg --raw"''
     ];
diff --git a/pkgs/tools/security/chipsec/default.nix b/pkgs/tools/security/chipsec/default.nix
index 5b4957139d753..64a4946136f09 100644
--- a/pkgs/tools/security/chipsec/default.nix
+++ b/pkgs/tools/security/chipsec/default.nix
@@ -48,7 +48,7 @@ python3.pkgs.buildPythonApplication rec {
 
   setupPyBuildFlags = [
     "--build-lib=$CHIPSEC_BUILD_LIB"
-  ] ++ lib.optional (!withDriver) [
+  ] ++ lib.optionals (!withDriver) [
     "--skip-driver"
   ];
 
diff --git a/pkgs/tools/security/rhash/default.nix b/pkgs/tools/security/rhash/default.nix
index e071f460b1aa9..b539772213bb6 100644
--- a/pkgs/tools/security/rhash/default.nix
+++ b/pkgs/tools/security/rhash/default.nix
@@ -46,7 +46,7 @@ stdenv.mkDerivation rec {
   installTargets = [
     "install"
     "install-lib-headers"
-  ] ++ lib.optional (!enableStatic) [
+  ] ++ lib.optionals (!enableStatic) [
     "install-lib-so-link"
   ];
 
diff --git a/pkgs/tools/security/sudo/default.nix b/pkgs/tools/security/sudo/default.nix
index 429027df872df..d667734ef9916 100644
--- a/pkgs/tools/security/sudo/default.nix
+++ b/pkgs/tools/security/sudo/default.nix
@@ -35,10 +35,10 @@ stdenv.mkDerivation rec {
     "--with-iologdir=/var/log/sudo-io"
     "--with-sendmail=${sendmailPath}"
     "--enable-tmpfiles.d=no"
-  ] ++ lib.optional withInsults [
+  ] ++ lib.optionals withInsults [
     "--with-insults"
     "--with-all-insults"
-  ] ++ lib.optional withSssd [
+  ] ++ lib.optionals withSssd [
     "--with-sssd"
     "--with-sssd-lib=${sssd}/lib"
   ];
diff --git a/pkgs/tools/system/chase/default.nix b/pkgs/tools/system/chase/default.nix
index ff4885b088d5f..d20d33235cf87 100644
--- a/pkgs/tools/system/chase/default.nix
+++ b/pkgs/tools/system/chase/default.nix
@@ -12,8 +12,7 @@ stdenv.mkDerivation rec {
   };
 
   doCheck = true;
-  makeFlags = [ "-e" ];
-  makeFlagsArray="LIBS=-lgc";
+  makeFlags = [ "-e" "LIBS=-lgc" ];
 
   meta = with lib ; {
     description = "Follow a symlink and print out its target file";
diff --git a/pkgs/tools/system/fio/default.nix b/pkgs/tools/system/fio/default.nix
index 0fc90be2dcbf1..c2c46e9a5d14e 100644
--- a/pkgs/tools/system/fio/default.nix
+++ b/pkgs/tools/system/fio/default.nix
@@ -31,7 +31,7 @@ stdenv.mkDerivation rec {
 
   pythonPath = [ python3.pkgs.six ];
 
-  makeWrapperArgs = lib.optional withGnuplot [
+  makeWrapperArgs = lib.optionals withGnuplot [
     "--prefix PATH : ${lib.makeBinPath [ gnuplot ]}"
   ];
 
diff --git a/pkgs/tools/system/netdata/default.nix b/pkgs/tools/system/netdata/default.nix
index 96ca146358d26..d27ebc4e2a64a 100644
--- a/pkgs/tools/system/netdata/default.nix
+++ b/pkgs/tools/system/netdata/default.nix
@@ -99,9 +99,9 @@ in stdenv.mkDerivation rec {
     "--sysconfdir=/etc"
     "--disable-ebpf"
     "--with-jemalloc=${jemalloc}"
-  ] ++ optional (!withDBengine) [
+  ] ++ optionals (!withDBengine) [
     "--disable-dbengine"
-  ] ++ optional (!withCloud) [
+  ] ++ optionals (!withCloud) [
     "--disable-cloud"
   ];
 
diff --git a/pkgs/tools/system/tre-command/default.nix b/pkgs/tools/system/tre-command/default.nix
index f79c1625fbf25..971aa29b9644a 100644
--- a/pkgs/tools/system/tre-command/default.nix
+++ b/pkgs/tools/system/tre-command/default.nix
@@ -22,7 +22,7 @@ rustPlatform.buildRustPackage rec {
   '';
 
   # this test requires package to be in a git repo to succeed
-  checkFlags = "--skip respect_git_ignore";
+  checkFlags = [ "--skip" "respect_git_ignore" ];
 
   meta = with lib; {
     description = "Tree command, improved";
diff --git a/pkgs/top-level/perl-packages.nix b/pkgs/top-level/perl-packages.nix
index 5384881159288..a2b547d5fbb70 100644
--- a/pkgs/top-level/perl-packages.nix
+++ b/pkgs/top-level/perl-packages.nix
@@ -849,7 +849,7 @@ let
     };
     buildInputs = [ PodParser ];
     propagatedBuildInputs = [ AppPackager FileLoadLines IOString ImageInfo PDFAPI2 StringInterpolateNamed TextLayout ]
-      ++ lib.optional (!stdenv.isDarwin) [ Wx ];
+      ++ lib.optionals (!stdenv.isDarwin) [ Wx ];
     nativeBuildInputs = lib.optional stdenv.isDarwin shortenPerlShebang;
     postInstall = lib.optionalString stdenv.isDarwin ''
       shortenPerlShebang $out/bin/chordpro
@@ -5288,7 +5288,7 @@ let
       hash = "sha256-+OzKRch+uRMlmSsT8FlPgI5vG8TDuafxQbmoODhNJSw=";
     };
 
-    makeMakerFlags = "--libpath=${lib.getLib pkgs.openssl}/lib --incpath=${pkgs.openssl.dev}/include";
+    makeMakerFlags = [ "--libpath=${lib.getLib pkgs.openssl}/lib" "--incpath=${pkgs.openssl.dev}/include" ];
     buildInputs = [ PathClass ];
     propagatedBuildInputs = [ BytesRandomSecure LWPProtocolHttps ];
     meta = {
@@ -6697,7 +6697,7 @@ let
       })
     ];
 
-    makeMakerFlags = "SQLITE_INC=${pkgs.sqlite.dev}/include SQLITE_LIB=${pkgs.sqlite.out}/lib";
+    makeMakerFlags = [ "SQLITE_INC=${pkgs.sqlite.dev}/include" "SQLITE_LIB=${pkgs.sqlite.out}/lib" ];
 
     postInstall = ''
       # Get rid of a pointless copy of the SQLite sources.
@@ -6786,7 +6786,7 @@ let
     buildInputs = [ pkgs.postgresql ];
     propagatedBuildInputs = [ DBI ];
 
-    makeMakerFlags = "POSTGRES_HOME=${pkgs.postgresql}";
+    makeMakerFlags = [ "POSTGRES_HOME=${pkgs.postgresql}" ];
 
     # tests freeze in a sandbox
     doCheck = false;
@@ -9310,7 +9310,7 @@ let
       hash = "sha256-Uuax3Hyy2HpM30OboUXguejPKMwmpIo8+Zd8g0Y5Z+4=";
     };
     buildInputs = [ pkgs.file ConfigAutoConf TestFatal ];
-    makeMakerFlags = "--lib=${pkgs.file}/lib";
+    makeMakerFlags = [ "--lib=${pkgs.file}/lib" ];
     preCheck = ''
       substituteInPlace t/oo-api.t \
         --replace "/usr/share/file/magic.mgc" "${pkgs.file}/share/misc/magic.mgc"
@@ -9958,7 +9958,7 @@ let
     # otherwise "cc1: error: -Wformat-security ignored without -Wformat [-Werror=format-security]"
     hardeningDisable = [ "format" ];
 
-    makeMakerFlags = "--lib_png_path=${pkgs.libpng.out} --lib_jpeg_path=${pkgs.libjpeg.out} --lib_zlib_path=${pkgs.zlib.out} --lib_ft_path=${pkgs.freetype.out} --lib_fontconfig_path=${pkgs.fontconfig.lib} --lib_xpm_path=${pkgs.xorg.libXpm.out}";
+    makeMakerFlags = [ "--lib_png_path=${pkgs.libpng.out}" "--lib_jpeg_path=${pkgs.libjpeg.out}" "--lib_zlib_path=${pkgs.zlib.out}" "--lib_ft_path=${pkgs.freetype.out}" "--lib_fontconfig_path=${pkgs.fontconfig.lib}" "--lib_xpm_path=${pkgs.xorg.libXpm.out}" ];
 
     meta = {
       description = "Perl interface to the gd2 graphics library";
@@ -10017,7 +10017,7 @@ let
       url = "mirror://cpan/authors/id/M/MA/MAXMIND/Geo-IP-1.51.tar.gz";
       hash = "sha256-FjAgMV1cVEGDaseeCKd7Qo8nf9CQvqT6gNpwd7JDaro=";
     };
-    makeMakerFlags = "LIBS=-L${pkgs.geoip}/lib INC=-I${pkgs.geoip}/include";
+    makeMakerFlags = [ "LIBS=-L${pkgs.geoip}/lib" "INC=-I${pkgs.geoip}/include" ];
     doCheck = false; # seems to access the network
     meta = {
       description = "Look up location and network information by IP Address";
@@ -10510,7 +10510,7 @@ let
       hash = "sha256-fY8se2F2L7TsctLsKBKQ8vh/nH0pgnPaRSVDKmXncNY=";
     };
     propagatedBuildInputs = [ pkgs.krb5Full.dev ];
-    makeMakerFlags = "--gssapiimpl ${pkgs.krb5Full.dev}";
+    makeMakerFlags = [ "--gssapiimpl" "${pkgs.krb5Full.dev}" ];
     meta = {
       description = "Perl extension providing access to the GSSAPIv2 library";
       license = with lib.licenses; [ artistic1 gpl1Plus ];
@@ -11783,7 +11783,7 @@ let
       hash = "sha256-dNRNcBwfFPxLmE+toelVcmtQTC2LBtJl56hh+llDy0g=";
     };
     buildInputs = [ pkgs.freetype pkgs.fontconfig pkgs.libjpeg pkgs.libpng ];
-    makeMakerFlags = "--incpath ${pkgs.libjpeg.dev}/include --libpath ${pkgs.libjpeg.out}/lib --incpath ${pkgs.libpng.dev}/include --libpath ${pkgs.libpng.out}/lib";
+    makeMakerFlags = [ "--incpath ${pkgs.libjpeg.dev}/include" "--libpath ${pkgs.libjpeg.out}/lib" "--incpath" "${pkgs.libpng.dev}/include" "--libpath" "${pkgs.libpng.out}/lib" ];
     meta = {
       description = "Perl extension for Generating 24 bit Images";
       homepage = "http://imager.perl.org";
@@ -11844,7 +11844,7 @@ let
     };
     buildInputs = [ pkgs.libpng pkgs.libjpeg TestNoWarnings ];
     propagatedBuildInputs = [ pkgs.zlib ];
-    makeMakerFlags = "--with-jpeg-includes=${pkgs.libjpeg.dev}/include --with-jpeg-libs=${pkgs.libjpeg.out}/lib --with-png-includes=${pkgs.libpng.dev}/include --with-png-libs=${pkgs.libpng.out}/lib";
+    makeMakerFlags = [ "--with-jpeg-includes=${pkgs.libjpeg.dev}/include" "--with-jpeg-libs=${pkgs.libjpeg.out}/lib" "--with-png-includes=${pkgs.libpng.dev}/include" "--with-png-libs=${pkgs.libpng.out}/lib" ];
     meta = {
       description = "Fast, high-quality fixed-point image resizing";
       license = with lib.licenses; [ gpl2Plus ];
@@ -12574,7 +12574,7 @@ let
     propagatedBuildInputs = [ Inline ];
 
     # TODO: upgrade https://github.com/NixOS/nixpkgs/pull/89731
-    makeMakerFlags = "J2SDK=${pkgs.jdk8}";
+    makeMakerFlags = [ "J2SDK=${pkgs.jdk8}" ];
 
     # FIXME: Apparently tests want to access the network.
     doCheck = false;
@@ -12831,7 +12831,7 @@ let
     outputs = [ "out" "tex" ];
     propagatedBuildInputs = [ ArchiveZip DBFile FileWhich IOString ImageMagick ImageSize JSONXS LWP ParseRecDescent PodParser TextUnidecode XMLLibXSLT ];
     nativeBuildInputs = [ pkgs.makeWrapper ] ++ lib.optional stdenv.isDarwin shortenPerlShebang;
-    makeMakerFlags = "TEXMF=\${tex} NOMKTEXLSR";
+    makeMakerFlags = [ "TEXMF=\${tex}" "NOMKTEXLSR" ];
     # shebangs need to be patched before executables are copied to $out
     preBuild = ''
       patchShebangs bin/
@@ -12909,7 +12909,13 @@ let
     outputs = [ "out" ];
     buildInputs = [ pkgs.apacheHttpd pkgs.apr pkgs.aprutil ApacheTest ExtUtilsXSBuilder ];
     propagatedBuildInputs = [ (pkgs.apacheHttpdPackages.mod_perl.override { inherit perl; }) ];
-    makeMakerFlags = "--with-apache2-src=${pkgs.apacheHttpd.dev} --with-apache2-apxs=${pkgs.apacheHttpd.dev}/bin/apxs --with-apache2-httpd=${pkgs.apacheHttpd.out}/bin/httpd --with-apr-config=${pkgs.apr.dev}/bin/apr-1-config --with-apu-config=${pkgs.aprutil.dev}/bin/apu-1-config";
+    makeMakerFlags = [
+      "--with-apache2-src=${pkgs.apacheHttpd.dev}"
+      "--with-apache2-apxs=${pkgs.apacheHttpd.dev}/bin/apxs"
+      "--with-apache2-httpd=${pkgs.apacheHttpd.out}/bin/httpd"
+      "--with-apr-config=${pkgs.apr.dev}/bin/apr-1-config"
+      "--with-apu-config=${pkgs.aprutil.dev}/bin/apu-1-config"
+    ];
     preConfigure = ''
       # override broken prereq check
       substituteInPlace configure --replace "prereq_check=\"\$PERL \$PERL_OPTS build/version_check.pl\"" "prereq_check=\"echo\""
@@ -14573,7 +14579,7 @@ let
     #   `overflow'; Pari.o:(.bss+0x80): first defined here
     NIX_CFLAGS_COMPILE = "-fcommon";
     preConfigure = "cp ${pari_tgz} pari-${pariversion}.tgz";
-    makeMakerFlags = "pari_tgz=pari-${pariversion}.tgz";
+    makeMakerFlags = [ "pari_tgz=pari-${pariversion}.tgz" ];
     src = fetchurl {
       url = "mirror://cpan/authors/id/I/IL/ILYAZ/modules/Math-Pari-2.030518.zip";
       hash = "sha256-3DiVWpaQvmuvqN4lJiEjd8Psn+jaXsAiY6nK+UtYu5E=";
@@ -15739,7 +15745,7 @@ let
       hash = "sha256-9bghtZsP3JZw5G7Q/PMtiRHyUSYYmotowWUvkiHu4mk=";
     };
 
-    makeMakerFlags = "MP_AP_DESTDIR=$out";
+    makeMakerFlags = [ "MP_AP_DESTDIR=$out" ];
     buildInputs = [ pkgs.apacheHttpd ];
     doCheck = false; # would try to start Apache HTTP server
     passthru.tests = nixosTests.mod_perl;
@@ -16437,7 +16443,7 @@ let
     buildInputs = [ ModuleBuildTiny TestSharedFork pkgs.postgresql ];
     propagatedBuildInputs = [ DBDPg DBI FileWhich FunctionParameters Moo TieHashMethod TryTiny TypeTiny ];
 
-    makeMakerFlags = "POSTGRES_HOME=${pkgs.postgresql}";
+    makeMakerFlags = [ "POSTGRES_HOME=${pkgs.postgresql}" ];
 
     meta = {
       description = "PostgreSQL runner for tests";
@@ -17578,7 +17584,7 @@ let
       hash = "sha256-hS1u6H6PDQFCIwJlgcu1aSS6jN3TzrKcYZHbthItQ8U=";
     };
     propagatedBuildInputs = [ DigestHMAC ];
-    makeMakerFlags = "--noonline-tests";
+    makeMakerFlags = [ "--noonline-tests" ];
     meta = {
       description = "Perl Interface to the Domain Name System";
       license = with lib.licenses; [ mit ];
@@ -22734,8 +22740,8 @@ let
       pkgs.tk
     ] ++ lib.optionals stdenv.isDarwin [
       darwin.apple_sdk.frameworks.CoreServices ];
-    makeMakerFlags = lib.optionalString stdenv.isLinux
-      "--tclsh=${pkgs.tcl}/bin/tclsh --nousestubs";
+    makeMakerFlags = lib.optionals stdenv.isLinux
+      [ "--tclsh=${pkgs.tcl}/bin/tclsh" "--nousestubs" ];
     meta = {
       description = "Tcl extension module for Perl";
       license = with lib.licenses; [ artistic1 gpl1Plus ];
@@ -26156,7 +26162,7 @@ let
       url = "mirror://cpan/authors/id/S/SR/SREZIC/Tk-804.035.tar.gz";
       hash = "sha256-TSuAKRum3jTY7IhqCFptvSt5C5JgNaCH6ZAlYUxf/dQ=";
     };
-    makeMakerFlags = "X11INC=${pkgs.xorg.libX11.dev}/include X11LIB=${pkgs.xorg.libX11.out}/lib";
+    makeMakerFlags = [ "X11INC=${pkgs.xorg.libX11.dev}/include" "X11LIB=${pkgs.xorg.libX11.out}/lib" ];
     buildInputs = [ pkgs.xorg.libX11 pkgs.libpng ];
     doCheck = false;            # Expects working X11.
     meta = {
@@ -26172,7 +26178,7 @@ let
       url = "mirror://cpan/authors/id/A/AS/ASB/Tk-ToolBar-0.12.tar.gz";
       hash = "sha256-Rj4oTsRxN+fEJclpGwKo3sXOJytY6h9jWa6AQaI53Q8=";
     };
-    makeMakerFlags = "X11INC=${pkgs.xorg.libX11.dev}/include X11LIB=${pkgs.xorg.libX11.out}/lib";
+    makeMakerFlags = [ "X11INC=${pkgs.xorg.libX11.dev}/include" "X11LIB=${pkgs.xorg.libX11.out}/lib" ];
     buildInputs = [ Tk ];
     doCheck = false;            # Expects working X11.
     meta = {
@@ -27279,7 +27285,7 @@ let
     '' + lib.optionalString stdenv.isCygwin ''
       sed -i"" -e "s@my \$compiler = File::Spec->catfile(\$path, \$cc\[0\]) \. \$Config{_exe};@my \$compiler = File::Spec->catfile(\$path, \$cc\[0\]) \. (\$^O eq 'cygwin' ? \"\" : \$Config{_exe});@" inc/Devel/CheckLib.pm
     '';
-    makeMakerFlags = "EXPATLIBPATH=${pkgs.expat.out}/lib EXPATINCPATH=${pkgs.expat.dev}/include";
+    makeMakerFlags = [ "EXPATLIBPATH=${pkgs.expat.out}/lib" "EXPATINCPATH=${pkgs.expat.dev}/include" ];
     propagatedBuildInputs = [ LWP ];
     meta = {
       description = "A perl module for parsing XML documents";
@@ -27806,7 +27812,7 @@ let
     NIX_CFLAGS_COMPILE = "-I${pkgs.openssl_1_1.dev}/include -I${pkgs.libidn2}.dev}/include";
     NIX_CFLAGS_LINK = "-L${lib.getLib pkgs.openssl_1_1}/lib -L${lib.getLib pkgs.libidn2}/lib -lcrypto -lidn2";
 
-    makeMakerFlags = "--prefix-openssl=${pkgs.openssl_1_1.dev}";
+    makeMakerFlags = [ "--prefix-openssl=${pkgs.openssl_1_1.dev}" ];
 
     nativeBuildInputs = [ pkgs.pkg-config ];
     buildInputs = [ DevelChecklib ModuleInstall ModuleInstallXSUtil TestFatal pkgs.ldns pkgs.libidn2 pkgs.openssl_1_1 ];