various: replace substituteAll with replaceVars (#360770)
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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;
|
||||
})
|
||||
];
|
||||
}
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
, skopeo
|
||||
, stdenv
|
||||
, storeDir ? builtins.storeDir
|
||||
, substituteAll
|
||||
, symlinkJoin
|
||||
, tarsum
|
||||
, util-linux
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
runtimeShell,
|
||||
stdenvNoCC,
|
||||
callPackage,
|
||||
substituteAll,
|
||||
writeShellScript,
|
||||
makeWrapper,
|
||||
dotnetCorePackages,
|
||||
|
||||
@@ -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)];
|
||||
});
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
makeWrapper,
|
||||
perl,
|
||||
substituteAll,
|
||||
substitute,
|
||||
cudd,
|
||||
fetchurl,
|
||||
nix-update-script,
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
})
|
||||
];
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 = ''
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
, src ? null
|
||||
, monorepoSrc ? null
|
||||
, runCommand
|
||||
, substituteAll
|
||||
, cmake
|
||||
, ninja
|
||||
, libxml2
|
||||
|
||||
@@ -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"; })
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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
|
||||
;
|
||||
}
|
||||
))
|
||||
];
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
, fixup-yarn-lock
|
||||
, npmHooks
|
||||
, yarn
|
||||
, substituteAll
|
||||
, libnotify
|
||||
, unzip
|
||||
, pkgs
|
||||
|
||||
@@ -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";
|
||||
})
|
||||
];
|
||||
|
||||
@@ -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;
|
||||
})
|
||||
];
|
||||
}
|
||||
|
||||
@@ -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
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user