{ config, pkgs, lib, ... }: { custom.samba-share = { enable = true; folders = { movies = config.services.syncthing.declarative.folders.movies.path; series = config.services.syncthing.declarative.folders.series.path; samples = config.services.syncthing.declarative.folders.samples.path; music = config.services.syncthing.declarative.folders.music-library.path; books = config.services.syncthing.declarative.folders.books.path; }; }; services.syncthing = { enable = true; openDefaultPorts = false; dataDir = "/home/syncthing"; configDir = "/home/syncthing"; declarative = { cert = toString ; key = toString ; overrideFolders = true; folders = { # on encrypted hard drive # ----------------------- private = { enable = true; path = "/home/syncthing/private"; }; desktop = { enable = true; path = "/home/syncthing/desktop"; }; finance = { enable = true; path = "/home/syncthing/finance"; }; fotos = { enable = true; path = "/home/syncthing/fotos"; }; lost-fotos = { enable = true; path = "/home/syncthing/lost-fotos.ct"; }; music-projects = { enable = true; path = "/home/syncthing/music-projects"; }; zettlr = { enable = true; path = "/home/syncthing/zettlr"; }; # on media hard drive (not encrypted) # ----------------------------------- video-material = { enable = true; path = "/home/syncthing/video-material"; }; music-library-free = { enable = true; path = "/media/syncthing/music-library-free"; rescanInterval = 8 * 3600; }; books = { enable = true; path = "/media/syncthing/books"; rescanInterval = 8 * 3600; }; porn = { enable = true; path = "/media/syncthing/porn"; rescanInterval = 8 * 3600; }; samples = { enable = true; path = "/media/syncthing/samples"; rescanInterval = 8 * 3600; }; movies = { enable = true; path = "/media/syncthing/movies"; rescanInterval = 8 * 3600; }; music-library = { enable = true; path = "/media/syncthing/music-library"; rescanInterval = 8 * 3600; }; series = { enable = true; path = "/media/syncthing/series"; rescanInterval = 8 * 3600; }; smartphone-folder = { enable = true; path = "/media/syncthing/smartphone-folder"; rescanInterval = 8 * 3600; }; processing = { enable = true; path = "/media/syncthing/sketchbook"; rescanInterval = 8 * 3600; }; }; }; }; system.permown."/media/syncthing" = { owner = "syncthing"; group = "syncthing"; }; systemd.services."permown._media_syncthing" = { bindsTo = [ "media.mount" ]; after = [ "media.mount" ]; }; systemd.services."syncthing" = { bindsTo = [ "media.mount" ]; after = [ "media.mount" ]; }; backup.dirs = [ "/home/syncthing/finance" ]; }