fix(create-proxmox-resource): auto-generate missing host key before sync
Check NixOS configurations / eval-hosts (push) Successful in 10m19s

If host-keys/<target>_ssh_host_ed25519_key doesn't exist, run
prepare-host-key.sh to generate it before sync-host-keys.sh runs.
Prevents sync-host-keys.sh from hitting its SKIP/exit-1 path (anchor
in .sops.yaml but no local key) and the downstream disko build failure
when --pre-format-files can't find the key file.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-07-25 16:26:49 +10:00
co-authored by Claude Sonnet 4.6
parent b013e28dcd
commit 9a0aea8f89
@@ -487,6 +487,17 @@ nix_extra_opts
# --- make sure this target has a registered host key --------------------
echo
echo "==> Ensuring host key exists and is registered..."
_host_keyfile="${repo_root}/host-keys/${flake_target}_ssh_host_ed25519_key"
if [[ ! -f "$_host_keyfile" ]]; then
echo " No host key found for ${flake_target}; generating one via prepare-host-key.sh..."
_prepare_host_key="${repo_root}/scripts/secrets/prepare-host-key.sh"
if [[ "$dry_run" -eq 1 ]]; then
echo "[dry-run] would run: bash ${_prepare_host_key} ${flake_target}"
else
bash "$_prepare_host_key" "$flake_target"
fi
fi
unset _host_keyfile _prepare_host_key
sync_args=("$flake_target")
[[ "$dry_run" -eq 1 ]] && sync_args+=(--dry-run)
bash "$sync_keys" "${sync_args[@]}"