Skip to content

Commit

Permalink
treewide: optional -> optionals where the argument is a list
Browse files Browse the repository at this point in the history
the argument to optional should not be list
  • Loading branch information
Artturin committed Oct 10, 2022
1 parent f4ea120 commit 7e49471
Show file tree
Hide file tree
Showing 197 changed files with 257 additions and 257 deletions.
2 changes: 1 addition & 1 deletion lib/generators.nix
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ rec {

attr = let attrFilter = name: value: name != "_module" && value != null;
in ind: x: libStr.concatStringsSep "\n" (lib.flatten (lib.mapAttrsToList
(name: value: lib.optional (attrFilter name value) [
(name: value: lib.optionals (attrFilter name value) [
(key "\t${ind}" name)
(expr "\t${ind}" value)
]) x));
Expand Down
2 changes: 1 addition & 1 deletion nixos/modules/hardware/video/nvidia.nix
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ in
in optional primeEnabled {
name = igpuDriver;
display = offloadCfg.enable;
modules = optional (igpuDriver == "amdgpu") [ pkgs.xorg.xf86videoamdgpu ];
modules = optionals (igpuDriver == "amdgpu") [ pkgs.xorg.xf86videoamdgpu ];
deviceSection = ''
BusID "${igpuBusId}"
${optionalString (syncCfg.enable && igpuDriver != "amdgpu") ''Option "AccelMethod" "none"''}
Expand Down
2 changes: 1 addition & 1 deletion nixos/modules/services/misc/ethminer.nix
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ in
config = mkIf cfg.enable {

systemd.services.ethminer = {
path = optional (cfg.toolkit == "cuda") [ pkgs.cudaPackages.cudatoolkit ];
path = optionals (cfg.toolkit == "cuda") [ pkgs.cudaPackages.cudatoolkit ];
description = "ethminer ethereum mining service";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
Expand Down
2 changes: 1 addition & 1 deletion nixos/modules/services/misc/podgrab.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ in
};
serviceConfig = {
DynamicUser = true;
EnvironmentFile = lib.optional (cfg.passwordFile != null) [
EnvironmentFile = lib.optionals (cfg.passwordFile != null) [
cfg.passwordFile
];
ExecStart = "${pkgs.podgrab}/bin/podgrab";
Expand Down
2 changes: 1 addition & 1 deletion nixos/modules/services/networking/hostapd.nix
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ in

environment.systemPackages = [ pkgs.hostapd ];

services.udev.packages = optional (cfg.countryCode != null) [ pkgs.crda ];
services.udev.packages = optionals (cfg.countryCode != null) [ pkgs.crda ];

systemd.services.hostapd =
{ description = "hostapd wireless AP";
Expand Down
4 changes: 2 additions & 2 deletions nixos/modules/services/security/tor.nix
Original file line number Diff line number Diff line change
Expand Up @@ -816,13 +816,13 @@ in
always create a container/VM with a separate Tor daemon instance.
'' ++
flatten (mapAttrsToList (n: o:
optional (o.settings.HiddenServiceVersion == 2) [
optionals (o.settings.HiddenServiceVersion == 2) [
(optional (o.settings.HiddenServiceExportCircuitID != null) ''
HiddenServiceExportCircuitID is used in the HiddenService: ${n}
but this option is only for v3 hidden services.
'')
] ++
optional (o.settings.HiddenServiceVersion != 2) [
optionals (o.settings.HiddenServiceVersion != 2) [
(optional (o.settings.HiddenServiceAuthorizeClient != null) ''
HiddenServiceAuthorizeClient is used in the HiddenService: ${n}
but this option is only for v2 hidden services.
Expand Down
2 changes: 1 addition & 1 deletion nixos/modules/services/web-apps/netbox.nix
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ let
'';
})).override {
plugins = ps: ((cfg.plugins ps)
++ optional cfg.enableLdap [ ps.django-auth-ldap ]);
++ optionals cfg.enableLdap [ ps.django-auth-ldap ]);
};
netboxManageScript = with pkgs; (writeScriptBin "netbox-manage" ''
#!${stdenv.shell}
Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/audio/chuck/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 ];

Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/audio/grandorgue/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/audio/snapcast/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/blockchains/polkadot/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 ];

Expand Down
4 changes: 2 additions & 2 deletions pkgs/applications/editors/rstudio/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ in
makeWrapper
pandoc
nodejs
] ++ lib.optional (!server) [
] ++ lib.optionals (!server) [
copyDesktopItems
];

Expand Down Expand Up @@ -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"
];

Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/editors/vim/configurable.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 [
Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/editors/vscode/generic.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 [
Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/emulators/retroarch/cores.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions pkgs/applications/file-managers/nnn/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 ];

Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/gis/gmt/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/graphics/kcc/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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[@]}"
Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/misc/audio/sox/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
];
Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/misc/blender/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/networking/browsers/links2/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 ];

Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/networking/cluster/hadoop/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ''
Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/networking/firehol/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ buildPythonApplication rec {
peewee
prompt-toolkit
setuptools
] ++ lib.optional enableDbusUi [
] ++ lib.optionals enableDbusUi [
dbus-python
notify2
pygobject3
Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/networking/irc/convos/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ perlPackages.buildPerlPackage rec {
};

nativeBuildInputs = [ makeWrapper ]
++ optional stdenv.isDarwin [ shortenPerlShebang ];
++ optionals stdenv.isDarwin [ shortenPerlShebang ];

buildInputs = with perlPackages; [
CryptPassphrase CryptPassphraseArgon2 CryptPassphraseBcrypt
Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/networking/mailreaders/alot/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ with python3.pkgs; buildPythonApplication rec {

outputs = [
"out"
] ++ lib.optional withManpage [
] ++ lib.optionals withManpage [
"man"
];

Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/networking/mailreaders/meli/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions pkgs/applications/networking/mpop/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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"
];

Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/networking/sync/lsyncd/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions pkgs/applications/networking/znc/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/radio/rtl-sdr/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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"
];
Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/science/biology/megahit/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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; {
Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/science/biology/neuron/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 ''
Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/science/biology/samtools/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ''
Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/science/logic/fast-downward/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/science/math/ratpoints/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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}'';
Expand Down
4 changes: 2 additions & 2 deletions pkgs/applications/version-management/datalad/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
8 changes: 4 additions & 4 deletions pkgs/applications/version-management/dvc/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Loading

0 comments on commit 7e49471

Please sign in to comment.