From e3244e9ff008312235d213cc1066eaa8d2602ce1 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Sun, 18 Aug 2024 12:52:34 +0200 Subject: [PATCH] treewide: replace xxxFlagsArray with non-Array variant in nix code The xxxFlagsArray variants were never meant to be used in nix code, at least they can't be used properly without __structuredAttrs turned on. If no spaces are passed in the argument the xxxFlagsArray can be replaced as-is with the non-Array variant. When whitespace needs to be passed, the derivation is additionally changed to enable __structuredAttrs. --- pkgs/applications/graphics/oculante/default.nix | 3 +-- .../element/keytar/default.nix | 8 ++++---- pkgs/applications/video/uvccapture/default.nix | 2 +- pkgs/by-name/ne/neovim-unwrapped/package.nix | 16 +++++++--------- pkgs/by-name/xm/xmoji/package.nix | 2 +- pkgs/by-name/xr/xr-hardware/package.nix | 2 +- pkgs/development/cuda-modules/nccl/default.nix | 2 +- pkgs/development/cuda-modules/saxpy/default.nix | 2 +- .../libraries/appindicator-sharp/default.nix | 2 +- .../libraries/science/math/bonmin/default.nix | 4 +++- .../libraries/science/math/scalapack/default.nix | 4 +++- .../libraries/webkit2-sharp/default.nix | 2 +- .../tools/build-managers/fac/default.nix | 2 +- .../tools/rust/cargo-cache/default.nix | 2 +- pkgs/games/warmux/default.nix | 4 +++- pkgs/servers/janus-gateway/default.nix | 2 +- pkgs/tools/backup/monolith/default.nix | 2 +- pkgs/tools/cd-dvd/sacd/default.nix | 2 +- pkgs/tools/misc/intermodal/default.nix | 2 +- pkgs/tools/security/sudo/default.nix | 5 +---- 20 files changed, 35 insertions(+), 35 deletions(-) diff --git a/pkgs/applications/graphics/oculante/default.nix b/pkgs/applications/graphics/oculante/default.nix index 3f3d39769f81..eafa515da340 100644 --- a/pkgs/applications/graphics/oculante/default.nix +++ b/pkgs/applications/graphics/oculante/default.nix @@ -41,8 +41,6 @@ rustPlatform.buildRustPackage rec { wrapGAppsHook3 ]; - checkFlagsArray = [ "--skip=tests::net" ]; # requires network access - buildInputs = [ openssl fontconfig @@ -62,6 +60,7 @@ rustPlatform.buildRustPackage rec { checkFlags = [ "--skip=bench" + "--skip=tests::net" # requires network access ]; postInstall = '' diff --git a/pkgs/applications/networking/instant-messengers/element/keytar/default.nix b/pkgs/applications/networking/instant-messengers/element/keytar/default.nix index d43894e08239..7d17d582762a 100644 --- a/pkgs/applications/networking/instant-messengers/element/keytar/default.nix +++ b/pkgs/applications/networking/instant-messengers/element/keytar/default.nix @@ -37,10 +37,10 @@ in stdenv.mkDerivation rec { ''; # https://nodejs.org/api/os.html#osarch - npmFlagsArray = [ "--arch=${if stdenv.hostPlatform.parsed.cpu.name == "i686" then "ia32" - else if stdenv.hostPlatform.parsed.cpu.name == "x86_64" then "x64" - else if stdenv.hostPlatform.parsed.cpu.name == "aarch64" then "arm64" - else stdenv.hostPlatform.parsed.cpu.name}" ]; + npmFlags = [ "--arch=${if stdenv.hostPlatform.parsed.cpu.name == "i686" then "ia32" + else if stdenv.hostPlatform.parsed.cpu.name == "x86_64" then "x64" + else if stdenv.hostPlatform.parsed.cpu.name == "aarch64" then "arm64" + else stdenv.hostPlatform.parsed.cpu.name}" ]; installPhase = '' runHook preInstall diff --git a/pkgs/applications/video/uvccapture/default.nix b/pkgs/applications/video/uvccapture/default.nix index 96e42b1a7f95..f7067c8dd71a 100644 --- a/pkgs/applications/video/uvccapture/default.nix +++ b/pkgs/applications/video/uvccapture/default.nix @@ -30,7 +30,7 @@ stdenv.mkDerivation rec { done ''; - makeFlagsArray = [ "PREFIX=$(out)/bin/" ]; + makeFlags = [ "PREFIX=$(out)/bin/" ]; preInstall = '' mkdir -p "$out/bin" diff --git a/pkgs/by-name/ne/neovim-unwrapped/package.nix b/pkgs/by-name/ne/neovim-unwrapped/package.nix index b40ffac4a3a6..3eeee33d068b 100644 --- a/pkgs/by-name/ne/neovim-unwrapped/package.nix +++ b/pkgs/by-name/ne/neovim-unwrapped/package.nix @@ -149,7 +149,7 @@ in { # check that the above patching actually works disallowedRequisites = [ stdenv.cc ] ++ lib.optional (lua != codegenLua) codegenLua; - cmakeFlagsArray = [ + cmakeFlags = [ # Don't use downloaded dependencies. At the end of the configurePhase one # can spot that cmake says this option was "not used by the project". # That's because all dependencies were found and @@ -157,15 +157,13 @@ in { "-DUSE_BUNDLED=OFF" ] ++ lib.optional (!lua.pkgs.isLuaJIT) "-DPREFER_LUA=ON" - ; + ++ lib.optionals lua.pkgs.isLuaJIT [ + "-DLUAC_PRG=${codegenLua}/bin/luajit -b -s %s -" + "-DLUA_GEN_PRG=${codegenLua}/bin/luajit" + "-DLUA_PRG=${neovimLuaEnvOnBuild}/bin/luajit" + ]; - preConfigure = lib.optionalString lua.pkgs.isLuaJIT '' - cmakeFlagsArray+=( - "-DLUAC_PRG=${codegenLua}/bin/luajit -b -s %s -" - "-DLUA_GEN_PRG=${codegenLua}/bin/luajit" - "-DLUA_PRG=${neovimLuaEnvOnBuild}/bin/luajit" - ) - '' + lib.optionalString stdenv.isDarwin '' + preConfigure = lib.optionalString stdenv.isDarwin '' substituteInPlace src/nvim/CMakeLists.txt --replace " util" "" '' + '' mkdir -p $out/lib/nvim/parser diff --git a/pkgs/by-name/xm/xmoji/package.nix b/pkgs/by-name/xm/xmoji/package.nix index f8558cb8146a..de0b48feaf04 100644 --- a/pkgs/by-name/xm/xmoji/package.nix +++ b/pkgs/by-name/xm/xmoji/package.nix @@ -50,7 +50,7 @@ stdenv.mkDerivation (finalAttrs: { xcbutilimage ]; - makeFlagsArray = [ "prefix=${placeholder "out"}" ]; + makeFlags = [ "prefix=${placeholder "out"}" ]; meta = { description = "Plain X11 emoji keyboard"; diff --git a/pkgs/by-name/xr/xr-hardware/package.nix b/pkgs/by-name/xr/xr-hardware/package.nix index 0f9b9360d3c0..aa7bd7596a68 100644 --- a/pkgs/by-name/xr/xr-hardware/package.nix +++ b/pkgs/by-name/xr/xr-hardware/package.nix @@ -19,7 +19,7 @@ stdenvNoCC.mkDerivation (finalAttrs: { dontBuild = true; installTargets = "install_package"; - installFlagsArray = "DESTDIR=${placeholder "out"}"; + installFlags = "DESTDIR=${placeholder "out"}"; passthru.updateScript = nix-update-script { }; diff --git a/pkgs/development/cuda-modules/nccl/default.nix b/pkgs/development/cuda-modules/nccl/default.nix index 3dd36e17f0a4..00026d97e69f 100644 --- a/pkgs/development/cuda-modules/nccl/default.nix +++ b/pkgs/development/cuda-modules/nccl/default.nix @@ -69,7 +69,7 @@ backendStdenv.mkDerivation (finalAttrs: { patchShebangs ./src/device/generate.py ''; - makeFlagsArray = + makeFlags = [ "PREFIX=$(out)" "NVCC_GENCODE=${cudaFlags.gencodeString}" diff --git a/pkgs/development/cuda-modules/saxpy/default.nix b/pkgs/development/cuda-modules/saxpy/default.nix index 5eb0a235ace8..57b6120ccea9 100644 --- a/pkgs/development/cuda-modules/saxpy/default.nix +++ b/pkgs/development/cuda-modules/saxpy/default.nix @@ -53,7 +53,7 @@ backendStdenv.mkDerivation { ] ++ lib.optionals (cudaAtLeast "12.0") [ cuda_cccl ]; - cmakeFlagsArray = [ + cmakeFlags = [ (lib.cmakeBool "CMAKE_VERBOSE_MAKEFILE" true) (lib.cmakeFeature "CMAKE_CUDA_ARCHITECTURES" flags.cmakeCudaArchitecturesString) ]; diff --git a/pkgs/development/libraries/appindicator-sharp/default.nix b/pkgs/development/libraries/appindicator-sharp/default.nix index 9eff4e3895ba..3062074f4cd7 100644 --- a/pkgs/development/libraries/appindicator-sharp/default.nix +++ b/pkgs/development/libraries/appindicator-sharp/default.nix @@ -32,7 +32,7 @@ stdenv.mkDerivation rec { ]; ac_cv_path_MDOC = "no"; - installFlagsArray = ["GAPIXMLDIR=/tmp/gapixml"]; + installFlags = ["GAPIXMLDIR=/tmp/gapixml"]; meta = { description = "Bindings for appindicator using gobject-introspection"; diff --git a/pkgs/development/libraries/science/math/bonmin/default.nix b/pkgs/development/libraries/science/math/bonmin/default.nix index 9fca78df7c63..a389c602b1b6 100644 --- a/pkgs/development/libraries/science/math/bonmin/default.nix +++ b/pkgs/development/libraries/science/math/bonmin/default.nix @@ -31,6 +31,8 @@ stdenv.mkDerivation rec { sha256 = "sha256-nqjAQ1NdNJ/T4p8YljEWRt/uy2aDwyBeAsag0TmRc5Q="; }; + __structuredAttrs = true; + nativeBuildInputs = [ doxygen gfortran @@ -50,7 +52,7 @@ stdenv.mkDerivation rec { zlib ]; - configureFlagsArray = lib.optionals stdenv.isDarwin [ + configureFlags = lib.optionals stdenv.isDarwin [ "--with-asl-lib=-lipoptamplinterface -lamplsolver" ]; diff --git a/pkgs/development/libraries/science/math/scalapack/default.nix b/pkgs/development/libraries/science/math/scalapack/default.nix index f1e0f6cf5a12..b36f48647819 100644 --- a/pkgs/development/libraries/science/math/scalapack/default.nix +++ b/pkgs/development/libraries/science/math/scalapack/default.nix @@ -17,6 +17,8 @@ stdenv.mkDerivation rec { passthru = { inherit (blas) isILP64; }; + __structuredAttrs = true; + # upstream patch, remove with next release patches = [ (fetchpatch { name = "gcc-10"; @@ -62,7 +64,7 @@ stdenv.mkDerivation rec { # Increase individual test timeout from 1500s to 10000s because hydra's builds # sometimes fail due to this - checkFlagsArray = [ "ARGS=--timeout 10000" ]; + checkFlags = [ "ARGS=--timeout 10000" ]; postFixup = '' # _IMPORT_PREFIX, used to point to lib, points to dev output. Every package using the generated diff --git a/pkgs/development/libraries/webkit2-sharp/default.nix b/pkgs/development/libraries/webkit2-sharp/default.nix index de10fff43da0..6407a8709f6e 100644 --- a/pkgs/development/libraries/webkit2-sharp/default.nix +++ b/pkgs/development/libraries/webkit2-sharp/default.nix @@ -42,7 +42,7 @@ stdenv.mkDerivation rec { ''; ac_cv_path_MONODOCER = "no"; - installFlagsArray = ["GAPIXMLDIR=/tmp/gapixml"]; + installFlags = ["GAPIXMLDIR=/tmp/gapixml"]; passthru = { inherit webkitgtk; diff --git a/pkgs/development/tools/build-managers/fac/default.nix b/pkgs/development/tools/build-managers/fac/default.nix index d4748ecf98a0..b44cefe6a953 100644 --- a/pkgs/development/tools/build-managers/fac/default.nix +++ b/pkgs/development/tools/build-managers/fac/default.nix @@ -17,7 +17,7 @@ rustPlatform.buildRustPackage rec { # fac includes a unit test called ls_files_works which assumes it's # running in a git repo. Nix's sandbox runs cargo build outside git, # so this test won't work. - checkFlagsArray = [ "--skip=ls_files_works" ]; + checkFlags = [ "--skip=ls_files_works" ]; # fac calls git at runtime, expecting it to be in the PATH, # so we need to patch it to call git by absolute path instead. diff --git a/pkgs/development/tools/rust/cargo-cache/default.nix b/pkgs/development/tools/rust/cargo-cache/default.nix index 8c8a4ea29a34..1c19b61bf8b4 100644 --- a/pkgs/development/tools/rust/cargo-cache/default.nix +++ b/pkgs/development/tools/rust/cargo-cache/default.nix @@ -15,7 +15,7 @@ rustPlatform.buildRustPackage rec { buildInputs = lib.optionals stdenv.isDarwin [ libiconv Security ]; - checkFlagsArray = [ "offline_tests" ]; + checkFlags = [ "offline_tests" ]; meta = with lib; { description = "Manage cargo cache (\${CARGO_HOME}, ~/.cargo/), print sizes of dirs and remove dirs selectively"; diff --git a/pkgs/games/warmux/default.nix b/pkgs/games/warmux/default.nix index 2e3a96a08651..368f0d39e9c2 100644 --- a/pkgs/games/warmux/default.nix +++ b/pkgs/games/warmux/default.nix @@ -15,8 +15,10 @@ stdenv.mkDerivation { sha256 = "1hvzglsmp75xiqqb0k75qjz4jwi8kl3fhn8zfsz53hhhqmbw6wkr"; }; + __structuredAttrs = true; + preConfigure = "patchShebangs autogen.sh && ./autogen.sh"; - configureFlagsArray = ("CFLAGS=-include ${zlib.dev}/include/zlib.h"); + configureFlags = ["CFLAGS=-include ${zlib.dev}/include/zlib.h"]; nativeBuildInputs = [ autoconf automake gettext intltool libtool pkg-config diff --git a/pkgs/servers/janus-gateway/default.nix b/pkgs/servers/janus-gateway/default.nix index 8a08962f646b..9a0ecad23dd4 100644 --- a/pkgs/servers/janus-gateway/default.nix +++ b/pkgs/servers/janus-gateway/default.nix @@ -42,7 +42,7 @@ stdenv.mkDerivation rec { "--enable-post-processing" ]; - makeFlagsArray = [ + makeFlags = [ "BORINGSSL_LIBS=-L${lib.getLib boringssl}/lib" ]; diff --git a/pkgs/tools/backup/monolith/default.nix b/pkgs/tools/backup/monolith/default.nix index b43e97e1ba95..b95ada9574ed 100644 --- a/pkgs/tools/backup/monolith/default.nix +++ b/pkgs/tools/backup/monolith/default.nix @@ -25,7 +25,7 @@ rustPlatform.buildRustPackage rec { buildInputs = lib.optionals stdenv.isLinux [ openssl ] ++ lib.optionals stdenv.isDarwin [ libiconv Security SystemConfiguration ]; - checkFlagsArray = [ "--skip=tests::cli" ]; + checkFlags = [ "--skip=tests::cli" ]; meta = with lib; { description = "Bundle any web page into a single HTML file"; diff --git a/pkgs/tools/cd-dvd/sacd/default.nix b/pkgs/tools/cd-dvd/sacd/default.nix index 67c70ebc76a0..ddd2c2dcd8c8 100644 --- a/pkgs/tools/cd-dvd/sacd/default.nix +++ b/pkgs/tools/cd-dvd/sacd/default.nix @@ -25,7 +25,7 @@ stdenv.mkDerivation (finalAttrs: { }) ]; - makeFlagsArray = [ + makeFlags = [ "PREFIX=$(out)" ]; diff --git a/pkgs/tools/misc/intermodal/default.nix b/pkgs/tools/misc/intermodal/default.nix index c15d529279da..a12008408723 100644 --- a/pkgs/tools/misc/intermodal/default.nix +++ b/pkgs/tools/misc/intermodal/default.nix @@ -14,7 +14,7 @@ rustPlatform.buildRustPackage rec { cargoHash = "sha256-7vtUMG6mxAHKnbouyTsaUf1myJssxYoqAIOjc6m86Fo="; # include_hidden test tries to use `chflags` on darwin - checkFlagsArray = lib.optionals stdenv.isDarwin [ "--skip=subcommand::torrent::create::tests::include_hidden" ]; + checkFlags = lib.optionals stdenv.isDarwin [ "--skip=subcommand::torrent::create::tests::include_hidden" ]; nativeBuildInputs = [ installShellFiles ]; diff --git a/pkgs/tools/security/sudo/default.nix b/pkgs/tools/security/sudo/default.nix index 885fcc51aa48..508cfafc69de 100644 --- a/pkgs/tools/security/sudo/default.nix +++ b/pkgs/tools/security/sudo/default.nix @@ -39,6 +39,7 @@ stdenv.mkDerivation (finalAttrs: { "--with-iologdir=/var/log/sudo-io" "--with-sendmail=${sendmailPath}" "--enable-tmpfiles.d=no" + "--with-passprompt=[sudo] password for %p: " # intentional trailing space ] ++ lib.optionals withInsults [ "--with-insults" "--with-all-insults" @@ -47,10 +48,6 @@ stdenv.mkDerivation (finalAttrs: { "--with-sssd-lib=${sssd}/lib" ]; - configureFlagsArray = [ - "--with-passprompt=[sudo] password for %p: " # intentional trailing space - ]; - postConfigure = '' cat >> pathnames.h <<'EOF'