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

119 lines
2.7 KiB
Nix
Raw Normal View History

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 = {
2023-03-12 17:50:01 +01:00
media = config.services.syncthing.folders.media.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
};
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-12-15 15:48:53 +01:00
art = {
enable = true;
path = "/home/syncthing/art";
};
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";
2023-02-24 03:51:12 +01:00
rescanInterval = 40 * 24 * 3600;
2022-01-15 09:32:59 +01:00
};
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";
2023-02-24 03:51:12 +01:00
rescanInterval = 5 * 31 * 24 * 3600;
2019-10-24 02:20:38 +02:00
};
2023-03-12 17:50:01 +01:00
media = {
2022-01-15 09:32:59 +01:00
enable = true;
2023-03-12 17:50:01 +01:00
path = "/media/syncthing/media";
2023-03-13 09:47:33 +01:00
rescanInterval = 30 * 24 * 3600;
type = "receiveonly";
2023-03-12 17:50:01 +01:00
versioning = {
type = "simple";
params.keep = "3";
};
2022-01-15 09:32:59 +01:00
};
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;
};
2019-10-24 02:20:38 +02:00
};
};
2020-04-10 11:36:58 +02:00
2022-12-18 16:46:20 +01:00
services.permown."/home/syncthing" = {
owner = "syncthing";
group = "syncthing";
};
2022-12-18 17:29:16 +01:00
services.permown."/media/syncthing" = {
2020-09-08 21:45:42 +02:00
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
}