2019-12-20 05:54:26 +01:00
|
|
|
{ config, pkgs, lib, ... }: {
|
2019-10-24 02:20:38 +02:00
|
|
|
|
2022-08-21 13:25:43 +02:00
|
|
|
users.groups."syncthing".members = [ "mpd" "syncthing" "upload" ];
|
2020-04-10 11:36:58 +02:00
|
|
|
|
|
|
|
custom.samba-share = {
|
2020-10-28 23:56:30 +01:00
|
|
|
enable = true;
|
2020-04-10 11:36:58 +02:00
|
|
|
folders = {
|
2022-01-15 09:32:59 +01:00
|
|
|
movies = config.services.syncthing.folders.movies.path;
|
|
|
|
music = config.services.syncthing.folders.music-library.path;
|
|
|
|
samples = config.services.syncthing.folders.samples.path;
|
|
|
|
series = config.services.syncthing.folders.series.path;
|
2022-01-04 07:31:19 +01:00
|
|
|
series2 = "/media/series";
|
2022-01-15 09:32:59 +01:00
|
|
|
books = config.services.syncthing.folders.books.path;
|
2020-04-10 11:36:58 +02:00
|
|
|
};
|
2022-08-21 13:25:43 +02:00
|
|
|
private.upload = {
|
|
|
|
folder = "/media/upload";
|
|
|
|
users = "upload";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
users.users.upload = {
|
|
|
|
isNormalUser = true;
|
|
|
|
group = "upload";
|
2020-04-10 11:36:58 +02:00
|
|
|
};
|
|
|
|
|
2022-08-27 03:03:02 +02:00
|
|
|
users.groups.upload = { };
|
2022-08-21 13:25:43 +02:00
|
|
|
|
2021-09-27 18:53:45 +02:00
|
|
|
sops.secrets.syncthing_cert = { };
|
|
|
|
sops.secrets.syncthing_key = { };
|
|
|
|
|
2020-11-21 18:56:11 +01:00
|
|
|
services.syncthing = {
|
2019-10-24 02:20:38 +02:00
|
|
|
enable = true;
|
2020-04-10 11:36:58 +02:00
|
|
|
openDefaultPorts = true;
|
2022-01-15 09:32:59 +01:00
|
|
|
cert = toString config.sops.secrets.syncthing_cert.path;
|
|
|
|
key = toString config.sops.secrets.syncthing_key.path;
|
2019-10-24 02:20:38 +02:00
|
|
|
|
2022-01-15 09:32:59 +01:00
|
|
|
overrideFolders = true;
|
|
|
|
folders = {
|
2019-10-25 03:03:25 +02:00
|
|
|
|
2022-01-15 09:32:59 +01:00
|
|
|
# on encrypted drive
|
|
|
|
# ------------------
|
|
|
|
private = {
|
|
|
|
enable = true;
|
|
|
|
path = "/home/syncthing/private";
|
|
|
|
};
|
2022-09-23 20:29:18 +02:00
|
|
|
password-store = {
|
|
|
|
enable = true;
|
|
|
|
path = "/home/syncthing/password-store";
|
|
|
|
};
|
2022-01-15 09:32:59 +01:00
|
|
|
desktop = {
|
|
|
|
enable = true;
|
|
|
|
path = "/home/syncthing/desktop";
|
|
|
|
};
|
|
|
|
finance = {
|
|
|
|
enable = true;
|
|
|
|
path = "/home/syncthing/finance";
|
|
|
|
};
|
|
|
|
fotos = {
|
|
|
|
enable = true;
|
|
|
|
path = "/home/syncthing/fotos";
|
|
|
|
};
|
2019-10-24 02:20:38 +02:00
|
|
|
|
2022-01-15 09:32:59 +01:00
|
|
|
# no need to be encrypted
|
|
|
|
# -----------------------
|
|
|
|
books = {
|
|
|
|
enable = true;
|
|
|
|
path = "/media/syncthing/books";
|
|
|
|
rescanInterval = 8 * 3600;
|
|
|
|
};
|
2022-01-17 11:57:52 +01:00
|
|
|
lost-fotos = {
|
2022-01-15 09:32:59 +01:00
|
|
|
enable = true;
|
2022-01-17 11:57:52 +01:00
|
|
|
path = "/media/syncthing/lost-fotos.ct";
|
2022-01-15 09:32:59 +01:00
|
|
|
rescanInterval = 8 * 3600;
|
2019-10-24 02:20:38 +02:00
|
|
|
};
|
2022-01-17 11:57:52 +01:00
|
|
|
movies = {
|
2022-01-15 09:32:59 +01:00
|
|
|
enable = true;
|
2022-01-17 11:57:52 +01:00
|
|
|
path = "/media/syncthing/movies";
|
|
|
|
rescanInterval = 8 * 3600;
|
2022-01-15 09:32:59 +01:00
|
|
|
};
|
|
|
|
music-library = {
|
|
|
|
enable = true;
|
|
|
|
path = "/media/syncthing/music-library";
|
|
|
|
rescanInterval = 8 * 3600;
|
|
|
|
};
|
2022-01-17 11:57:52 +01:00
|
|
|
music-projects = {
|
|
|
|
enable = true;
|
|
|
|
path = "/media/syncthing/music-projects";
|
|
|
|
rescanInterval = 8 * 3600;
|
|
|
|
};
|
|
|
|
nextcloud_backup = {
|
2022-01-15 09:32:59 +01:00
|
|
|
enable = true;
|
2022-01-17 11:57:52 +01:00
|
|
|
path = "/media/syncthing/nextcloud_backup";
|
2022-01-15 09:32:59 +01:00
|
|
|
rescanInterval = 8 * 3600;
|
|
|
|
};
|
|
|
|
samples = {
|
|
|
|
enable = true;
|
|
|
|
path = "/media/syncthing/samples";
|
|
|
|
rescanInterval = 8 * 3600;
|
|
|
|
};
|
|
|
|
series = {
|
|
|
|
enable = true;
|
|
|
|
path = "/media/syncthing/series";
|
|
|
|
rescanInterval = 8 * 3600;
|
|
|
|
};
|
2019-10-24 02:20:38 +02:00
|
|
|
};
|
|
|
|
};
|
2020-04-10 11:36:58 +02:00
|
|
|
|
2021-02-19 11:42:37 +01:00
|
|
|
system.permown."/home/syncthing" = {
|
|
|
|
owner = "syncthing";
|
|
|
|
group = "syncthing";
|
|
|
|
};
|
2020-09-08 21:45:42 +02:00
|
|
|
system.permown."/media/syncthing" = {
|
|
|
|
owner = "syncthing";
|
|
|
|
group = "syncthing";
|
|
|
|
};
|
|
|
|
systemd.services."permown._media_syncthing" = {
|
|
|
|
bindsTo = [ "media.mount" ];
|
|
|
|
after = [ "media.mount" ];
|
|
|
|
};
|
2020-04-10 11:36:58 +02:00
|
|
|
systemd.services."syncthing" = {
|
|
|
|
bindsTo = [ "media.mount" ];
|
|
|
|
after = [ "media.mount" ];
|
|
|
|
};
|
|
|
|
|
2022-01-23 20:23:47 +01:00
|
|
|
backup.dirs = [
|
|
|
|
config.services.syncthing.folders.finance.path
|
|
|
|
];
|
|
|
|
|
2019-10-24 02:20:38 +02:00
|
|
|
}
|