makeSetupHook: support depsTargetTargetPropagated

This commit is contained in:
Artturin 2022-12-30 22:14:00 +02:00
parent 84e37a10ec
commit 9a9c42e19f
4 changed files with 17 additions and 9 deletions

View File

@ -623,15 +623,24 @@ rec {
*/
makeSetupHook =
{ name ? lib.warn "calling makeSetupHook without passing a name is deprecated." "hook"
, deps ? []
, substitutions ? {}
, meta ? {}
, passthru ? {}
, deps ? [ ]
# hooks go in nativeBuildInput so these will be nativeBuildInput
, propagatedBuildInputs ? [ ]
# these will be buildInputs
, depsTargetTargetPropagated ? [ ]
, meta ? { }
, passthru ? { }
, substitutions ? { }
}:
script:
runCommand name
(substitutions // {
inherit meta;
inherit depsTargetTargetPropagated;
propagatedBuildInputs =
# remove list conditionals before 23.11
lib.warnIf (!lib.isList deps) "deps argument to makeSetupHook must be a list. content: ${toString deps}"
propagatedBuildInputs ++ (if lib.isList deps then deps else [ deps ] );
strictDeps = true;
# TODO 2023-01, no backport: simplify to inherit passthru;
passthru = passthru
@ -642,8 +651,7 @@ rec {
(''
mkdir -p $out/nix-support
cp ${script} $out/nix-support/setup-hook
'' + lib.optionalString (deps != []) ''
printWords ${toString deps} > $out/nix-support/propagated-build-inputs
recordPropagatedDependencies
'' + lib.optionalString (substitutions != {}) ''
substituteAll ${script} $out/nix-support/setup-hook
'');

View File

@ -8,7 +8,7 @@
# imported as wrapLua in lua-packages.nix and passed to build-lua-derivation to be used as buildInput
makeSetupHook {
name = "wrap-lua-hook";
deps = makeWrapper;
deps = [ makeWrapper ];
substitutions.executable = lua.interpreter;
substitutions.lua = lua;
substitutions.LuaPathSearchPaths = lib.escapeShellArgs lua.LuaPathSearchPaths;

View File

@ -10,7 +10,7 @@
# Each of the substitutions is available in the wrap.sh script as @thingSubstituted@
makeSetupHook {
name = "${octave.name}-pkgs-setup-hook";
deps = makeWrapper;
deps = [ makeWrapper ];
substitutions.executable = octave.interpreter;
substitutions.octave = octave;
} ./wrap.sh

View File

@ -5,7 +5,7 @@
makePythonHook {
name = "wrap-python-hook";
deps = makeWrapper;
deps = [ makeWrapper ];
substitutions.sitePackages = python.sitePackages;
substitutions.executable = python.interpreter;
substitutions.python = python.pythonForBuild;