about summary refs log tree commit diff
path: root/ops/terraform/deploy-nixos/nix-eval.sh
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2024-03-20T13·28+0200
committerclbot <clbot@tvl.fyi>2024-03-24T21·26+0000
commit982da2f3eaa76bb63b6868bdf07df954f63d1af4 (patch)
tree2d0af69004ba38f79695aaeed83dfd0a73912917 /ops/terraform/deploy-nixos/nix-eval.sh
parentfe6ae58ba5c16bbf8348c083a0b1b79635b39c53 (diff)
feat(ops/terraform/deploy-nixos): add outPath output parameter r/7780
We already did all the instantiation, grabbing the calculated output
path too is cheap.

Change-Id: Id591865c65159409da739f706a9de29a9f50456a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11214
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
Diffstat (limited to 'ops/terraform/deploy-nixos/nix-eval.sh')
-rwxr-xr-xops/terraform/deploy-nixos/nix-eval.sh6
1 files changed, 5 insertions, 1 deletions
diff --git a/ops/terraform/deploy-nixos/nix-eval.sh b/ops/terraform/deploy-nixos/nix-eval.sh
index 2591da28ae0f..d7d59e317b61 100755
--- a/ops/terraform/deploy-nixos/nix-eval.sh
+++ b/ops/terraform/deploy-nixos/nix-eval.sh
@@ -27,8 +27,12 @@ eval "$(jq -r '@sh "attrpath=\(.attrpath) && entrypoint=\(.entrypoint) && argstr
 # shellcheck disable=SC2086,SC2154
 drv=$(nix-instantiate -A "${attrpath}" "${entrypoint}" ${argstr})
 
+# Determine the output path.
+outPath=$(nix show-derivation "${drv}" | jq -r ".\"${drv}\".outputs.out.path")
+
 # Return a JSON back to stdout.
 # It contains the following keys:
 #
 # - `drv`: the store path of the Derivation that has been instantiated.
-jq -n --arg drv "$drv" '{"drv":$drv}'
+# - `outPath`: the output store path.
+jq -n --arg drv "$drv" --arg outPath "$outPath" '{"drv":$drv, "outPath":$outPath}'