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.
This commit is contained in:
Wolfgang Walther 2024-08-18 12:52:34 +02:00
parent e325795397
commit e3244e9ff0
No known key found for this signature in database
GPG Key ID: B39893FA5F65CAE1
20 changed files with 35 additions and 35 deletions

View File

@ -41,8 +41,6 @@ rustPlatform.buildRustPackage rec {
wrapGAppsHook3 wrapGAppsHook3
]; ];
checkFlagsArray = [ "--skip=tests::net" ]; # requires network access
buildInputs = [ buildInputs = [
openssl openssl
fontconfig fontconfig
@ -62,6 +60,7 @@ rustPlatform.buildRustPackage rec {
checkFlags = [ checkFlags = [
"--skip=bench" "--skip=bench"
"--skip=tests::net" # requires network access
]; ];
postInstall = '' postInstall = ''

View File

@ -37,7 +37,7 @@ in stdenv.mkDerivation rec {
''; '';
# https://nodejs.org/api/os.html#osarch # https://nodejs.org/api/os.html#osarch
npmFlagsArray = [ "--arch=${if stdenv.hostPlatform.parsed.cpu.name == "i686" then "ia32" 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 == "x86_64" then "x64"
else if stdenv.hostPlatform.parsed.cpu.name == "aarch64" then "arm64" else if stdenv.hostPlatform.parsed.cpu.name == "aarch64" then "arm64"
else stdenv.hostPlatform.parsed.cpu.name}" ]; else stdenv.hostPlatform.parsed.cpu.name}" ];

View File

@ -30,7 +30,7 @@ stdenv.mkDerivation rec {
done done
''; '';
makeFlagsArray = [ "PREFIX=$(out)/bin/" ]; makeFlags = [ "PREFIX=$(out)/bin/" ];
preInstall = '' preInstall = ''
mkdir -p "$out/bin" mkdir -p "$out/bin"

View File

@ -149,7 +149,7 @@ in {
# check that the above patching actually works # check that the above patching actually works
disallowedRequisites = [ stdenv.cc ] ++ lib.optional (lua != codegenLua) codegenLua; disallowedRequisites = [ stdenv.cc ] ++ lib.optional (lua != codegenLua) codegenLua;
cmakeFlagsArray = [ cmakeFlags = [
# Don't use downloaded dependencies. At the end of the configurePhase one # 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". # can spot that cmake says this option was "not used by the project".
# That's because all dependencies were found and # That's because all dependencies were found and
@ -157,15 +157,13 @@ in {
"-DUSE_BUNDLED=OFF" "-DUSE_BUNDLED=OFF"
] ]
++ lib.optional (!lua.pkgs.isLuaJIT) "-DPREFER_LUA=ON" ++ lib.optional (!lua.pkgs.isLuaJIT) "-DPREFER_LUA=ON"
; ++ lib.optionals lua.pkgs.isLuaJIT [
preConfigure = lib.optionalString lua.pkgs.isLuaJIT ''
cmakeFlagsArray+=(
"-DLUAC_PRG=${codegenLua}/bin/luajit -b -s %s -" "-DLUAC_PRG=${codegenLua}/bin/luajit -b -s %s -"
"-DLUA_GEN_PRG=${codegenLua}/bin/luajit" "-DLUA_GEN_PRG=${codegenLua}/bin/luajit"
"-DLUA_PRG=${neovimLuaEnvOnBuild}/bin/luajit" "-DLUA_PRG=${neovimLuaEnvOnBuild}/bin/luajit"
) ];
'' + lib.optionalString stdenv.isDarwin ''
preConfigure = lib.optionalString stdenv.isDarwin ''
substituteInPlace src/nvim/CMakeLists.txt --replace " util" "" substituteInPlace src/nvim/CMakeLists.txt --replace " util" ""
'' + '' '' + ''
mkdir -p $out/lib/nvim/parser mkdir -p $out/lib/nvim/parser

View File

@ -50,7 +50,7 @@ stdenv.mkDerivation (finalAttrs: {
xcbutilimage xcbutilimage
]; ];
makeFlagsArray = [ "prefix=${placeholder "out"}" ]; makeFlags = [ "prefix=${placeholder "out"}" ];
meta = { meta = {
description = "Plain X11 emoji keyboard"; description = "Plain X11 emoji keyboard";

View File

@ -19,7 +19,7 @@ stdenvNoCC.mkDerivation (finalAttrs: {
dontBuild = true; dontBuild = true;
installTargets = "install_package"; installTargets = "install_package";
installFlagsArray = "DESTDIR=${placeholder "out"}"; installFlags = "DESTDIR=${placeholder "out"}";
passthru.updateScript = nix-update-script { }; passthru.updateScript = nix-update-script { };

View File

@ -69,7 +69,7 @@ backendStdenv.mkDerivation (finalAttrs: {
patchShebangs ./src/device/generate.py patchShebangs ./src/device/generate.py
''; '';
makeFlagsArray = makeFlags =
[ [
"PREFIX=$(out)" "PREFIX=$(out)"
"NVCC_GENCODE=${cudaFlags.gencodeString}" "NVCC_GENCODE=${cudaFlags.gencodeString}"

View File

@ -53,7 +53,7 @@ backendStdenv.mkDerivation {
] ]
++ lib.optionals (cudaAtLeast "12.0") [ cuda_cccl ]; ++ lib.optionals (cudaAtLeast "12.0") [ cuda_cccl ];
cmakeFlagsArray = [ cmakeFlags = [
(lib.cmakeBool "CMAKE_VERBOSE_MAKEFILE" true) (lib.cmakeBool "CMAKE_VERBOSE_MAKEFILE" true)
(lib.cmakeFeature "CMAKE_CUDA_ARCHITECTURES" flags.cmakeCudaArchitecturesString) (lib.cmakeFeature "CMAKE_CUDA_ARCHITECTURES" flags.cmakeCudaArchitecturesString)
]; ];

View File

@ -32,7 +32,7 @@ stdenv.mkDerivation rec {
]; ];
ac_cv_path_MDOC = "no"; ac_cv_path_MDOC = "no";
installFlagsArray = ["GAPIXMLDIR=/tmp/gapixml"]; installFlags = ["GAPIXMLDIR=/tmp/gapixml"];
meta = { meta = {
description = "Bindings for appindicator using gobject-introspection"; description = "Bindings for appindicator using gobject-introspection";

View File

@ -31,6 +31,8 @@ stdenv.mkDerivation rec {
sha256 = "sha256-nqjAQ1NdNJ/T4p8YljEWRt/uy2aDwyBeAsag0TmRc5Q="; sha256 = "sha256-nqjAQ1NdNJ/T4p8YljEWRt/uy2aDwyBeAsag0TmRc5Q=";
}; };
__structuredAttrs = true;
nativeBuildInputs = [ nativeBuildInputs = [
doxygen doxygen
gfortran gfortran
@ -50,7 +52,7 @@ stdenv.mkDerivation rec {
zlib zlib
]; ];
configureFlagsArray = lib.optionals stdenv.isDarwin [ configureFlags = lib.optionals stdenv.isDarwin [
"--with-asl-lib=-lipoptamplinterface -lamplsolver" "--with-asl-lib=-lipoptamplinterface -lamplsolver"
]; ];

View File

@ -17,6 +17,8 @@ stdenv.mkDerivation rec {
passthru = { inherit (blas) isILP64; }; passthru = { inherit (blas) isILP64; };
__structuredAttrs = true;
# upstream patch, remove with next release # upstream patch, remove with next release
patches = [ (fetchpatch { patches = [ (fetchpatch {
name = "gcc-10"; name = "gcc-10";
@ -62,7 +64,7 @@ stdenv.mkDerivation rec {
# Increase individual test timeout from 1500s to 10000s because hydra's builds # Increase individual test timeout from 1500s to 10000s because hydra's builds
# sometimes fail due to this # sometimes fail due to this
checkFlagsArray = [ "ARGS=--timeout 10000" ]; checkFlags = [ "ARGS=--timeout 10000" ];
postFixup = '' postFixup = ''
# _IMPORT_PREFIX, used to point to lib, points to dev output. Every package using the generated # _IMPORT_PREFIX, used to point to lib, points to dev output. Every package using the generated

View File

@ -42,7 +42,7 @@ stdenv.mkDerivation rec {
''; '';
ac_cv_path_MONODOCER = "no"; ac_cv_path_MONODOCER = "no";
installFlagsArray = ["GAPIXMLDIR=/tmp/gapixml"]; installFlags = ["GAPIXMLDIR=/tmp/gapixml"];
passthru = { passthru = {
inherit webkitgtk; inherit webkitgtk;

View File

@ -17,7 +17,7 @@ rustPlatform.buildRustPackage rec {
# fac includes a unit test called ls_files_works which assumes it's # 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, # running in a git repo. Nix's sandbox runs cargo build outside git,
# so this test won't work. # 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, # 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. # so we need to patch it to call git by absolute path instead.

View File

@ -15,7 +15,7 @@ rustPlatform.buildRustPackage rec {
buildInputs = lib.optionals stdenv.isDarwin [ libiconv Security ]; buildInputs = lib.optionals stdenv.isDarwin [ libiconv Security ];
checkFlagsArray = [ "offline_tests" ]; checkFlags = [ "offline_tests" ];
meta = with lib; { meta = with lib; {
description = "Manage cargo cache (\${CARGO_HOME}, ~/.cargo/), print sizes of dirs and remove dirs selectively"; description = "Manage cargo cache (\${CARGO_HOME}, ~/.cargo/), print sizes of dirs and remove dirs selectively";

View File

@ -15,8 +15,10 @@ stdenv.mkDerivation {
sha256 = "1hvzglsmp75xiqqb0k75qjz4jwi8kl3fhn8zfsz53hhhqmbw6wkr"; sha256 = "1hvzglsmp75xiqqb0k75qjz4jwi8kl3fhn8zfsz53hhhqmbw6wkr";
}; };
__structuredAttrs = true;
preConfigure = "patchShebangs autogen.sh && ./autogen.sh"; preConfigure = "patchShebangs autogen.sh && ./autogen.sh";
configureFlagsArray = ("CFLAGS=-include ${zlib.dev}/include/zlib.h"); configureFlags = ["CFLAGS=-include ${zlib.dev}/include/zlib.h"];
nativeBuildInputs = [ nativeBuildInputs = [
autoconf automake gettext intltool libtool pkg-config autoconf automake gettext intltool libtool pkg-config

View File

@ -42,7 +42,7 @@ stdenv.mkDerivation rec {
"--enable-post-processing" "--enable-post-processing"
]; ];
makeFlagsArray = [ makeFlags = [
"BORINGSSL_LIBS=-L${lib.getLib boringssl}/lib" "BORINGSSL_LIBS=-L${lib.getLib boringssl}/lib"
]; ];

View File

@ -25,7 +25,7 @@ rustPlatform.buildRustPackage rec {
buildInputs = lib.optionals stdenv.isLinux [ openssl ] buildInputs = lib.optionals stdenv.isLinux [ openssl ]
++ lib.optionals stdenv.isDarwin [ libiconv Security SystemConfiguration ]; ++ lib.optionals stdenv.isDarwin [ libiconv Security SystemConfiguration ];
checkFlagsArray = [ "--skip=tests::cli" ]; checkFlags = [ "--skip=tests::cli" ];
meta = with lib; { meta = with lib; {
description = "Bundle any web page into a single HTML file"; description = "Bundle any web page into a single HTML file";

View File

@ -25,7 +25,7 @@ stdenv.mkDerivation (finalAttrs: {
}) })
]; ];
makeFlagsArray = [ makeFlags = [
"PREFIX=$(out)" "PREFIX=$(out)"
]; ];

View File

@ -14,7 +14,7 @@ rustPlatform.buildRustPackage rec {
cargoHash = "sha256-7vtUMG6mxAHKnbouyTsaUf1myJssxYoqAIOjc6m86Fo="; cargoHash = "sha256-7vtUMG6mxAHKnbouyTsaUf1myJssxYoqAIOjc6m86Fo=";
# include_hidden test tries to use `chflags` on darwin # 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 ]; nativeBuildInputs = [ installShellFiles ];

View File

@ -39,6 +39,7 @@ stdenv.mkDerivation (finalAttrs: {
"--with-iologdir=/var/log/sudo-io" "--with-iologdir=/var/log/sudo-io"
"--with-sendmail=${sendmailPath}" "--with-sendmail=${sendmailPath}"
"--enable-tmpfiles.d=no" "--enable-tmpfiles.d=no"
"--with-passprompt=[sudo] password for %p: " # intentional trailing space
] ++ lib.optionals withInsults [ ] ++ lib.optionals withInsults [
"--with-insults" "--with-insults"
"--with-all-insults" "--with-all-insults"
@ -47,10 +48,6 @@ stdenv.mkDerivation (finalAttrs: {
"--with-sssd-lib=${sssd}/lib" "--with-sssd-lib=${sssd}/lib"
]; ];
configureFlagsArray = [
"--with-passprompt=[sudo] password for %p: " # intentional trailing space
];
postConfigure = postConfigure =
'' ''
cat >> pathnames.h <<'EOF' cat >> pathnames.h <<'EOF'