{ 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; }; bruno = { path = "~/dev/bruno"; label = "bruno"; devices = builtins.attrNames syncDevices; }; }; devices = syncDevices; }; }; }; }