Skip to content

Commit

Permalink
treewide: replace substituteAll with replaceVars (part 2)
Browse files Browse the repository at this point in the history
Driving NixOS#237216 forward.
  • Loading branch information
wolfgangwalther committed Jan 14, 2025
1 parent b2ddf2d commit 90ef4b5
Show file tree
Hide file tree
Showing 39 changed files with 97 additions and 153 deletions.
5 changes: 2 additions & 3 deletions pkgs/applications/audio/espeak-ng/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
libtool,
pkg-config,
ronn,
substituteAll,
replaceVars,
buildPackages,
mbrolaSupport ? true,
mbrola,
Expand Down Expand Up @@ -45,8 +45,7 @@ stdenv.mkDerivation rec {
]
++ lib.optionals mbrolaSupport [
# Hardcode correct mbrola paths.
(substituteAll {
src = ./mbrola.patch;
(replaceVars ./mbrola.patch {
inherit mbrola;
})
];
Expand Down
5 changes: 2 additions & 3 deletions pkgs/applications/display-managers/lightdm/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
buildPackages,
fetchFromGitHub,
nix-update-script,
substituteAll,
replaceVars,
plymouth,
pam,
pkg-config,
Expand Down Expand Up @@ -85,8 +85,7 @@ stdenv.mkDerivation rec {
# Hardcode plymouth to fix transitions.
# For some reason it can't find `plymouth`
# even when it's in PATH in environment.systemPackages.
(substituteAll {
src = ./fix-paths.patch;
(replaceVars ./fix-paths.patch {
plymouth = "${plymouth}/bin/plymouth";
})
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
codeium,
fetchFromGitHub,
melpaBuild,
substituteAll,
replaceVars,
gitUpdater,
}:

Expand All @@ -19,8 +19,7 @@ melpaBuild {
};

patches = [
(substituteAll {
src = ./0000-set-codeium-command-executable.patch;
(replaceVars ./0000-set-codeium-command-executable.patch {
codeium = lib.getExe' codeium "codeium_language_server";
})
];
Expand Down
27 changes: 8 additions & 19 deletions pkgs/applications/editors/vim/plugins/overrides.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
fetchurl,
neovimUtils,
replaceVars,
substituteAll,
# Language dependencies
fetchYarnDeps,
mkYarnModules,
Expand Down Expand Up @@ -181,8 +180,7 @@ in

aw-watcher-vim = super.aw-watcher-vim.overrideAttrs {
patches = [
(substituteAll {
src = ./patches/aw-watcher-vim/program_paths.patch;
(replaceVars ./patches/aw-watcher-vim/program_paths.patch {
curl = lib.getExe curl;
})
];
Expand Down Expand Up @@ -1096,8 +1094,7 @@ in
super.fruzzy.overrideAttrs (old: {
buildInputs = [ nim1 ];
patches = [
(substituteAll {
src = ./patches/fruzzy/get_version.patch;
(replaceVars ./patches/fruzzy/get_version.patch {
inherit (old) version;
})
];
Expand Down Expand Up @@ -1236,8 +1233,7 @@ in

gx-nvim = super.gx-nvim.overrideAttrs {
patches = lib.optionals stdenv.hostPlatform.isLinux [
(substituteAll {
src = ./patches/gx-nvim/fix-paths.patch;
(replaceVars ./patches/gx-nvim/fix-paths.patch {
inherit xdg-utils;
})
];
Expand Down Expand Up @@ -1523,10 +1519,7 @@ in
# https://github.com/NixOS/nixpkgs/pull/105810#issuecomment-740007985
# https://github.com/camspiers/lens.vim/pull/40/files
patches = [
(substituteAll {
src = ./patches/lens-vim/remove_duplicate_g_lens_animate.patch;
inherit languagetool;
})
./patches/lens-vim/remove_duplicate_g_lens_animate.patch
];
};

Expand Down Expand Up @@ -1655,8 +1648,7 @@ in
in
super.markdown-preview-nvim.overrideAttrs {
patches = [
(substituteAll {
src = ./markdown-preview-nvim/fix-node-paths.patch;
(replaceVars ./markdown-preview-nvim/fix-node-paths.patch {
node = "${nodejs}/bin/node";
})
];
Expand Down Expand Up @@ -2566,8 +2558,7 @@ in
"openscad.utilities"
];
patches = [
(substituteAll {
src = ./patches/openscad.nvim/program_paths.patch;
(replaceVars ./patches/openscad.nvim/program_paths.patch {
htop = lib.getExe htop;
openscad = lib.getExe openscad;
zathura = lib.getExe zathura;
Expand Down Expand Up @@ -2676,8 +2667,7 @@ in

Preview-nvim = super.Preview-nvim.overrideAttrs {
patches = [
(substituteAll {
src = ./patches/preview-nvim/hardcode-mdt-binary-path.patch;
(replaceVars ./patches/preview-nvim/hardcode-mdt-binary-path.patch {
mdt = lib.getExe md-tui;
})
];
Expand Down Expand Up @@ -3521,8 +3511,7 @@ in
# let g:grammarous#show_first_error = 1
# see https://github.com/rhysd/vim-grammarous/issues/39
patches = [
(substituteAll {
src = ./patches/vim-grammarous/set_default_languagetool.patch;
(replaceVars ./patches/vim-grammarous/set_default_languagetool.patch {
inherit languagetool;
})
];
Expand Down
5 changes: 2 additions & 3 deletions pkgs/applications/emulators/wine/packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
pkgsi686Linux,
pkgsCross,
callPackage,
substituteAll,
replaceVars,
moltenvk,
wineRelease ? "stable",
supportFlags,
Expand Down Expand Up @@ -80,8 +80,7 @@ with src;
mingwW64.buildPackages.gcc
];
monos = [ mono ];
buildScript = substituteAll {
src = ./builder-wow.sh;
buildScript = replaceVars ./builder-wow.sh {
# pkgconfig has trouble picking the right architecture
pkgconfig64remove = lib.makeSearchPathOutput "dev" "lib/pkgconfig" [
pkgs.glib
Expand Down
5 changes: 2 additions & 3 deletions pkgs/applications/graphics/gimp/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
stdenv,
lib,
fetchurl,
substituteAll,
replaceVars,
autoreconfHook,
pkg-config,
intltool,
Expand Down Expand Up @@ -74,8 +74,7 @@ stdenv.mkDerivation (finalAttrs: {
patches = [
# to remove compiler from the runtime closure, reference was retained via
# gimp --version --verbose output
(substituteAll {
src = ./remove-cc-reference.patch;
(replaceVars ./remove-cc-reference.patch {
cc_version = stdenv.cc.cc.name;
})

Expand Down
8 changes: 3 additions & 5 deletions pkgs/applications/graphics/inkscape/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
, potrace
, python3
, runCommand
, substituteAll
, replaceVars
, wrapGAppsHook3
, libepoxy
, zlib
Expand Down Expand Up @@ -92,15 +92,13 @@ stdenv.mkDerivation (finalAttrs: {
url = "https://gitlab.com/inkscape/inkscape/-/commit/eb6dadcf1a5c660167ba43f3606c8e7cc6529787.patch";
hash = "sha256-FvbJV/YrBwhHg0kFdbhyd/Y9g7YV2nPIrRqZt7yJ50Q=";
})
(substituteAll {
src = ./fix-python-paths.patch;
(replaceVars ./fix-python-paths.patch {
# Python is used at run-time to execute scripts,
# e.g., those from the "Effects" menu.
python3 = lib.getExe python3Env;
})
(substituteAll {
(replaceVars ./fix-ps2pdf-path.patch {
# Fix path to ps2pdf binary
src = ./fix-ps2pdf-path.patch;
inherit ghostscript;
})
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
lib,
writeScript,
fetchFromGitHub,
substituteAll,
replaceVars,
inkscape,
pdflatex,
lualatex,
Expand Down Expand Up @@ -33,8 +33,7 @@ python3.pkgs.buildPythonApplication rec {
patches = [
# Make sure we can point directly to pdflatex in the extension,
# instead of relying on the PATH (which might not have it)
(substituteAll {
src = ./fix-paths.patch;
(replaceVars ./fix-paths.patch {
inherit pdflatex lualatex;
})

Expand Down
11 changes: 6 additions & 5 deletions pkgs/applications/virtualization/virtualbox/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
libvpx,
nettools,
dbus,
substituteAll,
replaceVars,
gsoap,
zlib,
xz,
Expand Down Expand Up @@ -235,10 +235,11 @@ stdenv.mkDerivation (finalAttrs: {
# these issues by patching the code to set QT_PLUGIN_PATH to the necessary paths,
# after the code that unsets it. Note that qtsvg is included so that SVG icons from
# the user's icon theme can be loaded.
++ optional (!headless && enableHardening) (substituteAll {
src = ./qt-env-vars.patch;
qtPluginPath = "${qtbase}/bin/${qtbase.qtPluginPrefix}:${qtsvg}/bin/${qtbase.qtPluginPrefix}:${qtwayland}/bin/${qtbase.qtPluginPrefix}";
})
++ optional (!headless && enableHardening) (
replaceVars ./qt-env-vars.patch {
qtPluginPath = "${qtbase}/bin/${qtbase.qtPluginPrefix}:${qtsvg}/bin/${qtbase.qtPluginPrefix}:${qtwayland}/bin/${qtbase.qtPluginPrefix}";
}
)
# While the KVM patch should not break any other behavior if --with-kvm is not specified,
# we don't take any chances and only apply it if people actually want to use KVM support.
++ optional enableKvm (
Expand Down
5 changes: 2 additions & 3 deletions pkgs/build-support/mitm-cache/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
fetchFromGitHub,
callPackage,
rustPlatform,
substituteAll,
replaceVars,
openssl,
Security,
python3Packages,
Expand All @@ -27,8 +27,7 @@ rustPlatform.buildRustPackage rec {

cargoHash = "sha256-6eYOSSlswJGR2IrFo17qVnwI+h2FkyTjLFvwf62nG2c=";

setupHook = substituteAll {
src = ./setup-hook.sh;
setupHook = replaceVars ./setup-hook.sh {
inherit openssl;
ephemeral_port_reserve = python3Packages.ephemeral-port-reserve;
};
Expand Down
8 changes: 3 additions & 5 deletions pkgs/desktops/deepin/go-package/dde-daemon/default.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
lib,
fetchFromGitHub,
substituteAll,
replaceVars,
buildGoModule,
pkg-config,
deepin-gettext-tools,
Expand Down Expand Up @@ -48,12 +48,10 @@ buildGoModule rec {

patches = [
./0001-dont-set-PATH.diff
(substituteAll {
src = ./0002-fix-custom-wallpapers-path.diff;
(replaceVars ./0002-fix-custom-wallpapers-path.diff {
inherit coreutils;
})
(substituteAll {
src = ./0003-aviod-use-hardcode-path.diff;
(replaceVars ./0003-aviod-use-hardcode-path.diff {
inherit dbus;
})
];
Expand Down
5 changes: 2 additions & 3 deletions pkgs/desktops/gnome/extensions/EasyScreenCast/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
lib,
stdenv,
fetchFromGitHub,
substituteAll,
replaceVars,
glib,
gnome-shell,
gettext,
Expand All @@ -22,8 +22,7 @@ stdenv.mkDerivation (finalAttrs: {
};

patches = [
(substituteAll {
src = ./fix-gi-path.patch;
(replaceVars ./fix-gi-path.patch {
gnomeShell = gnome-shell;
})
];
Expand Down
5 changes: 2 additions & 3 deletions pkgs/desktops/gnome/extensions/arcmenu/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
fetchFromGitLab,
glib,
gettext,
substituteAll,
replaceVars,
gnome-menus,
}:

Expand All @@ -20,8 +20,7 @@ stdenv.mkDerivation rec {
};

patches = [
(substituteAll {
src = ./fix_gmenu.patch;
(replaceVars ./fix_gmenu.patch {
gmenu_path = "${gnome-menus}/lib/girepository-1.0";
})
];
Expand Down
5 changes: 2 additions & 3 deletions pkgs/desktops/gnome/extensions/drop-down-terminal/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
lib,
stdenv,
fetchFromGitHub,
substituteAll,
replaceVars,
gjs,
vte,
gnome,
Expand All @@ -25,8 +25,7 @@ stdenv.mkDerivation rec {
};

patches = [
(substituteAll {
src = ./fix_vte_and_gjs.patch;
(replaceVars ./fix_vte_and_gjs.patch {
inherit gjs vte;
})
];
Expand Down
Loading

0 comments on commit 90ef4b5

Please sign in to comment.