diff options
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/syncthing.nix | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/modules/syncthing.nix b/modules/syncthing.nix new file mode 100644 index 0000000..71cd3ac --- /dev/null +++ b/modules/syncthing.nix @@ -0,0 +1,71 @@ +{ lib, ... }: + +let + commonFolderSettings = { + devices = [ + "bismuth" + "graphite" + "renard" + ]; + # clean every hour, keep files that are less than 14 days old. + versioning = { + type = "staggered"; + params = { + cleanInterval = toString (60 * 60); + maxAge = toString (14 * 24 * 60 * 60); + }; + }; + }; + + folder = name: path: { + ${name} = { + inherit path; + } // commonFolderSettings; + }; + +in +{ + # client-side + services.syncthing = { + enable = true; + openDefaultPorts = true; + + dataDir = "/home/mel"; + configDir = "/home/mel/.config/syncthing"; + + user = "mel"; + group = "users"; + + # only take declarative configuration below + overrideDevices = true; + overrideFolders = true; + settings = { + devices = { + # clients + bismuth.id = "MXC4UQG-PRZESJ3-AQYGWNG-EMCI44Q-UC7YFNP-6ZDF3SA-NLZCVUH-FQAK6QK"; + graphite.id = "THWA2HN-BZ4URXS-P5PKAJY-YEBYQSH-2MUDKXC-CL3YQ2A-VHFUPCE-ROHQNQ7"; + + # server, defined in network + renard.id = "XLGIQ7O-NZ6RRJT-EOEZHGT-SCX5MMM-NCC3WWO-D4QLBY5-EP5ZNKA-CL74XAU"; + }; + + folders = lib.mergeAttrsList [ + # freedesktop.org user directories + (folder "desktop" "~/Desktop") + (folder "documents" "~/Documents") + (folder "pictures" "~/Pictures") + (folder "music" "~/Music") + (folder "videos" "~/Videos") + + # other custom directories + (folder "thoughts" "~/Thoughts") + (folder "code" "~/Code") + (folder "scripts" "~/Scripts") + (folder "projects" "~/Projects") + ]; + + # no telemetry + options.urAccepted = -1; + }; + }; +} |
