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