{ pkgs, lib, user, host, secrets, ...}: let devices = { north = { name = "NxNORTH"; id = ""; }; xps = { name = "NxXPS"; id = ""; }; ace = { name = "NxACE"; id = ""; }; s21u = { name = "NxS21U"; id = ""; }; diane = { name = "diane"; id = ""; }; daniel = { name = "daniel"; id = ""; }; tessa = { name = "tessa"; id = ""; }; georg = { name = "georg"; id = ""; }; }; conv = _: device: with device; { "${name}" = {id = id;};}; dirs = { default = { name = "sync"; path = "/home/${user}/sync"; }; }; justname = devices: (builtins.map (device: device.name)) devices; cd = /home/${user}/.config/syncthing; in lib.mkIf (user != "tv") { services.syncthing = { enable = true; user = "${user}"; dataDir = "/home/${user}/.local/share/syncthing"; # useless ? configDir = cd; # key = builtins.toFile "key.pem" secrets.syncthing.${host}.key; # cert = builtins.toFile "cert.pem" secrets.syncthing.${host}.cert; # overrideDevices = true; # overrideFolders = true; settings = { devices = with (builtins.mapAttrs conv devices); if (host == "NxXPS") then ( north // ace // s21u ) else if (host == "NxNORTH") then ( xps // ace // s21u ) else ( north // xps // s21u // diane // daniel // tessa // georg ); folders = with dirs; if (host == "NxXPS") then { "${default.name}" = { path = default.path; devices = with devices; (justname [ north ace s21u ]); }; } else { what = "dman"; }; }; }; }