various: replace substituteAll with replaceVars (#360770)

authored by philiptaron.tngl.sh and committed by GitHub 246e737c 3c241d34

+70 -85
+4 -4
pkgs/applications/editors/emacs/make-emacs.nix
··· 51 51 , recurseIntoAttrs 52 52 , sigtool 53 53 , sqlite 54 - , substituteAll 54 + , replaceVars 55 55 , systemd 56 56 , tree-sitter 57 57 , texinfo ··· 148 148 inherit src; 149 149 150 150 patches = patches fetchpatch ++ lib.optionals withNativeCompilation [ 151 - (substituteAll { 152 - src = if lib.versionOlder finalAttrs.version "29" 151 + (replaceVars (if lib.versionOlder finalAttrs.version "29" 153 152 then ./native-comp-driver-options-28.patch 154 153 else if lib.versionOlder finalAttrs.version "30" 155 154 then ./native-comp-driver-options.patch 156 - else ./native-comp-driver-options-30.patch; 155 + else ./native-comp-driver-options-30.patch) { 156 + 157 157 backendPath = (lib.concatStringsSep " " 158 158 (builtins.map (x: ''"-B${x}"'') ([ 159 159 # Paths necessary so the JIT compiler finds its libraries:
+2 -3
pkgs/applications/kde/kdegraphics-thumbnailers/default.nix
··· 1 1 { 2 - mkDerivation, lib, ghostscript, substituteAll, 2 + mkDerivation, lib, ghostscript, replaceVars, 3 3 extra-cmake-modules, karchive, kio, libkexiv2, libkdcraw, kdegraphics-mobipocket 4 4 }: 5 5 ··· 15 15 patches = [ 16 16 # Hardcode patches to Ghostscript so PDF thumbnails work OOTB. 17 17 # Intentionally not doing the same for dvips because TeX is big. 18 - (substituteAll { 18 + (replaceVars ./gs-paths.patch { 19 19 gs = "${ghostscript}/bin/gs"; 20 - src = ./gs-paths.patch; 21 20 }) 22 21 ]; 23 22 }
-1
pkgs/build-support/docker/default.nix
··· 26 26 , skopeo 27 27 , stdenv 28 28 , storeDir ? builtins.storeDir 29 - , substituteAll 30 29 , symlinkJoin 31 30 , tarsum 32 31 , util-linux
-1
pkgs/build-support/dotnet/build-dotnet-module/default.nix
··· 3 3 runtimeShell, 4 4 stdenvNoCC, 5 5 callPackage, 6 - substituteAll, 7 6 writeShellScript, 8 7 makeWrapper, 9 8 dotnetCorePackages,
+2 -2
pkgs/build-support/testers/default.nix
··· 10 10 runCommandWith, 11 11 stdenv, 12 12 stdenvNoCC, 13 - substituteAll, 13 + replaceVars, 14 14 testers, 15 15 }: 16 16 # Documentation is in doc/build-helpers/testers.chapter.md ··· 24 24 testBuildFailure = drv: drv.overrideAttrs (orig: { 25 25 builder = buildPackages.bash; 26 26 args = [ 27 - (substituteAll { coreutils = buildPackages.coreutils; src = ./expect-failure.sh; }) 27 + (replaceVars ./expect-failure.sh { coreutils = buildPackages.coreutils; }) 28 28 orig.realBuilder or stdenv.shell 29 29 ] ++ orig.args or ["-e" (orig.builder or ../../stdenv/generic/default-builder.sh)]; 30 30 });
-1
pkgs/by-name/cb/cbmc/package.nix
··· 11 11 makeWrapper, 12 12 perl, 13 13 substituteAll, 14 - substitute, 15 14 cudd, 16 15 fetchurl, 17 16 nix-update-script,
+9 -9
pkgs/by-name/hy/hylafaxplus/config.site
··· 1 1 @config_maxgid@ 2 - DIR_BIN="@out_@/bin" 3 - DIR_FONTMAP="@out_@/share/ghostscript/@ghostscript_version@" 4 - DIR_LIB="@out_@/lib" 5 - DIR_LIBDATA="@out_@/spool/etc" 6 - DIR_LIBEXEC="@out_@/spool/bin" 2 + DIR_BIN="@out@/bin" 3 + DIR_FONTMAP="@out@/share/ghostscript/@ghostscript_version@" 4 + DIR_LIB="@out@/lib" 5 + DIR_LIBDATA="@out@/spool/etc" 6 + DIR_LIBEXEC="@out@/spool/bin" 7 7 DIR_LOCKS=/var/lock 8 - DIR_MAN="@out_@/share/man" 9 - DIR_SBIN="@out_@/spool/bin" 10 - DIR_SPOOL="@out_@/spool" 8 + DIR_MAN="@out@/share/man" 9 + DIR_SBIN="@out@/spool/bin" 10 + DIR_SPOOL="@out@/spool" 11 11 FONTMAP="@ghostscript@/share/ghostscript/@ghostscript_version@" 12 12 PATH_AFM="@ghostscript@/share/ghostscript/fonts" 13 - PATH_DPSRIP="@out_@/spool/bin/ps2fax" 13 + PATH_DPSRIP="@out@/spool/bin/ps2fax" 14 14 PATH_EGETTY="@coreutils@/bin/false" 15 15 PATH_GSRIP="@ghostscript@/bin/gs" 16 16 PATH_IMPRIP="@coreutils@/bin/false"
+5 -11
pkgs/by-name/hy/hylafaxplus/package.nix
··· 3 3 , fakeroot 4 4 , fetchurl 5 5 , libfaketime 6 - , substituteAll 6 + , replaceVars 7 7 ## runtime dependencies 8 8 , coreutils 9 9 , file ··· 35 35 version = "7.0.9"; 36 36 hash = "sha512-3OJwM4vFC9pzPozPobFLiNNx/Qnkl8BpNNziRUpJNBDLBxjtg/eDm3GnprS2hpt7VUoV4PCsFvp1hxhNnhlUwQ=="; 37 37 38 - configSite = substituteAll { 39 - name = "${pname}-config.site"; 40 - src = ./config.site; 38 + configSite = replaceVars ./config.site { 41 39 config_maxgid = lib.optionalString (maxgid!=null) ''CONFIG_MAXGID=${builtins.toString maxgid}''; 42 40 ghostscript_version = ghostscript.version; 43 - out_ = "@out@"; # "out" will be resolved in post-install.sh 41 + out = null; # "out" will be resolved in post-install.sh 44 42 inherit coreutils ghostscript libtiff; 45 43 }; 46 44 47 - postPatch = substituteAll { 48 - name = "${pname}-post-patch.sh"; 49 - src = ./post-patch.sh; 45 + postPatch = replaceVars ./post-patch.sh { 50 46 inherit configSite; 51 47 maxuid = lib.optionalString (maxuid!=null) (builtins.toString maxuid); 52 48 faxcover_binpath = lib.makeBinPath ··· 55 51 [stdenv.shellPackage coreutils findutils gnused gnugrep gawk]; 56 52 }; 57 53 58 - postInstall = substituteAll { 59 - name = "${pname}-post-install.sh"; 60 - src = ./post-install.sh; 54 + postInstall = replaceVars ./post-install.sh { 61 55 inherit fakeroot libfaketime; 62 56 }; 63 57
+2 -3
pkgs/by-name/li/libnvidia-container/package.nix
··· 10 10 rpcsvc-proto, 11 11 libtirpc, 12 12 makeWrapper, 13 - substituteAll, 14 13 removeReferencesTo, 15 14 replaceVars, 16 15 go, ··· 23 22 rev = modprobeVersion; 24 23 sha256 = "sha256-iBRMkvOXacs/llTtvc/ZC5i/q9gc8lMuUHxMbu8A+Kg="; 25 24 }; 26 - modprobePatch = substituteAll { 27 - src = ./modprobe.patch; 25 + modprobePatch = replaceVars ./modprobe.patch { 26 + 28 27 inherit modprobeVersion; 29 28 }; 30 29 in
+4 -4
pkgs/by-name/ps/ps2eps/package.nix
··· 1 1 { lib 2 2 , fetchFromGitHub 3 3 , perlPackages 4 - , substituteAll 4 + , replaceVars 5 5 , ghostscript 6 6 , installShellFiles 7 7 }: ··· 18 18 hash = "sha256-SPLwsGKLVhANoqSQ/GJ938cYjbjMbUOXkNn9so3aJTA="; 19 19 }; 20 20 patches = [ 21 - (substituteAll { 22 - src = ./hardcode-deps.patch; 21 + (replaceVars ./hardcode-deps.patch { 23 22 gs = "${ghostscript}/bin/gs"; 24 - # bbox cannot be substituted here because substituteAll doesn't know what 23 + # bbox cannot be substituted here because replaceVars doesn't know what 25 24 # will be the $out path of the main derivation 25 + bbox = null; 26 26 }) 27 27 ]; 28 28
+1 -1
pkgs/by-name/tp/tpm2-pkcs11/package.nix
··· 1 - { stdenv, lib, fetchFromGitHub, substituteAll 1 + { stdenv, lib, fetchFromGitHub 2 2 , pkg-config, autoreconfHook, autoconf-archive, makeWrapper, patchelf 3 3 , tpm2-tss, tpm2-tools, opensc, openssl, sqlite, python3, glibc, libyaml 4 4 , abrmdSupport ? true, tpm2-abrmd ? null
+2 -3
pkgs/by-name/zo/zod/package.nix
··· 13 13 , makeWrapper 14 14 , coreutils 15 15 , scalingFactor ? 2 # this is to resize the fixed-size zod_launcher window 16 - , substituteAll 16 + , replaceVars 17 17 }: 18 18 let 19 19 name = "zod-engine"; ··· 70 70 # 2,3,4 look acceptable on my 4k monitor and 1 is unreadable. 71 71 # also the ./ in the run command is removed to have easier time starting the game 72 72 patches = [ 73 - (substituteAll { 73 + (replaceVars ./0002-add-scaling-factor-to-source.patch { 74 74 inherit scalingFactor; 75 - src=./0002-add-scaling-factor-to-source.patch; 76 75 }) 77 76 ]; 78 77 postPatch = ''
-1
pkgs/development/compilers/llvm/common/clang/default.nix
··· 5 5 , src ? null 6 6 , monorepoSrc ? null 7 7 , runCommand 8 - , substituteAll 9 8 , cmake 10 9 , ninja 11 10 , libxml2
+12 -9
pkgs/development/compilers/llvm/common/default.nix
··· 7 7 preLibcCrossHeaders, 8 8 libxcrypt, 9 9 substitute, 10 - substituteAll, 10 + replaceVars, 11 11 fetchFromGitHub, 12 12 fetchpatch, 13 13 fetchpatch2, ··· 546 546 ./clang/ignore-nostd-link-13.diff 547 547 ) 548 548 ++ [ 549 - (substituteAll { 550 - src = 549 + (replaceVars 550 + ( 551 551 if (lib.versionOlder metadata.release_version "16") then 552 552 ./clang/clang-11-15-LLVMgold-path.patch 553 553 else 554 - ./clang/clang-at-least-16-LLVMgold-path.patch; 555 - libllvmLibdir = "${tools.libllvm.lib}/lib"; 556 - }) 554 + ./clang/clang-at-least-16-LLVMgold-path.patch 555 + ) 556 + { 557 + libllvmLibdir = "${tools.libllvm.lib}/lib"; 558 + } 559 + ) 557 560 ] 558 561 # Backport version logic from Clang 16. This is needed by the following patch. 559 562 ++ lib.optional (lib.versions.major metadata.release_version == "15") (fetchpatch { ··· 661 664 patches = 662 665 let 663 666 resourceDirPatch = callPackage ( 664 - { substituteAll, libclang }: 665 - (substituteAll { 666 - src = metadata.getVersionFile "lldb/resource-dir.patch"; 667 + { replaceVars, libclang }: 668 + (replaceVars (metadata.getVersionFile "lldb/resource-dir.patch") { 669 + 667 670 clangLibDir = "${lib.getLib libclang}/lib"; 668 671 }).overrideAttrs 669 672 (_: _: { name = "resource-dir.patch"; })
+5 -5
pkgs/development/python-modules/pysdl2/PySDL2-dll.patch
··· 39 39 40 40 try: 41 41 - dll = DLL("SDL2", ["SDL2", "SDL2-2.0", "SDL2-2.0.0"], os.getenv("PYSDL2_DLL_PATH")) 42 - + dll = DLL("SDL2", "@sdl2@") 42 + + dll = DLL("SDL2", "@SDL2@") 43 43 except RuntimeError as exc: 44 44 raise ImportError(exc) 45 45 ··· 53 53 try: 54 54 - dll = DLL("SDL2_gfx", ["SDL2_gfx", "SDL2_gfx-1.0"], 55 55 - os.getenv("PYSDL2_DLL_PATH")) 56 - + dll = DLL("SDL2_gfx", "@sdl2_gfx@") 56 + + dll = DLL("SDL2_gfx", "@SDL2_gfx@") 57 57 except RuntimeError as exc: 58 58 raise ImportError(exc) 59 59 ··· 68 68 - dll = DLL( 69 69 - "SDL2_image", ["SDL2_image", "SDL2_image-2.0"], os.getenv("PYSDL2_DLL_PATH") 70 70 - ) 71 - + dll = DLL("SDL2_image", "@sdl2_image@") 71 + + dll = DLL("SDL2_image", "@SDL2_image@") 72 72 except RuntimeError as exc: 73 73 raise ImportError(exc) 74 74 ··· 82 82 try: 83 83 - dll = DLL("SDL2_mixer", ["SDL2_mixer", "SDL2_mixer-2.0"], 84 84 - os.getenv("PYSDL2_DLL_PATH")) 85 - + dll = DLL("SDL2_mixer", "@sdl2_mixer@") 85 + + dll = DLL("SDL2_mixer", "@SDL2_mixer@") 86 86 except RuntimeError as exc: 87 87 raise ImportError(exc) 88 88 ··· 96 96 try: 97 97 - dll = DLL("SDL2_ttf", ["SDL2_ttf", "SDL2_ttf-2.0"], 98 98 - os.getenv("PYSDL2_DLL_PATH")) 99 - + dll = DLL("SDL2_ttf", "@sdl2_ttf@") 99 + + dll = DLL("SDL2_ttf", "@SDL2_ttf@") 100 100 except RuntimeError as exc: 101 101 raise ImportError(exc) 102 102
+13 -16
pkgs/development/python-modules/pysdl2/default.nix
··· 1 1 { 2 2 stdenv, 3 3 lib, 4 - substituteAll, 4 + replaceVars, 5 5 fetchPypi, 6 6 buildPythonPackage, 7 7 SDL2, ··· 38 38 ]; 39 39 propagatedBuildInputs = [ SDL2 ]; 40 40 patches = [ 41 - (substituteAll ( 42 - { 43 - src = ./PySDL2-dll.patch; 44 - } 45 - // 46 - builtins.mapAttrs 47 - (_: pkg: "${pkg}/lib/lib${pkg.pname}${stdenv.hostPlatform.extensions.sharedLibrary}") 48 - { 49 - # substituteAll keys must start lowercase 50 - sdl2 = SDL2; 51 - sdl2_ttf = SDL2_ttf; 52 - sdl2_image = SDL2_image; 53 - sdl2_gfx = SDL2_gfx; 54 - sdl2_mixer = SDL2_mixer; 55 - } 41 + (replaceVars ./PySDL2-dll.patch ( 42 + builtins.mapAttrs 43 + (_: pkg: "${pkg}/lib/lib${pkg.pname}${stdenv.hostPlatform.extensions.sharedLibrary}") 44 + { 45 + inherit 46 + SDL2 47 + SDL2_ttf 48 + SDL2_image 49 + SDL2_gfx 50 + SDL2_mixer 51 + ; 52 + } 56 53 )) 57 54 ]; 58 55
-1
pkgs/development/tools/electron/common.nix
··· 8 8 , fixup-yarn-lock 9 9 , npmHooks 10 10 , yarn 11 - , substituteAll 12 11 , libnotify 13 12 , unzip 14 13 , pkgs
+4 -4
pkgs/development/tools/ocaml/merlin/4.x.nix
··· 1 1 { lib 2 - , substituteAll 2 + , replaceVars 3 3 , fetchurl 4 4 , ocaml 5 5 , dune_3 ··· 57 57 old-patch = lib.versionOlder version "4.17"; 58 58 in 59 59 [ 60 - (substituteAll { 61 - src = if old-patch then ./fix-paths.patch else ./fix-paths2.patch; 62 - dot_merlin_reader = "${dot-merlin-reader}/bin/dot-merlin-reader"; 60 + (replaceVars (if old-patch then ./fix-paths.patch else ./fix-paths2.patch) { 61 + 62 + dot-merlin-reader = "${dot-merlin-reader}/bin/dot-merlin-reader"; 63 63 dune = "${dune_3}/bin/dune"; 64 64 }) 65 65 ];
+2 -3
pkgs/kde/gear/kdegraphics-thumbnailers/default.nix
··· 1 1 { 2 2 mkKdeDerivation, 3 - substituteAll, 3 + replaceVars, 4 4 ghostscript, 5 5 }: 6 6 mkKdeDerivation { ··· 9 9 patches = [ 10 10 # Hardcode patches to Ghostscript so PDF thumbnails work OOTB. 11 11 # Intentionally not doing the same for dvips because TeX is big. 12 - (substituteAll { 12 + (replaceVars ./gs-paths.patch { 13 13 gs = "${ghostscript}/bin/gs"; 14 - src = ./gs-paths.patch; 15 14 }) 16 15 ]; 17 16 }
+3 -3
pkgs/os-specific/linux/lvm2/common.nix
··· 6 6 , coreutils 7 7 , libuuid 8 8 , libaio 9 - , substituteAll 9 + , replaceVars 10 10 , enableCmdlib ? false 11 11 , enableDmeventd ? false 12 12 , udevSupport ? !stdenv.hostPlatform.isStatic, udev ··· 91 91 92 92 patches = [ 93 93 # fixes paths to and checks for tools 94 - (substituteAll (let 94 + (replaceVars ./fix-blkdeactivate.patch (let 95 95 optionalTool = cond: pkg: if cond then pkg else "/run/current-system/sw"; 96 96 in { 97 - src = ./fix-blkdeactivate.patch; 98 97 inherit coreutils; 99 98 util_linux = optionalTool enableUtilLinux util-linux; 100 99 mdadm = optionalTool enableMdadm mdadm; 101 100 multipath_tools = optionalTool enableMultipath multipath-tools; 102 101 vdo = optionalTool enableVDO vdo; 102 + SBINDIR = null; # part of original source code in the patch's context 103 103 })) 104 104 ./fix-stdio-usage.patch 105 105 ];