stdenv: do not leak outputName out of loop

This is an implementation detail leaking out into the bash environment
and it did manange to confuse me as potentially being a way to get the "default"
output name when structuredAttrs is enabled, because of the "outputName" derivation attribute.
This commit is contained in:
Stefan Frijters 2026-05-18 13:43:58 +02:00
commit fea908fde9
No known key found for this signature in database
GPG key ID: 7619A6BC6E7DFA6F

View file

@ -29,10 +29,15 @@ if [[ -n "${NIX_ATTRS_JSON_FILE:-}" ]]; then
__structuredAttrs=1
echo "structuredAttrs is enabled"
for outputName in "${!outputs[@]}"; do
# ex: out=/nix/store/...
export "$outputName=${outputs[$outputName]}"
done
_exportOutputsByName() {
local outputName
for outputName in "${!outputs[@]}"; do
# ex: out=/nix/store/...
export "$outputName=${outputs[$outputName]}"
done
}
_exportOutputsByName
else
__structuredAttrs=
: "${outputs:=out}"