diff --git a/pkgs/applications/editors/emacs/make-emacs.nix b/pkgs/applications/editors/emacs/make-emacs.nix index 0eb43d47dc0e..e87330ab1136 100644 --- a/pkgs/applications/editors/emacs/make-emacs.nix +++ b/pkgs/applications/editors/emacs/make-emacs.nix @@ -51,7 +51,7 @@ , recurseIntoAttrs , sigtool , sqlite -, substituteAll +, replaceVars , systemd , tree-sitter , texinfo @@ -148,12 +148,12 @@ mkDerivation (finalAttrs: { inherit src; patches = patches fetchpatch ++ lib.optionals withNativeCompilation [ - (substituteAll { - src = if lib.versionOlder finalAttrs.version "29" + (replaceVars (if lib.versionOlder finalAttrs.version "29" then ./native-comp-driver-options-28.patch else if lib.versionOlder finalAttrs.version "30" then ./native-comp-driver-options.patch - else ./native-comp-driver-options-30.patch; + else ./native-comp-driver-options-30.patch) { + backendPath = (lib.concatStringsSep " " (builtins.map (x: ''"-B${x}"'') ([ # Paths necessary so the JIT compiler finds its libraries: diff --git a/pkgs/applications/kde/kdegraphics-thumbnailers/default.nix b/pkgs/applications/kde/kdegraphics-thumbnailers/default.nix index 6686f582d6d2..a8711164926c 100644 --- a/pkgs/applications/kde/kdegraphics-thumbnailers/default.nix +++ b/pkgs/applications/kde/kdegraphics-thumbnailers/default.nix @@ -1,5 +1,5 @@ { - mkDerivation, lib, ghostscript, substituteAll, + mkDerivation, lib, ghostscript, replaceVars, extra-cmake-modules, karchive, kio, libkexiv2, libkdcraw, kdegraphics-mobipocket }: @@ -15,9 +15,8 @@ mkDerivation { patches = [ # Hardcode patches to Ghostscript so PDF thumbnails work OOTB. # Intentionally not doing the same for dvips because TeX is big. - (substituteAll { + (replaceVars ./gs-paths.patch { gs = "${ghostscript}/bin/gs"; - src = ./gs-paths.patch; }) ]; } diff --git a/pkgs/build-support/docker/default.nix b/pkgs/build-support/docker/default.nix index 80c5c79dea91..c948d802a953 100644 --- a/pkgs/build-support/docker/default.nix +++ b/pkgs/build-support/docker/default.nix @@ -26,7 +26,6 @@ , skopeo , stdenv , storeDir ? builtins.storeDir -, substituteAll , symlinkJoin , tarsum , util-linux diff --git a/pkgs/build-support/dotnet/build-dotnet-module/default.nix b/pkgs/build-support/dotnet/build-dotnet-module/default.nix index 7b02b92b3c65..418e21b36c70 100644 --- a/pkgs/build-support/dotnet/build-dotnet-module/default.nix +++ b/pkgs/build-support/dotnet/build-dotnet-module/default.nix @@ -3,7 +3,6 @@ runtimeShell, stdenvNoCC, callPackage, - substituteAll, writeShellScript, makeWrapper, dotnetCorePackages, diff --git a/pkgs/build-support/testers/default.nix b/pkgs/build-support/testers/default.nix index ba605adeb9a0..92b248882e6f 100644 --- a/pkgs/build-support/testers/default.nix +++ b/pkgs/build-support/testers/default.nix @@ -10,7 +10,7 @@ runCommandWith, stdenv, stdenvNoCC, - substituteAll, + replaceVars, testers, }: # Documentation is in doc/build-helpers/testers.chapter.md @@ -24,7 +24,7 @@ testBuildFailure = drv: drv.overrideAttrs (orig: { builder = buildPackages.bash; args = [ - (substituteAll { coreutils = buildPackages.coreutils; src = ./expect-failure.sh; }) + (replaceVars ./expect-failure.sh { coreutils = buildPackages.coreutils; }) orig.realBuilder or stdenv.shell ] ++ orig.args or ["-e" (orig.builder or ../../stdenv/generic/default-builder.sh)]; }); diff --git a/pkgs/by-name/cb/cbmc/package.nix b/pkgs/by-name/cb/cbmc/package.nix index 7a5ddce33511..0b7200647536 100644 --- a/pkgs/by-name/cb/cbmc/package.nix +++ b/pkgs/by-name/cb/cbmc/package.nix @@ -11,7 +11,6 @@ makeWrapper, perl, substituteAll, - substitute, cudd, fetchurl, nix-update-script, diff --git a/pkgs/by-name/hy/hylafaxplus/config.site b/pkgs/by-name/hy/hylafaxplus/config.site index 7c8014449216..aa66fad916b7 100644 --- a/pkgs/by-name/hy/hylafaxplus/config.site +++ b/pkgs/by-name/hy/hylafaxplus/config.site @@ -1,16 +1,16 @@ @config_maxgid@ -DIR_BIN="@out_@/bin" -DIR_FONTMAP="@out_@/share/ghostscript/@ghostscript_version@" -DIR_LIB="@out_@/lib" -DIR_LIBDATA="@out_@/spool/etc" -DIR_LIBEXEC="@out_@/spool/bin" +DIR_BIN="@out@/bin" +DIR_FONTMAP="@out@/share/ghostscript/@ghostscript_version@" +DIR_LIB="@out@/lib" +DIR_LIBDATA="@out@/spool/etc" +DIR_LIBEXEC="@out@/spool/bin" DIR_LOCKS=/var/lock -DIR_MAN="@out_@/share/man" -DIR_SBIN="@out_@/spool/bin" -DIR_SPOOL="@out_@/spool" +DIR_MAN="@out@/share/man" +DIR_SBIN="@out@/spool/bin" +DIR_SPOOL="@out@/spool" FONTMAP="@ghostscript@/share/ghostscript/@ghostscript_version@" PATH_AFM="@ghostscript@/share/ghostscript/fonts" -PATH_DPSRIP="@out_@/spool/bin/ps2fax" +PATH_DPSRIP="@out@/spool/bin/ps2fax" PATH_EGETTY="@coreutils@/bin/false" PATH_GSRIP="@ghostscript@/bin/gs" PATH_IMPRIP="@coreutils@/bin/false" diff --git a/pkgs/by-name/hy/hylafaxplus/package.nix b/pkgs/by-name/hy/hylafaxplus/package.nix index 3c66ce8129f3..c2c6045ecc4b 100644 --- a/pkgs/by-name/hy/hylafaxplus/package.nix +++ b/pkgs/by-name/hy/hylafaxplus/package.nix @@ -3,7 +3,7 @@ , fakeroot , fetchurl , libfaketime -, substituteAll +, replaceVars ## runtime dependencies , coreutils , file @@ -35,18 +35,14 @@ let version = "7.0.9"; hash = "sha512-3OJwM4vFC9pzPozPobFLiNNx/Qnkl8BpNNziRUpJNBDLBxjtg/eDm3GnprS2hpt7VUoV4PCsFvp1hxhNnhlUwQ=="; - configSite = substituteAll { - name = "${pname}-config.site"; - src = ./config.site; + configSite = replaceVars ./config.site { config_maxgid = lib.optionalString (maxgid!=null) ''CONFIG_MAXGID=${builtins.toString maxgid}''; ghostscript_version = ghostscript.version; - out_ = "@out@"; # "out" will be resolved in post-install.sh + out = null; # "out" will be resolved in post-install.sh inherit coreutils ghostscript libtiff; }; - postPatch = substituteAll { - name = "${pname}-post-patch.sh"; - src = ./post-patch.sh; + postPatch = replaceVars ./post-patch.sh { inherit configSite; maxuid = lib.optionalString (maxuid!=null) (builtins.toString maxuid); faxcover_binpath = lib.makeBinPath @@ -55,9 +51,7 @@ let [stdenv.shellPackage coreutils findutils gnused gnugrep gawk]; }; - postInstall = substituteAll { - name = "${pname}-post-install.sh"; - src = ./post-install.sh; + postInstall = replaceVars ./post-install.sh { inherit fakeroot libfaketime; }; diff --git a/pkgs/by-name/li/libnvidia-container/package.nix b/pkgs/by-name/li/libnvidia-container/package.nix index 9b3023813c3f..703943bc2d20 100644 --- a/pkgs/by-name/li/libnvidia-container/package.nix +++ b/pkgs/by-name/li/libnvidia-container/package.nix @@ -10,7 +10,6 @@ rpcsvc-proto, libtirpc, makeWrapper, - substituteAll, removeReferencesTo, replaceVars, go, @@ -23,8 +22,8 @@ let rev = modprobeVersion; sha256 = "sha256-iBRMkvOXacs/llTtvc/ZC5i/q9gc8lMuUHxMbu8A+Kg="; }; - modprobePatch = substituteAll { - src = ./modprobe.patch; + modprobePatch = replaceVars ./modprobe.patch { + inherit modprobeVersion; }; in diff --git a/pkgs/by-name/ps/ps2eps/package.nix b/pkgs/by-name/ps/ps2eps/package.nix index c8f558889c60..88d295b03c66 100644 --- a/pkgs/by-name/ps/ps2eps/package.nix +++ b/pkgs/by-name/ps/ps2eps/package.nix @@ -1,7 +1,7 @@ { lib , fetchFromGitHub , perlPackages -, substituteAll +, replaceVars , ghostscript , installShellFiles }: @@ -18,11 +18,11 @@ perlPackages.buildPerlPackage rec { hash = "sha256-SPLwsGKLVhANoqSQ/GJ938cYjbjMbUOXkNn9so3aJTA="; }; patches = [ - (substituteAll { - src = ./hardcode-deps.patch; + (replaceVars ./hardcode-deps.patch { gs = "${ghostscript}/bin/gs"; - # bbox cannot be substituted here because substituteAll doesn't know what + # bbox cannot be substituted here because replaceVars doesn't know what # will be the $out path of the main derivation + bbox = null; }) ]; diff --git a/pkgs/by-name/tp/tpm2-pkcs11/package.nix b/pkgs/by-name/tp/tpm2-pkcs11/package.nix index 80d9a1c45200..06ae9c5f849c 100644 --- a/pkgs/by-name/tp/tpm2-pkcs11/package.nix +++ b/pkgs/by-name/tp/tpm2-pkcs11/package.nix @@ -1,4 +1,4 @@ -{ stdenv, lib, fetchFromGitHub, substituteAll +{ stdenv, lib, fetchFromGitHub , pkg-config, autoreconfHook, autoconf-archive, makeWrapper, patchelf , tpm2-tss, tpm2-tools, opensc, openssl, sqlite, python3, glibc, libyaml , abrmdSupport ? true, tpm2-abrmd ? null diff --git a/pkgs/by-name/zo/zod/package.nix b/pkgs/by-name/zo/zod/package.nix index e0c2031dde25..7a992251c9a5 100644 --- a/pkgs/by-name/zo/zod/package.nix +++ b/pkgs/by-name/zo/zod/package.nix @@ -13,7 +13,7 @@ , makeWrapper , coreutils , scalingFactor ? 2 # this is to resize the fixed-size zod_launcher window -, substituteAll +, replaceVars }: let name = "zod-engine"; @@ -70,9 +70,8 @@ let # 2,3,4 look acceptable on my 4k monitor and 1 is unreadable. # also the ./ in the run command is removed to have easier time starting the game patches = [ - (substituteAll { + (replaceVars ./0002-add-scaling-factor-to-source.patch { inherit scalingFactor; - src=./0002-add-scaling-factor-to-source.patch; }) ]; postPatch = '' diff --git a/pkgs/development/compilers/llvm/common/clang/default.nix b/pkgs/development/compilers/llvm/common/clang/default.nix index 44e13c48fd4b..db19f8b59ea2 100644 --- a/pkgs/development/compilers/llvm/common/clang/default.nix +++ b/pkgs/development/compilers/llvm/common/clang/default.nix @@ -5,7 +5,6 @@ , src ? null , monorepoSrc ? null , runCommand -, substituteAll , cmake , ninja , libxml2 diff --git a/pkgs/development/compilers/llvm/common/default.nix b/pkgs/development/compilers/llvm/common/default.nix index d8d1ffddc80e..102a43161e3d 100644 --- a/pkgs/development/compilers/llvm/common/default.nix +++ b/pkgs/development/compilers/llvm/common/default.nix @@ -7,7 +7,7 @@ preLibcCrossHeaders, libxcrypt, substitute, - substituteAll, + replaceVars, fetchFromGitHub, fetchpatch, fetchpatch2, @@ -546,14 +546,17 @@ let ./clang/ignore-nostd-link-13.diff ) ++ [ - (substituteAll { - src = + (replaceVars + ( if (lib.versionOlder metadata.release_version "16") then ./clang/clang-11-15-LLVMgold-path.patch else - ./clang/clang-at-least-16-LLVMgold-path.patch; - libllvmLibdir = "${tools.libllvm.lib}/lib"; - }) + ./clang/clang-at-least-16-LLVMgold-path.patch + ) + { + libllvmLibdir = "${tools.libllvm.lib}/lib"; + } + ) ] # Backport version logic from Clang 16. This is needed by the following patch. ++ lib.optional (lib.versions.major metadata.release_version == "15") (fetchpatch { @@ -661,9 +664,9 @@ let patches = let resourceDirPatch = callPackage ( - { substituteAll, libclang }: - (substituteAll { - src = metadata.getVersionFile "lldb/resource-dir.patch"; + { replaceVars, libclang }: + (replaceVars (metadata.getVersionFile "lldb/resource-dir.patch") { + clangLibDir = "${lib.getLib libclang}/lib"; }).overrideAttrs (_: _: { name = "resource-dir.patch"; }) diff --git a/pkgs/development/python-modules/pysdl2/PySDL2-dll.patch b/pkgs/development/python-modules/pysdl2/PySDL2-dll.patch index 9b8374a0f051..792c8bcd28e2 100644 --- a/pkgs/development/python-modules/pysdl2/PySDL2-dll.patch +++ b/pkgs/development/python-modules/pysdl2/PySDL2-dll.patch @@ -39,7 +39,7 @@ index 2413329..f460bf6 100644 try: - dll = DLL("SDL2", ["SDL2", "SDL2-2.0", "SDL2-2.0.0"], os.getenv("PYSDL2_DLL_PATH")) -+ dll = DLL("SDL2", "@sdl2@") ++ dll = DLL("SDL2", "@SDL2@") except RuntimeError as exc: raise ImportError(exc) @@ -53,7 +53,7 @@ index 015eeaf..d6ce52f 100644 try: - dll = DLL("SDL2_gfx", ["SDL2_gfx", "SDL2_gfx-1.0"], - os.getenv("PYSDL2_DLL_PATH")) -+ dll = DLL("SDL2_gfx", "@sdl2_gfx@") ++ dll = DLL("SDL2_gfx", "@SDL2_gfx@") except RuntimeError as exc: raise ImportError(exc) @@ -68,7 +68,7 @@ index a702136..dcdea51 100644 - dll = DLL( - "SDL2_image", ["SDL2_image", "SDL2_image-2.0"], os.getenv("PYSDL2_DLL_PATH") - ) -+ dll = DLL("SDL2_image", "@sdl2_image@") ++ dll = DLL("SDL2_image", "@SDL2_image@") except RuntimeError as exc: raise ImportError(exc) @@ -82,7 +82,7 @@ index 5f2163c..23d95b0 100644 try: - dll = DLL("SDL2_mixer", ["SDL2_mixer", "SDL2_mixer-2.0"], - os.getenv("PYSDL2_DLL_PATH")) -+ dll = DLL("SDL2_mixer", "@sdl2_mixer@") ++ dll = DLL("SDL2_mixer", "@SDL2_mixer@") except RuntimeError as exc: raise ImportError(exc) @@ -96,7 +96,7 @@ index 7c5f7db..61814cd 100644 try: - dll = DLL("SDL2_ttf", ["SDL2_ttf", "SDL2_ttf-2.0"], - os.getenv("PYSDL2_DLL_PATH")) -+ dll = DLL("SDL2_ttf", "@sdl2_ttf@") ++ dll = DLL("SDL2_ttf", "@SDL2_ttf@") except RuntimeError as exc: raise ImportError(exc) diff --git a/pkgs/development/python-modules/pysdl2/default.nix b/pkgs/development/python-modules/pysdl2/default.nix index 7854f2465432..2bc97d102b7f 100644 --- a/pkgs/development/python-modules/pysdl2/default.nix +++ b/pkgs/development/python-modules/pysdl2/default.nix @@ -1,7 +1,7 @@ { stdenv, lib, - substituteAll, + replaceVars, fetchPypi, buildPythonPackage, SDL2, @@ -38,21 +38,18 @@ buildPythonPackage rec { ]; propagatedBuildInputs = [ SDL2 ]; patches = [ - (substituteAll ( - { - src = ./PySDL2-dll.patch; - } - // - builtins.mapAttrs - (_: pkg: "${pkg}/lib/lib${pkg.pname}${stdenv.hostPlatform.extensions.sharedLibrary}") - { - # substituteAll keys must start lowercase - sdl2 = SDL2; - sdl2_ttf = SDL2_ttf; - sdl2_image = SDL2_image; - sdl2_gfx = SDL2_gfx; - sdl2_mixer = SDL2_mixer; - } + (replaceVars ./PySDL2-dll.patch ( + builtins.mapAttrs + (_: pkg: "${pkg}/lib/lib${pkg.pname}${stdenv.hostPlatform.extensions.sharedLibrary}") + { + inherit + SDL2 + SDL2_ttf + SDL2_image + SDL2_gfx + SDL2_mixer + ; + } )) ]; diff --git a/pkgs/development/tools/electron/common.nix b/pkgs/development/tools/electron/common.nix index bd4843edbcca..3be25cfbe9d0 100644 --- a/pkgs/development/tools/electron/common.nix +++ b/pkgs/development/tools/electron/common.nix @@ -8,7 +8,6 @@ , fixup-yarn-lock , npmHooks , yarn -, substituteAll , libnotify , unzip , pkgs diff --git a/pkgs/development/tools/ocaml/merlin/4.x.nix b/pkgs/development/tools/ocaml/merlin/4.x.nix index 4a5f571332d6..dbb7abf14f7d 100644 --- a/pkgs/development/tools/ocaml/merlin/4.x.nix +++ b/pkgs/development/tools/ocaml/merlin/4.x.nix @@ -1,5 +1,5 @@ { lib -, substituteAll +, replaceVars , fetchurl , ocaml , dune_3 @@ -57,9 +57,9 @@ buildDunePackage { old-patch = lib.versionOlder version "4.17"; in [ - (substituteAll { - src = if old-patch then ./fix-paths.patch else ./fix-paths2.patch; - dot_merlin_reader = "${dot-merlin-reader}/bin/dot-merlin-reader"; + (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/kde/gear/kdegraphics-thumbnailers/default.nix b/pkgs/kde/gear/kdegraphics-thumbnailers/default.nix index bfb3ba1fc850..79ae5c8b30a9 100644 --- a/pkgs/kde/gear/kdegraphics-thumbnailers/default.nix +++ b/pkgs/kde/gear/kdegraphics-thumbnailers/default.nix @@ -1,6 +1,6 @@ { mkKdeDerivation, - substituteAll, + replaceVars, ghostscript, }: mkKdeDerivation { @@ -9,9 +9,8 @@ mkKdeDerivation { patches = [ # Hardcode patches to Ghostscript so PDF thumbnails work OOTB. # Intentionally not doing the same for dvips because TeX is big. - (substituteAll { + (replaceVars ./gs-paths.patch { gs = "${ghostscript}/bin/gs"; - src = ./gs-paths.patch; }) ]; } diff --git a/pkgs/os-specific/linux/lvm2/common.nix b/pkgs/os-specific/linux/lvm2/common.nix index b690a19de29f..830464053a05 100644 --- a/pkgs/os-specific/linux/lvm2/common.nix +++ b/pkgs/os-specific/linux/lvm2/common.nix @@ -6,7 +6,7 @@ , coreutils , libuuid , libaio -, substituteAll +, replaceVars , enableCmdlib ? false , enableDmeventd ? false , udevSupport ? !stdenv.hostPlatform.isStatic, udev @@ -91,15 +91,15 @@ stdenv.mkDerivation rec { patches = [ # fixes paths to and checks for tools - (substituteAll (let + (replaceVars ./fix-blkdeactivate.patch (let optionalTool = cond: pkg: if cond then pkg else "/run/current-system/sw"; in { - src = ./fix-blkdeactivate.patch; inherit coreutils; util_linux = optionalTool enableUtilLinux util-linux; mdadm = optionalTool enableMdadm mdadm; multipath_tools = optionalTool enableMultipath multipath-tools; vdo = optionalTool enableVDO vdo; + SBINDIR = null; # part of original source code in the patch's context })) ./fix-stdio-usage.patch ];