tcl.tclRequiresCheckHook: make compatible with structuredAttrs

With __structuredAttrs enabled, arguments to mkDerivation are not exported as
environment variables inside the bash builder by default, so in this case
tclRequiresCheck doesn't exist when the tcl oneliner tries to read it.
tclRequiresCheck is also an array in this case.

So, expand the array and set the environment variable explicitly for the tcl
call only.
This commit is contained in:
Stefan Frijters
2026-04-07 23:51:46 +02:00
parent 4e05b4eea9
commit fe8fcfd271
@@ -5,9 +5,9 @@ tclRequiresCheckPhase () {
echo "Executing tclRequiresCheckPhase"
if [ -n "$tclRequiresCheck" ]; then
echo "Check whether the following packages can be required: $tclRequiresCheck"
echo "Check whether the following packages can be required: ${tclRequiresCheck[*]}"
export TCLLIBPATH="$out/lib $TCLLIBPATH" # Redundant if tcl-package-hook is also used
tclsh <<<'exit [catch {foreach req $env(tclRequiresCheck) {package require $req}}]'
tclRequiresCheck="${tclRequiresCheck[@]}" tclsh <<<'exit [catch {foreach req $env(tclRequiresCheck) {package require $req}}]'
fi
}