From b19d0f6d3d46970dc97012a7a2964aa73d647114 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Sat, 25 Jan 2025 16:28:57 +0100 Subject: [PATCH] treewide: replace substituteAll with replaceVars --- .../scripts/incus/incus-container-image.nix | 3 +- .../incus/incus-virtual-machine-image.nix | 3 +- .../scripts/lxd/lxd-container-image.nix | 3 +- .../scripts/lxd/lxd-virtual-machine-image.nix | 3 +- nixos/modules/installer/cd-dvd/iso-image.nix | 6 +--- .../services/misc/taskserver/default.nix | 3 +- .../modules/system/boot/loader/grub/grub.nix | 6 ++-- .../applications/editors/emacs/make-emacs.nix | 1 - pkgs/applications/networking/dropbox/cli.nix | 7 +++-- .../applications/science/logic/z3/default.nix | 2 +- .../ar/arma3-unix-launcher/package.nix | 5 ++-- pkgs/by-name/br/brillo/package.nix | 7 +++-- .../bu/budgie-control-center/package.nix | 6 ++-- ...001-Do-not-download-sources-in-cmake.patch | 2 +- pkgs/by-name/cb/cbmc/package.nix | 7 ++--- pkgs/by-name/fb/fbmenugen/package.nix | 7 +++-- pkgs/by-name/fr/freenet/package.nix | 7 +++-- pkgs/by-name/in/iniparser/package.nix | 1 - pkgs/by-name/me/meson/package.nix | 5 ++-- pkgs/by-name/nu/nuget-to-json/package.nix | 26 +++++++++-------- pkgs/by-name/nu/nuget-to-nix/package.nix | 28 ++++++++++--------- pkgs/by-name/sp/speechd/package.nix | 12 ++++---- pkgs/by-name/us/usbutils/package.nix | 5 ++-- .../stylesheets/xslt/docbook-xsl/default.nix | 5 ++-- .../gnome/extensions/extensionOverrides.nix | 4 +-- .../gnome/extensions/gsconnect/default.nix | 7 +++-- .../extensions/taskwhisperer/default.nix | 6 ++-- .../lomiri/qml/lomiri-ui-toolkit/default.nix | 6 ++-- pkgs/desktops/mate/caja-dropbox/default.nix | 7 +++-- .../development/compilers/crystal/default.nix | 5 ++-- .../compilers/dotnet/sign-apphost.nix | 5 ++-- pkgs/development/compilers/dotnet/wrapper.nix | 11 ++++---- .../compilers/emscripten/default.nix | 5 ++-- pkgs/development/compilers/go/1.22.nix | 11 +++----- pkgs/development/compilers/go/1.23.nix | 11 +++----- pkgs/development/compilers/go/1.24.nix | 11 +++----- pkgs/development/compilers/ponyc/default.nix | 5 ++-- .../compilers/swift/compiler/default.nix | 8 ++---- .../compilers/swift/swift-driver/default.nix | 5 ++-- .../compilers/swift/swiftpm/default.nix | 8 ++---- pkgs/development/compilers/vala/default.nix | 5 ++-- pkgs/development/embedded/platformio/core.nix | 8 ++---- .../haskell-modules/configuration-nix.nix | 6 ++-- .../development/interpreters/acl2/default.nix | 5 ++-- .../interpreters/python/pypy/default.nix | 8 ++---- .../libraries/appstream/default.nix | 5 ++-- pkgs/development/libraries/gssdp/tools.nix | 5 ++-- .../libraries/gstreamer/bad/default.nix | 5 ++-- .../libraries/gstreamer/good/default.nix | 5 ++-- pkgs/development/libraries/gtk/2.x.nix | 5 ++-- pkgs/development/libraries/gtk/3.x.nix | 5 ++-- pkgs/development/libraries/gtk/4.x.nix | 5 ++-- .../libraries/libextractor/default.nix | 5 ++-- pkgs/development/libraries/libpeas/2.x.nix | 5 ++-- .../development/libraries/libpeas/default.nix | 5 ++-- .../libraries/libproxy/default.nix | 5 ++-- .../libraries/libqofono/default.nix | 5 ++-- .../development/libraries/libsbsms/common.nix | 5 ++-- .../development/libraries/libvirt/default.nix | 5 ++-- .../libraries/qgnomeplatform/default.nix | 5 ++-- .../libraries/qt-5/modules/qttools.nix | 8 ++---- .../science/math/or-tools/default.nix | 5 ++-- pkgs/development/libraries/wayqt/default.nix | 5 ++-- .../libraries/webkitgtk/default.nix | 5 ++-- pkgs/development/lisp-modules/nix-cl.nix | 5 ++-- pkgs/development/lua-modules/nfd/default.nix | 5 ++-- .../ocaml-modules/carton/default.nix | 5 ++-- .../ocaml-modules/menhir/default.nix | 5 ++-- .../ocaml-modules/plotkicadsch/default.nix | 5 ++-- .../php-packages/couchbase/default.nix | 5 ++-- .../python-modules/aiohttp/default.nix | 5 ++-- .../python-modules/anytree/default.nix | 5 ++-- .../python-modules/attrs/default.nix | 5 ++-- .../python-modules/bash-kernel/default.nix | 5 ++-- .../python-modules/bokeh/default.nix | 5 ++-- .../python-modules/cairocffi/default.nix | 5 ++-- .../python-modules/cmdstanpy/default.nix | 5 ++-- .../python-modules/debugpy/default.nix | 11 +++----- .../python-modules/deltachat2/default.nix | 5 ++-- pkgs/development/python-modules/django/3.nix | 18 ++++++------ pkgs/development/python-modules/django/4.nix | 8 ++---- pkgs/development/python-modules/django/5.nix | 8 ++---- .../python-modules/dot2tex/default.nix | 5 ++-- .../espeak-phonemizer/default.nix | 5 ++-- .../python-modules/flit-gettext/default.nix | 5 ++-- .../python-modules/gattlib/default.nix | 7 +++-- .../git-annex-adapter/default.nix | 5 ++-- .../python-modules/glymur/default.nix | 5 ++-- .../python-modules/gpuctypes/default.nix | 5 ++-- .../python-modules/graphviz/default.nix | 5 ++-- .../python-modules/hydra-core/default.nix | 5 ++-- .../python-modules/imageio-ffmpeg/default.nix | 5 ++-- .../python-modules/imageio/default.nix | 5 ++-- .../python-modules/img2pdf/default.nix | 5 ++-- .../python-modules/iniconfig/default.nix | 5 ++-- .../python-modules/isal/default.nix | 5 ++-- .../python-modules/k5test/default.nix | 5 ++-- .../kaldi-active-grammar/default.nix | 5 ++-- .../python-modules/kornia-rs/default.nix | 5 ++-- .../python-modules/libevdev/default.nix | 5 ++-- .../python-modules/libusb1/default.nix | 5 ++-- .../python-modules/mido/default.nix | 5 ++-- .../python-modules/mss/default.nix | 5 ++-- .../python-modules/netmap/default.nix | 5 ++-- .../python-modules/nextcord/default.nix | 5 ++-- .../python-modules/nocturne/default.nix | 5 ++-- .../python-modules/notify-py/default.nix | 8 ++---- .../python-modules/numba/default.nix | 5 ++-- .../python-modules/nvidia-ml-py/default.nix | 5 ++-- .../python-modules/objgraph/default.nix | 5 ++-- .../python-modules/ocrmypdf/default.nix | 5 ++-- .../python-modules/omegaconf/default.nix | 5 ++-- .../python-modules/openai-whisper/default.nix | 5 ++-- .../python-modules/opuslib/default.nix | 5 ++-- .../python-modules/ots-python/default.nix | 5 ++-- .../python-modules/pdfminer-six/default.nix | 5 ++-- .../python-modules/phonemizer/default.nix | 5 ++-- .../python-modules/pikepdf/default.nix | 5 ++-- .../development/python-modules/protobuf/4.nix | 5 ++-- .../python-modules/proton-client/default.nix | 5 ++-- .../protonvpn-nm-lib/default.nix | 5 ++-- .../python-modules/pulsectl/default.nix | 5 ++-- .../python-modules/pydot/default.nix | 5 ++-- .../python-modules/pygame-ce/default.nix | 5 ++-- .../python-modules/pygame/default.nix | 5 ++-- .../python-modules/pygraphviz/default.nix | 5 ++-- .../python-modules/pylama/default.nix | 5 ++-- .../python-modules/pylddwrap/default.nix | 5 ++-- .../python-modules/pyocr/default.nix | 22 ++++++++------- .../python-modules/pyogg/default.nix | 5 ++-- .../python-modules/pypandoc/default.nix | 5 ++-- .../python-modules/pyproj/default.nix | 5 ++-- .../python-modules/pysaml2/default.nix | 5 ++-- .../python-modules/pytesseract/default.nix | 5 ++-- .../python-modules/python-magic/default.nix | 5 ++-- .../python-modules/python-mapnik/default.nix | 5 ++-- .../python-matter-server/default.nix | 5 ++-- .../python-rapidjson/default.nix | 5 ++-- .../python-modules/python3-gnutls/default.nix | 5 ++-- .../python-modules/pythran/default.nix | 5 ++-- .../python-modules/pyturbojpeg/default.nix | 5 ++-- .../pyvirtualdisplay/default.nix | 5 ++-- .../python-modules/slixmpp/default.nix | 5 ++-- .../python-modules/sounddevice/default.nix | 5 ++-- .../python-modules/streamdeck/default.nix | 5 ++-- .../python-modules/termplotlib/default.nix | 5 ++-- .../python-modules/tinygrad/default.nix | 5 ++-- .../python-modules/tpm2-pytss/default.nix | 5 ++-- .../python-modules/vispy/default.nix | 5 ++-- .../python-modules/wallet-py3k/default.nix | 5 ++-- .../python-modules/wandb/default.nix | 5 ++-- .../python-modules/wavefile/default.nix | 5 ++-- .../python-modules/weasyprint/default.nix | 6 ++-- .../python-modules/wxpython/4.2.nix | 5 ++-- .../python-modules/xsdata/default.nix | 5 ++-- .../python-modules/youseedee/default.nix | 5 ++-- .../development/python-modules/yq/default.nix | 5 ++-- .../python-modules/zlib-ng/default.nix | 5 ++-- .../rocm-modules/5/rocprofiler/default.nix | 5 ++-- .../rocm-modules/6/rocprofiler/default.nix | 5 ++-- .../tcl-modules/by-name/ex/expect/package.nix | 5 ++-- .../build-managers/bazel/bazel_5/default.nix | 14 ++++------ .../build-managers/bazel/bazel_6/default.nix | 14 ++++------ .../build-managers/bazel/bazel_7/default.nix | 8 ++---- pkgs/development/tools/ocaml/merlin/4.x.nix | 1 - .../tools/ocaml/merlin/default.nix | 7 ++--- .../dwarf-therapist/wrapper.nix | 7 +++-- pkgs/games/dwarf-fortress/wrapper/default.nix | 7 ++--- pkgs/kde/plasma/kinfocenter/default.nix | 7 +++-- pkgs/kde/plasma/plasma-workspace/default.nix | 7 +++-- pkgs/os-specific/linux/udisks/2-default.nix | 11 ++------ pkgs/servers/home-assistant/default.nix | 5 ++-- pkgs/tools/inputmethods/ibus/default.nix | 11 ++++++-- pkgs/tools/misc/ckb-next/default.nix | 6 ++-- .../networking/networkmanager/default.nix | 9 +++--- 175 files changed, 444 insertions(+), 608 deletions(-) diff --git a/nixos/maintainers/scripts/incus/incus-container-image.nix b/nixos/maintainers/scripts/incus/incus-container-image.nix index 63b9353f7ee3..9faf6a5d87ad 100644 --- a/nixos/maintainers/scripts/incus/incus-container-image.nix +++ b/nixos/maintainers/scripts/incus/incus-container-image.nix @@ -16,8 +16,7 @@ # copy the config for nixos-rebuild system.activationScripts.config = let - config = pkgs.substituteAll { - src = ./incus-container-image-inner.nix; + config = pkgs.replaceVars ./incus-container-image-inner.nix { stateVersion = lib.trivial.release; }; in diff --git a/nixos/maintainers/scripts/incus/incus-virtual-machine-image.nix b/nixos/maintainers/scripts/incus/incus-virtual-machine-image.nix index 0742e7d75ac9..db60160c9c77 100644 --- a/nixos/maintainers/scripts/incus/incus-virtual-machine-image.nix +++ b/nixos/maintainers/scripts/incus/incus-virtual-machine-image.nix @@ -16,8 +16,7 @@ # copy the config for nixos-rebuild system.activationScripts.config = let - config = pkgs.substituteAll { - src = ./incus-virtual-machine-image-inner.nix; + config = pkgs.replaceVars ./incus-virtual-machine-image-inner.nix { stateVersion = lib.trivial.release; }; in diff --git a/nixos/maintainers/scripts/lxd/lxd-container-image.nix b/nixos/maintainers/scripts/lxd/lxd-container-image.nix index 5913ed69a6db..0ccc6308b96b 100644 --- a/nixos/maintainers/scripts/lxd/lxd-container-image.nix +++ b/nixos/maintainers/scripts/lxd/lxd-container-image.nix @@ -18,8 +18,7 @@ # copy the config for nixos-rebuild system.activationScripts.config = let - config = pkgs.substituteAll { - src = ./lxd-container-image-inner.nix; + config = pkgs.replaceVars ./lxd-container-image-inner.nix { stateVersion = lib.trivial.release; }; in diff --git a/nixos/maintainers/scripts/lxd/lxd-virtual-machine-image.nix b/nixos/maintainers/scripts/lxd/lxd-virtual-machine-image.nix index 1ccecc4c351d..19582e2c0d5d 100644 --- a/nixos/maintainers/scripts/lxd/lxd-virtual-machine-image.nix +++ b/nixos/maintainers/scripts/lxd/lxd-virtual-machine-image.nix @@ -18,8 +18,7 @@ # copy the config for nixos-rebuild system.activationScripts.config = let - config = pkgs.substituteAll { - src = ./lxd-virtual-machine-image-inner.nix; + config = pkgs.replaceVars ./lxd-virtual-machine-image-inner.nix { stateVersion = lib.trivial.release; }; in diff --git a/nixos/modules/installer/cd-dvd/iso-image.nix b/nixos/modules/installer/cd-dvd/iso-image.nix index 5a700f070b62..665b968c9d1d 100644 --- a/nixos/modules/installer/cd-dvd/iso-image.nix +++ b/nixos/modules/installer/cd-dvd/iso-image.nix @@ -832,11 +832,7 @@ in { source = config.isoImage.splashImage; target = "/isolinux/background.png"; } - { source = pkgs.substituteAll { - name = "isolinux.cfg"; - src = pkgs.writeText "isolinux.cfg-in" isolinuxCfg; - bootRoot = "/boot"; - }; + { source = isolinuxCfg; target = "/isolinux/isolinux.cfg"; } { source = "${pkgs.syslinux}/share/syslinux"; diff --git a/nixos/modules/services/misc/taskserver/default.nix b/nixos/modules/services/misc/taskserver/default.nix index 592514718940..dc9033b5a23b 100644 --- a/nixos/modules/services/misc/taskserver/default.nix +++ b/nixos/modules/services/misc/taskserver/default.nix @@ -142,8 +142,7 @@ let src = pkgs.runCommand "nixos-taskserver-src" { preferLocalBuild = true; } '' mkdir -p "$out" cat "${ - pkgs.substituteAll { - src = ./helper-tool.py; + pkgs.replaceVars ./helper-tool.py { inherit taskd certtool; inherit (cfg) dataDir diff --git a/nixos/modules/system/boot/loader/grub/grub.nix b/nixos/modules/system/boot/loader/grub/grub.nix index 81f94e8639d9..72e8e4c0d081 100644 --- a/nixos/modules/system/boot/loader/grub/grub.nix +++ b/nixos/modules/system/boot/loader/grub/grub.nix @@ -727,11 +727,13 @@ in system.build.installBootLoader = let - install-grub-pl = pkgs.substituteAll { - src = ./install-grub.pl; + install-grub-pl = pkgs.replaceVars ./install-grub.pl { utillinux = pkgs.util-linux; btrfsprogs = pkgs.btrfs-progs; inherit (config.system.nixos) distroName; + # targets of a replacement in code + bootPath = null; + bootRoot = null; }; perl = pkgs.perl.withPackages (p: with p; [ FileSlurp FileCopyRecursive diff --git a/pkgs/applications/editors/emacs/make-emacs.nix b/pkgs/applications/editors/emacs/make-emacs.nix index 6a7dbf488591..c50c3a66bd60 100644 --- a/pkgs/applications/editors/emacs/make-emacs.nix +++ b/pkgs/applications/editors/emacs/make-emacs.nix @@ -185,7 +185,6 @@ mkDerivation (finalAttrs: { ./native-comp-driver-options-30.patch ) { - backendPath = ( lib.concatStringsSep " " ( builtins.map (x: ''"-B${x}"'') ( diff --git a/pkgs/applications/networking/dropbox/cli.nix b/pkgs/applications/networking/dropbox/cli.nix index 31eda100eb97..aeb89f52a6da 100644 --- a/pkgs/applications/networking/dropbox/cli.nix +++ b/pkgs/applications/networking/dropbox/cli.nix @@ -1,7 +1,7 @@ { lib, stdenv, - substituteAll, + replaceVars, autoreconfHook, pkg-config, fetchurl, @@ -34,9 +34,10 @@ stdenv.mkDerivation { strictDeps = true; patches = [ - (substituteAll { - src = ./fix-cli-paths.patch; + (replaceVars ./fix-cli-paths.patch { inherit dropboxd; + # patch context + DESKTOP_FILE_DIR = null; }) ]; diff --git a/pkgs/applications/science/logic/z3/default.nix b/pkgs/applications/science/logic/z3/default.nix index 1c874934adbd..20be36ebda6c 100644 --- a/pkgs/applications/science/logic/z3/default.nix +++ b/pkgs/applications/science/logic/z3/default.nix @@ -150,7 +150,7 @@ let }; # replace @dir@ in the path of the given list of patches - fixupPatches = dir: map (patch: replaceVars patch { dir = dir; }); + fixupPatches = dir: map (patch: replaceVars patch { inherit dir; }); in { z3_4_13 = common { diff --git a/pkgs/by-name/ar/arma3-unix-launcher/package.nix b/pkgs/by-name/ar/arma3-unix-launcher/package.nix index 6c15df4cd33a..44c3fa908eab 100644 --- a/pkgs/by-name/ar/arma3-unix-launcher/package.nix +++ b/pkgs/by-name/ar/arma3-unix-launcher/package.nix @@ -11,7 +11,7 @@ nlohmann_json, qt5, spdlog, - substituteAll, + replaceVars, buildDayZLauncher ? false, }: stdenv.mkDerivation (finalAttrs: { @@ -27,8 +27,7 @@ stdenv.mkDerivation (finalAttrs: { patches = [ # prevent CMake from trying to get libraries on the internet - (substituteAll { - src = ./dont_fetch_dependencies.patch; + (replaceVars ./dont_fetch_dependencies.patch { argparse_src = fetchFromGitHub { owner = "p-ranav"; repo = "argparse"; diff --git a/pkgs/by-name/br/brillo/package.nix b/pkgs/by-name/br/brillo/package.nix index fb4358628cdb..3d642154c028 100644 --- a/pkgs/by-name/br/brillo/package.nix +++ b/pkgs/by-name/br/brillo/package.nix @@ -4,7 +4,7 @@ fetchFromGitLab, go-md2man, coreutils, - substituteAll, + replaceVars, }: stdenv.mkDerivation rec { @@ -19,9 +19,10 @@ stdenv.mkDerivation rec { }; patches = [ - (substituteAll { - src = ./udev-rule.patch; + (replaceVars ./udev-rule.patch { inherit coreutils; + # patch context + group = null; }) ]; diff --git a/pkgs/by-name/bu/budgie-control-center/package.nix b/pkgs/by-name/bu/budgie-control-center/package.nix index 622d46eafa83..1e97c87364d8 100644 --- a/pkgs/by-name/bu/budgie-control-center/package.nix +++ b/pkgs/by-name/bu/budgie-control-center/package.nix @@ -2,7 +2,7 @@ lib, stdenv, fetchFromGitHub, - substituteAll, + replaceVars, accountsservice, adwaita-icon-theme, budgie-desktop, @@ -81,13 +81,11 @@ stdenv.mkDerivation (finalAttrs: { }; patches = [ - (substituteAll { - src = ./paths.patch; + (replaceVars ./paths.patch { budgie_desktop = budgie-desktop; gcm = gnome-color-manager; inherit cups - glibc libgnomekbd shadow ; diff --git a/pkgs/by-name/cb/cbmc/0001-Do-not-download-sources-in-cmake.patch b/pkgs/by-name/cb/cbmc/0001-Do-not-download-sources-in-cmake.patch index 324fd2adc04a..18a22340b11a 100644 --- a/pkgs/by-name/cb/cbmc/0001-Do-not-download-sources-in-cmake.patch +++ b/pkgs/by-name/cb/cbmc/0001-Do-not-download-sources-in-cmake.patch @@ -17,7 +17,7 @@ index 2c1289a..8128362 100644 download_project(PROJ cudd - URL https://sourceforge.net/projects/cudd-mirror/files/cudd-3.0.0.tar.gz/download - URL_MD5 4fdafe4924b81648b908881c81fe6c30 -+ SOURCE_DIR @cudd.src@ ++ SOURCE_DIR @cudd@ ) if(NOT EXISTS ${cudd_SOURCE_DIR}/Makefile) diff --git a/pkgs/by-name/cb/cbmc/package.nix b/pkgs/by-name/cb/cbmc/package.nix index fe86380d9b6f..9f43b14131de 100644 --- a/pkgs/by-name/cb/cbmc/package.nix +++ b/pkgs/by-name/cb/cbmc/package.nix @@ -8,7 +8,7 @@ flex, makeWrapper, perl, - substituteAll, + replaceVars, cudd, nix-update-script, fetchpatch, @@ -47,9 +47,8 @@ stdenv.mkDerivation (finalAttrs: { ]; patches = [ - (substituteAll { - src = ./0001-Do-not-download-sources-in-cmake.patch; - inherit cudd; + (replaceVars ./0001-Do-not-download-sources-in-cmake.patch { + cudd = cudd.src; }) ./0002-Do-not-download-sources-in-cmake.patch # Fixes build with libc++ >= 19 due to the removal of std::char_traits. diff --git a/pkgs/by-name/fb/fbmenugen/package.nix b/pkgs/by-name/fb/fbmenugen/package.nix index 1b6d303f07dd..018a5a2a1689 100644 --- a/pkgs/by-name/fb/fbmenugen/package.nix +++ b/pkgs/by-name/fb/fbmenugen/package.nix @@ -5,7 +5,7 @@ gnused, makeWrapper, perlPackages, - substituteAll, + replaceVars, xorg, wrapGAppsHook3, gitUpdater, @@ -23,10 +23,11 @@ perlPackages.buildPerlPackage rec { }; patches = [ - (substituteAll { - src = ./0001-Fix-paths.patch; + (replaceVars ./0001-Fix-paths.patch { xmessage = xorg.xmessage; inherit fluxbox gnused; + # replaced in postPatch + fbmenugen = null; }) ]; diff --git a/pkgs/by-name/fr/freenet/package.nix b/pkgs/by-name/fr/freenet/package.nix index 4046a270c3e7..3d9bdb6dac8a 100644 --- a/pkgs/by-name/fr/freenet/package.nix +++ b/pkgs/by-name/fr/freenet/package.nix @@ -8,7 +8,7 @@ gradle_8, bash, coreutils, - substituteAll, + replaceVars, nixosTests, writeText, }: @@ -50,14 +50,15 @@ stdenv.mkDerivation rec { jdk ]; - wrapper = substituteAll { - src = ./freenetWrapper; + wrapper = replaceVars ./freenetWrapper { inherit bash coreutils jre seednodes ; + # replaced in installPhase + CLASSPATH = null; }; mitmCache = gradle.fetchDeps { diff --git a/pkgs/by-name/in/iniparser/package.nix b/pkgs/by-name/in/iniparser/package.nix index ca36474af0d9..b04a3fbf48e7 100644 --- a/pkgs/by-name/in/iniparser/package.nix +++ b/pkgs/by-name/in/iniparser/package.nix @@ -27,7 +27,6 @@ stdenv.mkDerivation (finalAttrs: { (replaceVars ./remove-fetchcontent-usage.patch { # Do not let cmake's fetchContent download unity unitySrc = symlinkJoin { - name = "unity-with-iniparser-config"; paths = [ (fetchFromGitHub { owner = "throwtheswitch"; diff --git a/pkgs/by-name/me/meson/package.nix b/pkgs/by-name/me/meson/package.nix index 79d0e5b7eb54..581f844c8b6c 100644 --- a/pkgs/by-name/me/meson/package.nix +++ b/pkgs/by-name/me/meson/package.nix @@ -12,7 +12,7 @@ ninja, pkg-config, python3, - substituteAll, + replaceVars, zlib, }: @@ -46,8 +46,7 @@ python3.pkgs.buildPythonApplication rec { # are not as predictable, therefore we need to keep them in the RPATH. # At the moment we are keeping the paths starting with /nix/store. # https://github.com/NixOS/nixpkgs/issues/31222#issuecomment-365811634 - (substituteAll { - src = ./001-fix-rpath.patch; + (replaceVars ./001-fix-rpath.patch { inherit (builtins) storeDir; }) diff --git a/pkgs/by-name/nu/nuget-to-json/package.nix b/pkgs/by-name/nu/nuget-to-json/package.nix index 6a2be3060576..7691a503dcb9 100644 --- a/pkgs/by-name/nu/nuget-to-json/package.nix +++ b/pkgs/by-name/nu/nuget-to-json/package.nix @@ -1,7 +1,7 @@ { lib, runtimeShell, - substituteAll, + replaceVarsWith, nix, coreutils, jq, @@ -12,23 +12,25 @@ cacert, }: -substituteAll { +replaceVarsWith { name = "nuget-to-json"; dir = "bin"; src = ./nuget-to-json.sh; isExecutable = true; - inherit runtimeShell cacert; - binPath = lib.makeBinPath [ - nix - coreutils - jq - xmlstarlet - curl - gnugrep - gawk - ]; + replacements = { + inherit runtimeShell cacert; + binPath = lib.makeBinPath [ + nix + coreutils + jq + xmlstarlet + curl + gnugrep + gawk + ]; + }; meta = { description = "Convert a nuget packages directory to a lockfile for buildDotnetModule"; diff --git a/pkgs/by-name/nu/nuget-to-nix/package.nix b/pkgs/by-name/nu/nuget-to-nix/package.nix index dcd51fa81457..118ca77cc3c6 100644 --- a/pkgs/by-name/nu/nuget-to-nix/package.nix +++ b/pkgs/by-name/nu/nuget-to-nix/package.nix @@ -1,7 +1,7 @@ { lib, runtimeShell, - substituteAll, + replaceVarsWith, nix, coreutils, jq, @@ -13,24 +13,26 @@ cacert, }: -substituteAll { +replaceVarsWith { name = "nuget-to-nix"; dir = "bin"; src = ./nuget-to-nix.sh; isExecutable = true; - inherit runtimeShell cacert; - binPath = lib.makeBinPath [ - nix - coreutils - jq - xmlstarlet - curl - gnugrep - gawk - nuget-to-json - ]; + replacements = { + inherit runtimeShell cacert; + binPath = lib.makeBinPath [ + nix + coreutils + jq + xmlstarlet + curl + gnugrep + gawk + nuget-to-json + ]; + }; meta = { description = "Convert a nuget packages directory to a lockfile for buildDotnetModule"; diff --git a/pkgs/by-name/sp/speechd/package.nix b/pkgs/by-name/sp/speechd/package.nix index 58bee929bfab..2947cf31bdb7 100644 --- a/pkgs/by-name/sp/speechd/package.nix +++ b/pkgs/by-name/sp/speechd/package.nix @@ -1,7 +1,7 @@ { stdenv, lib, - substituteAll, + replaceVars, pkg-config, fetchurl, python3Packages, @@ -47,16 +47,16 @@ stdenv.mkDerivation rec { patches = [ - (substituteAll { - src = ./fix-paths.patch; + (replaceVars ./fix-paths.patch { utillinux = util-linux; + # patch context + bindir = null; }) ] ++ lib.optionals (withEspeak && espeak.mbrolaSupport) [ # Replace FHS paths. - (substituteAll { - src = ./fix-mbrola-paths.patch; - inherit espeak mbrola; + (replaceVars ./fix-mbrola-paths.patch { + inherit mbrola; }) ]; diff --git a/pkgs/by-name/us/usbutils/package.nix b/pkgs/by-name/us/usbutils/package.nix index 72a557c931f0..49a7d88925ea 100644 --- a/pkgs/by-name/us/usbutils/package.nix +++ b/pkgs/by-name/us/usbutils/package.nix @@ -2,7 +2,7 @@ lib, stdenv, fetchurl, - substituteAll, + replaceVars, fetchpatch, meson, ninja, @@ -23,8 +23,7 @@ stdenv.mkDerivation rec { patches = [ - (substituteAll { - src = ./fix-paths.patch; + (replaceVars ./fix-paths.patch { inherit hwdata; }) ] diff --git a/pkgs/data/sgml+xml/stylesheets/xslt/docbook-xsl/default.nix b/pkgs/data/sgml+xml/stylesheets/xslt/docbook-xsl/default.nix index 8d839427a2fe..49beba0de955 100644 --- a/pkgs/data/sgml+xml/stylesheets/xslt/docbook-xsl/default.nix +++ b/pkgs/data/sgml+xml/stylesheets/xslt/docbook-xsl/default.nix @@ -1,7 +1,7 @@ { lib, stdenv, - substituteAll, + replaceVars, fetchurl, fetchpatch, findXMLCatalogs, @@ -50,8 +50,7 @@ let }) # Add legacy sourceforge.net URIs to the catalog - (substituteAll { - src = ./catalog-legacy-uris.patch; + (replaceVars ./catalog-legacy-uris.patch { inherit legacySuffix suffix version; }) ] diff --git a/pkgs/desktops/gnome/extensions/extensionOverrides.nix b/pkgs/desktops/gnome/extensions/extensionOverrides.nix index b3f1929c3cef..c4bd7f0880b4 100644 --- a/pkgs/desktops/gnome/extensions/extensionOverrides.nix +++ b/pkgs/desktops/gnome/extensions/extensionOverrides.nix @@ -21,7 +21,6 @@ , smartmontools , replaceVars , stdenvNoCC -, substituteAll , touchegg , util-linux , vte @@ -136,8 +135,7 @@ super: lib.trivial.pipe super [ }); in { patches = [ - (substituteAll { - src = ./extensionOverridesPatches/lunarcal_at_ailin.nemui.patch; + (replaceVars ./extensionOverridesPatches/lunarcal_at_ailin.nemui.patch { chinese_calendar_path = chinese-calendar; }) ]; diff --git a/pkgs/desktops/gnome/extensions/gsconnect/default.nix b/pkgs/desktops/gnome/extensions/gsconnect/default.nix index c4db5afa5771..3a029b6519f1 100644 --- a/pkgs/desktops/gnome/extensions/gsconnect/default.nix +++ b/pkgs/desktops/gnome/extensions/gsconnect/default.nix @@ -1,7 +1,7 @@ { stdenv , lib , fetchFromGitHub -, substituteAll +, replaceVars , openssl , gsound , meson @@ -35,9 +35,10 @@ stdenv.mkDerivation rec { patches = [ # Make typelibs available in the extension - (substituteAll { - src = ./fix-paths.patch; + (replaceVars ./fix-paths.patch { gapplication = "${glib.bin}/bin/gapplication"; + # Replaced in postPatch + typelibPath = null; }) # Allow installing installed tests to a separate output diff --git a/pkgs/desktops/gnome/extensions/taskwhisperer/default.nix b/pkgs/desktops/gnome/extensions/taskwhisperer/default.nix index fc37e6875820..32b920fce9c0 100644 --- a/pkgs/desktops/gnome/extensions/taskwhisperer/default.nix +++ b/pkgs/desktops/gnome/extensions/taskwhisperer/default.nix @@ -1,7 +1,7 @@ { lib, stdenv, - substituteAll, + replaceVars, fetchFromGitHub, taskwarrior2, gettext, @@ -37,10 +37,8 @@ stdenv.mkDerivation rec { ]; patches = [ - (substituteAll { - src = ./fix-paths.patch; + (replaceVars ./fix-paths.patch { task = "${taskwarrior2}/bin/task"; - shell = runtimeShell; }) ]; diff --git a/pkgs/desktops/lomiri/qml/lomiri-ui-toolkit/default.nix b/pkgs/desktops/lomiri/qml/lomiri-ui-toolkit/default.nix index 3ad337e3dd80..ca2dece93391 100644 --- a/pkgs/desktops/lomiri/qml/lomiri-ui-toolkit/default.nix +++ b/pkgs/desktops/lomiri/qml/lomiri-ui-toolkit/default.nix @@ -3,7 +3,7 @@ lib, fetchFromGitLab, gitUpdater, - substituteAll, + replaceVars, testers, dbus-test-runner, dpkg, @@ -63,9 +63,7 @@ stdenv.mkDerivation (finalAttrs: { patches = [ ./2001-Mark-problematic-tests.patch - (substituteAll { - src = ./2002-Nixpkgs-versioned-QML-path.patch.in; - name = "2002-Nixpkgs-versioned-QML-path.patch"; + (replaceVars ./2002-Nixpkgs-versioned-QML-path.patch.in { qtVersion = lib.versions.major qtbase.version; }) ]; diff --git a/pkgs/desktops/mate/caja-dropbox/default.nix b/pkgs/desktops/mate/caja-dropbox/default.nix index 00ee31898376..9bce1b56f531 100644 --- a/pkgs/desktops/mate/caja-dropbox/default.nix +++ b/pkgs/desktops/mate/caja-dropbox/default.nix @@ -2,7 +2,7 @@ lib, stdenv, fetchurl, - substituteAll, + replaceVars, pkg-config, gobject-introspection, gdk-pixbuf, @@ -26,9 +26,10 @@ stdenv.mkDerivation rec { }; patches = [ - (substituteAll { - src = ./fix-cli-paths.patch; + (replaceVars ./fix-cli-paths.patch { inherit dropboxd; + # patch context + DESKTOP_FILE_DIR = null; }) ]; diff --git a/pkgs/development/compilers/crystal/default.nix b/pkgs/development/compilers/crystal/default.nix index 52557ca4a64a..f83ac656dcf8 100644 --- a/pkgs/development/compilers/crystal/default.nix +++ b/pkgs/development/compilers/crystal/default.nix @@ -4,7 +4,7 @@ , fetchurl , fetchpatch , lib -, substituteAll +, replaceVars # Dependencies , boehmgc , coreutils @@ -95,8 +95,7 @@ let }; patches = [ - (substituteAll { - src = ./tzdata.patch; + (replaceVars ./tzdata.patch { inherit tzdata; }) ] diff --git a/pkgs/development/compilers/dotnet/sign-apphost.nix b/pkgs/development/compilers/dotnet/sign-apphost.nix index 021d9ef61a90..e69adc5f3660 100644 --- a/pkgs/development/compilers/dotnet/sign-apphost.nix +++ b/pkgs/development/compilers/dotnet/sign-apphost.nix @@ -1,12 +1,11 @@ { - substituteAll, + replaceVars, callPackage, }: let sigtool = callPackage ./sigtool.nix { }; in -substituteAll { - src = ./sign-apphost.proj; +replaceVars ./sign-apphost.proj { codesign = "${sigtool}/bin/codesign"; } diff --git a/pkgs/development/compilers/dotnet/wrapper.nix b/pkgs/development/compilers/dotnet/wrapper.nix index d268476c2c14..2ac14b665fea 100644 --- a/pkgs/development/compilers/dotnet/wrapper.nix +++ b/pkgs/development/compilers/dotnet/wrapper.nix @@ -15,7 +15,7 @@ darwin, icu, lndir, - substituteAll, + replaceVars, nugetPackageHook, xmlstarlet, }: @@ -42,10 +42,11 @@ stdenvNoCC.mkDerivation (finalAttrs: { [ ./dotnet-setup-hook.sh ] - ++ lib.optional (type == "sdk") (substituteAll { - src = ./dotnet-sdk-setup-hook.sh; - inherit lndir xmlstarlet; - }); + ++ lib.optional (type == "sdk") ( + replaceVars ./dotnet-sdk-setup-hook.sh { + inherit lndir xmlstarlet; + } + ); propagatedSandboxProfile = toString unwrapped.__propagatedSandboxProfile; diff --git a/pkgs/development/compilers/emscripten/default.nix b/pkgs/development/compilers/emscripten/default.nix index 6a3e7738fc1d..54386a3ca24e 100644 --- a/pkgs/development/compilers/emscripten/default.nix +++ b/pkgs/development/compilers/emscripten/default.nix @@ -10,7 +10,7 @@ llvmPackages, symlinkJoin, makeWrapper, - substituteAll, + replaceVars, buildNpmPackage, emscripten, }: @@ -57,8 +57,7 @@ stdenv.mkDerivation rec { ]; patches = [ - (substituteAll { - src = ./0001-emulate-clang-sysroot-include-logic.patch; + (replaceVars ./0001-emulate-clang-sysroot-include-logic.patch { resourceDir = "${llvmEnv}/lib/clang/${lib.versions.major llvmPackages.llvm.version}/"; }) ]; diff --git a/pkgs/development/compilers/go/1.22.nix b/pkgs/development/compilers/go/1.22.nix index b64be8d90a71..471d398358a8 100644 --- a/pkgs/development/compilers/go/1.22.nix +++ b/pkgs/development/compilers/go/1.22.nix @@ -3,7 +3,7 @@ stdenv, fetchurl, tzdata, - substituteAll, + replaceVars, iana-etc, xcbuild, mailcap, @@ -75,20 +75,17 @@ stdenv.mkDerivation (finalAttrs: { ''; patches = [ - (substituteAll { - src = ./iana-etc-1.17.patch; + (replaceVars ./iana-etc-1.17.patch { iana = iana-etc; }) # Patch the mimetype database location which is missing on NixOS. # but also allow static binaries built with NixOS to run outside nix - (substituteAll { - src = ./mailcap-1.17.patch; + (replaceVars ./mailcap-1.17.patch { inherit mailcap; }) # prepend the nix path to the zoneinfo files but also leave the original value for static binaries # that run outside a nix server - (substituteAll { - src = ./tzdata-1.19.patch; + (replaceVars ./tzdata-1.19.patch { inherit tzdata; }) ./remove-tools-1.11.patch diff --git a/pkgs/development/compilers/go/1.23.nix b/pkgs/development/compilers/go/1.23.nix index 514cf806be38..dfeffaac7784 100644 --- a/pkgs/development/compilers/go/1.23.nix +++ b/pkgs/development/compilers/go/1.23.nix @@ -3,7 +3,7 @@ stdenv, fetchurl, tzdata, - substituteAll, + replaceVars, iana-etc, xcbuild, mailcap, @@ -75,20 +75,17 @@ stdenv.mkDerivation (finalAttrs: { ''; patches = [ - (substituteAll { - src = ./iana-etc-1.17.patch; + (replaceVars ./iana-etc-1.17.patch { iana = iana-etc; }) # Patch the mimetype database location which is missing on NixOS. # but also allow static binaries built with NixOS to run outside nix - (substituteAll { - src = ./mailcap-1.17.patch; + (replaceVars ./mailcap-1.17.patch { inherit mailcap; }) # prepend the nix path to the zoneinfo files but also leave the original value for static binaries # that run outside a nix server - (substituteAll { - src = ./tzdata-1.19.patch; + (replaceVars ./tzdata-1.19.patch { inherit tzdata; }) ./remove-tools-1.11.patch diff --git a/pkgs/development/compilers/go/1.24.nix b/pkgs/development/compilers/go/1.24.nix index 75a4cb6c8475..a563cbcd85a2 100644 --- a/pkgs/development/compilers/go/1.24.nix +++ b/pkgs/development/compilers/go/1.24.nix @@ -3,7 +3,7 @@ stdenv, fetchurl, tzdata, - substituteAll, + replaceVars, iana-etc, xcbuild, mailcap, @@ -75,20 +75,17 @@ stdenv.mkDerivation (finalAttrs: { ''; patches = [ - (substituteAll { - src = ./iana-etc-1.17.patch; + (replaceVars ./iana-etc-1.17.patch { iana = iana-etc; }) # Patch the mimetype database location which is missing on NixOS. # but also allow static binaries built with NixOS to run outside nix - (substituteAll { - src = ./mailcap-1.17.patch; + (replaceVars ./mailcap-1.17.patch { inherit mailcap; }) # prepend the nix path to the zoneinfo files but also leave the original value for static binaries # that run outside a nix server - (substituteAll { - src = ./tzdata-1.19.patch; + (replaceVars ./tzdata-1.19.patch { inherit tzdata; }) ./remove-tools-1.11.patch diff --git a/pkgs/development/compilers/ponyc/default.nix b/pkgs/development/compilers/ponyc/default.nix index 005605e9095a..a78cd863dabd 100644 --- a/pkgs/development/compilers/ponyc/default.nix +++ b/pkgs/development/compilers/ponyc/default.nix @@ -13,7 +13,7 @@ python3, # Not really used for anything real, just at build time. git, - substituteAll, + replaceVars, which, z3, cctools, @@ -67,8 +67,7 @@ stdenv.mkDerivation (rec { ./disable-networking-tests.patch ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ - (substituteAll { - src = ./fix-darwin-build.patch; + (replaceVars ./fix-darwin-build.patch { libSystem = darwin.Libsystem; }) ]; diff --git a/pkgs/development/compilers/swift/compiler/default.nix b/pkgs/development/compilers/swift/compiler/default.nix index 09a9e59eff3d..8e21e0d0e166 100644 --- a/pkgs/development/compilers/swift/compiler/default.nix +++ b/pkgs/development/compilers/swift/compiler/default.nix @@ -28,7 +28,7 @@ , glibc , libuuid # Darwin-specific -, substituteAll +, replaceVars , fixDarwinDylibNames , xcbuild , cctools # libtool @@ -300,12 +300,10 @@ in stdenv.mkDerivation { patch -p1 -d swift -i ${./patches/swift-linux-fix-libc-paths.patch} patch -p1 -d swift -i ${./patches/swift-linux-fix-linking.patch} patch -p1 -d swift -i ${./patches/swift-darwin-libcxx-flags.patch} - patch -p1 -d swift -i ${substituteAll { - src = ./patches/swift-darwin-plistbuddy-workaround.patch; + patch -p1 -d swift -i ${replaceVars ./patches/swift-darwin-plistbuddy-workaround.patch { inherit swiftArch; }} - patch -p1 -d swift -i ${substituteAll { - src = ./patches/swift-prevent-sdk-dirs-warning.patch; + patch -p1 -d swift -i ${replaceVars ./patches/swift-prevent-sdk-dirs-warning.patch { inherit (builtins) storeDir; }} diff --git a/pkgs/development/compilers/swift/swift-driver/default.nix b/pkgs/development/compilers/swift/swift-driver/default.nix index 52567304af31..1872e9f6a875 100644 --- a/pkgs/development/compilers/swift/swift-driver/default.nix +++ b/pkgs/development/compilers/swift/swift-driver/default.nix @@ -10,7 +10,7 @@ XCTest, sqlite, ncurses, - substituteAll, + replaceVars, }: let sources = callPackage ../sources.nix { }; @@ -50,8 +50,7 @@ stdenv.mkDerivation { hash = "sha256-eVBaKN6uzj48ZnHtwGV0k5ChKjak1tDCyE+wTdyGq2c="; }) # Prevent a warning about SDK directories we don't have. - (substituteAll { - src = ./patches/prevent-sdk-dirs-warnings.patch; + (replaceVars ./patches/prevent-sdk-dirs-warnings.patch { inherit (builtins) storeDir; }) ]; diff --git a/pkgs/development/compilers/swift/swiftpm/default.nix b/pkgs/development/compilers/swift/swiftpm/default.nix index 53fd9fcb8ac9..48f8b49a8df4 100644 --- a/pkgs/development/compilers/swift/swiftpm/default.nix +++ b/pkgs/development/compilers/swift/swiftpm/default.nix @@ -13,7 +13,7 @@ pkg-config, sqlite, ncurses, - substituteAll, + replaceVars, runCommandLocal, makeWrapper, DarwinTools, # sw_vers @@ -45,8 +45,7 @@ let ./patches/disable-xctest.patch ./patches/fix-clang-cxx.patch ./patches/nix-pkgconfig-vars.patch - (substituteAll { - src = ./patches/fix-stdlib-path.patch; + (replaceVars ./patches/fix-stdlib-path.patch { inherit (builtins) storeDir; swiftLib = swift.swift.lib; }) @@ -429,8 +428,7 @@ stdenv.mkDerivation ( # Prevent a warning about SDK directories we don't have. swiftpmMakeMutable swift-driver patch -p1 -d .build/checkouts/swift-driver -i ${ - substituteAll { - src = ../swift-driver/patches/prevent-sdk-dirs-warnings.patch; + replaceVars ../swift-driver/patches/prevent-sdk-dirs-warnings.patch { inherit (builtins) storeDir; } } diff --git a/pkgs/development/compilers/vala/default.nix b/pkgs/development/compilers/vala/default.nix index 0285a5355461..0c5c18277e2a 100644 --- a/pkgs/development/compilers/vala/default.nix +++ b/pkgs/development/compilers/vala/default.nix @@ -15,7 +15,7 @@ libintl, libtool, expat, - substituteAll, + replaceVars, vala, gobject-introspection, }: @@ -45,8 +45,7 @@ let pname = "vala"; inherit version; - setupHook = substituteAll { - src = ./setup-hook.sh; + setupHook = replaceVars ./setup-hook.sh { apiVersion = lib.versions.majorMinor version; }; diff --git a/pkgs/development/embedded/platformio/core.nix b/pkgs/development/embedded/platformio/core.nix index e9071fa1ab24..1e5cdce702c1 100644 --- a/pkgs/development/embedded/platformio/core.nix +++ b/pkgs/development/embedded/platformio/core.nix @@ -6,7 +6,7 @@ installShellFiles, git, spdx-license-list-data, - substituteAll, + replaceVars, }: with python3Packages; @@ -29,12 +29,10 @@ buildPythonApplication rec { ]; patches = [ - (substituteAll { - src = ./interpreter.patch; + (replaceVars ./interpreter.patch { interpreter = (python3Packages.python.withPackages (_: propagatedBuildInputs)).interpreter; }) - (substituteAll { - src = ./use-local-spdx-license-list.patch; + (replaceVars ./use-local-spdx-license-list.patch { spdx_license_list_data = spdx-license-list-data.json; }) ./missing-udev-rules-nixos.patch diff --git a/pkgs/development/haskell-modules/configuration-nix.nix b/pkgs/development/haskell-modules/configuration-nix.nix index c0ff75b80800..c098a042b3ab 100644 --- a/pkgs/development/haskell-modules/configuration-nix.nix +++ b/pkgs/development/haskell-modules/configuration-nix.nix @@ -1325,9 +1325,11 @@ self: super: builtins.intersectAttrs super { # whatever graphviz is in PATH. graphviz = overrideCabal (drv: { patches = [ - (pkgs.substituteAll { - src = ./patches/graphviz-hardcode-graphviz-store-path.patch; + (pkgs.replaceVars ./patches/graphviz-hardcode-graphviz-store-path.patch { inherit (pkgs) graphviz; + # patch context + dot = null; + PATH = null; }) ] ++ (drv.patches or []); }) super.graphviz; diff --git a/pkgs/development/interpreters/acl2/default.nix b/pkgs/development/interpreters/acl2/default.nix index 6be3b9a865c5..3f6fbe627898 100644 --- a/pkgs/development/interpreters/acl2/default.nix +++ b/pkgs/development/interpreters/acl2/default.nix @@ -6,7 +6,7 @@ fetchpatch, runCommandLocal, makeWrapper, - substituteAll, + replaceVars, sbcl, bash, which, @@ -52,8 +52,7 @@ stdenv.mkDerivation rec { libipasir = callPackage ./libipasirglucose4 { }; patches = [ - (substituteAll { - src = ./0001-Fix-some-paths-for-Nix-build.patch; + (replaceVars ./0001-Fix-some-paths-for-Nix-build.patch { libipasir = "${libipasir}/lib/${libipasir.libname}"; libssl = "${lib.getLib openssl}/lib/libssl${stdenv.hostPlatform.extensions.sharedLibrary}"; libcrypto = "${lib.getLib openssl}/lib/libcrypto${stdenv.hostPlatform.extensions.sharedLibrary}"; diff --git a/pkgs/development/interpreters/python/pypy/default.nix b/pkgs/development/interpreters/python/pypy/default.nix index 795bceede768..f40efde427ee 100644 --- a/pkgs/development/interpreters/python/pypy/default.nix +++ b/pkgs/development/interpreters/python/pypy/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, substituteAll, fetchurl +{ lib, stdenv, replaceVars, fetchurl , zlibSupport ? true, zlib , bzip2, pkg-config, libffi , sqlite, openssl, ncurses, python, expat, tcl, tk, tclPackages, libX11 @@ -76,8 +76,7 @@ in with passthru; stdenv.mkDerivation rec { patches = [ ./dont_fetch_vendored_deps.patch - (substituteAll { - src = ./tk_tcl_paths.patch; + (replaceVars ./tk_tcl_paths.patch { inherit tk tcl; tk_dev = tk.dev; tcl_dev = tcl; @@ -85,8 +84,7 @@ in with passthru; stdenv.mkDerivation rec { tcl_libprefix = tcl.libPrefix; }) - (substituteAll { - src = ./sqlite_paths.patch; + (replaceVars ./sqlite_paths.patch { inherit (sqlite) out dev; }) ]; diff --git a/pkgs/development/libraries/appstream/default.nix b/pkgs/development/libraries/appstream/default.nix index a0ea85c83543..d4d0e26adb08 100644 --- a/pkgs/development/libraries/appstream/default.nix +++ b/pkgs/development/libraries/appstream/default.nix @@ -1,6 +1,6 @@ { lib , stdenv -, substituteAll +, replaceVars , fetchFromGitHub , meson , mesonEmulatorHook @@ -50,8 +50,7 @@ stdenv.mkDerivation (finalAttrs: { patches = [ # Fix hardcoded paths - (substituteAll { - src = ./fix-paths.patch; + (replaceVars ./fix-paths.patch { libstemmer_includedir = "${lib.getDev libstemmer}/include"; }) diff --git a/pkgs/development/libraries/gssdp/tools.nix b/pkgs/development/libraries/gssdp/tools.nix index 7708bb6991a2..37fa43f91990 100644 --- a/pkgs/development/libraries/gssdp/tools.nix +++ b/pkgs/development/libraries/gssdp/tools.nix @@ -1,7 +1,7 @@ { stdenv, lib, - substituteAll, + replaceVars, meson, ninja, pkg-config, @@ -18,8 +18,7 @@ stdenv.mkDerivation rec { patches = [ # Allow building tools separately from the library. # This is needed to break the depenency cycle. - (substituteAll { - src = ./standalone-tools.patch; + (replaceVars ./standalone-tools.patch { inherit version; }) ]; diff --git a/pkgs/development/libraries/gstreamer/bad/default.nix b/pkgs/development/libraries/gstreamer/bad/default.nix index 3231bb6c649f..7e756b976b21 100644 --- a/pkgs/development/libraries/gstreamer/bad/default.nix +++ b/pkgs/development/libraries/gstreamer/bad/default.nix @@ -2,7 +2,7 @@ , stdenv , fetchurl , fetchpatch -, substituteAll +, replaceVars , meson , ninja , gettext @@ -127,8 +127,7 @@ stdenv.mkDerivation rec { patches = [ # Add fallback paths for nvidia userspace libraries - (substituteAll { - src = ./fix-paths.patch; + (replaceVars ./fix-paths.patch { inherit (addDriverRunpath) driverLink; }) # Add support for newer AJA SDK from next GStreamer release diff --git a/pkgs/development/libraries/gstreamer/good/default.nix b/pkgs/development/libraries/gstreamer/good/default.nix index f9da5f6ba128..dd8abf8a8b99 100644 --- a/pkgs/development/libraries/gstreamer/good/default.nix +++ b/pkgs/development/libraries/gstreamer/good/default.nix @@ -1,6 +1,6 @@ { lib, stdenv , fetchurl -, substituteAll +, replaceVars , meson , nasm , ninja @@ -71,8 +71,7 @@ stdenv.mkDerivation rec { # Reenable dynamic loading of libsoup on Darwin and use a different approach to do it. ./souploader-darwin.diff # dlopen libsoup_3 with an absolute path - (substituteAll { - src = ./souploader.diff; + (replaceVars ./souploader.diff { nixLibSoup3Path = "${lib.getLib libsoup_3}/lib"; }) ]; diff --git a/pkgs/development/libraries/gtk/2.x.nix b/pkgs/development/libraries/gtk/2.x.nix index d1abe9b8e035..87b638ad76a4 100644 --- a/pkgs/development/libraries/gtk/2.x.nix +++ b/pkgs/development/libraries/gtk/2.x.nix @@ -22,7 +22,7 @@ pango, perl, pkg-config, - substituteAll, + replaceVars, testers, AppKit, Cocoa, @@ -32,8 +32,7 @@ }: let - gtkCleanImmodulesCache = substituteAll { - src = ./hooks/clean-immodules-cache.sh; + gtkCleanImmodulesCache = replaceVars ./hooks/clean-immodules-cache.sh { gtk_module_path = "gtk-2.0"; gtk_binary_version = "2.10.0"; }; diff --git a/pkgs/development/libraries/gtk/3.x.nix b/pkgs/development/libraries/gtk/3.x.nix index e995b48a1557..4f7ff70764c5 100644 --- a/pkgs/development/libraries/gtk/3.x.nix +++ b/pkgs/development/libraries/gtk/3.x.nix @@ -1,6 +1,6 @@ { lib , stdenv -, substituteAll +, replaceVars , fetchurl , pkg-config , gettext @@ -53,8 +53,7 @@ let - gtkCleanImmodulesCache = substituteAll { - src = ./hooks/clean-immodules-cache.sh; + gtkCleanImmodulesCache = replaceVars ./hooks/clean-immodules-cache.sh { gtk_module_path = "gtk-3.0"; gtk_binary_version = "3.0.0"; }; diff --git a/pkgs/development/libraries/gtk/4.x.nix b/pkgs/development/libraries/gtk/4.x.nix index c89cbce621a1..3c5cb9e863c1 100644 --- a/pkgs/development/libraries/gtk/4.x.nix +++ b/pkgs/development/libraries/gtk/4.x.nix @@ -1,7 +1,7 @@ { lib , stdenv , buildPackages -, substituteAll +, replaceVars , fetchurl , pkg-config , docutils @@ -58,8 +58,7 @@ let - gtkCleanImmodulesCache = substituteAll { - src = ./hooks/clean-immodules-cache.sh; + gtkCleanImmodulesCache = replaceVars ./hooks/clean-immodules-cache.sh { gtk_module_path = "gtk-4.0"; gtk_binary_version = "4.0.0"; }; diff --git a/pkgs/development/libraries/libextractor/default.nix b/pkgs/development/libraries/libextractor/default.nix index b46d4d8d1975..c8a545239846 100644 --- a/pkgs/development/libraries/libextractor/default.nix +++ b/pkgs/development/libraries/libextractor/default.nix @@ -3,7 +3,7 @@ stdenv, fetchurl, fetchpatch2, - substituteAll, + replaceVars, libtool, gettext, zlib, @@ -60,8 +60,7 @@ stdenv.mkDerivation rec { ++ lib.optionals gstreamerSupport [ # Libraries cannot be wrapped so we need to hardcode the plug-in paths. - (substituteAll { - src = ./gst-hardcode-plugins.patch; + (replaceVars ./gst-hardcode-plugins.patch { load_gst_plugins = lib.concatMapStrings ( plugin: ''gst_registry_scan_path(gst_registry_get(), "${lib.getLib plugin}/lib/gstreamer-1.0");'' ) (gstPlugins gst_all_1); diff --git a/pkgs/development/libraries/libpeas/2.x.nix b/pkgs/development/libraries/libpeas/2.x.nix index 35f204a1d5b4..c318f57be718 100644 --- a/pkgs/development/libraries/libpeas/2.x.nix +++ b/pkgs/development/libraries/libpeas/2.x.nix @@ -3,7 +3,7 @@ , buildPackages , fetchurl , pkgsCross -, substituteAll +, replaceVars , pkg-config , gi-docgen , gobject-introspection @@ -34,8 +34,7 @@ stdenv.mkDerivation rec { patches = [ # Make PyGObject’s gi library available. - (substituteAll { - src = ./fix-paths.patch; + (replaceVars ./fix-paths.patch { pythonPaths = lib.concatMapStringsSep ", " (pkg: "'${pkg}/${python3.sitePackages}'") [ python3.pkgs.pygobject3 ]; diff --git a/pkgs/development/libraries/libpeas/default.nix b/pkgs/development/libraries/libpeas/default.nix index df0398797df0..2958f8f31b55 100644 --- a/pkgs/development/libraries/libpeas/default.nix +++ b/pkgs/development/libraries/libpeas/default.nix @@ -2,7 +2,7 @@ stdenv, lib, fetchurl, - substituteAll, + replaceVars, meson, ninja, pkg-config, @@ -34,8 +34,7 @@ stdenv.mkDerivation rec { patches = [ # Make PyGObject’s gi library available. - (substituteAll { - src = ./fix-paths.patch; + (replaceVars ./fix-paths.patch { pythonPaths = lib.concatMapStringsSep ", " (pkg: "'${pkg}/${python3.sitePackages}'") [ python3.pkgs.pygobject3 ]; diff --git a/pkgs/development/libraries/libproxy/default.nix b/pkgs/development/libraries/libproxy/default.nix index fe65c9d3bc1e..ad0c8d343fb6 100644 --- a/pkgs/development/libraries/libproxy/default.nix +++ b/pkgs/development/libraries/libproxy/default.nix @@ -15,7 +15,7 @@ ninja, pkg-config, stdenv, - substituteAll, + replaceVars, vala, }: @@ -46,8 +46,7 @@ stdenv.mkDerivation (finalAttrs: { # Hardcode path to Settings schemas for GNOME & related desktops. # Otherwise every app using libproxy would need to be wrapped individually. - (substituteAll { - src = ./hardcode-gsettings.patch; + (replaceVars ./hardcode-gsettings.patch { gds = glib.getSchemaPath gsettings-desktop-schemas; }) ]; diff --git a/pkgs/development/libraries/libqofono/default.nix b/pkgs/development/libraries/libqofono/default.nix index 04acf0639767..4b67650d3541 100644 --- a/pkgs/development/libraries/libqofono/default.nix +++ b/pkgs/development/libraries/libqofono/default.nix @@ -1,6 +1,6 @@ { lib, - substituteAll, + replaceVars, mkDerivation, fetchFromGitHub, gitUpdater, @@ -22,8 +22,7 @@ mkDerivation rec { }; patches = [ - (substituteAll { - src = ./0001-NixOS-provide-mobile-broadband-provider-info-path.patch; + (replaceVars ./0001-NixOS-provide-mobile-broadband-provider-info-path.patch { mobileBroadbandProviderInfo = mobile-broadband-provider-info; }) ./0001-NixOS-Skip-tests-they-re-shock-full-of-hardcoded-FHS.patch diff --git a/pkgs/development/libraries/libsbsms/common.nix b/pkgs/development/libraries/libsbsms/common.nix index 358710b79501..71c7114b296c 100644 --- a/pkgs/development/libraries/libsbsms/common.nix +++ b/pkgs/development/libraries/libsbsms/common.nix @@ -2,7 +2,7 @@ lib, stdenv, fetchurl, - substituteAll, + replaceVars, pname, version, url, @@ -19,8 +19,7 @@ stdenv.mkDerivation rec { patches = [ # Fix buidling on platforms other than x86 - (substituteAll { - src = ./configure.patch; + (replaceVars ./configure.patch { msse = lib.optionalString stdenv.hostPlatform.isx86_64 "-msse"; }) ]; diff --git a/pkgs/development/libraries/libvirt/default.nix b/pkgs/development/libraries/libvirt/default.nix index 4de3f7887bc8..00856f3ef29d 100644 --- a/pkgs/development/libraries/libvirt/default.nix +++ b/pkgs/development/libraries/libvirt/default.nix @@ -32,7 +32,7 @@ , readline , rpcsvc-proto , stdenv -, substituteAll +, replaceVars , xhtml1 , json_c , writeScript @@ -127,8 +127,7 @@ stdenv.mkDerivation rec { patches = [ ./0001-meson-patch-in-an-install-prefix-for-building-on-nix.patch ] ++ lib.optionals enableZfs [ - (substituteAll { - src = ./0002-substitute-zfs-and-zpool-commands.patch; + (replaceVars ./0002-substitute-zfs-and-zpool-commands.patch { zfs = "${zfs}/bin/zfs"; zpool = "${zfs}/bin/zpool"; }) diff --git a/pkgs/development/libraries/qgnomeplatform/default.nix b/pkgs/development/libraries/qgnomeplatform/default.nix index 187236621730..270a6593c740 100644 --- a/pkgs/development/libraries/qgnomeplatform/default.nix +++ b/pkgs/development/libraries/qgnomeplatform/default.nix @@ -11,7 +11,7 @@ gtk3, qtbase, qtwayland, - substituteAll, + replaceVars, gsettings-desktop-schemas, useQt6 ? false, }: @@ -29,8 +29,7 @@ stdenv.mkDerivation rec { patches = [ # Hardcode GSettings schema path to avoid crashes from missing schemas - (substituteAll { - src = ./hardcode-gsettings.patch; + (replaceVars ./hardcode-gsettings.patch { gds_gsettings_path = glib.getSchemaPath gsettings-desktop-schemas; }) diff --git a/pkgs/development/libraries/qt-5/modules/qttools.nix b/pkgs/development/libraries/qt-5/modules/qttools.nix index 52be15d64e8a..e4b95207fe92 100644 --- a/pkgs/development/libraries/qt-5/modules/qttools.nix +++ b/pkgs/development/libraries/qt-5/modules/qttools.nix @@ -4,7 +4,7 @@ lib, qtbase, qtdeclarative, - substituteAll, + replaceVars, llvmPackages, }: @@ -29,13 +29,11 @@ qtModule { patches = [ # fixQtBuiltinPaths overwrites builtin paths we should keep - (substituteAll { - src = ./qttools-QT_HOST_DATA-refs.patch; + (replaceVars ./qttools-QT_HOST_DATA-refs.patch { qtbaseDev = lib.getDev qtbase; }) - (substituteAll { - src = ./qttools-libclang-main-header.patch; + (replaceVars ./qttools-libclang-main-header.patch { libclangDev = lib.getDev llvmPackages.libclang; }) ]; diff --git a/pkgs/development/libraries/science/math/or-tools/default.nix b/pkgs/development/libraries/science/math/or-tools/default.nix index c460694da0fe..3c3fac71a1e4 100644 --- a/pkgs/development/libraries/science/math/or-tools/default.nix +++ b/pkgs/development/libraries/science/math/or-tools/default.nix @@ -7,7 +7,7 @@ eigen, ensureNewerSourcesForZipFilesHook, fetchFromGitHub, - substituteAll, + replaceVars, glpk, lib, pkg-config, @@ -40,8 +40,7 @@ stdenv.mkDerivation rec { }; patches = [ - (substituteAll { - src = ./offline.patch; + (replaceVars ./offline.patch { pybind11_protobuf = "../../pybind11_protobuf"; }) ]; diff --git a/pkgs/development/libraries/wayqt/default.nix b/pkgs/development/libraries/wayqt/default.nix index 86fa6cd20325..3bed9f6fc7bb 100644 --- a/pkgs/development/libraries/wayqt/default.nix +++ b/pkgs/development/libraries/wayqt/default.nix @@ -2,7 +2,7 @@ stdenv, lib, fetchFromGitLab, - substituteAll, + replaceVars, meson, pkg-config, qttools, @@ -25,8 +25,7 @@ stdenv.mkDerivation (finalAttrs: { patches = [ # qmake get qtbase's path, but wayqt need qtwayland - (substituteAll { - src = ./fix-qtwayland-header-path.diff; + (replaceVars ./fix-qtwayland-header-path.diff { qtWaylandPath = "${qtwayland}/include"; }) ]; diff --git a/pkgs/development/libraries/webkitgtk/default.nix b/pkgs/development/libraries/webkitgtk/default.nix index 1469dd6d6429..e1609e6f2ed3 100644 --- a/pkgs/development/libraries/webkitgtk/default.nix +++ b/pkgs/development/libraries/webkitgtk/default.nix @@ -65,7 +65,7 @@ libbacktrace, systemd, xdg-dbus-proxy, - substituteAll, + replaceVars, glib, unifdef, addDriverRunpath, @@ -103,8 +103,7 @@ clangStdenv.mkDerivation (finalAttrs: { }; patches = lib.optionals clangStdenv.hostPlatform.isLinux [ - (substituteAll { - src = ./fix-bubblewrap-paths.patch; + (replaceVars ./fix-bubblewrap-paths.patch { inherit (builtins) storeDir; inherit (addDriverRunpath) driverLink; }) diff --git a/pkgs/development/lisp-modules/nix-cl.nix b/pkgs/development/lisp-modules/nix-cl.nix index 773372d25afa..1357dafe3df3 100644 --- a/pkgs/development/lisp-modules/nix-cl.nix +++ b/pkgs/development/lisp-modules/nix-cl.nix @@ -59,7 +59,7 @@ let ; inherit (pkgs) - substituteAll + replaceVars ; # Stolen from python-packages.nix @@ -209,8 +209,7 @@ let ; }; - buildScript = substituteAll { - src = ./builder.lisp; + buildScript = replaceVars ./builder.lisp { asdf = "${asdfFasl}/asdf.${faslExt}"; }; diff --git a/pkgs/development/lua-modules/nfd/default.nix b/pkgs/development/lua-modules/nfd/default.nix index 1b34c1bd1803..a9b7aaef9e77 100644 --- a/pkgs/development/lua-modules/nfd/default.nix +++ b/pkgs/development/lua-modules/nfd/default.nix @@ -5,7 +5,7 @@ lua, pkg-config, lib, - substituteAll, + replaceVars, zenity, AppKit, }: @@ -24,8 +24,7 @@ buildLuarocksPackage { # use zenity because default gtk impl just crashes patches = [ - (substituteAll { - src = ./zenity.patch; + (replaceVars ./zenity.patch { inherit zenity; }) ]; diff --git a/pkgs/development/ocaml-modules/carton/default.nix b/pkgs/development/ocaml-modules/carton/default.nix index b1f35bea8fa5..ea9eb4f06462 100644 --- a/pkgs/development/ocaml-modules/carton/default.nix +++ b/pkgs/development/ocaml-modules/carton/default.nix @@ -27,7 +27,7 @@ cmdliner, hxd, getconf, - substituteAll, + replaceVars, }: buildDunePackage rec { @@ -42,8 +42,7 @@ buildDunePackage rec { }; patches = [ - (substituteAll { - src = ./carton-find-getconf.patch; + (replaceVars ./carton-find-getconf.patch { getconf = "${getconf}"; }) ]; diff --git a/pkgs/development/ocaml-modules/menhir/default.nix b/pkgs/development/ocaml-modules/menhir/default.nix index ae0f15843b30..c465e0fc6d32 100644 --- a/pkgs/development/ocaml-modules/menhir/default.nix +++ b/pkgs/development/ocaml-modules/menhir/default.nix @@ -1,6 +1,6 @@ { buildDunePackage, - substituteAll, + replaceVars, ocaml, menhirLib, menhirSdk, @@ -19,8 +19,7 @@ buildDunePackage rec { ]; patches = [ - (substituteAll { - src = ./menhir-suggest-menhirLib.patch; + (replaceVars ./menhir-suggest-menhirLib.patch { libdir = "${menhirLib}/lib/ocaml/${ocaml.version}/site-lib/menhirLib"; }) ]; diff --git a/pkgs/development/ocaml-modules/plotkicadsch/default.nix b/pkgs/development/ocaml-modules/plotkicadsch/default.nix index 69f67ae580a6..3497dd0771a3 100644 --- a/pkgs/development/ocaml-modules/plotkicadsch/default.nix +++ b/pkgs/development/ocaml-modules/plotkicadsch/default.nix @@ -1,7 +1,7 @@ { lib, buildDunePackage, - substituteAll, + replaceVars, base64, cmdliner, digestif, @@ -24,8 +24,7 @@ buildDunePackage rec { minimalOCamlVersion = "4.09"; patches = [ - (substituteAll { - src = ./fix-paths.patch; + (replaceVars ./fix-paths.patch { inherit coreutils imagemagick; }) ]; diff --git a/pkgs/development/php-packages/couchbase/default.nix b/pkgs/development/php-packages/couchbase/default.nix index 381ec3734243..fb98e4846d83 100644 --- a/pkgs/development/php-packages/couchbase/default.nix +++ b/pkgs/development/php-packages/couchbase/default.nix @@ -4,7 +4,7 @@ fetchFromGitHub, libcouchbase, zlib, - substituteAll, + replaceVars, php, }: let @@ -29,8 +29,7 @@ buildPecl { ]; patches = [ - (substituteAll { - src = ./libcouchbase.patch; + (replaceVars ./libcouchbase.patch { inherit libcouchbase; }) ]; diff --git a/pkgs/development/python-modules/aiohttp/default.nix b/pkgs/development/python-modules/aiohttp/default.nix index bf6a0326ff4e..028cceefc363 100644 --- a/pkgs/development/python-modules/aiohttp/default.nix +++ b/pkgs/development/python-modules/aiohttp/default.nix @@ -4,7 +4,7 @@ buildPythonPackage, fetchFromGitHub, fetchpatch2, - substituteAll, + replaceVars, isPy310, isPyPy, @@ -57,8 +57,7 @@ buildPythonPackage rec { }; patches = [ - (substituteAll { - src = ./unvendor-llhttp.patch; + (replaceVars ./unvendor-llhttp.patch { llhttpDev = lib.getDev llhttp; llhttpLib = lib.getLib llhttp; }) diff --git a/pkgs/development/python-modules/anytree/default.nix b/pkgs/development/python-modules/anytree/default.nix index 55f1b8d9ac13..9483bf12dadc 100644 --- a/pkgs/development/python-modules/anytree/default.nix +++ b/pkgs/development/python-modules/anytree/default.nix @@ -8,7 +8,7 @@ pytest7CheckHook, pythonOlder, six, - substituteAll, + replaceVars, withGraphviz ? true, }: @@ -27,8 +27,7 @@ buildPythonPackage rec { }; patches = lib.optionals withGraphviz [ - (substituteAll { - src = ./graphviz.patch; + (replaceVars ./graphviz.patch { inherit graphviz; }) ]; diff --git a/pkgs/development/python-modules/attrs/default.nix b/pkgs/development/python-modules/attrs/default.nix index 5f14d0b149a6..f8824a6fef31 100644 --- a/pkgs/development/python-modules/attrs/default.nix +++ b/pkgs/development/python-modules/attrs/default.nix @@ -4,7 +4,7 @@ buildPythonPackage, fetchPypi, pythonOlder, - substituteAll, + replaceVars, hatchling, }: @@ -20,9 +20,8 @@ buildPythonPackage rec { }; patches = [ - (substituteAll { + (replaceVars ./remove-hatch-plugins.patch { # hatch-vcs and hatch-fancy-pypi-readme depend on pytest, which depends on attrs - src = ./remove-hatch-plugins.patch; inherit version; }) ]; diff --git a/pkgs/development/python-modules/bash-kernel/default.nix b/pkgs/development/python-modules/bash-kernel/default.nix index ff088a618e1d..6e546b311d3f 100644 --- a/pkgs/development/python-modules/bash-kernel/default.nix +++ b/pkgs/development/python-modules/bash-kernel/default.nix @@ -8,7 +8,7 @@ python, pexpect, bashInteractive, - substituteAll, + replaceVars, }: buildPythonPackage rec { @@ -23,8 +23,7 @@ buildPythonPackage rec { }; patches = [ - (substituteAll { - src = ./bash-path.patch; + (replaceVars ./bash-path.patch { bash = lib.getExe bashInteractive; }) ]; diff --git a/pkgs/development/python-modules/bokeh/default.nix b/pkgs/development/python-modules/bokeh/default.nix index 9ed21c339dee..9f7ac29dd5ec 100644 --- a/pkgs/development/python-modules/bokeh/default.nix +++ b/pkgs/development/python-modules/bokeh/default.nix @@ -4,7 +4,7 @@ fetchPypi, fetchFromGitHub, pythonOlder, - substituteAll, + replaceVars, colorama, contourpy, jinja2, @@ -64,8 +64,7 @@ buildPythonPackage rec { }; patches = [ - (substituteAll { - src = ./hardcode-nodejs-npmjs-paths.patch; + (replaceVars ./hardcode-nodejs-npmjs-paths.patch { node_bin = "${nodejs}/bin/node"; npm_bin = "${nodejs}/bin/npm"; }) diff --git a/pkgs/development/python-modules/cairocffi/default.nix b/pkgs/development/python-modules/cairocffi/default.nix index b871515bc42a..0779eae1c92d 100644 --- a/pkgs/development/python-modules/cairocffi/default.nix +++ b/pkgs/development/python-modules/cairocffi/default.nix @@ -5,7 +5,7 @@ pythonOlder, fetchPypi, lib, - substituteAll, + replaceVars, pikepdf, pytestCheckHook, cairo, @@ -32,8 +32,7 @@ buildPythonPackage rec { patches = [ # OSError: dlopen() failed to load a library: gdk-pixbuf-2.0 / gdk-pixbuf-2.0-0 - (substituteAll { - src = ./dlopen-paths.patch; + (replaceVars ./dlopen-paths.patch { ext = stdenv.hostPlatform.extensions.sharedLibrary; cairo = cairo.out; glib = glib.out; diff --git a/pkgs/development/python-modules/cmdstanpy/default.nix b/pkgs/development/python-modules/cmdstanpy/default.nix index c03c2cf8403c..439b1c255307 100644 --- a/pkgs/development/python-modules/cmdstanpy/default.nix +++ b/pkgs/development/python-modules/cmdstanpy/default.nix @@ -2,7 +2,7 @@ lib, buildPythonPackage, fetchFromGitHub, - substituteAll, + replaceVars, cmdstan, setuptools, pandas, @@ -27,8 +27,7 @@ buildPythonPackage rec { }; patches = [ - (substituteAll { - src = ./use-nix-cmdstan-path.patch; + (replaceVars ./use-nix-cmdstan-path.patch { cmdstan = "${cmdstan}/opt/cmdstan"; }) ]; diff --git a/pkgs/development/python-modules/debugpy/default.nix b/pkgs/development/python-modules/debugpy/default.nix index d87103d4d0a1..a2b42176966b 100644 --- a/pkgs/development/python-modules/debugpy/default.nix +++ b/pkgs/development/python-modules/debugpy/default.nix @@ -5,7 +5,7 @@ pythonOlder, pythonAtLeast, fetchFromGitHub, - substituteAll, + replaceVars, gdb, lldb, pytestCheckHook, @@ -39,8 +39,7 @@ buildPythonPackage rec { patches = [ # Use nixpkgs version instead of versioneer - (substituteAll { - src = ./hardcode-version.patch; + (replaceVars ./hardcode-version.patch { inherit version; }) @@ -62,15 +61,13 @@ buildPythonPackage rec { ] ++ lib.optionals stdenv.hostPlatform.isLinux [ # Hard code GDB path (used to attach to process) - (substituteAll { - src = ./hardcode-gdb.patch; + (replaceVars ./hardcode-gdb.patch { inherit gdb; }) ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ # Hard code LLDB path (used to attach to process) - (substituteAll { - src = ./hardcode-lldb.patch; + (replaceVars ./hardcode-lldb.patch { inherit lldb; }) ]; diff --git a/pkgs/development/python-modules/deltachat2/default.nix b/pkgs/development/python-modules/deltachat2/default.nix index a2dcc68076f0..021e4f73fb10 100644 --- a/pkgs/development/python-modules/deltachat2/default.nix +++ b/pkgs/development/python-modules/deltachat2/default.nix @@ -4,7 +4,7 @@ buildPythonPackage, deltachat-rpc-server, setuptools-scm, - substituteAll, + replaceVars, }: buildPythonPackage rec { @@ -20,8 +20,7 @@ buildPythonPackage rec { }; patches = [ - (substituteAll { - src = ./paths.patch; + (replaceVars ./paths.patch { deltachatrpcserver = lib.getExe deltachat-rpc-server; }) ]; diff --git a/pkgs/development/python-modules/django/3.nix b/pkgs/development/python-modules/django/3.nix index b4d478e3d8bd..d8520e33e97c 100644 --- a/pkgs/development/python-modules/django/3.nix +++ b/pkgs/development/python-modules/django/3.nix @@ -3,7 +3,7 @@ stdenv, buildPythonPackage, fetchPypi, - substituteAll, + replaceVars, geos_3_9, gdal, asgiref, @@ -28,17 +28,17 @@ buildPythonPackage rec { patches = [ - (substituteAll { - src = ./django_3_set_zoneinfo_dir.patch; + (replaceVars ./django_3_set_zoneinfo_dir.patch { zoneinfo = tzdata + "/share/zoneinfo"; }) ] - ++ lib.optional withGdal (substituteAll { - src = ./django_3_set_geos_gdal_lib.patch; - inherit geos_3_9; - inherit gdal; - extension = stdenv.hostPlatform.extensions.sharedLibrary; - }); + ++ lib.optional withGdal ( + replaceVars ./django_3_set_geos_gdal_lib.patch { + inherit geos_3_9; + inherit gdal; + extension = stdenv.hostPlatform.extensions.sharedLibrary; + } + ); propagatedBuildInputs = [ asgiref diff --git a/pkgs/development/python-modules/django/4.nix b/pkgs/development/python-modules/django/4.nix index e7deafc63271..b5183c00d9dd 100644 --- a/pkgs/development/python-modules/django/4.nix +++ b/pkgs/development/python-modules/django/4.nix @@ -6,7 +6,7 @@ fetchpatch, pythonAtLeast, pythonOlder, - substituteAll, + replaceVars, # build setuptools, @@ -59,8 +59,7 @@ buildPythonPackage rec { patches = [ - (substituteAll { - src = ./django_4_set_zoneinfo_dir.patch; + (replaceVars ./django_4_set_zoneinfo_dir.patch { zoneinfo = tzdata + "/share/zoneinfo"; }) # make sure the tests don't remove packages from our pythonpath @@ -75,8 +74,7 @@ buildPythonPackage rec { }) ] ++ lib.optionals withGdal [ - (substituteAll { - src = ./django_4_set_geos_gdal_lib.patch; + (replaceVars ./django_4_set_geos_gdal_lib.patch { geos = geos; gdal = gdal; extension = stdenv.hostPlatform.extensions.sharedLibrary; diff --git a/pkgs/development/python-modules/django/5.nix b/pkgs/development/python-modules/django/5.nix index 0a46ca3e1e7e..d04533cbf4a0 100644 --- a/pkgs/development/python-modules/django/5.nix +++ b/pkgs/development/python-modules/django/5.nix @@ -5,7 +5,7 @@ fetchFromGitHub, fetchpatch, pythonOlder, - substituteAll, + replaceVars, # build-system setuptools, @@ -58,8 +58,7 @@ buildPythonPackage rec { patches = [ - (substituteAll { - src = ./django_5_set_zoneinfo_dir.patch; + (replaceVars ./django_5_set_zoneinfo_dir.patch { zoneinfo = tzdata + "/share/zoneinfo"; }) # prevent tests from messing with our pythonpath @@ -75,8 +74,7 @@ buildPythonPackage rec { }) ] ++ lib.optionals withGdal [ - (substituteAll { - src = ./django_5_set_geos_gdal_lib.patch; + (replaceVars ./django_5_set_geos_gdal_lib.patch { geos = geos; gdal = gdal; extension = stdenv.hostPlatform.extensions.sharedLibrary; diff --git a/pkgs/development/python-modules/dot2tex/default.nix b/pkgs/development/python-modules/dot2tex/default.nix index acd9bbc34a1f..fc593d8a5871 100644 --- a/pkgs/development/python-modules/dot2tex/default.nix +++ b/pkgs/development/python-modules/dot2tex/default.nix @@ -2,7 +2,7 @@ lib, buildPythonPackage, fetchPypi, - substituteAll, + replaceVars, pyparsing, graphviz, pytestCheckHook, @@ -20,8 +20,7 @@ buildPythonPackage rec { }; patches = [ - (substituteAll { - src = ./path.patch; + (replaceVars ./path.patch { inherit graphviz; }) ./test.patch # https://github.com/kjellmf/dot2tex/issues/5 diff --git a/pkgs/development/python-modules/espeak-phonemizer/default.nix b/pkgs/development/python-modules/espeak-phonemizer/default.nix index 4ecae59fbc58..6b7304a7c895 100644 --- a/pkgs/development/python-modules/espeak-phonemizer/default.nix +++ b/pkgs/development/python-modules/espeak-phonemizer/default.nix @@ -2,7 +2,7 @@ lib, buildPythonPackage, fetchFromGitHub, - substituteAll, + replaceVars, espeak-ng, pytestCheckHook, }: @@ -20,8 +20,7 @@ buildPythonPackage rec { }; patches = [ - (substituteAll { - src = ./cdll.patch; + (replaceVars ./cdll.patch { libespeak_ng = "${lib.getLib espeak-ng}/lib/libespeak-ng.so"; }) ]; diff --git a/pkgs/development/python-modules/flit-gettext/default.nix b/pkgs/development/python-modules/flit-gettext/default.nix index 311861da7f71..cdf3dadf14ed 100644 --- a/pkgs/development/python-modules/flit-gettext/default.nix +++ b/pkgs/development/python-modules/flit-gettext/default.nix @@ -2,7 +2,7 @@ lib, buildPythonPackage, fetchFromGitHub, - substituteAll, + replaceVars, # build-system flit-scm, @@ -30,8 +30,7 @@ buildPythonPackage rec { }; patches = [ - (substituteAll { - src = ./msgfmt-path.patch; + (replaceVars ./msgfmt-path.patch { msgfmt = lib.getExe' gettext "msgfmt"; }) ]; diff --git a/pkgs/development/python-modules/gattlib/default.nix b/pkgs/development/python-modules/gattlib/default.nix index bb961a993a13..a3f3a0d16e90 100644 --- a/pkgs/development/python-modules/gattlib/default.nix +++ b/pkgs/development/python-modules/gattlib/default.nix @@ -3,7 +3,9 @@ buildPythonPackage, fetchFromGitHub, fetchpatch, - substituteAll, + replaceVars, + + # build pkg-config, glibc, python, @@ -31,8 +33,7 @@ buildPythonPackage rec { url = "https://github.com/oscaracena/pygattlib/commit/73a73b71cfc139e1e0a08816fb976ff330c77ea5.patch"; hash = "sha256-/Y/CZNdN/jcxWroqRfdCH2rPUxZUbug668MIAow0scs="; }) - (substituteAll { - src = ./setup.patch; + (replaceVars ./setup.patch { boost_version = let pythonVersion = with lib.versions; "${major python.version}${minor python.version}"; diff --git a/pkgs/development/python-modules/git-annex-adapter/default.nix b/pkgs/development/python-modules/git-annex-adapter/default.nix index cd1dc62261f9..de88fb53556c 100644 --- a/pkgs/development/python-modules/git-annex-adapter/default.nix +++ b/pkgs/development/python-modules/git-annex-adapter/default.nix @@ -10,7 +10,7 @@ pytestCheckHook, pythonOlder, setuptools, - substituteAll, + replaceVars, util-linux, }: @@ -42,8 +42,7 @@ buildPythonPackage rec { url = "https://github.com/alpernebbi/git-annex-adapter/commit/d0d8905965a3659ce95cbd8f8b1e8598f0faf76b.patch"; hash = "sha256-UcRTKzD3sbXGIuxj4JzZDnvjTYyWVkfeWgKiZ1rAlus="; }) - (substituteAll { - src = ./git-annex-path.patch; + (replaceVars ./git-annex-path.patch { gitAnnex = "${git-annex}/bin/git-annex"; }) ]; diff --git a/pkgs/development/python-modules/glymur/default.nix b/pkgs/development/python-modules/glymur/default.nix index d5fdb4fd0242..ebc6d0134203 100644 --- a/pkgs/development/python-modules/glymur/default.nix +++ b/pkgs/development/python-modules/glymur/default.nix @@ -13,7 +13,7 @@ pythonOlder, scikit-image, setuptools, - substituteAll, + replaceVars, }: buildPythonPackage rec { @@ -37,8 +37,7 @@ buildPythonPackage rec { url = "https://github.com/quintusdias/glymur/commit/89b159299035ebb05776c3b90278f410ca6dba64.patch"; hash = "sha256-C/Q5WZmW5YtN3U8fxKljfqwKHtFLfR2LQ69Tj8SuIWg="; }) - (substituteAll { - src = ./set-lib-paths.patch; + (replaceVars ./set-lib-paths.patch { openjp2_lib = "${lib.getLib openjpeg}/lib/libopenjp2${stdenv.hostPlatform.extensions.sharedLibrary}"; tiff_lib = "${lib.getLib libtiff}/lib/libtiff${stdenv.hostPlatform.extensions.sharedLibrary}"; }) diff --git a/pkgs/development/python-modules/gpuctypes/default.nix b/pkgs/development/python-modules/gpuctypes/default.nix index f8c8f1111160..9b3bb75434f9 100644 --- a/pkgs/development/python-modules/gpuctypes/default.nix +++ b/pkgs/development/python-modules/gpuctypes/default.nix @@ -3,7 +3,7 @@ config, buildPythonPackage, fetchFromGitHub, - substituteAll, + replaceVars, addDriverRunpath, cudaSupport ? config.cudaSupport, rocmSupport ? config.rocmSupport, @@ -33,8 +33,7 @@ buildPythonPackage rec { }; patches = [ - (substituteAll { - src = ./0001-fix-dlopen-cuda.patch; + (replaceVars ./0001-fix-dlopen-cuda.patch { inherit (addDriverRunpath) driverLink; libnvrtc = if cudaSupport then diff --git a/pkgs/development/python-modules/graphviz/default.nix b/pkgs/development/python-modules/graphviz/default.nix index 99a78b6d7661..9af39497f215 100644 --- a/pkgs/development/python-modules/graphviz/default.nix +++ b/pkgs/development/python-modules/graphviz/default.nix @@ -4,7 +4,7 @@ buildPythonPackage, pythonOlder, fetchFromGitHub, - substituteAll, + replaceVars, graphviz-nox, xdg-utils, makeFontsConf, @@ -32,8 +32,7 @@ buildPythonPackage rec { }; patches = [ - (substituteAll { - src = ./paths.patch; + (replaceVars ./paths.patch { graphviz = graphviz-nox; xdgutils = xdg-utils; }) diff --git a/pkgs/development/python-modules/hydra-core/default.nix b/pkgs/development/python-modules/hydra-core/default.nix index 0518e523d3d9..6264ff89d6c7 100644 --- a/pkgs/development/python-modules/hydra-core/default.nix +++ b/pkgs/development/python-modules/hydra-core/default.nix @@ -11,7 +11,7 @@ packaging, pytestCheckHook, pythonOlder, - substituteAll, + replaceVars, }: buildPythonPackage rec { @@ -29,8 +29,7 @@ buildPythonPackage rec { }; patches = [ - (substituteAll { - src = ./antlr4.patch; + (replaceVars ./antlr4.patch { antlr_jar = "${antlr4.out}/share/java/antlr-${antlr4.version}-complete.jar"; }) # https://github.com/facebookresearch/hydra/pull/2731 diff --git a/pkgs/development/python-modules/imageio-ffmpeg/default.nix b/pkgs/development/python-modules/imageio-ffmpeg/default.nix index c10d435da7bc..a49ac3e344a0 100644 --- a/pkgs/development/python-modules/imageio-ffmpeg/default.nix +++ b/pkgs/development/python-modules/imageio-ffmpeg/default.nix @@ -2,7 +2,7 @@ lib, buildPythonPackage, fetchFromGitHub, - substituteAll, + replaceVars, ffmpeg, # build-system @@ -27,8 +27,7 @@ buildPythonPackage rec { }; patches = [ - (substituteAll { - src = ./ffmpeg-path.patch; + (replaceVars ./ffmpeg-path.patch { ffmpeg = lib.getExe ffmpeg; }) ]; diff --git a/pkgs/development/python-modules/imageio/default.nix b/pkgs/development/python-modules/imageio/default.nix index d19c5579e25a..b0ec295e10a7 100644 --- a/pkgs/development/python-modules/imageio/default.nix +++ b/pkgs/development/python-modules/imageio/default.nix @@ -4,7 +4,7 @@ buildPythonPackage, fetchFromGitHub, isPyPy, - substituteAll, + replaceVars, # build-system setuptools, @@ -42,8 +42,7 @@ buildPythonPackage rec { }; patches = lib.optionals (!stdenv.hostPlatform.isDarwin) [ - (substituteAll { - src = ./libgl-path.patch; + (replaceVars ./libgl-path.patch { libgl = "${libGL.out}/lib/libGL${stdenv.hostPlatform.extensions.sharedLibrary}"; }) ]; diff --git a/pkgs/development/python-modules/img2pdf/default.nix b/pkgs/development/python-modules/img2pdf/default.nix index 4e49d01ad8b6..913e8a913acc 100644 --- a/pkgs/development/python-modules/img2pdf/default.nix +++ b/pkgs/development/python-modules/img2pdf/default.nix @@ -3,7 +3,7 @@ buildPythonPackage, isPy27, fetchFromGitea, - substituteAll, + replaceVars, fetchpatch, colord, setuptools, @@ -38,8 +38,7 @@ buildPythonPackage rec { }; patches = [ - (substituteAll { - src = ./default-icc-profile.patch; + (replaceVars ./default-icc-profile.patch { srgbProfile = if stdenv.hostPlatform.isDarwin then "/System/Library/ColorSync/Profiles/sRGB Profile.icc" diff --git a/pkgs/development/python-modules/iniconfig/default.nix b/pkgs/development/python-modules/iniconfig/default.nix index fcf045c94411..206faab7ae1d 100644 --- a/pkgs/development/python-modules/iniconfig/default.nix +++ b/pkgs/development/python-modules/iniconfig/default.nix @@ -1,7 +1,7 @@ { lib, buildPythonPackage, - substituteAll, + replaceVars, fetchPypi, hatchling, }: @@ -20,8 +20,7 @@ buildPythonPackage rec { patches = [ # Cannot use hatch-vcs, due to an inifinite recursion - (substituteAll { - src = ./version.patch; + (replaceVars ./version.patch { inherit version; }) ]; diff --git a/pkgs/development/python-modules/isal/default.nix b/pkgs/development/python-modules/isal/default.nix index 0594330edaf8..2626fe2e4ef5 100644 --- a/pkgs/development/python-modules/isal/default.nix +++ b/pkgs/development/python-modules/isal/default.nix @@ -2,7 +2,7 @@ lib, buildPythonPackage, fetchFromGitHub, - substituteAll, + replaceVars, # build-system setuptools, @@ -29,8 +29,7 @@ buildPythonPackage rec { }; patches = [ - (substituteAll { - src = ./version.patch; + (replaceVars ./version.patch { inherit version; }) ]; diff --git a/pkgs/development/python-modules/k5test/default.nix b/pkgs/development/python-modules/k5test/default.nix index 208f24c2b2bf..f1bfd4097c78 100644 --- a/pkgs/development/python-modules/k5test/default.nix +++ b/pkgs/development/python-modules/k5test/default.nix @@ -6,7 +6,7 @@ krb5-c, pythonOlder, setuptools, - substituteAll, + replaceVars, }: buildPythonPackage rec { @@ -22,8 +22,7 @@ buildPythonPackage rec { }; patches = [ - (substituteAll { - src = ./fix-paths.patch; + (replaceVars ./fix-paths.patch { inherit findutils; krb5 = krb5-c; # krb5-config is in dev output diff --git a/pkgs/development/python-modules/kaldi-active-grammar/default.nix b/pkgs/development/python-modules/kaldi-active-grammar/default.nix index 14795b0c1268..c26bbabb60c7 100644 --- a/pkgs/development/python-modules/kaldi-active-grammar/default.nix +++ b/pkgs/development/python-modules/kaldi-active-grammar/default.nix @@ -10,7 +10,7 @@ numpy, cffi, openfst, - substituteAll, + replaceVars, callPackage, }: @@ -43,8 +43,7 @@ buildPythonPackage rec { # Uses the dependencies' binaries from $PATH instead of a specific directory ./0002-exec-path.patch # Makes it dynamically link to the correct Kaldi library - (substituteAll { - src = ./0003-ffi-path.patch; + (replaceVars ./0003-ffi-path.patch { kaldiFork = "${kaldi}/lib"; }) ]; diff --git a/pkgs/development/python-modules/kornia-rs/default.nix b/pkgs/development/python-modules/kornia-rs/default.nix index b5311998abf9..e4b7bbd2a17e 100644 --- a/pkgs/development/python-modules/kornia-rs/default.nix +++ b/pkgs/development/python-modules/kornia-rs/default.nix @@ -6,7 +6,7 @@ rustPlatform, cmake, nasm, - substituteAll, + replaceVars, libiconv, }: @@ -36,8 +36,7 @@ buildPythonPackage rec { # The path dependency doesn't vendor the dependencies correctly, so get kornia-rs from crates instead. patches = [ - (substituteAll { - src = ./kornia-rs-from-crates.patch; + (replaceVars ./kornia-rs-from-crates.patch { inherit version; }) ]; diff --git a/pkgs/development/python-modules/libevdev/default.nix b/pkgs/development/python-modules/libevdev/default.nix index e7be644cdd5a..1d511b3afae5 100644 --- a/pkgs/development/python-modules/libevdev/default.nix +++ b/pkgs/development/python-modules/libevdev/default.nix @@ -3,7 +3,7 @@ buildPythonPackage, isPy27, fetchPypi, - substituteAll, + replaceVars, pkgs, pytestCheckHook, }: @@ -20,8 +20,7 @@ buildPythonPackage rec { }; patches = [ - (substituteAll { - src = ./fix-paths.patch; + (replaceVars ./fix-paths.patch { libevdev = lib.getLib pkgs.libevdev; }) ]; diff --git a/pkgs/development/python-modules/libusb1/default.nix b/pkgs/development/python-modules/libusb1/default.nix index 34f6c1b7636f..18a9603b0625 100644 --- a/pkgs/development/python-modules/libusb1/default.nix +++ b/pkgs/development/python-modules/libusb1/default.nix @@ -3,7 +3,7 @@ stdenv, buildPythonPackage, fetchFromGitHub, - substituteAll, + replaceVars, setuptools, libusb1, pytestCheckHook, @@ -22,8 +22,7 @@ buildPythonPackage rec { }; patches = [ - (substituteAll { - src = ./ctypes.patch; + (replaceVars ./ctypes.patch { libusb = "${lib.getLib libusb1}/lib/libusb-1.0${stdenv.hostPlatform.extensions.sharedLibrary}"; }) ]; diff --git a/pkgs/development/python-modules/mido/default.nix b/pkgs/development/python-modules/mido/default.nix index 34227c595d3f..0a4547b1fd1f 100644 --- a/pkgs/development/python-modules/mido/default.nix +++ b/pkgs/development/python-modules/mido/default.nix @@ -3,7 +3,7 @@ lib, buildPythonPackage, fetchPypi, - substituteAll, + replaceVars, # build-system setuptools, @@ -39,8 +39,7 @@ buildPythonPackage rec { }; patches = [ - (substituteAll { - src = ./libportmidi-cdll.patch; + (replaceVars ./libportmidi-cdll.patch { libportmidi = "${portmidi.out}/lib/libportmidi${stdenv.hostPlatform.extensions.sharedLibrary}"; }) ]; diff --git a/pkgs/development/python-modules/mss/default.nix b/pkgs/development/python-modules/mss/default.nix index f7b5a590b1ba..d7585caecb68 100644 --- a/pkgs/development/python-modules/mss/default.nix +++ b/pkgs/development/python-modules/mss/default.nix @@ -4,7 +4,7 @@ fetchPypi, pythonOlder, stdenv, - substituteAll, + replaceVars, # build-system hatchling, @@ -34,8 +34,7 @@ buildPythonPackage rec { }; patches = lib.optionals stdenv.hostPlatform.isLinux [ - (substituteAll { - src = ./linux-paths.patch; + (replaceVars ./linux-paths.patch { x11 = "${xorg.libX11}/lib/libX11.so"; xfixes = "${xorg.libXfixes}/lib/libXfixes.so"; xrandr = "${xorg.libXrandr}/lib/libXrandr.so"; diff --git a/pkgs/development/python-modules/netmap/default.nix b/pkgs/development/python-modules/netmap/default.nix index c863ae189dcb..81d326f50e41 100644 --- a/pkgs/development/python-modules/netmap/default.nix +++ b/pkgs/development/python-modules/netmap/default.nix @@ -2,7 +2,7 @@ lib, buildPythonPackage, fetchFromGitHub, - substituteAll, + replaceVars, nmap, python, }: @@ -20,8 +20,7 @@ buildPythonPackage rec { }; patches = [ - (substituteAll { - src = ./nmap-path.patch; + (replaceVars ./nmap-path.patch { nmap = "${lib.getBin nmap}/bin/nmap"; }) ]; diff --git a/pkgs/development/python-modules/nextcord/default.nix b/pkgs/development/python-modules/nextcord/default.nix index 10aff1066fbc..c5e023027877 100644 --- a/pkgs/development/python-modules/nextcord/default.nix +++ b/pkgs/development/python-modules/nextcord/default.nix @@ -5,7 +5,7 @@ pythonAtLeast, pythonOlder, fetchFromGitHub, - substituteAll, + replaceVars, ffmpeg, libopus, aiohttp, @@ -34,8 +34,7 @@ buildPythonPackage rec { }; patches = [ - (substituteAll { - src = ./paths.patch; + (replaceVars ./paths.patch { ffmpeg = "${ffmpeg}/bin/ffmpeg"; libopus = "${libopus}/lib/libopus${stdenv.hostPlatform.extensions.sharedLibrary}"; }) diff --git a/pkgs/development/python-modules/nocturne/default.nix b/pkgs/development/python-modules/nocturne/default.nix index 0934e6fd2535..2d105972419e 100644 --- a/pkgs/development/python-modules/nocturne/default.nix +++ b/pkgs/development/python-modules/nocturne/default.nix @@ -9,7 +9,7 @@ pybind11, pyvirtualdisplay, sfml, - substituteAll, + replaceVars, }: buildPythonPackage rec { @@ -32,8 +32,7 @@ buildPythonPackage rec { ''; patches = [ - (substituteAll { - src = ./dependencies.patch; + (replaceVars ./dependencies.patch { gtest_src = gtest.src; }) ]; diff --git a/pkgs/development/python-modules/notify-py/default.nix b/pkgs/development/python-modules/notify-py/default.nix index 45893825139b..16f48f3725e7 100644 --- a/pkgs/development/python-modules/notify-py/default.nix +++ b/pkgs/development/python-modules/notify-py/default.nix @@ -4,7 +4,7 @@ buildPythonPackage, pythonOlder, fetchFromGitHub, - substituteAll, + replaceVars, alsa-utils, libnotify, which, @@ -33,16 +33,14 @@ buildPythonPackage rec { patches = lib.optionals stdenv.hostPlatform.isLinux [ # hardcode paths to aplay and notify-send - (substituteAll { - src = ./linux-paths.patch; + (replaceVars ./linux-paths.patch { aplay = "${alsa-utils}/bin/aplay"; notifysend = "${libnotify}/bin/notify-send"; }) ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ # hardcode path to which - (substituteAll { - src = ./darwin-paths.patch; + (replaceVars ./darwin-paths.patch { which = "${which}/bin/which"; }) ]; diff --git a/pkgs/development/python-modules/numba/default.nix b/pkgs/development/python-modules/numba/default.nix index fa72fbab6021..16df1272c82b 100644 --- a/pkgs/development/python-modules/numba/default.nix +++ b/pkgs/development/python-modules/numba/default.nix @@ -11,7 +11,7 @@ numpy_1, llvmlite, libcxx, - substituteAll, + replaceVars, writers, numba, pytestCheckHook, @@ -96,8 +96,7 @@ buildPythonPackage rec { ]; patches = lib.optionals cudaSupport [ - (substituteAll { - src = ./cuda_path.patch; + (replaceVars ./cuda_path.patch { cuda_toolkit_path = cudatoolkit; cuda_toolkit_lib_path = lib.getLib cudatoolkit; }) diff --git a/pkgs/development/python-modules/nvidia-ml-py/default.nix b/pkgs/development/python-modules/nvidia-ml-py/default.nix index f5b4ea48a75d..e48b8b7d43e2 100644 --- a/pkgs/development/python-modules/nvidia-ml-py/default.nix +++ b/pkgs/development/python-modules/nvidia-ml-py/default.nix @@ -2,7 +2,7 @@ lib, fetchPypi, buildPythonPackage, - substituteAll, + replaceVars, addDriverRunpath, setuptools, cudaPackages, @@ -22,8 +22,7 @@ buildPythonPackage rec { }; patches = [ - (substituteAll { - src = ./0001-locate-libnvidia-ml.so.1-on-NixOS.patch; + (replaceVars ./0001-locate-libnvidia-ml.so.1-on-NixOS.patch { inherit (addDriverRunpath) driverLink; }) ]; diff --git a/pkgs/development/python-modules/objgraph/default.nix b/pkgs/development/python-modules/objgraph/default.nix index de84c59b59b8..9f4cf86fa761 100644 --- a/pkgs/development/python-modules/objgraph/default.nix +++ b/pkgs/development/python-modules/objgraph/default.nix @@ -7,7 +7,7 @@ isPyPy, python, pythonOlder, - substituteAll, + replaceVars, setuptools, }: @@ -24,8 +24,7 @@ buildPythonPackage rec { }; patches = [ - (substituteAll { - src = ./hardcode-graphviz-path.patch; + (replaceVars ./hardcode-graphviz-path.patch { graphviz = graphvizPkgs; }) ]; diff --git a/pkgs/development/python-modules/ocrmypdf/default.nix b/pkgs/development/python-modules/ocrmypdf/default.nix index 5d75f8a829fc..dc87c6f4edfe 100644 --- a/pkgs/development/python-modules/ocrmypdf/default.nix +++ b/pkgs/development/python-modules/ocrmypdf/default.nix @@ -21,7 +21,7 @@ pythonOlder, rich, reportlab, - substituteAll, + replaceVars, tesseract, unpaper, installShellFiles, @@ -50,8 +50,7 @@ buildPythonPackage rec { patches = [ ./use-pillow-heif.patch - (substituteAll { - src = ./paths.patch; + (replaceVars ./paths.patch { gs = lib.getExe ghostscript_headless; jbig2 = lib.getExe jbig2enc; pngquant = lib.getExe pngquant; diff --git a/pkgs/development/python-modules/omegaconf/default.nix b/pkgs/development/python-modules/omegaconf/default.nix index e0f551cbc4a6..0c9e7ab833fe 100644 --- a/pkgs/development/python-modules/omegaconf/default.nix +++ b/pkgs/development/python-modules/omegaconf/default.nix @@ -13,7 +13,7 @@ pythonAtLeast, pythonOlder, pyyaml, - substituteAll, + replaceVars, }: buildPythonPackage rec { @@ -31,8 +31,7 @@ buildPythonPackage rec { }; patches = [ - (substituteAll { - src = ./antlr4.patch; + (replaceVars ./antlr4.patch { antlr_jar = "${antlr4.out}/share/java/antlr-${antlr4.version}-complete.jar"; }) diff --git a/pkgs/development/python-modules/openai-whisper/default.nix b/pkgs/development/python-modules/openai-whisper/default.nix index 4c0327558971..634f8677be2c 100644 --- a/pkgs/development/python-modules/openai-whisper/default.nix +++ b/pkgs/development/python-modules/openai-whisper/default.nix @@ -3,7 +3,7 @@ stdenv, fetchFromGitHub, buildPythonPackage, - substituteAll, + replaceVars, # build-system setuptools, @@ -38,8 +38,7 @@ buildPythonPackage rec { }; patches = [ - (substituteAll { - src = ./ffmpeg-path.patch; + (replaceVars ./ffmpeg-path.patch { ffmpeg = ffmpeg-headless; }) ]; diff --git a/pkgs/development/python-modules/opuslib/default.nix b/pkgs/development/python-modules/opuslib/default.nix index 4f7c86d2a481..b645a2d1b1d0 100644 --- a/pkgs/development/python-modules/opuslib/default.nix +++ b/pkgs/development/python-modules/opuslib/default.nix @@ -7,7 +7,7 @@ pytestCheckHook, lib, stdenv, - substituteAll, + replaceVars, setuptools, }: @@ -38,8 +38,7 @@ buildPythonPackage rec { url = "https://github.com/orion-labs/opuslib/commit/87a214fc98c1dcae38035e99fe8e279a160c4a52.patch"; hash = "sha256-UoOafyTFvWLY7ErtBhkXTZSgbMZFrg5DGxjbhqEI7wo="; }) - (substituteAll { - src = ./opuslib-paths.patch; + (replaceVars ./opuslib-paths.patch { opusLibPath = "${libopus}/lib/libopus${stdenv.hostPlatform.extensions.sharedLibrary}"; }) ]; diff --git a/pkgs/development/python-modules/ots-python/default.nix b/pkgs/development/python-modules/ots-python/default.nix index 9c0ae3625c21..ca91bfeaacee 100644 --- a/pkgs/development/python-modules/ots-python/default.nix +++ b/pkgs/development/python-modules/ots-python/default.nix @@ -2,7 +2,7 @@ lib, buildPythonPackage, fetchPypi, - substituteAll, + replaceVars, opentype-sanitizer, setuptools-scm, pytestCheckHook, @@ -23,8 +23,7 @@ buildPythonPackage rec { # Invoke ots-sanitize from the opentype-sanitizer package instead of # downloading precompiled binaries from the internet. # (nixpkgs-specific, not upstreamable) - (substituteAll { - src = ./0001-use-packaged-ots.patch; + (replaceVars ./0001-use-packaged-ots.patch { ots_sanitize = "${opentype-sanitizer}/bin/ots-sanitize"; }) ]; diff --git a/pkgs/development/python-modules/pdfminer-six/default.nix b/pkgs/development/python-modules/pdfminer-six/default.nix index be653431e2a5..0fd59cbd4aec 100644 --- a/pkgs/development/python-modules/pdfminer-six/default.nix +++ b/pkgs/development/python-modules/pdfminer-six/default.nix @@ -8,7 +8,7 @@ pythonOlder, pytestCheckHook, setuptools, - substituteAll, + replaceVars, ocrmypdf, }: @@ -34,8 +34,7 @@ buildPythonPackage rec { excludes = [ "CHANGELOG.md" ]; hash = "sha256-fsSXvN92MVtNFpAst0ctvGrbxVvoe4Nyz4wMZqJ1aw8="; }) - (substituteAll { - src = ./disable-setuptools-git-versioning.patch; + (replaceVars ./disable-setuptools-git-versioning.patch { inherit version; }) ]; diff --git a/pkgs/development/python-modules/phonemizer/default.nix b/pkgs/development/python-modules/phonemizer/default.nix index 561088b606d8..9b4a69a67876 100644 --- a/pkgs/development/python-modules/phonemizer/default.nix +++ b/pkgs/development/python-modules/phonemizer/default.nix @@ -1,7 +1,7 @@ { lib, stdenv, - substituteAll, + replaceVars, buildPythonPackage, fetchPypi, joblib, @@ -27,8 +27,7 @@ buildPythonPackage rec { }; patches = [ - (substituteAll { - src = ./backend-paths.patch; + (replaceVars ./backend-paths.patch { libespeak = "${lib.getLib espeak-ng}/lib/libespeak-ng${stdenv.hostPlatform.extensions.sharedLibrary}"; # FIXME package festival }) diff --git a/pkgs/development/python-modules/pikepdf/default.nix b/pkgs/development/python-modules/pikepdf/default.nix index da0ebb79b504..f05ed913e313 100644 --- a/pkgs/development/python-modules/pikepdf/default.nix +++ b/pkgs/development/python-modules/pikepdf/default.nix @@ -20,7 +20,7 @@ python-xmp-toolkit, qpdf, setuptools, - substituteAll, + replaceVars, }: buildPythonPackage rec { @@ -42,8 +42,7 @@ buildPythonPackage rec { }; patches = [ - (substituteAll { - src = ./paths.patch; + (replaceVars ./paths.patch { jbig2dec = lib.getExe' jbig2dec "jbig2dec"; mutool = lib.getExe' mupdf-headless "mutool"; }) diff --git a/pkgs/development/python-modules/protobuf/4.nix b/pkgs/development/python-modules/protobuf/4.nix index c4db1b86e164..48af41c206ec 100644 --- a/pkgs/development/python-modules/protobuf/4.nix +++ b/pkgs/development/python-modules/protobuf/4.nix @@ -9,7 +9,7 @@ protobuf, pytestCheckHook, pythonAtLeast, - substituteAll, + replaceVars, tzdata, }: @@ -31,8 +31,7 @@ buildPythonPackage { patches = lib.optionals (lib.versionAtLeast protobuf.version "22") [ # Replace the vendored abseil-cpp with nixpkgs' - (substituteAll { - src = ./use-nixpkgs-abseil-cpp.patch; + (replaceVars ./use-nixpkgs-abseil-cpp.patch { abseil_cpp_include_path = "${lib.getDev protobuf.abseil-cpp}/include"; }) ] diff --git a/pkgs/development/python-modules/proton-client/default.nix b/pkgs/development/python-modules/proton-client/default.nix index 4e178ce26c92..b7a4db2ae9b0 100644 --- a/pkgs/development/python-modules/proton-client/default.nix +++ b/pkgs/development/python-modules/proton-client/default.nix @@ -4,7 +4,7 @@ buildPythonPackage, fetchFromGitHub, pythonOlder, - substituteAll, + replaceVars, bcrypt, pyopenssl, python-gnupg, @@ -37,8 +37,7 @@ buildPythonPackage rec { patches = [ # Patches library by fixing the openssl path - (substituteAll { - src = ./0001-OpenSSL-path-fix.patch; + (replaceVars ./0001-OpenSSL-path-fix.patch { openssl = openssl.out; ext = stdenv.hostPlatform.extensions.sharedLibrary; }) diff --git a/pkgs/development/python-modules/protonvpn-nm-lib/default.nix b/pkgs/development/python-modules/protonvpn-nm-lib/default.nix index ff647a2582bd..2b679015e6bd 100644 --- a/pkgs/development/python-modules/protonvpn-nm-lib/default.nix +++ b/pkgs/development/python-modules/protonvpn-nm-lib/default.nix @@ -3,7 +3,7 @@ buildPythonPackage, fetchFromGitHub, pythonOlder, - substituteAll, + replaceVars, dbus-python, distro, jinja2, @@ -48,8 +48,7 @@ buildPythonPackage rec { ]; patches = [ - (substituteAll { - src = ./0001-Patching-GIRepository.patch; + (replaceVars ./0001-Patching-GIRepository.patch { networkmanager_path = "${networkmanager}/lib/girepository-1.0"; }) ]; diff --git a/pkgs/development/python-modules/pulsectl/default.nix b/pkgs/development/python-modules/pulsectl/default.nix index 485acd9f7880..a4340c4a7fc8 100644 --- a/pkgs/development/python-modules/pulsectl/default.nix +++ b/pkgs/development/python-modules/pulsectl/default.nix @@ -4,7 +4,7 @@ fetchPypi, libpulseaudio, glibc, - substituteAll, + replaceVars, stdenv, pulseaudio, unittestCheckHook, @@ -22,8 +22,7 @@ buildPythonPackage rec { patches = [ # substitute library paths for libpulse and librt - (substituteAll { - src = ./library-paths.patch; + (replaceVars ./library-paths.patch { libpulse = "${libpulseaudio.out}/lib/libpulse${stdenv.hostPlatform.extensions.sharedLibrary}"; librt = "${glibc.out}/lib/librt${stdenv.hostPlatform.extensions.sharedLibrary}"; }) diff --git a/pkgs/development/python-modules/pydot/default.nix b/pkgs/development/python-modules/pydot/default.nix index a8756cab87a1..bdbabe92c715 100644 --- a/pkgs/development/python-modules/pydot/default.nix +++ b/pkgs/development/python-modules/pydot/default.nix @@ -3,7 +3,7 @@ buildPythonPackage, fetchPypi, setuptools, - substituteAll, + replaceVars, graphviz, pytestCheckHook, chardet, @@ -37,8 +37,7 @@ buildPythonPackage rec { ]; patches = [ - (substituteAll { - src = ./hardcode-graphviz-path.patch; + (replaceVars ./hardcode-graphviz-path.patch { inherit graphviz; }) ]; diff --git a/pkgs/development/python-modules/pygame-ce/default.nix b/pkgs/development/python-modules/pygame-ce/default.nix index 470ece383353..cd288f7184f9 100644 --- a/pkgs/development/python-modules/pygame-ce/default.nix +++ b/pkgs/development/python-modules/pygame-ce/default.nix @@ -1,7 +1,7 @@ { stdenv, lib, - substituteAll, + replaceVars, fetchFromGitHub, buildPythonPackage, pythonOlder, @@ -45,8 +45,7 @@ buildPythonPackage rec { }; patches = [ - (substituteAll { - src = ./fix-dependency-finding.patch; + (replaceVars ./fix-dependency-finding.patch { buildinputs_include = builtins.toJSON ( builtins.concatMap (dep: [ "${lib.getDev dep}/" diff --git a/pkgs/development/python-modules/pygame/default.nix b/pkgs/development/python-modules/pygame/default.nix index f4da6a9f001c..c5c6ac9175eb 100644 --- a/pkgs/development/python-modules/pygame/default.nix +++ b/pkgs/development/python-modules/pygame/default.nix @@ -3,7 +3,7 @@ stdenv, buildPythonPackage, fetchFromGitHub, - substituteAll, + replaceVars, fontconfig, python, @@ -44,8 +44,7 @@ buildPythonPackage rec { patches = [ # Patch pygame's dependency resolution to let it find build inputs - (substituteAll { - src = ./fix-dependency-finding.patch; + (replaceVars ./fix-dependency-finding.patch { buildinputs_include = builtins.toJSON ( builtins.concatMap (dep: [ "${lib.getDev dep}/" diff --git a/pkgs/development/python-modules/pygraphviz/default.nix b/pkgs/development/python-modules/pygraphviz/default.nix index f6cf8b1a1595..f0a218a7883c 100644 --- a/pkgs/development/python-modules/pygraphviz/default.nix +++ b/pkgs/development/python-modules/pygraphviz/default.nix @@ -3,7 +3,7 @@ buildPythonPackage, pythonOlder, fetchFromGitHub, - substituteAll, + replaceVars, graphviz, coreutils, pkg-config, @@ -27,8 +27,7 @@ buildPythonPackage rec { patches = [ # pygraphviz depends on graphviz executables and wc being in PATH - (substituteAll { - src = ./path.patch; + (replaceVars ./path.patch { path = lib.makeBinPath [ graphviz coreutils diff --git a/pkgs/development/python-modules/pylama/default.nix b/pkgs/development/python-modules/pylama/default.nix index 112d9392d80d..39b5657819ad 100644 --- a/pkgs/development/python-modules/pylama/default.nix +++ b/pkgs/development/python-modules/pylama/default.nix @@ -2,7 +2,7 @@ lib, buildPythonPackage, fetchFromGitHub, - substituteAll, + replaceVars, git, eradicate, mccabe, @@ -32,8 +32,7 @@ let }; patches = [ - (substituteAll { - src = ./paths.patch; + (replaceVars ./paths.patch { git = "${lib.getBin git}/bin/git"; }) ]; diff --git a/pkgs/development/python-modules/pylddwrap/default.nix b/pkgs/development/python-modules/pylddwrap/default.nix index b24700cee2c8..cb68291f27e6 100644 --- a/pkgs/development/python-modules/pylddwrap/default.nix +++ b/pkgs/development/python-modules/pylddwrap/default.nix @@ -6,7 +6,7 @@ icontract, pytestCheckHook, pythonOlder, - substituteAll, + replaceVars, typing-extensions, }: @@ -24,8 +24,7 @@ buildPythonPackage rec { }; patches = [ - (substituteAll { - src = ./replace_env_with_placeholder.patch; + (replaceVars ./replace_env_with_placeholder.patch { ldd_bin = "${stdenv.cc.bintools.libc_bin}/bin/ldd"; }) ]; diff --git a/pkgs/development/python-modules/pyocr/default.nix b/pkgs/development/python-modules/pyocr/default.nix index 7df733b680a0..8305e308918e 100644 --- a/pkgs/development/python-modules/pyocr/default.nix +++ b/pkgs/development/python-modules/pyocr/default.nix @@ -7,7 +7,7 @@ tesseract, cuneiform, isPy3k, - substituteAll, + replaceVars, pytestCheckHook, setuptools, setuptools-scm, @@ -33,15 +33,17 @@ buildPythonPackage rec { patches = [ ] - ++ (lib.optional withTesseractSupport (substituteAll { - src = ./paths-tesseract.patch; - inherit tesseract; - tesseractLibraryLocation = "${tesseract}/lib/libtesseract${stdenv.hostPlatform.extensions.sharedLibrary}"; - })) - ++ (lib.optional stdenv.hostPlatform.isLinux (substituteAll { - src = ./paths-cuneiform.patch; - inherit cuneiform; - })); + ++ (lib.optional withTesseractSupport ( + replaceVars ./paths-tesseract.patch { + inherit tesseract; + tesseractLibraryLocation = "${tesseract}/lib/libtesseract${stdenv.hostPlatform.extensions.sharedLibrary}"; + } + )) + ++ (lib.optional stdenv.hostPlatform.isLinux ( + replaceVars ./paths-cuneiform.patch { + inherit cuneiform; + } + )); propagatedBuildInputs = [ pillow ]; diff --git a/pkgs/development/python-modules/pyogg/default.nix b/pkgs/development/python-modules/pyogg/default.nix index 03d51fef67fa..220777cd3609 100644 --- a/pkgs/development/python-modules/pyogg/default.nix +++ b/pkgs/development/python-modules/pyogg/default.nix @@ -8,7 +8,7 @@ libogg, libopus, opusfile, - substituteAll, + replaceVars, }: buildPythonPackage rec { @@ -45,8 +45,7 @@ buildPythonPackage rec { "--binary" ]; patches = [ - (substituteAll { - src = ./pyogg-paths.patch; + (replaceVars ./pyogg-paths.patch { flacLibPath = "${flac.out}/lib/libFLAC${stdenv.hostPlatform.extensions.sharedLibrary}"; oggLibPath = "${libogg}/lib/libogg${stdenv.hostPlatform.extensions.sharedLibrary}"; vorbisLibPath = "${libvorbis}/lib/libvorbis${stdenv.hostPlatform.extensions.sharedLibrary}"; diff --git a/pkgs/development/python-modules/pypandoc/default.nix b/pkgs/development/python-modules/pypandoc/default.nix index 0aad26e59cb6..102750113157 100644 --- a/pkgs/development/python-modules/pypandoc/default.nix +++ b/pkgs/development/python-modules/pypandoc/default.nix @@ -6,7 +6,7 @@ pandocfilters, poetry-core, pythonOlder, - substituteAll, + replaceVars, texliveSmall, }: @@ -25,8 +25,7 @@ buildPythonPackage rec { }; patches = [ - (substituteAll { - src = ./static-pandoc-path.patch; + (replaceVars ./static-pandoc-path.patch { pandoc = "${lib.getBin pandoc}/bin/pandoc"; pandocVersion = pandoc.version; }) diff --git a/pkgs/development/python-modules/pyproj/default.nix b/pkgs/development/python-modules/pyproj/default.nix index d419fbb76949..77f863139ed5 100644 --- a/pkgs/development/python-modules/pyproj/default.nix +++ b/pkgs/development/python-modules/pyproj/default.nix @@ -4,7 +4,7 @@ fetchFromGitHub, pytestCheckHook, pythonOlder, - substituteAll, + replaceVars, certifi, cython, @@ -31,8 +31,7 @@ buildPythonPackage rec { # force pyproj to use ${proj} patches = [ - (substituteAll { - src = ./001.proj.patch; + (replaceVars ./001.proj.patch { proj = proj; projdev = proj.dev; }) diff --git a/pkgs/development/python-modules/pysaml2/default.nix b/pkgs/development/python-modules/pysaml2/default.nix index 8fb26fb9f5f2..dca55176f162 100644 --- a/pkgs/development/python-modules/pysaml2/default.nix +++ b/pkgs/development/python-modules/pysaml2/default.nix @@ -17,7 +17,7 @@ requests, responses, setuptools, - substituteAll, + replaceVars, xmlschema, xmlsec, zope-interface, @@ -38,8 +38,7 @@ buildPythonPackage rec { }; patches = [ - (substituteAll { - src = ./hardcode-xmlsec1-path.patch; + (replaceVars ./hardcode-xmlsec1-path.patch { inherit xmlsec; }) ]; diff --git a/pkgs/development/python-modules/pytesseract/default.nix b/pkgs/development/python-modules/pytesseract/default.nix index e64c3e28a2b6..502bb3dd2465 100644 --- a/pkgs/development/python-modules/pytesseract/default.nix +++ b/pkgs/development/python-modules/pytesseract/default.nix @@ -5,7 +5,7 @@ packaging, pillow, tesseract, - substituteAll, + replaceVars, pytestCheckHook, setuptools, }: @@ -23,8 +23,7 @@ buildPythonPackage rec { }; patches = [ - (substituteAll { - src = ./tesseract-binary.patch; + (replaceVars ./tesseract-binary.patch { drv = tesseract; }) ]; diff --git a/pkgs/development/python-modules/python-magic/default.nix b/pkgs/development/python-modules/python-magic/default.nix index 942f4562d9db..c84659014b71 100644 --- a/pkgs/development/python-modules/python-magic/default.nix +++ b/pkgs/development/python-modules/python-magic/default.nix @@ -4,7 +4,7 @@ buildPythonPackage, fetchFromGitHub, fetchpatch, - substituteAll, + replaceVars, file, pytestCheckHook, }: @@ -22,8 +22,7 @@ buildPythonPackage rec { }; patches = [ - (substituteAll { - src = ./libmagic-path.patch; + (replaceVars ./libmagic-path.patch { libmagic = "${file}/lib/libmagic${stdenv.hostPlatform.extensions.sharedLibrary}"; }) (fetchpatch { diff --git a/pkgs/development/python-modules/python-mapnik/default.nix b/pkgs/development/python-modules/python-mapnik/default.nix index 6e0b93a60907..2ce7bff0593d 100644 --- a/pkgs/development/python-modules/python-mapnik/default.nix +++ b/pkgs/development/python-modules/python-mapnik/default.nix @@ -2,7 +2,7 @@ lib, buildPythonPackage, fetchFromGitHub, - substituteAll, + replaceVars, isPyPy, python, setuptools, @@ -43,8 +43,7 @@ buildPythonPackage rec { patches = [ # python-mapnik seems to depend on having the mapnik src directory # structure available at build time. We just hardcode the paths. - (substituteAll { - src = ./find-libmapnik.patch; + (replaceVars ./find-libmapnik.patch { libmapnik = "${mapnik}/lib"; }) # Use `std::optional` rather than `boost::optional` diff --git a/pkgs/development/python-modules/python-matter-server/default.nix b/pkgs/development/python-modules/python-matter-server/default.nix index 9f860cdf7b54..90563f8b101f 100644 --- a/pkgs/development/python-modules/python-matter-server/default.nix +++ b/pkgs/development/python-modules/python-matter-server/default.nix @@ -4,7 +4,7 @@ fetchFromGitHub, pythonOlder, stdenvNoCC, - substituteAll, + replaceVars, # build setuptools, @@ -69,8 +69,7 @@ buildPythonPackage rec { }; patches = [ - (substituteAll { - src = ./link-paa-root-certs.patch; + (replaceVars ./link-paa-root-certs.patch { paacerts = paaCerts; }) ]; diff --git a/pkgs/development/python-modules/python-rapidjson/default.nix b/pkgs/development/python-modules/python-rapidjson/default.nix index 32153ca9f8c3..2c686ca2d8d4 100644 --- a/pkgs/development/python-modules/python-rapidjson/default.nix +++ b/pkgs/development/python-modules/python-rapidjson/default.nix @@ -7,7 +7,7 @@ pytestCheckHook, pytz, setuptools, - substituteAll, + replaceVars, }: buildPythonPackage rec { @@ -25,8 +25,7 @@ buildPythonPackage rec { }; patches = [ - (substituteAll { - src = ./rapidjson-include-dir.patch; + (replaceVars ./rapidjson-include-dir.patch { rapidjson = lib.getDev rapidjson; }) ]; diff --git a/pkgs/development/python-modules/python3-gnutls/default.nix b/pkgs/development/python-modules/python3-gnutls/default.nix index 60bf464cb510..88958200c0ec 100644 --- a/pkgs/development/python-modules/python3-gnutls/default.nix +++ b/pkgs/development/python-modules/python3-gnutls/default.nix @@ -1,7 +1,7 @@ { lib, fetchFromGitHub, - substituteAll, + replaceVars, buildPythonPackage, isPy3k, gnutls, @@ -34,8 +34,7 @@ buildPythonPackage rec { ]; patches = [ - (substituteAll { - src = ./libgnutls-path.patch; + (replaceVars ./libgnutls-path.patch { gnutlslib = "${lib.getLib gnutls}/lib"; }) ]; diff --git a/pkgs/development/python-modules/pythran/default.nix b/pkgs/development/python-modules/pythran/default.nix index c8873f5d3eed..9f041f3374cf 100644 --- a/pkgs/development/python-modules/pythran/default.nix +++ b/pkgs/development/python-modules/pythran/default.nix @@ -4,7 +4,7 @@ buildPythonPackage, fetchFromGitHub, fetchpatch2, - substituteAll, + replaceVars, # build-system setuptools, @@ -37,8 +37,7 @@ buildPythonPackage rec { patches = [ # Hardcode path to mp library - (substituteAll { - src = ./0001-hardcode-path-to-libgomp.patch; + (replaceVars ./0001-hardcode-path-to-libgomp.patch { gomp = "${ if stdenv.cc.isClang then openmp else (lib.getLib stdenv.cc.cc) }/lib/libgomp${stdenv.hostPlatform.extensions.sharedLibrary}"; diff --git a/pkgs/development/python-modules/pyturbojpeg/default.nix b/pkgs/development/python-modules/pyturbojpeg/default.nix index d91e446e5d7a..735f0a928c81 100644 --- a/pkgs/development/python-modules/pyturbojpeg/default.nix +++ b/pkgs/development/python-modules/pyturbojpeg/default.nix @@ -7,7 +7,7 @@ setuptools, numpy, python, - substituteAll, + replaceVars, }: buildPythonPackage rec { @@ -23,8 +23,7 @@ buildPythonPackage rec { }; patches = [ - (substituteAll { - src = ./lib-path.patch; + (replaceVars ./lib-path.patch { libturbojpeg = "${lib.getLib libjpeg_turbo}/lib/libturbojpeg${stdenv.hostPlatform.extensions.sharedLibrary}"; }) ]; diff --git a/pkgs/development/python-modules/pyvirtualdisplay/default.nix b/pkgs/development/python-modules/pyvirtualdisplay/default.nix index ac2a3bf68f69..dca19a30340c 100644 --- a/pkgs/development/python-modules/pyvirtualdisplay/default.nix +++ b/pkgs/development/python-modules/pyvirtualdisplay/default.nix @@ -3,7 +3,7 @@ stdenv, buildPythonPackage, fetchPypi, - substituteAll, + replaceVars, xorg, # build-system @@ -32,8 +32,7 @@ buildPythonPackage rec { }; patches = lib.optionals stdenv.hostPlatform.isLinux [ - (substituteAll { - src = ./paths.patch; + (replaceVars ./paths.patch { xauth = lib.getExe xorg.xauth; xdpyinfo = lib.getExe xorg.xdpyinfo; }) diff --git a/pkgs/development/python-modules/slixmpp/default.nix b/pkgs/development/python-modules/slixmpp/default.nix index 02070116ebda..0d1cb77e17c2 100644 --- a/pkgs/development/python-modules/slixmpp/default.nix +++ b/pkgs/development/python-modules/slixmpp/default.nix @@ -8,7 +8,7 @@ pyasn1, pyasn1-modules, pytestCheckHook, - substituteAll, + replaceVars, pythonOlder, }: @@ -34,8 +34,7 @@ buildPythonPackage rec { nativeCheckInputs = [ pytestCheckHook ]; patches = [ - (substituteAll { - src = ./hardcode-gnupg-path.patch; + (replaceVars ./hardcode-gnupg-path.patch { inherit gnupg; }) ]; diff --git a/pkgs/development/python-modules/sounddevice/default.nix b/pkgs/development/python-modules/sounddevice/default.nix index f90e2f7a3064..8784657600b9 100644 --- a/pkgs/development/python-modules/sounddevice/default.nix +++ b/pkgs/development/python-modules/sounddevice/default.nix @@ -8,7 +8,7 @@ cffi, numpy, portaudio, - substituteAll, + replaceVars, }: buildPythonPackage rec { @@ -38,8 +38,7 @@ buildPythonPackage rec { pythonImportsCheck = [ "sounddevice" ]; patches = [ - (substituteAll { - src = ./fix-portaudio-library-path.patch; + (replaceVars ./fix-portaudio-library-path.patch { portaudio = "${portaudio}/lib/libportaudio${stdenv.hostPlatform.extensions.sharedLibrary}"; }) ]; diff --git a/pkgs/development/python-modules/streamdeck/default.nix b/pkgs/development/python-modules/streamdeck/default.nix index e921659e2284..2d4009c57c7e 100644 --- a/pkgs/development/python-modules/streamdeck/default.nix +++ b/pkgs/development/python-modules/streamdeck/default.nix @@ -3,7 +3,7 @@ stdenv, buildPythonPackage, fetchPypi, - substituteAll, + replaceVars, pkgs, }: @@ -19,8 +19,7 @@ buildPythonPackage rec { patches = [ # substitute libusb path - (substituteAll { - src = ./hardcode-libusb.patch; + (replaceVars ./hardcode-libusb.patch { libusb = "${pkgs.hidapi}/lib/libhidapi-libusb${stdenv.hostPlatform.extensions.sharedLibrary}"; }) ]; diff --git a/pkgs/development/python-modules/termplotlib/default.nix b/pkgs/development/python-modules/termplotlib/default.nix index c4112b3e1629..d690ad1aa5a9 100644 --- a/pkgs/development/python-modules/termplotlib/default.nix +++ b/pkgs/development/python-modules/termplotlib/default.nix @@ -1,6 +1,6 @@ { lib, - substituteAll, + replaceVars, buildPythonPackage, fetchFromGitHub, pytestCheckHook, @@ -33,8 +33,7 @@ buildPythonPackage rec { propagatedBuildInputs = [ numpy ]; patches = [ - (substituteAll { - src = ./gnuplot-subprocess.patch; + (replaceVars ./gnuplot-subprocess.patch { gnuplot = "${gnuplot.out}/bin/gnuplot"; }) ]; diff --git a/pkgs/development/python-modules/tinygrad/default.nix b/pkgs/development/python-modules/tinygrad/default.nix index b7826c8c01f2..e979b7991281 100644 --- a/pkgs/development/python-modules/tinygrad/default.nix +++ b/pkgs/development/python-modules/tinygrad/default.nix @@ -3,7 +3,7 @@ config, buildPythonPackage, fetchFromGitHub, - substituteAll, + replaceVars, addDriverRunpath, cudaSupport ? config.cudaSupport, rocmSupport ? config.rocmSupport, @@ -56,8 +56,7 @@ buildPythonPackage rec { }; patches = [ - (substituteAll { - src = ./fix-dlopen-cuda.patch; + (replaceVars ./fix-dlopen-cuda.patch { inherit (addDriverRunpath) driverLink; libnvrtc = if cudaSupport then diff --git a/pkgs/development/python-modules/tpm2-pytss/default.nix b/pkgs/development/python-modules/tpm2-pytss/default.nix index 7ca0bb688a41..807f51dabe42 100644 --- a/pkgs/development/python-modules/tpm2-pytss/default.nix +++ b/pkgs/development/python-modules/tpm2-pytss/default.nix @@ -1,7 +1,7 @@ { lib, stdenv, - substituteAll, + replaceVars, buildPythonPackage, fetchPypi, fetchpatch, @@ -53,8 +53,7 @@ buildPythonPackage rec { # when cross-compiling is turned on. # This patch changes the call to pycparser.preprocess_file to provide the name # of the cross-compiling cpp - (substituteAll { - src = ./cross.patch; + (replaceVars ./cross.patch { crossPrefix = stdenv.hostPlatform.config; }) ]; diff --git a/pkgs/development/python-modules/vispy/default.nix b/pkgs/development/python-modules/vispy/default.nix index eb3b16c0a3ea..875c06b5fe71 100644 --- a/pkgs/development/python-modules/vispy/default.nix +++ b/pkgs/development/python-modules/vispy/default.nix @@ -2,7 +2,7 @@ lib, stdenv, buildPythonPackage, - substituteAll, + replaceVars, fetchPypi, cython, fontconfig, @@ -32,8 +32,7 @@ buildPythonPackage rec { }; patches = lib.optionals (!stdenv.hostPlatform.isDarwin) [ - (substituteAll { - src = ./library-paths.patch; + (replaceVars ./library-paths.patch { fontconfig = "${fontconfig.lib}/lib/libfontconfig${stdenv.hostPlatform.extensions.sharedLibrary}"; gl = "${libGL.out}/lib/libGL${stdenv.hostPlatform.extensions.sharedLibrary}"; }) diff --git a/pkgs/development/python-modules/wallet-py3k/default.nix b/pkgs/development/python-modules/wallet-py3k/default.nix index fb50398d5be4..1237dafc3396 100644 --- a/pkgs/development/python-modules/wallet-py3k/default.nix +++ b/pkgs/development/python-modules/wallet-py3k/default.nix @@ -2,7 +2,7 @@ lib, buildPythonPackage, fetchPypi, - substituteAll, + replaceVars, openssl, setuptools, six, @@ -19,8 +19,7 @@ buildPythonPackage rec { }; patches = [ - (substituteAll { - src = ./openssl-path.patch; + (replaceVars ./openssl-path.patch { openssl = lib.getExe openssl; }) ]; diff --git a/pkgs/development/python-modules/wandb/default.nix b/pkgs/development/python-modules/wandb/default.nix index 9636de89d64a..d724cc4afd6b 100644 --- a/pkgs/development/python-modules/wandb/default.nix +++ b/pkgs/development/python-modules/wandb/default.nix @@ -13,7 +13,7 @@ ## wandb buildPythonPackage, - substituteAll, + replaceVars, # build-system hatchling, @@ -150,8 +150,7 @@ buildPythonPackage rec { patches = [ # Replace git paths - (substituteAll { - src = ./hardcode-git-path.patch; + (replaceVars ./hardcode-git-path.patch { git = lib.getExe git; }) ]; diff --git a/pkgs/development/python-modules/wavefile/default.nix b/pkgs/development/python-modules/wavefile/default.nix index 9711e2684038..c36b099f26d0 100644 --- a/pkgs/development/python-modules/wavefile/default.nix +++ b/pkgs/development/python-modules/wavefile/default.nix @@ -7,7 +7,7 @@ pyaudio, numpy, libsndfile, - substituteAll, + replaceVars, }: buildPythonPackage rec { @@ -40,8 +40,7 @@ buildPythonPackage rec { patches = [ # Fix check error # OSError: libsndfile.so.1: cannot open shared object file: No such file or directory - (substituteAll { - src = ./libsndfile.py.patch; + (replaceVars ./libsndfile.py.patch { libsndfile = "${lib.getLib libsndfile}/lib/libsndfile${stdenv.hostPlatform.extensions.sharedLibrary}"; }) ]; diff --git a/pkgs/development/python-modules/weasyprint/default.nix b/pkgs/development/python-modules/weasyprint/default.nix index e50d4f3d921a..d9deb72e8266 100644 --- a/pkgs/development/python-modules/weasyprint/default.nix +++ b/pkgs/development/python-modules/weasyprint/default.nix @@ -18,7 +18,7 @@ pytest-cov-stub, pytestCheckHook, pythonOlder, - substituteAll, + replaceVars, tinycss2, tinyhtml5, }: @@ -37,13 +37,11 @@ buildPythonPackage rec { }; patches = [ - (substituteAll { - src = ./library-paths.patch; + (replaceVars ./library-paths.patch { fontconfig = "${fontconfig.lib}/lib/libfontconfig${stdenv.hostPlatform.extensions.sharedLibrary}"; pangoft2 = "${pango.out}/lib/libpangoft2-1.0${stdenv.hostPlatform.extensions.sharedLibrary}"; gobject = "${glib.out}/lib/libgobject-2.0${stdenv.hostPlatform.extensions.sharedLibrary}"; pango = "${pango.out}/lib/libpango-1.0${stdenv.hostPlatform.extensions.sharedLibrary}"; - pangocairo = "${pango.out}/lib/libpangocairo-1.0${stdenv.hostPlatform.extensions.sharedLibrary}"; harfbuzz = "${harfbuzz.out}/lib/libharfbuzz${stdenv.hostPlatform.extensions.sharedLibrary}"; harfbuzz_subset = "${harfbuzz.out}/lib/libharfbuzz-subset${stdenv.hostPlatform.extensions.sharedLibrary}"; }) diff --git a/pkgs/development/python-modules/wxpython/4.2.nix b/pkgs/development/python-modules/wxpython/4.2.nix index 8fd324dff01f..6a5d3debaf40 100644 --- a/pkgs/development/python-modules/wxpython/4.2.nix +++ b/pkgs/development/python-modules/wxpython/4.2.nix @@ -4,7 +4,7 @@ buildPythonPackage, setuptools, fetchPypi, - substituteAll, + replaceVars, # build autoPatchelfHook, @@ -52,8 +52,7 @@ buildPythonPackage rec { }; patches = [ - (substituteAll { - src = ./4.2-ctypes.patch; + (replaceVars ./4.2-ctypes.patch { libgdk = "${gtk3.out}/lib/libgdk-3.so"; libpangocairo = "${pango}/lib/libpangocairo-1.0.so"; libcairo = "${cairo}/lib/libcairo.so"; diff --git a/pkgs/development/python-modules/xsdata/default.nix b/pkgs/development/python-modules/xsdata/default.nix index 97d0d64a3b4b..3d4f21b9d1cd 100644 --- a/pkgs/development/python-modules/xsdata/default.nix +++ b/pkgs/development/python-modules/xsdata/default.nix @@ -3,7 +3,7 @@ buildPythonPackage, pythonOlder, fetchFromGitHub, - substituteAll, + replaceVars, ruff, click, click-default-group, @@ -32,8 +32,7 @@ buildPythonPackage rec { }; patches = [ - (substituteAll { - src = ./paths.patch; + (replaceVars ./paths.patch { ruff = lib.getExe ruff; }) ]; diff --git a/pkgs/development/python-modules/youseedee/default.nix b/pkgs/development/python-modules/youseedee/default.nix index e35be6b56568..6117e329d62a 100644 --- a/pkgs/development/python-modules/youseedee/default.nix +++ b/pkgs/development/python-modules/youseedee/default.nix @@ -2,7 +2,7 @@ lib, buildPythonPackage, fetchPypi, - substituteAll, + replaceVars, setuptools, setuptools-scm, filelock, @@ -23,8 +23,7 @@ buildPythonPackage rec { patches = [ # Load data files from the unicode-character-database package instead of # downloading them from the internet. (nixpkgs-specific, not upstreamable) - (substituteAll { - src = ./0001-use-packaged-unicode-data.patch; + (replaceVars ./0001-use-packaged-unicode-data.patch { ucd_dir = "${unicode-character-database}/share/unicode"; }) ]; diff --git a/pkgs/development/python-modules/yq/default.nix b/pkgs/development/python-modules/yq/default.nix index dfc1ae08903e..a0e3a27ac169 100644 --- a/pkgs/development/python-modules/yq/default.nix +++ b/pkgs/development/python-modules/yq/default.nix @@ -7,7 +7,7 @@ pytestCheckHook, pyyaml, setuptools-scm, - substituteAll, + replaceVars, tomlkit, xmltodict, }: @@ -23,8 +23,7 @@ buildPythonPackage rec { }; patches = [ - (substituteAll { - src = ./jq-path.patch; + (replaceVars ./jq-path.patch { jq = "${lib.getBin jq}/bin/jq"; }) ]; diff --git a/pkgs/development/python-modules/zlib-ng/default.nix b/pkgs/development/python-modules/zlib-ng/default.nix index 77b3743c0137..15380edc65fa 100644 --- a/pkgs/development/python-modules/zlib-ng/default.nix +++ b/pkgs/development/python-modules/zlib-ng/default.nix @@ -2,7 +2,7 @@ lib, buildPythonPackage, fetchFromGitHub, - substituteAll, + replaceVars, # build-system cmake, @@ -29,8 +29,7 @@ buildPythonPackage rec { }; patches = [ - (substituteAll { - src = ./version.patch; + (replaceVars ./version.patch { inherit version; }) ]; diff --git a/pkgs/development/rocm-modules/5/rocprofiler/default.nix b/pkgs/development/rocm-modules/5/rocprofiler/default.nix index 10397e8b9e7a..2948a7c03686 100644 --- a/pkgs/development/rocm-modules/5/rocprofiler/default.nix +++ b/pkgs/development/rocm-modules/5/rocprofiler/default.nix @@ -4,7 +4,7 @@ fetchFromGitHub, rocmUpdateScript, symlinkJoin, - substituteAll, + replaceVars, cmake, clang, clr, @@ -62,8 +62,7 @@ stdenv.mkDerivation (finalAttrs: { ./0000-dont-install-tests-hsaco.patch # Fix bad paths - (substituteAll { - src = ./0001-fix-shell-scripts.patch; + (replaceVars ./0001-fix-shell-scripts.patch { rocmtoolkit_merged = rocmtoolkit-merged; }) ]; diff --git a/pkgs/development/rocm-modules/6/rocprofiler/default.nix b/pkgs/development/rocm-modules/6/rocprofiler/default.nix index c3a0bf7112a6..a80c6e90f132 100644 --- a/pkgs/development/rocm-modules/6/rocprofiler/default.nix +++ b/pkgs/development/rocm-modules/6/rocprofiler/default.nix @@ -4,7 +4,7 @@ fetchFromGitHub, rocmUpdateScript, symlinkJoin, - substituteAll, + replaceVars, cmake, clang, clr, @@ -62,8 +62,7 @@ stdenv.mkDerivation (finalAttrs: { ./0000-dont-install-tests-hsaco.patch # Fix bad paths - (substituteAll { - src = ./0001-fix-shell-scripts.patch; + (replaceVars ./0001-fix-shell-scripts.patch { rocmtoolkit_merged = rocmtoolkit-merged; }) diff --git a/pkgs/development/tcl-modules/by-name/ex/expect/package.nix b/pkgs/development/tcl-modules/by-name/ex/expect/package.nix index ae1c8ae21cc1..f2d0c6d4bf63 100644 --- a/pkgs/development/tcl-modules/by-name/ex/expect/package.nix +++ b/pkgs/development/tcl-modules/by-name/ex/expect/package.nix @@ -7,7 +7,7 @@ makeWrapper, autoreconfHook, fetchpatch, - substituteAll, + replaceVars, }: tcl.mkTclDerivation rec { @@ -20,8 +20,7 @@ tcl.mkTclDerivation rec { }; patches = [ - (substituteAll { - src = ./fix-build-time-run-tcl.patch; + (replaceVars ./fix-build-time-run-tcl.patch { tcl = "${buildPackages.tcl}/bin/tclsh"; }) # The following patches fix compilation with clang 15+ diff --git a/pkgs/development/tools/build-managers/bazel/bazel_5/default.nix b/pkgs/development/tools/build-managers/bazel/bazel_5/default.nix index 5fd35f3cb914..79c6726806ea 100644 --- a/pkgs/development/tools/build-managers/bazel/bazel_5/default.nix +++ b/pkgs/development/tools/build-managers/bazel/bazel_5/default.nix @@ -38,7 +38,7 @@ # Also, don't clean up environment variables (so that NIX_ environment variables are passed to compilers). enableNixHacks ? false, file, - substituteAll, + replaceVars, writeTextFile, }: @@ -203,8 +203,7 @@ stdenv.mkDerivation rec { # This patch removes using the -fobjc-arc compiler option and makes the code # compile without automatic reference counting. Caveat: this leaks memory, but # we accept this fact because xcode_locator is only a short-lived process used during the build. - (substituteAll { - src = ./no-arc.patch; + (replaceVars ./no-arc.patch { multiBinPatch = if stdenv.hostPlatform.system == "aarch64-darwin" then "arm64" else "x86_64"; }) @@ -214,20 +213,17 @@ stdenv.mkDerivation rec { # This is non hermetic on non-nixos systems. On NixOS, bazel cannot find the required binaries. # So we are replacing this bazel paths by defaultShellPath, # improving hermeticity and making it work in nixos. - (substituteAll { - src = ../strict_action_env.patch; + (replaceVars ../strict_action_env.patch { strictActionEnvPatch = defaultShellPath; }) - (substituteAll { - src = ./actions_path.patch; + (replaceVars ./actions_path.patch { actionsPathPatch = defaultShellPath; }) # bazel reads its system bazelrc in /etc # override this path to a builtin one - (substituteAll { - src = ../bazel_rc.patch; + (replaceVars ../bazel_rc.patch { bazelSystemBazelRCPath = bazelRC; }) diff --git a/pkgs/development/tools/build-managers/bazel/bazel_6/default.nix b/pkgs/development/tools/build-managers/bazel/bazel_6/default.nix index 7d339dec2c96..e941d53395c0 100644 --- a/pkgs/development/tools/build-managers/bazel/bazel_6/default.nix +++ b/pkgs/development/tools/build-managers/bazel/bazel_6/default.nix @@ -16,7 +16,7 @@ # Also, don't clean up environment variables (so that NIX_ environment variables are passed to compilers). , enableNixHacks ? false , file -, substituteAll +, replaceVars , writeTextFile , writeShellApplication , makeBinaryWrapper @@ -239,8 +239,7 @@ stdenv.mkDerivation rec { # This patch removes using the -fobjc-arc compiler option and makes the code # compile without automatic reference counting. Caveat: this leaks memory, but # we accept this fact because xcode_locator is only a short-lived process used during the build. - (substituteAll { - src = ./no-arc.patch; + (replaceVars ./no-arc.patch { multiBinPatch = if stdenv.hostPlatform.system == "aarch64-darwin" then "arm64" else "x86_64"; }) @@ -250,20 +249,17 @@ stdenv.mkDerivation rec { # This is non hermetic on non-nixos systems. On NixOS, bazel cannot find the required binaries. # So we are replacing this bazel paths by defaultShellPath, # improving hermeticity and making it work in nixos. - (substituteAll { - src = ../strict_action_env.patch; + (replaceVars ../strict_action_env.patch { strictActionEnvPatch = defaultShellPath; }) - (substituteAll { - src = ./actions_path.patch; + (replaceVars ./actions_path.patch { actionsPathPatch = defaultShellPath; }) # bazel reads its system bazelrc in /etc # override this path to a builtin one - (substituteAll { - src = ../bazel_rc.patch; + (replaceVars ../bazel_rc.patch { bazelSystemBazelRCPath = bazelRC; }) ] ++ lib.optional enableNixHacks ./nix-hacks.patch; diff --git a/pkgs/development/tools/build-managers/bazel/bazel_7/default.nix b/pkgs/development/tools/build-managers/bazel/bazel_7/default.nix index cd9acfcfc723..11da64513cbf 100644 --- a/pkgs/development/tools/build-managers/bazel/bazel_7/default.nix +++ b/pkgs/development/tools/build-managers/bazel/bazel_7/default.nix @@ -5,7 +5,7 @@ fetchurl, makeWrapper, writeTextFile, - substituteAll, + replaceVars, writeShellApplication, makeBinaryWrapper, autoPatchelfHook, @@ -377,15 +377,13 @@ stdenv.mkDerivation rec { # This is non hermetic on non-nixos systems. On NixOS, bazel cannot find the required binaries. # So we are replacing this bazel paths by defaultShellPath, # improving hermeticity and making it work in nixos. - (substituteAll { - src = ../strict_action_env.patch; + (replaceVars ../strict_action_env.patch { strictActionEnvPatch = defaultShellPath; }) # bazel reads its system bazelrc in /etc # override this path to a builtin one - (substituteAll { - src = ../bazel_rc.patch; + (replaceVars ../bazel_rc.patch { bazelSystemBazelRCPath = bazelRC; }) ] diff --git a/pkgs/development/tools/ocaml/merlin/4.x.nix b/pkgs/development/tools/ocaml/merlin/4.x.nix index 2a230cd8039e..660fe6671625 100644 --- a/pkgs/development/tools/ocaml/merlin/4.x.nix +++ b/pkgs/development/tools/ocaml/merlin/4.x.nix @@ -64,7 +64,6 @@ buildDunePackage { in [ (replaceVars (if old-patch then ./fix-paths.patch else ./fix-paths2.patch) { - dot-merlin-reader = "${dot-merlin-reader}/bin/dot-merlin-reader"; dune = "${dune_3}/bin/dune"; }) diff --git a/pkgs/development/tools/ocaml/merlin/default.nix b/pkgs/development/tools/ocaml/merlin/default.nix index 12aaeac1fddd..858520d5b891 100644 --- a/pkgs/development/tools/ocaml/merlin/default.nix +++ b/pkgs/development/tools/ocaml/merlin/default.nix @@ -3,7 +3,7 @@ fetchurl, fetchpatch, buildDunePackage, - substituteAll, + replaceVars, dot-merlin-reader, dune_2, yojson, @@ -24,9 +24,8 @@ buildDunePackage rec { minimalOCamlVersion = "4.02.3"; patches = [ - (substituteAll { - src = ./fix-paths.patch; - dot_merlin_reader = "${dot-merlin-reader}/bin/dot-merlin-reader"; + (replaceVars ./fix-paths.patch { + dot-merlin-reader = "${dot-merlin-reader}/bin/dot-merlin-reader"; dune = "${dune_2}/bin/dune"; }) # https://github.com/ocaml/merlin/pull/1798 diff --git a/pkgs/games/dwarf-fortress/dwarf-therapist/wrapper.nix b/pkgs/games/dwarf-fortress/dwarf-therapist/wrapper.nix index 503dff90cd45..d7c966ef5630 100644 --- a/pkgs/games/dwarf-fortress/dwarf-therapist/wrapper.nix +++ b/pkgs/games/dwarf-fortress/dwarf-therapist/wrapper.nix @@ -1,4 +1,4 @@ -{ stdenv, dwarf-therapist, dwarf-fortress, substituteAll, coreutils, wrapQtAppsHook +{ stdenv, dwarf-therapist, dwarf-fortress, replaceVars, coreutils, wrapQtAppsHook }: let @@ -14,8 +14,7 @@ stdenv.mkDerivation { pname = "dwarf-therapist"; inherit (dwarf-therapist) version meta; - wrapper = substituteAll { - src = ./dwarf-therapist.in; + wrapper = replaceVars ./dwarf-therapist.in { stdenv_shell = "${stdenv.shell}"; rm = "${coreutils}/bin/rm"; ln = "${coreutils}/bin/ln"; @@ -23,6 +22,8 @@ stdenv.mkDerivation { mkdir = "${coreutils}/bin/mkdir"; dirname = "${coreutils}/bin/dirname"; therapist = "${dwarf-therapist}"; + # replaced in buildCommand + install = null; }; paths = [ dwarf-therapist ]; diff --git a/pkgs/games/dwarf-fortress/wrapper/default.nix b/pkgs/games/dwarf-fortress/wrapper/default.nix index b1a6555f6cb4..55f08c328558 100644 --- a/pkgs/games/dwarf-fortress/wrapper/default.nix +++ b/pkgs/games/dwarf-fortress/wrapper/default.nix @@ -2,7 +2,7 @@ stdenv, lib, buildEnv, - substituteAll, + replaceVars, makeWrapper, runCommand, coreutils, @@ -185,11 +185,8 @@ lib.throwIf (enableTWBT' && !enableDFHack) "dwarf-fortress: TWBT requires DFHack pname = "dwarf-fortress"; version = dwarf-fortress.dfVersion; - dfInit = substituteAll { - name = "dwarf-fortress-init"; - src = ./dwarf-fortress-init.in; + dfInit = replaceVars ./dwarf-fortress-init.in { inherit env; - inherit (dwarf-fortress) exe; stdenv_shell = "${stdenv.shell}"; cp = "${coreutils}/bin/cp"; rm = "${coreutils}/bin/rm"; diff --git a/pkgs/kde/plasma/kinfocenter/default.nix b/pkgs/kde/plasma/kinfocenter/default.nix index 8911e77cf452..ce85b92bfc12 100644 --- a/pkgs/kde/plasma/kinfocenter/default.nix +++ b/pkgs/kde/plasma/kinfocenter/default.nix @@ -10,7 +10,7 @@ pciutils, pulseaudio, qttools, - substituteAll, + replaceVars, systemsettings, util-linux, vulkan-tools, @@ -40,9 +40,10 @@ mkKdeDerivation { patches = [ # fwupdmgr is provided through NixOS' module - (substituteAll ( + (replaceVars ./0001-tool-paths.patch ( { - src = ./0001-tool-paths.patch; + # @QtBinariesDir@ only appears in the *removed* lines of the diff + QtBinariesDir = null; } // tools )) diff --git a/pkgs/kde/plasma/plasma-workspace/default.nix b/pkgs/kde/plasma/plasma-workspace/default.nix index 6225f7c3b77c..6aa092b2a757 100644 --- a/pkgs/kde/plasma/plasma-workspace/default.nix +++ b/pkgs/kde/plasma/plasma-workspace/default.nix @@ -1,7 +1,7 @@ { lib, mkKdeDerivation, - substituteAll, + replaceVars, dbus, fontconfig, xorg, @@ -22,8 +22,7 @@ mkKdeDerivation { pname = "plasma-workspace"; patches = [ - (substituteAll { - src = ./dependency-paths.patch; + (replaceVars ./dependency-paths.patch { dbusSend = lib.getExe' dbus "dbus-send"; fcMatch = lib.getExe' fontconfig "fc-match"; lsof = lib.getExe lsof; @@ -31,6 +30,8 @@ mkKdeDerivation { xmessage = lib.getExe xorg.xmessage; xrdb = lib.getExe xorg.xrdb; xsetroot = lib.getExe xorg.xsetroot; + # @QtBinariesDir@ only appears in the *removed* lines of the diff + QtBinariesDir = null; }) ]; diff --git a/pkgs/os-specific/linux/udisks/2-default.nix b/pkgs/os-specific/linux/udisks/2-default.nix index 9672e7761542..c3eac48f118f 100644 --- a/pkgs/os-specific/linux/udisks/2-default.nix +++ b/pkgs/os-specific/linux/udisks/2-default.nix @@ -2,7 +2,7 @@ lib, stdenv, fetchFromGitHub, - substituteAll, + replaceVars, pkg-config, gnused, autoreconfHook, @@ -55,20 +55,15 @@ stdenv.mkDerivation rec { ] ++ lib.optional (stdenv.hostPlatform == stdenv.buildPlatform) "devdoc"; patches = [ - (substituteAll { - src = ./fix-paths.patch; - bash = "${bash}/bin/bash"; + (replaceVars ./fix-paths.patch { false = "${coreutils}/bin/false"; mdadm = "${mdadm}/bin/mdadm"; - mkswap = "${util-linux}/bin/mkswap"; sed = "${gnused}/bin/sed"; sh = "${bash}/bin/sh"; sleep = "${coreutils}/bin/sleep"; - swapon = "${util-linux}/bin/swapon"; true = "${coreutils}/bin/true"; }) - (substituteAll { - src = ./force-path.patch; + (replaceVars ./force-path.patch { path = lib.makeBinPath [ btrfs-progs coreutils diff --git a/pkgs/servers/home-assistant/default.nix b/pkgs/servers/home-assistant/default.nix index 23f28b18597d..05c8a4f89acb 100644 --- a/pkgs/servers/home-assistant/default.nix +++ b/pkgs/servers/home-assistant/default.nix @@ -5,7 +5,7 @@ fetchFromGitHub, fetchPypi, python313, - substituteAll, + replaceVars, ffmpeg-headless, inetutils, nixosTests, @@ -440,8 +440,7 @@ python.pkgs.buildPythonApplication rec { ./patches/static-follow-symlinks.patch # Patch path to ffmpeg binary - (substituteAll { - src = ./patches/ffmpeg-path.patch; + (replaceVars ./patches/ffmpeg-path.patch { ffmpeg = "${lib.getExe ffmpeg-headless}"; }) ]; diff --git a/pkgs/tools/inputmethods/ibus/default.nix b/pkgs/tools/inputmethods/ibus/default.nix index d3161f748743..8e2f0bfbbc80 100644 --- a/pkgs/tools/inputmethods/ibus/default.nix +++ b/pkgs/tools/inputmethods/ibus/default.nix @@ -1,7 +1,7 @@ { lib, stdenv, - substituteAll, + replaceVars, fetchFromGitHub, autoreconfHook, gettext, @@ -71,10 +71,15 @@ stdenv.mkDerivation rec { }; patches = [ - (substituteAll { - src = ./fix-paths.patch; + (replaceVars ./fix-paths.patch { pythonInterpreter = python3Runtime.interpreter; pythonSitePackages = python3.sitePackages; + # patch context + prefix = null; + datarootdir = null; + localedir = null; + # removed line only + PYTHON = null; }) ./build-without-dbus-launch.patch ]; diff --git a/pkgs/tools/misc/ckb-next/default.nix b/pkgs/tools/misc/ckb-next/default.nix index f33ada649a34..9f3daa919e0f 100644 --- a/pkgs/tools/misc/ckb-next/default.nix +++ b/pkgs/tools/misc/ckb-next/default.nix @@ -2,7 +2,7 @@ lib, wrapQtAppsHook, fetchFromGitHub, - substituteAll, + replaceVars, udev, stdenv, pkg-config, @@ -57,9 +57,7 @@ stdenv.mkDerivation rec { patches = [ ./install-dirs.patch - (substituteAll { - name = "ckb-next-modprobe.patch"; - src = ./modprobe.patch; + (replaceVars ./modprobe.patch { inherit kmod; }) ]; diff --git a/pkgs/tools/networking/networkmanager/default.nix b/pkgs/tools/networking/networkmanager/default.nix index fa91b2c64dca..bdb0cf2a7659 100644 --- a/pkgs/tools/networking/networkmanager/default.nix +++ b/pkgs/tools/networking/networkmanager/default.nix @@ -1,7 +1,7 @@ { lib , stdenv , fetchurl -, substituteAll +, replaceVars , gettext , pkg-config , dbus @@ -122,10 +122,11 @@ stdenv.mkDerivation rec { ]; patches = [ - (substituteAll { - src = ./fix-paths.patch; - inherit iputils openconnect ethtool gnused systemd; + (replaceVars ./fix-paths.patch { + inherit iputils openconnect ethtool gnused; inherit runtimeShell; + # patch context + OUTPUT = null; }) # Meson does not support using different directories during build and