From a8d8b1465ce645ad027fc0859f360855c57233ba Mon Sep 17 00:00:00 2001 From: beatzaplenty Date: Tue, 28 Jul 2026 17:11:05 +1000 Subject: [PATCH] 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 Claude-Session: https://claude.ai/code/session_01HaH1cSGvhogRP5ExoF6nD8 --- scripts/ha/deploy.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/scripts/ha/deploy.sh b/scripts/ha/deploy.sh index 0c9b78b..acdecac 100755 --- a/scripts/ha/deploy.sh +++ b/scripts/ha/deploy.sh @@ -236,6 +236,18 @@ if ! $SKIP_SYNC_KEYS; then done 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 ─────────────────────────────────────────────────────── if ! $SKIP_CREATE_VMS; then