diff --git a/common/cluster-member.nix b/common/cluster-member.nix index 7eefc50..fae2a91 100644 --- a/common/cluster-member.nix +++ b/common/cluster-member.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ pkgs, lib, config, ... }: { # Cluster node configuration # Extends minimal-node with cluster-specific services (Consul, GlusterFS, CIFS, NFS) @@ -11,7 +11,14 @@ ./nfs-services-client.nix # New: NFS client for /data/services ]; - # Wait for eno1 to be routable before considering network online - # (hosts with different primary interfaces should override this) - systemd.network.wait-online.extraArgs = [ "--interface=eno1:routable" ]; + options.networking.cluster.primaryInterface = lib.mkOption { + type = lib.types.str; + default = "eno1"; + description = "Primary network interface for cluster communication (Consul, NFS, etc.)"; + }; + + config = { + # Wait for primary interface to be routable before considering network online + systemd.network.wait-online.extraArgs = [ "--interface=${config.networking.cluster.primaryInterface}:routable" ]; + }; } diff --git a/common/consul.nix b/common/consul.nix index 4477783..96572ec 100644 --- a/common/consul.nix +++ b/common/consul.nix @@ -13,7 +13,7 @@ in services.consul = { enable = true; webUi = true; - interface.advertise = "eno1"; + interface.advertise = config.networking.cluster.primaryInterface; extraConfig = { client_addr = "0.0.0.0"; datacenter = "alo"; diff --git a/hosts/beefy/default.nix b/hosts/beefy/default.nix index d5a54e5..770da52 100644 --- a/hosts/beefy/default.nix +++ b/hosts/beefy/default.nix @@ -16,5 +16,6 @@ }; networking.hostName = "beefy"; + networking.cluster.primaryInterface = "enp1s0"; services.tailscaleAutoconnect.authkey = "tskey-auth-k79UsDTw2v11CNTRL-oYqji35BE9c7CqM89Dzs9cBF14PmqYsi"; } diff --git a/hosts/chilly/default.nix b/hosts/chilly/default.nix index f3cfbf5..bddaef1 100644 --- a/hosts/chilly/default.nix +++ b/hosts/chilly/default.nix @@ -21,13 +21,11 @@ }; networking.hostName = "chilly"; + networking.cluster.primaryInterface = "br0"; services.tailscaleAutoconnect.authkey = "tskey-auth-kRXS9oPyPm11CNTRL-BE6YnbP9J6ZZuV9dHkX17ZMnm1JGdu93"; - services.consul.interface.advertise = lib.mkForce "br0"; networking.useNetworkd = true; systemd.network.enable = true; - # Wait for br0 to be routable before considering network online - systemd.network.wait-online.extraArgs = [ "--interface=br0:routable" ]; # not useful and potentially a security loophole services.resolved.llmnr = "false";