diff --git a/pkgs/build-support/trivial-builders.nix b/pkgs/build-support/trivial-builders.nix index 7318d13f6bab..aca9db9d1aba 100644 --- a/pkgs/build-support/trivial-builders.nix +++ b/pkgs/build-support/trivial-builders.nix @@ -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 ''); diff --git a/pkgs/development/interpreters/lua-5/wrap-lua.nix b/pkgs/development/interpreters/lua-5/wrap-lua.nix index c9ef151bea3c..2ba5d47d9dd9 100644 --- a/pkgs/development/interpreters/lua-5/wrap-lua.nix +++ b/pkgs/development/interpreters/lua-5/wrap-lua.nix @@ -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; diff --git a/pkgs/development/interpreters/octave/wrap-octave.nix b/pkgs/development/interpreters/octave/wrap-octave.nix index 1e4616136a1b..6e75ffab443d 100644 --- a/pkgs/development/interpreters/octave/wrap-octave.nix +++ b/pkgs/development/interpreters/octave/wrap-octave.nix @@ -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 diff --git a/pkgs/development/interpreters/python/wrap-python.nix b/pkgs/development/interpreters/python/wrap-python.nix index 83da013bfd2d..7a80813f6373 100644 --- a/pkgs/development/interpreters/python/wrap-python.nix +++ b/pkgs/development/interpreters/python/wrap-python.nix @@ -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;