Files
lux-old/modules/apps/syncthing.nix
2026-02-28 19:41:14 +01:00

50 lines
908 B
Nix

{
inputs,
den,
lib,
...
}:
let
meshDevices = lib.listToAttrs (
lib.concatMap (
host:
lib.mapAttrsToList (
userName: user:
let
name = "${userName}@${host.name}";
in
{
inherit name;
value = {
inherit name;
id = user.syncthingId;
};
}
) (lib.filterAttrs (_: u: u ? syncthingId) host.users)
) (lib.attrValues den.hosts.x86_64-linux)
);
in
{
lux.syncthing = {
homeManager = {
services.syncthing = {
enable = true;
overrideDevices = true;
overrideFolders = true;
settings = {
folders = {
sync = {
path = "~/sync";
label = "sync";
devices = lib.attrNames meshDevices;
};
};
devices = meshDevices;
};
};
};
};
}