From d68a3c27273b54cd4d85a9e9c3d242a68d3b1edc Mon Sep 17 00:00:00 2001 From: chris Date: Thu, 18 Sep 2025 12:00:40 +0000 Subject: [PATCH] too lazy to think of a message, so enjoy this pointless text. Good luck future me... --- clanServices/k3s/default.nix | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/clanServices/k3s/default.nix b/clanServices/k3s/default.nix index 91b4849..71d3b0a 100644 --- a/clanServices/k3s/default.nix +++ b/clanServices/k3s/default.nix @@ -90,14 +90,14 @@ in let inherit (builtins) head pathExists readFile; - controller = head (lib.attrNames roles.controller.machines or {}); + server = head (lib.attrNames (roles.server.machines or { not_found = {}; })); - # Read the controller's ip address - ipAddressPath = "${config.clan.core.settings.directory}/vars/per-machine/${controller}/k3s/ip_v4/value"; + # Read the server's ip address + ipAddressPath = "${config.clan.core.settings.directory}/vars/per-machine/${server}/k3s/ip_v4/value"; ipAddress = if pathExists ipAddressPath then readFile ipAddressPath else null; - # Read the controller's token - # tokenPath = "${config.clan.core.settings.directory}/vars/per-machine/${controller}/k3s/token"; + # Read the server's token + # tokenPath = "${config.clan.core.settings.directory}/vars/per-machine/${server}/k3s/token"; # token = if pathExists tokenPath then readFile tokenPath else null; in { @@ -118,10 +118,14 @@ in enable = true; role = "agent"; tokenFile = config.clan.core.vars.generators.k3s.files.token.path; - serverAddr = "https://${ipAddress}:6443"; + serverAddr = "https://${server}:6443"; }; }; }; }; }; + + perMachine = { config, ... }: { + exports.address = "https://${config.networking.fqdn}:6443"; + }; }