Files
lux/modules/capabilities/syncthing.nix
T
2026-06-23 21:23:35 +02:00

51 lines
1021 B
Nix

{
config,
lib,
...
}:
let
account = config.facts.account;
syncMachines = lib.mapAttrs' (
machineName: machine:
let
name = "${account.name}@${machineName}";
in
lib.nameValuePair name {
inherit name;
id = machine.syncthingId;
}
) (lib.filterAttrs (_: machine: (machine.syncthingId or null) != null) config.facts.machines);
syncPhones = {
"pixel-10" = {
name = "pixel-10";
id = "MTJHEHA-UMZDQZ7-BTMRRLQ-Y7BFPUJ-ZTY6LZX-PDXV3IS-XVJCU7B-EPETBQZ";
};
};
syncDevices = syncMachines // syncPhones;
in
{
flake.modules.homeManager.syncthing =
{ ... }:
{
services.syncthing = {
enable = true;
overrideDevices = true;
overrideFolders = true;
settings = {
folders = {
sync = {
path = "~/sync";
label = "sync";
devices = builtins.attrNames syncDevices;
};
};
devices = syncDevices;
};
};
};
}