2021-12-28 16:19:29 +01:00
|
|
|
{ config, pkgs, lib, ... }: {
|
|
|
|
|
2021-12-28 19:48:14 +01:00
|
|
|
imports = [ ../../system/all/syncthing.nix ];
|
2021-12-28 16:19:29 +01:00
|
|
|
|
|
|
|
sops.secrets.syncthing_cert = { };
|
|
|
|
sops.secrets.syncthing_key = { };
|
|
|
|
|
2021-12-28 19:48:14 +01:00
|
|
|
networking.firewall.allowedTCPPorts = [ 22000 ];
|
|
|
|
networking.firewall.allowedUDPPorts = [ 22000 ];
|
|
|
|
|
2021-12-28 16:19:29 +01:00
|
|
|
services.syncthing = {
|
|
|
|
enable = true;
|
|
|
|
openDefaultPorts = false;
|
2023-01-31 09:50:46 +01:00
|
|
|
dataDir = "/media/syncthing/config";
|
|
|
|
configDir = "/media/syncthing/config";
|
2022-01-09 19:22:12 +01:00
|
|
|
overrideDevices = true;
|
|
|
|
overrideFolders = true;
|
|
|
|
cert = toString config.sops.secrets.syncthing_cert.path;
|
|
|
|
key = toString config.sops.secrets.syncthing_key.path;
|
2021-12-28 16:19:29 +01:00
|
|
|
|
2023-12-09 17:15:50 +01:00
|
|
|
settings.folders = {
|
2022-01-09 19:22:12 +01:00
|
|
|
# on media hard drive (not encrypted)
|
|
|
|
# -----------------------------------
|
|
|
|
#borg-mirror = {
|
|
|
|
# enable = true;
|
|
|
|
# path = "/media/syncthing/borg";
|
|
|
|
# rescanInterval = 36 * 3600;
|
|
|
|
# type = "sendonly";
|
|
|
|
#};
|
|
|
|
#video-material = {
|
|
|
|
# enable = true;
|
|
|
|
# path = "/home/syncthing/video-material";
|
|
|
|
#};
|
|
|
|
books = {
|
|
|
|
enable = true;
|
|
|
|
path = "/media/syncthing/books";
|
|
|
|
};
|
2022-01-17 11:57:52 +01:00
|
|
|
lost-fotos = {
|
2022-01-09 19:22:12 +01:00
|
|
|
enable = true;
|
2022-01-17 11:57:52 +01:00
|
|
|
path = "/media/syncthing/lost-fotos.ct";
|
2023-12-09 17:15:50 +01:00
|
|
|
rescanIntervalS = 40 * 24 * 3600;
|
2022-01-09 19:22:12 +01:00
|
|
|
};
|
2023-04-10 17:38:08 +02:00
|
|
|
#media = {
|
|
|
|
# enable = true;
|
|
|
|
# watch = false;
|
|
|
|
# type = "sendonly";
|
|
|
|
# path = "/media/syncthing/media";
|
|
|
|
# rescanInterval = 27 * 24 * 3600;
|
|
|
|
#};
|
2022-01-17 11:57:52 +01:00
|
|
|
music-projects = {
|
|
|
|
enable = true;
|
2023-12-09 17:15:50 +01:00
|
|
|
#watch = true;
|
2022-01-17 11:57:52 +01:00
|
|
|
path = "/media/syncthing/music-projects";
|
|
|
|
};
|
|
|
|
nextcloud_backup = {
|
|
|
|
enable = true;
|
2023-12-09 17:15:50 +01:00
|
|
|
#watch = true;
|
2022-01-17 11:57:52 +01:00
|
|
|
path = "/media/syncthing/nextcloud_backup";
|
2023-12-09 17:15:50 +01:00
|
|
|
rescanIntervalS = 23 * 3600;
|
2022-01-17 11:57:52 +01:00
|
|
|
};
|
2021-12-28 16:19:29 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-12-18 16:46:20 +01:00
|
|
|
services.permown."/media/syncthing" = {
|
2023-10-05 09:27:38 +02:00
|
|
|
# not managed by syncthing anymore
|
2021-12-28 16:19:29 +01:00
|
|
|
owner = "syncthing";
|
|
|
|
group = "syncthing";
|
2021-12-29 19:46:20 +01:00
|
|
|
umask = "0002";
|
2021-12-28 16:19:29 +01:00
|
|
|
};
|
|
|
|
systemd.services."permown._media_syncthing" = {
|
|
|
|
bindsTo = [ "media.mount" ];
|
|
|
|
after = [ "media.mount" ];
|
|
|
|
};
|
|
|
|
systemd.services."syncthing" = {
|
|
|
|
bindsTo = [ "media.mount" ];
|
|
|
|
after = [ "media.mount" ];
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|