nixos-config/nixos/configs/porani/syncthing.nix

63 lines
1.6 KiB
Nix
Raw Normal View History

2019-12-20 05:54:26 +01:00
{ config, pkgs, lib, ... }: {
2021-03-05 08:22:35 +01:00
networking.firewall.interfaces."tinc.secure".allowedTCPPorts = [ 8384 ];
custom.samba-share = {
enable = true;
folders = {
2020-11-21 18:56:11 +01:00
movies = config.services.syncthing.declarative.folders.movies.path;
series = config.services.syncthing.declarative.folders.series.path;
music = config.services.syncthing.declarative.folders.music-library.path;
};
};
2019-10-24 02:20:38 +02:00
2020-11-21 18:56:11 +01:00
services.syncthing = {
2021-03-05 08:22:35 +01:00
guiAddress = lib.mkForce "${config.networking.hostName}.secret:8384";
2019-10-24 02:20:38 +02:00
enable = true;
openDefaultPorts = true;
declarative = {
cert = toString <secrets/syncthing/cert.pem>;
key = toString <secrets/syncthing/key.pem>;
overrideFolders = true;
folders = {
2019-10-25 03:03:25 +02:00
# on media hard drive (not encrypted)
# -----------------------------------
2019-10-26 13:44:27 +02:00
movies = {
enable = true;
path = "/media/movies";
rescanInterval = 8 * 3600;
2019-10-26 13:44:27 +02:00
};
music-library = {
enable = true;
path = "/media/music-library";
rescanInterval = 8 * 3600;
2019-10-26 13:44:27 +02:00
};
series = {
enable = true;
path = "/media/series";
rescanInterval = 8 * 3600;
2019-10-26 13:44:27 +02:00
};
2019-10-24 02:20:38 +02:00
};
};
};
system.permown."/media" = {
owner = "syncthing";
group = "syncthing";
2020-09-08 21:45:42 +02:00
};
systemd.services."permown._media" = {
bindsTo = [ "media.mount" ];
after = [ "media.mount" ];
2019-10-24 02:20:38 +02:00
};
systemd.services."syncthing" = {
bindsTo = [ "media.mount" ];
after = [ "media.mount" ];
};
users.groups."syncthing".members = [ "mpd" "syncthing" "kodi" "palo" ];
2020-09-04 00:49:35 +02:00
backup.dirs = [ "/var/lib/syncthing/finance" ];
2019-10-24 02:20:38 +02:00
}
2019-10-25 09:54:38 +02:00