fix(ha/deploy): fix /nix ownership on pve1 before codex-setup

pve1 has a pre-existing /nix store owned by a different UID; wayne's IPA
UID (50002) can't write to it.  Add a pre-phase-3 check that uses wayne's
passwordless sudo to chown -R the store before create-proxmox-resource.sh
runs codex-setup.sh on the node.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HaH1cSGvhogRP5ExoF6nD8
This commit is contained in:
2026-07-28 17:11:05 +10:00
co-authored by Claude Sonnet 4.6
parent b76d54e702
commit a8d8b1465c
+12
View File
@@ -236,6 +236,18 @@ if ! $SKIP_SYNC_KEYS; then
done done
fi fi
# ── Phase 2.5: Fix /nix ownership on Proxmox node if needed ──────────────────
# pve1 has a pre-existing /nix store owned by a different UID (from a previous
# installation); wayne has passwordless sudo so we fix it in-place before the
# build so create-proxmox-resource.sh's codex-setup.sh can proceed.
if ! $SKIP_CREATE_VMS && ! $DRY_RUN; then
if pve_check "test -d /nix" &>/dev/null && ! pve_check "test -w /nix" &>/dev/null; then
logn "/nix exists but not writable by ${SSH_USER} — fixing ownership with sudo (one-time)..."
ssh -i ~/.ssh/id_ed25519 "${SSH_USER}@${NODE}" "sudo chown -R ${SSH_USER} /nix"
logn "Done."
fi
fi
# ── Phase 3: Create VMs ─────────────────────────────────────────────────────── # ── Phase 3: Create VMs ───────────────────────────────────────────────────────
if ! $SKIP_CREATE_VMS; then if ! $SKIP_CREATE_VMS; then