nixos-config/nixos/machines/robi/syncthing.nix

92 lines
2.2 KiB
Nix
Raw Normal View History

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;
2021-12-28 19:48:14 +01:00
dataDir = "/media/syncthing";
configDir = "/media/syncthing";
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 = {
2021-12-28 16:19:29 +01:00
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";
2022-01-09 19:22:12 +01:00
};
movies = {
enable = true;
2022-01-18 20:20:56 +01:00
watch = true;
2022-01-09 19:22:12 +01:00
path = "/media/syncthing/movies";
2021-12-28 16:19:29 +01:00
};
2022-01-09 19:22:12 +01:00
music-library = {
enable = true;
2022-01-18 20:20:56 +01:00
watch = true;
2022-01-09 19:22:12 +01:00
path = "/media/syncthing/music";
};
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";
};
samples = {
enable = true;
2022-01-18 20:20:56 +01:00
watch = true;
2022-01-17 11:57:52 +01:00
path = "/media/syncthing/samples";
};
series = {
enable = true;
2022-01-18 20:20:56 +01:00
watch = true;
2022-01-17 11:57:52 +01:00
path = "/media/syncthing/series";
};
2022-01-09 19:22:12 +01:00
2021-12-28 16:19:29 +01:00
};
};
system.permown."/media/syncthing" = {
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" ];
};
}