From 5eea38d3ca4e5ffb8fddd345b2ee7d23b93b721f Mon Sep 17 00:00:00 2001 From: beatzaplenty Date: Wed, 29 Jul 2026 16:25:51 +1000 Subject: [PATCH] fix(flake): fix /etc/flake-target on ha-server-{1,2} so Switch-nix alias works mkTarget computed flakeTarget as "${platform}-${buildType}" which gives "proxmox-ha-server" for both nodes, but the actual nixosConfigurations keys are "proxmox-ha-server-1" / "proxmox-ha-server-2". This caused Switch-nix to fail immediately with an "unknown flake attribute" error. Add an optional nameSuffix parameter to mkTarget and pass "-1" / "-2" for the ha-server entries so /etc/flake-target matches the real attribute name on each node. Co-Authored-By: Claude Sonnet 4.6 Claude-Session: https://claude.ai/code/session_01J8djTWdXVzXZc99iujU6T2 --- flake.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flake.nix b/flake.nix index d4b0aa0..c0aa52d 100644 --- a/flake.nix +++ b/flake.nix @@ -45,9 +45,9 @@ # (hostName, hostId, per-machine secrets). Every build type except # nix-cache itself consumes the nix-cache substituter and remote # builder. - mkTarget = { platform, buildType, hostPath, homeFile ? ./modules/common/home.nix }: + mkTarget = { platform, buildType, hostPath, homeFile ? ./modules/common/home.nix, nameSuffix ? "" }: let - flakeTarget = "${platform}-${buildType}"; + flakeTarget = "${platform}-${buildType}${nameSuffix}"; in nixpkgs.lib.nixosSystem { inherit system; @@ -131,8 +131,8 @@ lxc-tor-relay = mkTarget { platform = "lxc"; buildType = "tor-relay"; hostPath = ./hosts/tor-relay/host.nix; }; - proxmox-ha-server-1 = mkTarget { platform = "proxmox"; buildType = "ha-server"; hostPath = ./hosts/ha-server-1/host.nix; }; - proxmox-ha-server-2 = mkTarget { platform = "proxmox"; buildType = "ha-server"; hostPath = ./hosts/ha-server-2/host.nix; }; + proxmox-ha-server-1 = mkTarget { platform = "proxmox"; buildType = "ha-server"; hostPath = ./hosts/ha-server-1/host.nix; nameSuffix = "-1"; }; + proxmox-ha-server-2 = mkTarget { platform = "proxmox"; buildType = "ha-server"; hostPath = ./hosts/ha-server-2/host.nix; nameSuffix = "-2"; }; }; # Auto-install environments (migrated from the former nix-auto-installer