clanServices/data-mesher: use clanLib.getPublicValue

This commit is contained in:
pinpox
2025-10-22 23:26:04 +02:00
parent a5cd36e845
commit 4a41c4cefb

View File

@@ -1,4 +1,7 @@
{ ... }: {
clanLib,
...
}:
let let
sharedInterface = sharedInterface =
{ lib, ... }: { lib, ... }:
@@ -51,15 +54,15 @@ let
builtins.foldl' ( builtins.foldl' (
urls: name: urls: name:
let let
ipPath = "${config.clan.core.settings.directory}/vars/per-machine/${name}/zerotier/zerotier-ip/value"; ip = clanLib.vars.getPublicValue {
flake = config.clan.core.settings.directory;
machine = name;
generator = "zerotier";
file = "zerotier-ip";
default = null;
};
in in
if builtins.pathExists ipPath then if ip != null then urls ++ [ "[${ip}]:${builtins.toString settings.network.port}" ] else urls
let
ip = builtins.readFile ipPath;
in
urls ++ [ "[${ip}]:${builtins.toString settings.network.port}" ]
else
urls
) [ ] (builtins.attrNames ((roles.admin.machines or { }) // (roles.signer.machines or { }))) ) [ ] (builtins.attrNames ((roles.admin.machines or { }) // (roles.signer.machines or { })))
); );
@@ -156,9 +159,14 @@ in
readHostKey = readHostKey =
machine: machine:
let let
path = "${config.clan.core.settings.directory}/vars/per-machine/${machine}/data-mesher-host-key/public_key/value"; publicKey = clanLib.vars.getPublicValue {
flake = config.clan.core.settings.directory;
inherit machine;
generator = "data-mesher-host-key";
file = "public_key";
};
in in
builtins.elemAt (lib.splitString "\n" (builtins.readFile path)) 1; builtins.elemAt (lib.splitString "\n" publicKey) 1;
in in
{ {
enable = true; enable = true;