improve syncthing config

This commit is contained in:
Henri Dohmen 2025-12-30 14:49:21 +01:00
parent 72c6b7ce88
commit 6461102325
Signed by: hd
GPG key ID: AB79213B044674AE
5 changed files with 52 additions and 31 deletions

View file

@ -9,12 +9,18 @@ let
};
load-var = x: import x inputs';
# watch out for cycles
outputs = {
outputs = rec {
"lan-dns" = load-var ./lan-dns.nix;
"ssh-keys" = load-var ./ssh-keys.nix;
"wg" = load-var ./wg.nix;
"syncthing" = load-var ./syncthing.nix;
"syncthing-managed-clients" = lib'.importJSON ./syncthing-managed-clients.json;
desktops = [
"c2"
"fw"
"solo"
];
servers = [ "roam" ];
clients = desktops ++ servers;
};
in
outputs

View file

@ -1,6 +1,6 @@
{ var, lib, ... }:
let
inherit (var.syncthing-managed-clients) managed_clients hashes;
inherit (lib.importJSON ./syncthing-managed-clients.json) managed_clients hashes;
unmanaged = {
"supernote".id = "3LHXAND-FXDIDWR-7BYAIX4-3GW2BWY-IHTX7HH-LTEDI5T-W7ETGVC-BUP2NAF";
};
@ -15,4 +15,7 @@ assert (
[ ] == (lib.intersectLists managed_clients (builtins.attrNames unmanaged))
) "Syncthing clients must either be unmanaged or declaratively configured."
);
unmanaged // builtins.mapAttrs (_: v: { id = v; }) hashes
rec {
managed = builtins.mapAttrs (_: v: { id = v; }) hashes;
all = unmanaged // managed;
}