nixos-config/configs/porani/syncthing.nix
Ingolf Wagner 5f15710bec
syncthing: rescanInterval is 8 hours on media,
to avoid starting the hard drive when not needed
2020-01-26 14:33:50 +13:00

94 lines
2.4 KiB
Nix

{ config, pkgs, lib, ... }: {
custom.samba-share = {
enable = true;
folders = {
movies = config.test.services.syncthing.declarative.folders.movies.path;
series = config.test.services.syncthing.declarative.folders.series.path;
music =
config.test.services.syncthing.declarative.folders.music-library.path;
};
};
test.services.syncthing = {
enable = true;
openDefaultPorts = true;
declarative = {
cert = toString <secrets/syncthing/cert.pem>;
key = toString <secrets/syncthing/key.pem>;
overrideFolders = true;
folders = {
# on encrypted device
# -------------------
desktop = {
enable = true;
path = "/var/lib/syncthing/desktop";
};
finance = {
enable = true;
path = "/var/lib/syncthing/finance";
versioning = {
type = "simple";
params.keep = "10";
};
};
fotos = {
enable = true;
path = "/var/lib/syncthing/fotos";
};
lost-fotos = {
enable = true;
path = "/var/lib/syncthing/lost-fotos.ct";
};
# on media hard drive (not encrypted)
# -----------------------------------
movies = {
enable = true;
path = "/media/movies";
rescanInterval = 8 * 3600;
};
music-library = {
enable = true;
path = "/media/music-library";
rescanInterval = 8 * 3600;
};
podcasts = {
enable = true;
path = "/media/podcasts";
rescanInterval = 8 * 3600;
};
series = {
enable = true;
path = "/media/series";
rescanInterval = 8 * 3600;
};
smartphone-music = {
enable = true;
path = "/media/smartphone-music";
rescanInterval = 8 * 3600;
};
};
};
};
systemd.services."permown._media" = {
bindsTo = [ "media.mount" ];
after = [ "media.mount" ];
};
system.permown."/media" = {
owner = "syncthing";
group = "syncthing";
umask = "0007";
};
systemd.services."syncthing" = {
bindsTo = [ "media.mount" ];
after = [ "media.mount" ];
};
users.groups."syncthing".members = [ "mpd" "syncthing" "kodi" "palo" ];
backup.all.restic.dirs = [ "/var/lib/syncthing/finance" ];
}