From c3007097a61d19babfa8d7f828e3533681a9dd6a Mon Sep 17 00:00:00 2001 From: beatzaplenty Date: Mon, 20 Jul 2026 15:19:35 +1000 Subject: [PATCH] Fix create-proxmox-resource.sh defaulting hostname to the flake target --name (used as pct/qm create's --hostname/--name) defaulted to $flake_target (e.g. "lxc-nix-cache"), not $host (e.g. "nix-cache"). Since proxmoxLXC.manageHostName pulls the guest's real networking.hostName straight from Proxmox's own container config, this silently overrode host.nix's hostName with a build-type-specific name. Default --name to --host instead, so the guest's identity matches host.nix regardless of which platform variant built it. Found by spinning up a fresh lxc-nix-cache test container and noticing its hostname was "lxc-nix-cache" instead of "nix-cache". Co-Authored-By: Claude Sonnet 5 --- scripts/create-proxmox-resource.sh | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/scripts/create-proxmox-resource.sh b/scripts/create-proxmox-resource.sh index 18c6171..ed4f8d4 100755 --- a/scripts/create-proxmox-resource.sh +++ b/scripts/create-proxmox-resource.sh @@ -40,8 +40,12 @@ Create mode (default): config.networking.hostName (server, docker, nix-cache, nixos, pxe-boot, nix-minimal). Use --list to see what's available for --type. - --name Proxmox display name/hostname (default: the flake - target name, e.g. lxc-server) + --name Proxmox display name/hostname (default: --host's + value, e.g. nix-cache -- for lxc this becomes the + guest's real networking.hostName too, since + proxmoxLXC.manageHostName pulls it from Proxmox's + own container config, so it must match host.nix + regardless of build type) --vmid Numeric VMID (default: next free, via \`pvesh get /cluster/nextid\` on the node). Refuses to run if this ID already exists. @@ -274,7 +278,13 @@ if [[ -z "$flake_target" ]]; then exit 1 fi -[[ -z "$name" ]] && name="$flake_target" +# The container/VM's real identity is --host (e.g. "nix-cache"), validated +# above against config.networking.hostName -- not the flake target name +# (e.g. "lxc-nix-cache"), which is build-type-specific and only exists to +# pick which platform variant to build. Defaulting --name to the flake +# target would make lxc's --hostname (which proxmoxLXC.manageHostName +# feeds straight into the guest's real hostname) disagree with host.nix. +[[ -z "$name" ]] && name="$host" # --- refuse to duplicate a host that's already really deployed ---------- # Checked by hostName, not exact flake target: proxmox-server being