From d86588d23033955df991216f49e334fc9b0e36f1 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Sun, 17 Nov 2024 22:34:43 +0100 Subject: [PATCH] treewide: improve prepending and appending derivation arguments in bash code Those would be problematic with __structuredAttrs turned on, because they'd turn those nice bash arrays back into strings - and potentially lose some of the values on the way. --- pkgs/applications/audio/fmit/default.nix | 16 +++++++++------- pkgs/applications/audio/sonic-pi/default.nix | 4 +--- pkgs/applications/kde/marble.nix | 6 +++--- .../misc/maliit-framework/default.nix | 6 +++--- pkgs/applications/science/misc/boinc/default.nix | 6 ++++-- .../version-management/monotone-viz/default.nix | 2 +- .../version-management/vcprompt/default.nix | 5 ++++- pkgs/applications/video/kodi/unwrapped.nix | 4 ++-- pkgs/build-support/release/binary-tarball.nix | 2 +- pkgs/by-name/cl/cl-launch/package.nix | 5 ++++- pkgs/by-name/fl/fluxus/package.nix | 4 +--- pkgs/by-name/gl/globulation2/package.nix | 10 +++++----- pkgs/by-name/gp/gpsd/package.nix | 5 ++--- pkgs/by-name/gt/gt5/package.nix | 6 +++--- pkgs/by-name/lx/lxdvdrip/package.nix | 5 ++++- pkgs/by-name/ne/netcdfcxx4/package.nix | 2 +- pkgs/by-name/nf/nfs-utils/package.nix | 5 ++--- pkgs/by-name/np/np2kai/package.nix | 3 ++- pkgs/by-name/pa/pacparser/package.nix | 6 ++++-- .../pa/patchPpdFilesHook/patch-ppd-hook.sh | 2 +- .../pu/pulseaudio-module-xrdp/package.nix | 2 +- pkgs/by-name/ro/rocksndiamonds/package.nix | 2 +- pkgs/by-name/rt/rt/package.nix | 12 ++++++------ pkgs/by-name/se/serf/package.nix | 12 ++++++------ pkgs/by-name/si/silc_client/package.nix | 10 +++++----- pkgs/by-name/sp/spaceFM/package.nix | 5 +---- pkgs/by-name/tr/trigger/package.nix | 5 ++++- pkgs/by-name/ts/tsocks/package.nix | 5 ++++- pkgs/by-name/un/unbound/package.nix | 3 ++- pkgs/by-name/xl/xlockmore/package.nix | 2 +- pkgs/desktops/gnustep/make/default.nix | 5 +---- pkgs/desktops/plasma-5/default.nix | 4 ++-- .../development/compilers/gcc/common/builder.nix | 2 +- .../cuda-modules/setup-hooks/setup-cuda-hook.sh | 2 +- .../haskell-modules/configuration-nix.nix | 2 +- .../haskell-modules/generic-builder.nix | 6 +++--- .../hooks/python-catch-conflicts-hook-tests.nix | 2 +- pkgs/development/libraries/glibc/common.nix | 11 +++++------ .../libraries/grantlee/5/setup-hook.sh | 4 ++-- .../libraries/kde-frameworks/default.nix | 2 +- .../extra-cmake-modules/setup-hook.sh | 2 +- pkgs/development/libraries/phonon/default.nix | 6 +++--- .../libraries/qt-5/hooks/qtbase-setup-hook.sh | 2 +- pkgs/development/python-modules/numpy/1.nix | 2 +- pkgs/development/python-modules/numpy/2.nix | 2 +- .../tools/analysis/rr/zen_workaround.nix | 2 +- .../tools/analysis/sparse/default.nix | 5 ++++- pkgs/development/tools/misc/luarocks/default.nix | 4 ++-- .../frameworks/extra-cmake-modules/ecm-hook.sh | 2 +- pkgs/os-specific/bsd/freebsd/pkgs/bin.nix | 2 +- pkgs/servers/nosql/mongodb/mongodb.nix | 8 ++++---- pkgs/servers/x11/xorg/builder.sh | 4 ++-- pkgs/tools/typesetting/tex/nix/run-latex.sh | 2 +- 53 files changed, 129 insertions(+), 116 deletions(-) diff --git a/pkgs/applications/audio/fmit/default.nix b/pkgs/applications/audio/fmit/default.nix index c22fe3ab0977a..85fd36c3d86e2 100644 --- a/pkgs/applications/audio/fmit/default.nix +++ b/pkgs/applications/audio/fmit/default.nix @@ -28,13 +28,15 @@ mkDerivation rec { substituteInPlace fmit.pro --replace '$$FMITVERSIONGITPRO' '${version}' ''; - preConfigure = '' - qmakeFlags="$qmakeFlags \ - CONFIG+=${lib.optionalString alsaSupport "acs_alsa"} \ - CONFIG+=${lib.optionalString jackSupport "acs_jack"} \ - CONFIG+=${lib.optionalString portaudioSupport "acs_portaudio"} \ - PREFIXSHORTCUT=$out" - ''; + qmakeFlags = [ + "PREFIXSHORTCUT=${placeholder "out"}" + ] ++ lib.optionals alsaSupport [ + "CONFIG+=acs_alsa" + ] ++ lib.optionals jackSupport [ + "CONFIG+=acs_jack" + ] ++ lib.optionals portaudioSupport [ + "CONFIG+=acs_portaudio" + ]; meta = with lib; { description = "Free Musical Instrument Tuner"; diff --git a/pkgs/applications/audio/sonic-pi/default.nix b/pkgs/applications/audio/sonic-pi/default.nix index 286e26bdaad38..2c5ad98f64f58 100644 --- a/pkgs/applications/audio/sonic-pi/default.nix +++ b/pkgs/applications/audio/sonic-pi/default.nix @@ -105,6 +105,7 @@ stdenv.mkDerivation rec { "-DUSE_SYSTEM_LIBS=ON" "-DBUILD_IMGUI_INTERFACE=${if withImGui then "ON" else "OFF"}" "-DWITH_QT_GUI_WEBENGINE=${if withTauWidget then "ON" else "OFF"}" + "-DAPP_INSTALL_ROOT=${placeholder "out"}/app" ]; doCheck = true; @@ -136,9 +137,6 @@ stdenv.mkDerivation rec { # Prebuild Ruby vendored dependencies and Qt docs ./linux-prebuild.sh -o - - # Append CMake flag depending on the value of $out - cmakeFlags+=" -DAPP_INSTALL_ROOT=$out/app" ''; postBuild = '' diff --git a/pkgs/applications/kde/marble.nix b/pkgs/applications/kde/marble.nix index 78fc52996dc51..7593e33c4c159 100644 --- a/pkgs/applications/kde/marble.nix +++ b/pkgs/applications/kde/marble.nix @@ -18,7 +18,7 @@ mkDerivation { protobuf_21 qtscript qtsvg qtquickcontrols qtwebengine shared-mime-info krunner kparts knewstuff gpsd ]; - preConfigure = '' - cmakeFlags+=" -DINCLUDE_INSTALL_DIR=''${!outputDev}/include" - ''; + cmakeFlags = [ + "-DINCLUDE_INSTALL_DIR=${placeholder "dev"}/include" + ]; } diff --git a/pkgs/applications/misc/maliit-framework/default.nix b/pkgs/applications/misc/maliit-framework/default.nix index 7093524fc04df..2d350d567e7cf 100644 --- a/pkgs/applications/misc/maliit-framework/default.nix +++ b/pkgs/applications/misc/maliit-framework/default.nix @@ -66,9 +66,9 @@ mkDerivation rec { wayland-scanner ]; - preConfigure = '' - cmakeFlags+="-DQT5_PLUGINS_INSTALL_DIR=$out/$qtPluginPrefix" - ''; + cmakeFlags = [ + "-DQT5_PLUGINS_INSTALL_DIR=${placeholder "out"}/$qtPluginPrefix" + ]; meta = with lib; { description = "Core libraries of Maliit and server"; diff --git a/pkgs/applications/science/misc/boinc/default.nix b/pkgs/applications/science/misc/boinc/default.nix index b8b57857c02aa..8e15dd6468b5b 100644 --- a/pkgs/applications/science/misc/boinc/default.nix +++ b/pkgs/applications/science/misc/boinc/default.nix @@ -63,12 +63,14 @@ stdenv.mkDerivation rec { preConfigure = '' ./_autosetup - configureFlags="$configureFlags --sysconfdir=$out/etc" ''; enableParallelBuilding = true; - configureFlags = [ "--disable-server" ] ++ lib.optionals headless [ "--disable-manager" ]; + configureFlags = [ + "--disable-server" + "--sysconfdir=${placeholder "out"}/etc" + ] ++ lib.optionals headless [ "--disable-manager" ]; postInstall = '' install --mode=444 -D 'client/scripts/boinc-client.service' "$out/etc/systemd/system/boinc.service" diff --git a/pkgs/applications/version-management/monotone-viz/default.nix b/pkgs/applications/version-management/monotone-viz/default.nix index e8eac58e73f61..0e9cd4ddc59cd 100644 --- a/pkgs/applications/version-management/monotone-viz/default.nix +++ b/pkgs/applications/version-management/monotone-viz/default.nix @@ -38,7 +38,7 @@ stdenv.mkDerivation rec { ]; preConfigure = '' - configureFlags="$configureFlags --with-lablgtk-dir=$(echo ${lablgtk}/lib/ocaml/*/site-lib/lablgtk2)" + appendToVar configureFlags "--with-lablgtk-dir=$(echo ${lablgtk}/lib/ocaml/*/site-lib/lablgtk2)" ''; postInstall = '' diff --git a/pkgs/applications/version-management/vcprompt/default.nix b/pkgs/applications/version-management/vcprompt/default.nix index d2ef35c9b6688..f831003c6fa36 100644 --- a/pkgs/applications/version-management/vcprompt/default.nix +++ b/pkgs/applications/version-management/vcprompt/default.nix @@ -14,9 +14,12 @@ stdenv.mkDerivation rec { preConfigure = '' autoconf - makeFlags="$makeFlags PREFIX=$out" ''; + makeFlags = [ + "PREFIX=${placeholder "out"}" + ]; + meta = with lib; { description = '' A little C program that prints a short string with barebones information diff --git a/pkgs/applications/video/kodi/unwrapped.nix b/pkgs/applications/video/kodi/unwrapped.nix index 374837b01b38c..116f01837bc8a 100644 --- a/pkgs/applications/video/kodi/unwrapped.nix +++ b/pkgs/applications/video/kodi/unwrapped.nix @@ -214,10 +214,10 @@ in stdenv.mkDerivation (finalAttrs: { # Need these tools on the build system when cross compiling, # hacky, but have found no other way. CXX=$CXX_FOR_BUILD LD=ld make -C tools/depends/native/JsonSchemaBuilder - cmakeFlags+=" -DWITH_JSONSCHEMABUILDER=$PWD/tools/depends/native/JsonSchemaBuilder/bin" + appendToVar cmakeFlags "-DWITH_JSONSCHEMABUILDER=$PWD/tools/depends/native/JsonSchemaBuilder/bin" CXX=$CXX_FOR_BUILD LD=ld make EXTRA_CONFIGURE= -C tools/depends/native/TexturePacker - cmakeFlags+=" -DWITH_TEXTUREPACKER=$PWD/tools/depends/native/TexturePacker/bin" + appendToVar cmakeFlags "-DWITH_TEXTUREPACKER=$PWD/tools/depends/native/TexturePacker/bin" ''; postPatch = '' diff --git a/pkgs/build-support/release/binary-tarball.nix b/pkgs/build-support/release/binary-tarball.nix index aeaa8edb52beb..17cea7678c046 100644 --- a/pkgs/build-support/release/binary-tarball.nix +++ b/pkgs/build-support/release/binary-tarball.nix @@ -48,7 +48,7 @@ stdenv.mkDerivation ( # Prefix hackery because of a bug in stdenv (it tries to `mkdir # $prefix', which doesn't work due to the DESTDIR). - configureFlags="--prefix=$prefix $configureFlags" + prependToVar configureFlags "--prefix=$prefix" dontAddPrefix=1 prefix=$TMPDIR/inst$prefix ''; diff --git a/pkgs/by-name/cl/cl-launch/package.nix b/pkgs/by-name/cl/cl-launch/package.nix index 35cfd01ff9252..02bd24da1c426 100644 --- a/pkgs/by-name/cl/cl-launch/package.nix +++ b/pkgs/by-name/cl/cl-launch/package.nix @@ -9,10 +9,13 @@ stdenv.mkDerivation rec { }; preConfigure = '' - export makeFlags="$makeFlags PREFIX='$out'" mkdir -p "$out/bin" ''; + makeFlags = [ + "PREFIX=${placeholder "out"}" + ]; + preBuild = '' sed -e 's/\t\t@/\t\t/g' -i Makefile ''; diff --git a/pkgs/by-name/fl/fluxus/package.nix b/pkgs/by-name/fl/fluxus/package.nix index dfa518c5c5741..ef3bdce4407ce 100644 --- a/pkgs/by-name/fl/fluxus/package.nix +++ b/pkgs/by-name/fl/fluxus/package.nix @@ -58,10 +58,8 @@ stdenv.mkDerivation { "RacketInclude=${racket}/include/racket" "RacketLib=${racket}/lib/racket" "DESTDIR=build" + "Prefix=${placeholder "out"}" ]; - configurePhase = '' - sconsFlags+=" Prefix=$out" - ''; installPhase = '' mkdir -p $out cp -r build$out/* $out/ diff --git a/pkgs/by-name/gl/globulation2/package.nix b/pkgs/by-name/gl/globulation2/package.nix index a444f18335fc4..a11dadb70dcd4 100644 --- a/pkgs/by-name/gl/globulation2/package.nix +++ b/pkgs/by-name/gl/globulation2/package.nix @@ -51,11 +51,11 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ scons ]; buildInputs = [ libGLU libGL SDL SDL_ttf SDL_image zlib SDL_net speex libvorbis libogg boost fribidi bsdiff ]; - postConfigure = '' - sconsFlags+=" BINDIR=$out/bin" - sconsFlags+=" INSTALLDIR=$out/share/globulation2" - sconsFlags+=" DATADIR=$out/share/globulation2/glob2" - ''; + sconsFlags = [ + "BINDIR=${placeholder "out"}/bin" + "INSTALLDIR=${placeholder "out"}/share/globulation2" + "DATADIR=${placeholder "out"}/share/globulation2/glob2" + ]; NIX_LDFLAGS = "-lboost_system"; diff --git a/pkgs/by-name/gp/gpsd/package.nix b/pkgs/by-name/gp/gpsd/package.nix index 4b9269ab66927..a259a22c940b9 100644 --- a/pkgs/by-name/gp/gpsd/package.nix +++ b/pkgs/by-name/gp/gpsd/package.nix @@ -89,9 +89,6 @@ stdenv.mkDerivation rec { sed -e "s|systemd_dir = .*|systemd_dir = '$out/lib/systemd/system'|" -i SConscript export TAR=noop substituteInPlace SConscript --replace "env['CCVERSION']" "env['CC']" - - sconsFlags+=" udevdir=$out/lib/udev" - sconsFlags+=" python_libdir=$out/${python3Packages.python.sitePackages}" ''; # - leapfetch=no disables going online at build time to fetch leap-seconds @@ -102,6 +99,8 @@ stdenv.mkDerivation rec { "gpsd_group=${gpsdGroup}" "systemd=yes" "xgps=${if guiSupport then "True" else "False"}" + "udevdir=${placeholder "out"}/lib/udev" + "python_libdir=${placeholder "out"}/${python3Packages.python.sitePackages}" ]; preCheck = '' diff --git a/pkgs/by-name/gt/gt5/package.nix b/pkgs/by-name/gt/gt5/package.nix index 68b0e31971621..378ede59e42ce 100644 --- a/pkgs/by-name/gt/gt5/package.nix +++ b/pkgs/by-name/gt/gt5/package.nix @@ -13,9 +13,9 @@ stdenv.mkDerivation rec { sed 's/-o root -g root//' -i Makefile ''; - preConfigure = '' - makeFlags="$makeFlags PREFIX=$out" - ''; + makeFlags = [ + "PREFIX=${placeholder "out"}" + ]; meta = { description = "Diff-capable 'du' browser"; diff --git a/pkgs/by-name/lx/lxdvdrip/package.nix b/pkgs/by-name/lx/lxdvdrip/package.nix index 32b533346dfdb..fea6e319cc022 100644 --- a/pkgs/by-name/lx/lxdvdrip/package.nix +++ b/pkgs/by-name/lx/lxdvdrip/package.nix @@ -12,9 +12,12 @@ stdenv.mkDerivation rec { postPatch = '' sed -i -e s,/usr/local,$out, -e s,/etc,$out/etc,g Makefile sed -i -e s,/usr/local,$out, mbuffer/Makefile - makeFlags="$makeFlags PREFIX=$out" ''; + makeFlags = [ + "PREFIX=${placeholder "out"}" + ]; + preInstall = '' mkdir -p $out/man/man1 $out/bin $out/share $out/etc ''; diff --git a/pkgs/by-name/ne/netcdfcxx4/package.nix b/pkgs/by-name/ne/netcdfcxx4/package.nix index 606e8a86b0c34..378fe8ceccf07 100644 --- a/pkgs/by-name/ne/netcdfcxx4/package.nix +++ b/pkgs/by-name/ne/netcdfcxx4/package.nix @@ -16,7 +16,7 @@ stdenv.mkDerivation rec { ]; preConfigure = '' - cmakeFlags+="-Dabs_top_srcdir=$(readlink -f ./)" + appendToVar cmakeFlags "-Dabs_top_srcdir=$(readlink -f ./)" ''; nativeBuildInputs = [ cmake ninja ]; diff --git a/pkgs/by-name/nf/nfs-utils/package.nix b/pkgs/by-name/nf/nfs-utils/package.nix index 5f0e62b1b8113..dd499fbf5397a 100644 --- a/pkgs/by-name/nf/nfs-utils/package.nix +++ b/pkgs/by-name/nf/nfs-utils/package.nix @@ -42,7 +42,8 @@ stdenv.mkDerivation rec { ''; configureFlags = - [ "--enable-gss" + [ "--with-start-statd=${placeholder "out"}/bin/start-statd" + "--enable-gss" "--enable-svcgss" "--with-statedir=/var/lib/nfs" "--with-krb5=${lib.getLib libkrb5}" @@ -67,8 +68,6 @@ stdenv.mkDerivation rec { sed -i "s,/usr/sbin,$out/bin,g" utils/statd/statd.c sed -i "s,^PATH=.*,PATH=$out/bin:${statdPath}," utils/statd/start-statd - configureFlags="--with-start-statd=$out/bin/start-statd $configureFlags" - substituteInPlace systemd/nfs-utils.service \ --replace "/bin/true" "${coreutils}/bin/true" diff --git a/pkgs/by-name/np/np2kai/package.nix b/pkgs/by-name/np/np2kai/package.nix index 0fc56e2844173..bea767d0ed078 100644 --- a/pkgs/by-name/np/np2kai/package.nix +++ b/pkgs/by-name/np/np2kai/package.nix @@ -124,7 +124,8 @@ stdenv.mkDerivation rec { configurePhase = '' export GIT_VERSION=${builtins.substring 0 7 src.rev} - buildFlags="$buildFlags ''${enableParallelBuilding:+-j$NIX_BUILD_CORES}" + '' + optionalString enableParallelBuilding '' + appendToVar buildFlags "-j$NIX_BUILD_CORES" '' + optionalString enableX11 '' cd x11 substituteInPlace Makefile.am \ diff --git a/pkgs/by-name/pa/pacparser/package.nix b/pkgs/by-name/pa/pacparser/package.nix index dfef255c15c9a..82d24f99c6f43 100644 --- a/pkgs/by-name/pa/pacparser/package.nix +++ b/pkgs/by-name/pa/pacparser/package.nix @@ -11,10 +11,12 @@ stdenv.mkDerivation rec { sha256 = "sha256-X842+xPjM404aQJTc2JwqU4vq8kgyKhpnqVu70pNLks="; }; - makeFlags = [ "NO_INTERNET=1" ]; + makeFlags = [ + "NO_INTERNET=1" + "PREFIX=${placeholder "out"}" + ]; preConfigure = '' - export makeFlags="$makeFlags PREFIX=$out" patchShebangs tests/runtests.sh cd src ''; diff --git a/pkgs/by-name/pa/patchPpdFilesHook/patch-ppd-hook.sh b/pkgs/by-name/pa/patchPpdFilesHook/patch-ppd-hook.sh index 77322b245b277..8227146364157 100644 --- a/pkgs/by-name/pa/patchPpdFilesHook/patch-ppd-hook.sh +++ b/pkgs/by-name/pa/patchPpdFilesHook/patch-ppd-hook.sh @@ -174,7 +174,7 @@ patchPpdFileCommands () { # The end result might contain too many # propagated dependencies for multi-output packages, # but never a broken package. - propagatedBuildInputs+=("$path") + appendToVar propagatedBuildInputs "$path" done < sorted-dependencies fi diff --git a/pkgs/by-name/pu/pulseaudio-module-xrdp/package.nix b/pkgs/by-name/pu/pulseaudio-module-xrdp/package.nix index c83d08fc828f2..5e62dd7a63868 100644 --- a/pkgs/by-name/pu/pulseaudio-module-xrdp/package.nix +++ b/pkgs/by-name/pu/pulseaudio-module-xrdp/package.nix @@ -24,7 +24,7 @@ stdenv.mkDerivation rec { mv pulseaudio-* pulseaudio-src chmod +w -Rv pulseaudio-src cp ${pulseaudio.dev}/include/pulse/config.h pulseaudio-src - configureFlags="$configureFlags PULSE_DIR=$(realpath ./pulseaudio-src)" + appendToVar configureFlags "PULSE_DIR=$(realpath ./pulseaudio-src)" ''; installPhase = '' diff --git a/pkgs/by-name/ro/rocksndiamonds/package.nix b/pkgs/by-name/ro/rocksndiamonds/package.nix index 4aa70ffa5334f..6331231659696 100644 --- a/pkgs/by-name/ro/rocksndiamonds/package.nix +++ b/pkgs/by-name/ro/rocksndiamonds/package.nix @@ -32,7 +32,7 @@ stdenv.mkDerivation rec { preBuild = '' dataDir="$out/share/rocksndiamonds" - makeFlags+="BASE_PATH=$dataDir" + appendToVar makeFlags "BASE_PATH=$dataDir" ''; installPhase = '' diff --git a/pkgs/by-name/rt/rt/package.nix b/pkgs/by-name/rt/rt/package.nix index 59933570d7b15..f73c6df494f9e 100644 --- a/pkgs/by-name/rt/rt/package.nix +++ b/pkgs/by-name/rt/rt/package.nix @@ -123,12 +123,12 @@ stdenv.mkDerivation rec { echo rt-${version} > .tag ''; preConfigure = '' - configureFlags="$configureFlags --with-web-user=$UID" - configureFlags="$configureFlags --with-web-group=$(id -g)" - configureFlags="$configureFlags --with-rt-group=$(id -g)" - configureFlags="$configureFlags --with-bin-owner=$UID" - configureFlags="$configureFlags --with-libs-owner=$UID" - configureFlags="$configureFlags --with-libs-group=$(id -g)" + appendToVar configureFlags "--with-web-user=$UID" + appendToVar configureFlags "--with-web-group=$(id -g)" + appendToVar configureFlags "--with-rt-group=$(id -g)" + appendToVar configureFlags "--with-bin-owner=$UID" + appendToVar configureFlags "--with-libs-owner=$UID" + appendToVar configureFlags "--with-libs-group=$(id -g)" ''; configureFlags = [ "--enable-graphviz" diff --git a/pkgs/by-name/se/serf/package.nix b/pkgs/by-name/se/serf/package.nix index 07138596d05de..1bbfe31f9c41c 100644 --- a/pkgs/by-name/se/serf/package.nix +++ b/pkgs/by-name/se/serf/package.nix @@ -37,13 +37,13 @@ stdenv.mkDerivation rec { prefixKey = "PREFIX="; preConfigure = '' - sconsFlags+=" APR=$(echo ${apr.dev}/bin/*-config)" - sconsFlags+=" APU=$(echo ${aprutil.dev}/bin/*-config)" - sconsFlags+=" CC=$CC" - sconsFlags+=" OPENSSL=${openssl}" - sconsFlags+=" ZLIB=${zlib}" + appendToVar sconsFlags "APR=$(echo ${apr.dev}/bin/*-config)" + appendToVar sconsFlags "APU=$(echo ${aprutil.dev}/bin/*-config)" + appendToVar sconsFlags "CC=$CC" + appendToVar sconsFlags "OPENSSL=${openssl}" + appendToVar sconsFlags "ZLIB=${zlib}" '' + lib.optionalString (!stdenv.hostPlatform.isCygwin) '' - sconsFlags+=" GSSAPI=${libkrb5.dev}" + appendToVar sconsFlags "GSSAPI=${libkrb5.dev}" ''; enableParallelBuilding = true; diff --git a/pkgs/by-name/si/silc_client/package.nix b/pkgs/by-name/si/silc_client/package.nix index 7a64e5cc12332..ae362b682674d 100644 --- a/pkgs/by-name/si/silc_client/package.nix +++ b/pkgs/by-name/si/silc_client/package.nix @@ -19,11 +19,11 @@ stdenv.mkDerivation rec { hardeningDisable = [ "format" ]; - configureFlags = [ "--with-ncurses=${ncurses.dev}" ]; - - preConfigure = lib.optionalString enablePlugin '' - configureFlags="$configureFlags --with-silc-plugin=$out/lib/irssi" - ''; + configureFlags = [ + "--with-ncurses=${ncurses.dev}" + ] ++ lib.optionals enablePlugin [ + "--with-silc-plugin=${placeholder "out"}/lib/irssi" + ]; nativeBuildInputs = [ pkg-config ]; buildInputs = [ perl glib ncurses ]; diff --git a/pkgs/by-name/sp/spaceFM/package.nix b/pkgs/by-name/sp/spaceFM/package.nix index f7c7eac9a3a3f..c2d90f513e109 100644 --- a/pkgs/by-name/sp/spaceFM/package.nix +++ b/pkgs/by-name/sp/spaceFM/package.nix @@ -30,12 +30,9 @@ stdenv.mkDerivation rec { configureFlags = [ "--with-bash-path=${pkgs.bash}/bin/bash" + "--sysconfdir=${placeholder "out"}/etc" ]; - preConfigure = '' - configureFlags="$configureFlags --sysconfdir=$out/etc" - ''; - postInstall = '' rm -f $out/etc/spacefm/spacefm.conf ln -s /etc/spacefm/spacefm.conf $out/etc/spacefm/spacefm.conf diff --git a/pkgs/by-name/tr/trigger/package.nix b/pkgs/by-name/tr/trigger/package.nix index 86b47f554193e..7b661f6422485 100644 --- a/pkgs/by-name/tr/trigger/package.nix +++ b/pkgs/by-name/tr/trigger/package.nix @@ -32,9 +32,12 @@ stdenv.mkDerivation rec { sed s,lSDL2main,lSDL2, -i GNUmakefile export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${SDL2.dev}/include/SDL2" - export makeFlags="$makeFlags prefix=$out" ''; + makeFlags = [ + "prefix=${placeholder "out"}" + ]; + enableParallelBuilding = true; postInstall = '' diff --git a/pkgs/by-name/ts/tsocks/package.nix b/pkgs/by-name/ts/tsocks/package.nix index c12f9a44ac6d2..33a66d637860f 100644 --- a/pkgs/by-name/ts/tsocks/package.nix +++ b/pkgs/by-name/ts/tsocks/package.nix @@ -14,9 +14,12 @@ stdenv.mkDerivation rec { preConfigure = '' sed -i -e "s,\\\/usr,"$(echo $out|sed -e "s,\\/,\\\\\\\/,g")",g" tsocks substituteInPlace tsocks --replace /usr $out - export configureFlags="$configureFlags --libdir=$out/lib" ''; + configureFlags = [ + "--libdir=${placeholder "out"}/lib" + ]; + preBuild = '' # We don't need the saveme binary, it is in fact never stored and we're # never injecting stuff into ld.so.preload anyway diff --git a/pkgs/by-name/un/unbound/package.nix b/pkgs/by-name/un/unbound/package.nix index c9d9a7a26cf6b..6bb4dbe5f8323 100644 --- a/pkgs/by-name/un/unbound/package.nix +++ b/pkgs/by-name/un/unbound/package.nix @@ -140,7 +140,8 @@ stdenv.mkDerivation (finalAttrs: { # Build libunbound again, but only against nettle instead of openssl. # This avoids gnutls.out -> unbound.lib -> lib.getLib openssl. '' - configureFlags="$configureFlags --with-nettle=${nettle.dev} --with-libunbound-only" + appendToVar configureFlags "--with-nettle=${nettle.dev}" + appendToVar configureFlags "--with-libunbound-only" configurePhase buildPhase if [ -n "$doCheck" ]; then diff --git a/pkgs/by-name/xl/xlockmore/package.nix b/pkgs/by-name/xl/xlockmore/package.nix index 37c864f87f413..4ef282631510a 100644 --- a/pkgs/by-name/xl/xlockmore/package.nix +++ b/pkgs/by-name/xl/xlockmore/package.nix @@ -19,6 +19,7 @@ stdenv.mkDerivation rec { # fine via PAM without super user privileges. configureFlags = [ "--disable-setuid" + "--enable-appdefaultdir=${placeholder "out"}/share/X11/app-defaults" ] ++ (lib.optional (pam != null) "--enable-pam"); postPatch = @@ -27,7 +28,6 @@ stdenv.mkDerivation rec { in '' sed -i 's,\(for ac_dir in\),\1 ${inputs},' configure.ac sed -i 's,/usr/,/no-such-dir/,g' configure.ac - configureFlags+=" --enable-appdefaultdir=$out/share/X11/app-defaults" ''; hardeningDisable = [ "format" ]; # no build output otherwise diff --git a/pkgs/desktops/gnustep/make/default.nix b/pkgs/desktops/gnustep/make/default.nix index 32dda5f648389..eed342d4847c3 100644 --- a/pkgs/desktops/gnustep/make/default.nix +++ b/pkgs/desktops/gnustep/make/default.nix @@ -17,12 +17,9 @@ stdenv.mkDerivation (finalAttrs: { configureFlags = [ "--with-layout=fhs-system" "--disable-install-p" + "--with-config-file=${placeholder "out"}/etc/GNUstep/GNUstep.conf" ]; - preConfigure = '' - configureFlags="$configureFlags --with-config-file=$out/etc/GNUstep/GNUstep.conf" - ''; - makeFlags = [ "GNUSTEP_INSTALLATION_DOMAIN=SYSTEM" ]; diff --git a/pkgs/desktops/plasma-5/default.nix b/pkgs/desktops/plasma-5/default.nix index 20c7904f9c0ab..61ad804d81900 100644 --- a/pkgs/desktops/plasma-5/default.nix +++ b/pkgs/desktops/plasma-5/default.nix @@ -61,7 +61,7 @@ let postHooks+=("source @dev@/nix-support/setup-hook") else # Propagate $${out} output - propagatedUserEnvPkgs+=" @${out}@" + appendToVar propagatedUserEnvPkgs "@${out}@" if [ -z "$outputDev" ]; then echo "error: \$outputDev is unset!" >&2 @@ -71,7 +71,7 @@ let # Propagate $dev so that this setup hook is propagated # But only if there is a separate $dev output if [ "$outputDev" != out ]; then - propagatedBuildInputs+=" @dev@" + appendToVar propagatedBuildInputs "@dev@" fi fi ''; diff --git a/pkgs/development/compilers/gcc/common/builder.nix b/pkgs/development/compilers/gcc/common/builder.nix index 874a43a75f820..ccc4a2feff0b6 100644 --- a/pkgs/development/compilers/gcc/common/builder.nix +++ b/pkgs/development/compilers/gcc/common/builder.nix @@ -185,7 +185,7 @@ originalAttrs: (stdenv.mkDerivation (finalAttrs: originalAttrs // { mkdir -p ../mingw # --with-build-sysroot expects that: cp -R $libcCross/include ../mingw - configureFlags="$configureFlags --with-build-sysroot=`pwd`/.." + appendToVar configureFlags "--with-build-sysroot=`pwd`/.." fi # Perform the build in a different directory. diff --git a/pkgs/development/cuda-modules/setup-hooks/setup-cuda-hook.sh b/pkgs/development/cuda-modules/setup-hooks/setup-cuda-hook.sh index 7799d72873a05..7586f9f4b4141 100644 --- a/pkgs/development/cuda-modules/setup-hooks/setup-cuda-hook.sh +++ b/pkgs/development/cuda-modules/setup-hooks/setup-cuda-hook.sh @@ -112,7 +112,7 @@ propagateCudaLibraries() { local propagatedBuildInputs=( "${!cudaHostPathsSeen[@]}" ) for output in $(getAllOutputNames) ; do if [[ ! "$output" = "$cudaPropagateToOutput" ]] ; then - propagatedBuildInputs+=( "${!output}" ) + appendToVar propagatedBuildInputs "${!output}" fi break done diff --git a/pkgs/development/haskell-modules/configuration-nix.nix b/pkgs/development/haskell-modules/configuration-nix.nix index 7a85abfba34ed..5d579924bf3a8 100644 --- a/pkgs/development/haskell-modules/configuration-nix.nix +++ b/pkgs/development/haskell-modules/configuration-nix.nix @@ -255,7 +255,7 @@ self: super: builtins.intersectAttrs super { jni = overrideCabal (drv: { preConfigure = '' local libdir=( "${pkgs.jdk}/lib/openjdk/jre/lib/"*"/server" ) - configureFlags+=" --extra-lib-dir=''${libdir[0]}" + appendToVar configureFlags "--extra-lib-dir=''${libdir[0]}" ''; }) super.jni; diff --git a/pkgs/development/haskell-modules/generic-builder.nix b/pkgs/development/haskell-modules/generic-builder.nix index eb7ea4cf76a28..34b3313674d6f 100644 --- a/pkgs/development/haskell-modules/generic-builder.nix +++ b/pkgs/development/haskell-modules/generic-builder.nix @@ -478,13 +478,13 @@ stdenv.mkDerivation ({ for p in "''${pkgsHostHost[@]}" "''${pkgsHostTarget[@]}"; do ${buildPkgDb ghc "$packageConfDir"} if [ -d "$p/include" ]; then - configureFlags+=" --extra-include-dirs=$p/include" + appendToVar configureFlags "--extra-include-dirs=$p/include" fi if [ -d "$p/lib" ]; then - configureFlags+=" --extra-lib-dirs=$p/lib" + appendToVar configureFlags "--extra-lib-dirs=$p/lib" fi if [[ -d "$p/Library/Frameworks" ]]; then - configureFlags+=" --extra-framework-dirs=$p/Library/Frameworks" + appendToVar configureFlags "--extra-framework-dirs=$p/Library/Frameworks" fi '' + '' done diff --git a/pkgs/development/interpreters/python/hooks/python-catch-conflicts-hook-tests.nix b/pkgs/development/interpreters/python/hooks/python-catch-conflicts-hook-tests.nix index 2a77ef015015e..4a691685a37a7 100644 --- a/pkgs/development/interpreters/python/hooks/python-catch-conflicts-hook-tests.nix +++ b/pkgs/development/interpreters/python/hooks/python-catch-conflicts-hook-tests.nix @@ -83,7 +83,7 @@ in { generatePythonPackage { pname = "cyclic-dependencies"; preFixup = '' - propagatedBuildInputs+=("$out") + appendToVar propagatedBuildInputs "$out" ''; }; diff --git a/pkgs/development/libraries/glibc/common.nix b/pkgs/development/libraries/glibc/common.nix index 09dde042848b4..42ca8f70ff2ef 100644 --- a/pkgs/development/libraries/glibc/common.nix +++ b/pkgs/development/libraries/glibc/common.nix @@ -224,6 +224,11 @@ stdenv.mkDerivation ({ inherit sha256; }; + makeFlags = lib.optionals (stdenv.cc.libc != null) [ + "BUILD_LDFLAGS=-Wl,-rpath,${stdenv.cc.libc}/lib" + "OBJDUMP=${stdenv.cc.bintools.bintools}/bin/objdump" + ]; + # Remove absolute paths from `configure' & co.; build out-of-tree. preConfigure = '' export PWD_P=$(type -tP pwd) @@ -237,12 +242,6 @@ stdenv.mkDerivation ({ cd ../build configureScript="`pwd`/../$sourceRoot/configure" - - ${lib.optionalString (stdenv.cc.libc != null) - ''makeFlags="$makeFlags BUILD_LDFLAGS=-Wl,-rpath,${stdenv.cc.libc}/lib OBJDUMP=${stdenv.cc.bintools.bintools}/bin/objdump"'' - } - - '' + lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) '' sed -i s/-lgcc_eh//g "../$sourceRoot/Makeconfig" diff --git a/pkgs/development/libraries/grantlee/5/setup-hook.sh b/pkgs/development/libraries/grantlee/5/setup-hook.sh index b51cb4a319091..1f57c38eb89a0 100644 --- a/pkgs/development/libraries/grantlee/5/setup-hook.sh +++ b/pkgs/development/libraries/grantlee/5/setup-hook.sh @@ -6,8 +6,8 @@ providesGrantleeRuntime() { _grantleeEnvHook() { if providesGrantleeRuntime "$1"; then - propagatedBuildInputs+=" $1" - propagatedUserEnvPkgs+=" $1" + appendToVar propagatedBuildInputs "$1" + appendToVar propagatedUserEnvPkgs "$1" fi } addEnvHooks "$hostOffset" _grantleeEnvHook diff --git a/pkgs/development/libraries/kde-frameworks/default.nix b/pkgs/development/libraries/kde-frameworks/default.nix index cc87ec2afa57b..e751d8b40b039 100644 --- a/pkgs/development/libraries/kde-frameworks/default.nix +++ b/pkgs/development/libraries/kde-frameworks/default.nix @@ -52,7 +52,7 @@ let # Propagate $dev so that this setup hook is propagated # But only if there is a separate $dev output if [ "''${outputDev:?}" != out ]; then - propagatedBuildInputs="''${propagatedBuildInputs-} @dev@" + appendToVar propagatedBuildInputs "@dev@" fi fi ''; diff --git a/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/setup-hook.sh b/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/setup-hook.sh index e576dbb4ec73b..abf330fd9662e 100644 --- a/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/setup-hook.sh +++ b/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/setup-hook.sh @@ -111,7 +111,7 @@ ecmHostPathHook() { if [ -d "$1/dbus-1" ] then - propagatedUserEnvPkgs+=" $1" + appendToVar propagatedUserEnvPkgs "$1" fi } addEnvHooks "$targetOffset" ecmHostPathHook diff --git a/pkgs/development/libraries/phonon/default.nix b/pkgs/development/libraries/phonon/default.nix index 58cd0245d0524..9068c5f67d53e 100644 --- a/pkgs/development/libraries/phonon/default.nix +++ b/pkgs/development/libraries/phonon/default.nix @@ -62,9 +62,9 @@ stdenv.mkDerivation rec { dontWrapQtApps = true; preConfigure = '' - cmakeFlags+=" -DPHONON_QT_MKSPECS_INSTALL_DIR=''${!outputDev}/mkspecs" - cmakeFlags+=" -DPHONON_QT_IMPORTS_INSTALL_DIR=''${!outputBin}/$qtQmlPrefix" - cmakeFlags+=" -DPHONON_QT_PLUGIN_INSTALL_DIR=''${!outputBin}/$qtPluginPrefix/designer" + appendToVar cmakeFlags "-DPHONON_QT_MKSPECS_INSTALL_DIR=''${!outputDev}/mkspecs" + appendToVar cmakeFlags "-DPHONON_QT_IMPORTS_INSTALL_DIR=''${!outputBin}/$qtQmlPrefix" + appendToVar cmakeFlags "-DPHONON_QT_PLUGIN_INSTALL_DIR=''${!outputBin}/$qtPluginPrefix/designer" ''; postPatch = '' diff --git a/pkgs/development/libraries/qt-5/hooks/qtbase-setup-hook.sh b/pkgs/development/libraries/qt-5/hooks/qtbase-setup-hook.sh index 1b189d24d9eef..1a9b940328682 100644 --- a/pkgs/development/libraries/qt-5/hooks/qtbase-setup-hook.sh +++ b/pkgs/development/libraries/qt-5/hooks/qtbase-setup-hook.sh @@ -72,7 +72,7 @@ qtEnvHostTargetHook() { qtEnvHostTargetSeen[$1]=1 if providesQtRuntime "$1" && [ "z${!outputBin}" != "z${!outputDev}" ] then - propagatedBuildInputs+=" $1" + appendToVar propagatedBuildInputs "$1" fi } envHostTargetHooks+=(qtEnvHostTargetHook) diff --git a/pkgs/development/python-modules/numpy/1.nix b/pkgs/development/python-modules/numpy/1.nix index 795f24e5eefa9..fad35559c9eda 100644 --- a/pkgs/development/python-modules/numpy/1.nix +++ b/pkgs/development/python-modules/numpy/1.nix @@ -126,7 +126,7 @@ buildPythonPackage rec { # HACK: copy mesonEmulatorHook's flags to the variable used by meson-python postConfigure = '' - mesonFlags="$mesonFlags ''${mesonFlagsArray[@]}" + concatTo mesonFlags mesonFlagsArray ''; preBuild = '' diff --git a/pkgs/development/python-modules/numpy/2.nix b/pkgs/development/python-modules/numpy/2.nix index bbf8acbb32929..db4d1fcc63ee1 100644 --- a/pkgs/development/python-modules/numpy/2.nix +++ b/pkgs/development/python-modules/numpy/2.nix @@ -103,7 +103,7 @@ buildPythonPackage rec { # HACK: copy mesonEmulatorHook's flags to the variable used by meson-python postConfigure = '' - mesonFlags="$mesonFlags ''${mesonFlagsArray[@]}" + concatTo mesonFlags mesonFlagsArray ''; buildInputs = [ diff --git a/pkgs/development/tools/analysis/rr/zen_workaround.nix b/pkgs/development/tools/analysis/rr/zen_workaround.nix index 4410224e84547..f69fdcf3b6386 100644 --- a/pkgs/development/tools/analysis/rr/zen_workaround.nix +++ b/pkgs/development/tools/analysis/rr/zen_workaround.nix @@ -17,7 +17,7 @@ stdenv.mkDerivation { "-C${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" ]; postConfigure = '' - makeFlags="$makeFlags M=$(pwd)" + appendToVar makeFlags "M=$(pwd)" ''; buildFlags = [ "modules" ]; diff --git a/pkgs/development/tools/analysis/sparse/default.nix b/pkgs/development/tools/analysis/sparse/default.nix index 497d571cf14c3..38adbe4d83775 100644 --- a/pkgs/development/tools/analysis/sparse/default.nix +++ b/pkgs/development/tools/analysis/sparse/default.nix @@ -14,9 +14,12 @@ in stdenv.mkDerivation rec { preConfigure = '' sed -i 's|"/usr/include"|"${stdenv.cc.libc.dev}/include"|' pre-process.c sed -i 's|qx(\$ccom -print-file-name=)|"${GCC_BASE}"|' cgcc - makeFlags+=" PREFIX=$out" ''; + makeFlags = [ + "PREFIX=${placeholder "out"}" + ]; + nativeBuildInputs = [ pkg-config ]; buildInputs = [ gtk3 libxml2 llvm perl sqlite ]; doCheck = true; diff --git a/pkgs/development/tools/misc/luarocks/default.nix b/pkgs/development/tools/misc/luarocks/default.nix index b15924b34f3c5..db85fdef01c4d 100644 --- a/pkgs/development/tools/misc/luarocks/default.nix +++ b/pkgs/development/tools/misc/luarocks/default.nix @@ -50,12 +50,12 @@ stdenv.mkDerivation (finalAttrs: { lua -e "" || { luajit -e "" && { export LUA_SUFFIX=jit - configureFlags="$configureFlags --lua-suffix=$LUA_SUFFIX" + appendToVar configureFlags "--lua-suffix=$LUA_SUFFIX" } } lua_inc="$(echo "${lua}/include"/*/)" if test -n "$lua_inc"; then - configureFlags="$configureFlags --with-lua-include=$lua_inc" + appendToVar configureFlags "--with-lua-include=$lua_inc" fi ''; diff --git a/pkgs/kde/frameworks/extra-cmake-modules/ecm-hook.sh b/pkgs/kde/frameworks/extra-cmake-modules/ecm-hook.sh index c635816777f52..85ba59faf8dfd 100644 --- a/pkgs/kde/frameworks/extra-cmake-modules/ecm-hook.sh +++ b/pkgs/kde/frameworks/extra-cmake-modules/ecm-hook.sh @@ -107,7 +107,7 @@ ecmHostPathHook() { if [ -d "$1/share/dbus-1" ] then - propagatedUserEnvPkgs+=" $1" + appendToVar propagatedUserEnvPkgs "$1" fi } addEnvHooks "$hostOffset" ecmHostPathHook diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/bin.nix b/pkgs/os-specific/bsd/freebsd/pkgs/bin.nix index 2b2738ec5794a..d287834dcd552 100644 --- a/pkgs/os-specific/bsd/freebsd/pkgs/bin.nix +++ b/pkgs/os-specific/bsd/freebsd/pkgs/bin.nix @@ -81,7 +81,7 @@ mkDerivation { ''; preInstall = '' - makeFlags="$makeFlags ROOTDIR=$out/root" + appendToVar makeFlags "ROOTDIR=$out/root" ''; outputs = [ diff --git a/pkgs/servers/nosql/mongodb/mongodb.nix b/pkgs/servers/nosql/mongodb/mongodb.nix index 37fc0a2e8a573..bd7f8ae61ec2c 100644 --- a/pkgs/servers/nosql/mongodb/mongodb.nix +++ b/pkgs/servers/nosql/mongodb/mongodb.nix @@ -136,12 +136,12 @@ in stdenv.mkDerivation rec { hardeningDisable = [ "fortify3" ]; preBuild = '' - sconsFlags+=" CC=$CC" - sconsFlags+=" CXX=$CXX" + appendToVar sconsFlags "CC=$CC" + appendToVar sconsFlags "CXX=$CXX" '' + lib.optionalString (!stdenv.hostPlatform.isDarwin) '' - sconsFlags+=" AR=$AR" + appendToVar sconsFlags "AR=$AR" '' + lib.optionalString stdenv.hostPlatform.isAarch64 '' - sconsFlags+=" CCFLAGS='-march=armv8-a+crc'" + appendToVar sconsFlags "CCFLAGS=-march=armv8-a+crc" ''; preInstall = '' diff --git a/pkgs/servers/x11/xorg/builder.sh b/pkgs/servers/x11/xorg/builder.sh index 833acf43a5b0a..1ed163690f89e 100644 --- a/pkgs/servers/x11/xorg/builder.sh +++ b/pkgs/servers/x11/xorg/builder.sh @@ -21,14 +21,14 @@ postInstall() { for p in "${pkgsHostHost[@]}" "${pkgsHostTarget[@]}"; do if test -e $p/lib/pkgconfig/$r.pc; then echo " found requisite $r in $p" - propagatedBuildInputs+=" $p" + appendToVar propagatedBuildInputs "$p" fi done done } -installFlags="appdefaultdir=$out/share/X11/app-defaults $installFlags" +prependToVar installFlags "appdefaultdir=$out/share/X11/app-defaults" if test -n "$x11BuildHook"; then diff --git a/pkgs/tools/typesetting/tex/nix/run-latex.sh b/pkgs/tools/typesetting/tex/nix/run-latex.sh index 3f8a16580ea58..9c18076872843 100644 --- a/pkgs/tools/typesetting/tex/nix/run-latex.sh +++ b/pkgs/tools/typesetting/tex/nix/run-latex.sh @@ -99,7 +99,7 @@ fi if test -f $rootNameBase.idx; then echo "MAKING INDEX..." if test -n "$compressBlanksInIndex"; then - makeindexFlags="$makeindexFlags -c" + appendToVar makeindexFlags "-c" fi makeindex $makeindexFlags $rootNameBase.idx runNeeded=1