{ 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; }; }; }; }; }