nixos-conf/servers/syncthing.nix

73 lines
1.9 KiB
Nix

{ config, lib, ... }:
{
boot.kernel.sysctl."fs.inotify.max_user_watches" = 204800;
services.syncthing = {
enable = true;
user = "vili";
dataDir = config.users.users.${config.services.syncthing.user}.home;
settings = {
defaults.ignores = [
"/Projects/Programming"
];
options = {
urAccepted = -1;
localAnnounceEnabled = false;
globalAnnounceEnabled = false;
natEnabled = false;
relaysEnabled = false;
};
devices = lib.mkMerge [
{
"syncthing" = {
id = "J6GNM4Z-2TWASPT-3P3EW4V-KZEQYFF-TXL22QX-4YTZ3WO-WLM7GQ7-NUP66A4";
addresses = [ "tcp://syncthing.vsinerva.fi:22000" ];
};
}
(lib.mkIf (config.networking.hostName == "syncthing") {
"helium" = {
id = "2MRUBSY-NHXYMAW-SY22RHP-CNNMHKR-DPDKMM4-2XV5F6M-6KSNLQI-DD4EOAM";
addresses = [ "tcp://helium.vsinerva.fi:22000" ];
};
"lithium" = {
id = "S4ZORDV-QBY7QC7-FQHADMZ-NQSKJUA-7B7LQNS-CWJLSMG-JPMN7YJ-OVRDZQA";
addresses = [ "tcp://lithium.vsinerva.fi:22000" ];
};
})
];
folders =
let
default = {
devices = lib.mkMerge [
[ "syncthing" ]
(lib.mkIf (config.networking.hostName == "syncthing") [
"helium"
"lithium"
])
];
versioning = {
type = "trashcan";
params.cleanoutDays = "30";
};
fsWatcherDelayS = 1;
};
in
{
"~/Documents" = default;
"~/Music" = default;
"~/Pictures" = default;
"~/Projects" = default;
"~/School" = default;
"~/Videos" = default;
"~/Zotero" = default;
};
};
#TCP/UDP 22000 for transfers and UDP 21027 for discovery
openDefaultPorts = true;
};
}