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
|
|
|
|
2022-01-09 19:22:12 +01:00
|
|
|
folders = {
|
|
|
|
# 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-02-24 02:01:18 +01:00
|
|
|
rescanInterval = 40 * 24 * 3600;
|
2022-01-09 19:22:12 +01:00
|
|
|
};
|
2023-03-12 17:50:01 +01:00
|
|
|
media = {
|
2022-01-09 19:22:12 +01:00
|
|
|
enable = true;
|
2022-01-18 20:20:56 +01:00
|
|
|
watch = true;
|
2023-03-13 09:47:33 +01:00
|
|
|
type = "sendonly";
|
2023-03-12 17:50:01 +01:00
|
|
|
path = "/media/syncthing/media";
|
2023-03-13 09:47:33 +01:00
|
|
|
rescanInterval = 27 * 24 * 3600;
|
2022-01-09 19:22:12 +01:00
|
|
|
};
|
2022-01-17 11:57:52 +01:00
|
|
|
music-projects = {
|
|
|
|
enable = true;
|
2022-01-18 20:20:56 +01:00
|
|
|
watch = true;
|
2022-01-17 11:57:52 +01:00
|
|
|
path = "/media/syncthing/music-projects";
|
|
|
|
};
|
|
|
|
nextcloud_backup = {
|
|
|
|
enable = true;
|
2022-01-18 20:20:56 +01:00
|
|
|
watch = true;
|
2022-01-17 11:57:52 +01:00
|
|
|
path = "/media/syncthing/nextcloud_backup";
|
2023-02-24 02:01:18 +01:00
|
|
|
rescanInterval = 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" = {
|
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" ];
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|