@@ -43,17 +43,26 @@ let
4343
4444 propagate = out:
4545 let setupHook = { writeScript }:
46− writeScript "setup-hook.sh" ''
47− # Propagate $${out} output
48− propagatedUserEnvPkgs+=" @${out}@"
49−
50− # Propagate $dev so that this setup hook is propagated
51− # But only if there is a separate $dev output
52− if [ "$outputDev" != out ]; then
53− if [ -n "$crossConfig" ]; then
54− propagatedBuildInputs+=" @dev@"
55− else
56− propagatedNativeBuildInputs+=" @dev@"
46+ writeScript "setup-hook" ''
47+ if [ "$hookName" != postHook ]; then
48+ postHooks+=("source @dev@/nix-support/setup-hook")
49+ else
50+ # Propagate $${out} output
51+ propagatedUserEnvPkgs="$propagatedUserEnvPkgs @${out}@"
52+
53+ if [ -z "$outputDev" ]; then
54+ echo "error: \$outputDev is unset!" >&2
55+ exit 1
56+ fi
57+
58+ # Propagate $dev so that this setup hook is propagated
59+ # But only if there is a separate $dev output
60+ if [ "$outputDev" != out ]; then
61+ if [ -n "$crossConfig" ]; then
62+ propagatedBuildInputs="$propagatedBuildInputs @dev@"
63+ else
64+ propagatedNativeBuildInputs="$propagatedNativeBuildInputs @dev@"
65+ fi
5766 fi
5867 fi
5968 '';