terraform/nix-build: fix building from non-flake

This commit is contained in:
Jörg Thalheim 2023-02-22 16:12:01 +01:00
parent 23bbd22fb2
commit 2abdb32c67

View File

@ -3,7 +3,7 @@ set -efu
declare file attribute
eval "$(jq -r '@sh "attribute=\(.attribute) file=\(.file)"')"
if [[ -e ${file+x} ]]; then
if [[ -n ${file-} ]] && [[ -e ${file-} ]]; then
out=$(nix build --no-link --json -f "$file" "$attribute")
printf '%s' "$out" | jq -c '.[].outputs'
else