nixos-conf/servers/syncthing.nix

74 lines
1.9 KiB
Nix
Raw Normal View History

2025-05-29 15:39:42 +03:00
{ config, lib, ... }:
2024-06-02 01:31:02 +03:00
{
2024-08-21 11:02:02 +03:00
boot.kernel.sysctl."fs.inotify.max_user_watches" = 204800;
2024-06-02 05:53:39 +03:00
services.syncthing = {
enable = true;
user = "vili";
dataDir = config.users.users.${config.services.syncthing.user}.home;
2024-06-02 01:31:02 +03:00
2024-06-02 05:53:39 +03:00
settings = {
2025-05-31 21:31:52 +03:00
defaults.ignores = [
"/Projects/Programming"
];
options = {
urAccepted = -1;
localAnnounceEnabled = false;
globalAnnounceEnabled = false;
natEnabled = false;
relaysEnabled = false;
};
2025-05-29 15:39:42 +03:00
devices = lib.mkMerge [
2024-10-02 10:46:06 +03:00
{
"syncthing" = {
2024-12-03 02:44:38 +02:00
id = "J6GNM4Z-2TWASPT-3P3EW4V-KZEQYFF-TXL22QX-4YTZ3WO-WLM7GQ7-NUP66A4";
2024-10-02 10:46:06 +03:00
addresses = [ "tcp://syncthing.vsinerva.fi:22000" ];
};
}
2025-05-29 15:39:42 +03:00
(lib.mkIf (config.networking.hostName == "syncthing") {
2024-10-02 10:46:06 +03:00
"helium" = {
id = "2MRUBSY-NHXYMAW-SY22RHP-CNNMHKR-DPDKMM4-2XV5F6M-6KSNLQI-DD4EOAM";
addresses = [ "tcp://helium.vsinerva.fi:22000" ];
2024-10-02 10:46:06 +03:00
};
"lithium" = {
id = "S4ZORDV-QBY7QC7-FQHADMZ-NQSKJUA-7B7LQNS-CWJLSMG-JPMN7YJ-OVRDZQA";
addresses = [ "tcp://lithium.vsinerva.fi:22000" ];
2024-10-02 10:46:06 +03:00
};
})
];
2024-06-02 01:31:02 +03:00
2024-06-02 05:53:39 +03:00
folders =
let
default = {
2025-05-29 15:39:42 +03:00
devices = lib.mkMerge [
2024-10-02 10:46:06 +03:00
[ "syncthing" ]
2025-05-29 15:39:42 +03:00
(lib.mkIf (config.networking.hostName == "syncthing") [
2024-10-02 10:46:06 +03:00
"helium"
"lithium"
])
2024-06-02 16:18:19 +03:00
];
2024-06-02 05:53:39 +03:00
versioning = {
type = "trashcan";
params.cleanoutDays = "30";
};
fsWatcherDelayS = 1;
};
2024-08-21 10:45:41 +03:00
in
{
"~/Documents" = default;
2025-05-31 21:31:52 +03:00
"~/Music" = default;
2024-06-02 05:53:39 +03:00
"~/Pictures" = default;
2025-05-31 21:31:52 +03:00
"~/Projects" = default;
2024-06-02 05:53:39 +03:00
"~/School" = default;
2025-05-31 21:31:52 +03:00
"~/Videos" = default;
2024-06-02 05:53:39 +03:00
"~/Zotero" = default;
};
};
2024-06-02 16:18:19 +03:00
#TCP/UDP 22000 for transfers and UDP 21027 for discovery
openDefaultPorts = true;
};
}