zion/modules/datasync.nix

146 lines
3.3 KiB
Nix
Raw Normal View History

2024-07-16 18:05:48 +02:00
{
config,
pkgs,
lib,
...
}:
{
# Syncthing configuration
2019-11-07 14:25:27 +01:00
services.syncthing = {
enable = true;
openDefaultPorts = true;
guiAddress = "0.0.0.0:8384";
dataDir = "/vault/syncthing";
2022-06-06 23:12:54 +02:00
key = config.age.secrets.syncthing.path;
2023-12-05 10:33:48 +01:00
settings = {
extraOptions.options = {
2023-07-27 00:14:13 +02:00
maxFolderConcurrency = 4;
progressUpdateIntervalS = -1;
};
2023-12-05 10:33:48 +01:00
devices = {
2024-07-16 18:05:48 +02:00
panacea.id = "VEGVHKF-P4FT3BD-4T3ML7J-65URQOU-3XKNMI5-6LGWSCI-BIQZOUE-RKQ6PQX";
2024-07-16 18:07:05 +02:00
caravanserai.id = "XQAXYEU-FWLAFZM-GTZYDGH-AIRBEXI-4CZD365-JUBTHDA-GOXXOYV-E5LEYQE";
2019-11-07 14:25:27 +01:00
};
2023-12-05 10:33:48 +01:00
folders = {
Documents = {
id = "wusdj-bfjkr";
type = "receiveonly";
path = "/vault/syncthing/Documents";
2024-07-16 18:05:48 +02:00
devices = [
"panacea"
"caravanserai"
];
2023-12-05 10:33:48 +01:00
};
2020-02-25 14:03:24 +01:00
2023-12-05 10:33:48 +01:00
Notes = {
id = "kafhz-bfmzm";
type = "receiveonly";
path = "/vault/syncthing/Notes";
2024-07-16 18:05:48 +02:00
devices = [
"panacea"
"caravanserai"
];
2023-12-05 10:33:48 +01:00
};
2020-02-25 14:03:24 +01:00
2023-12-05 10:33:48 +01:00
Music = {
id = "2aqt7-vpprc";
type = "receiveonly";
path = "/vault/syncthing/Music";
2024-07-16 18:05:48 +02:00
devices = [
"panacea"
"caravanserai"
];
2023-12-05 10:33:48 +01:00
};
2020-02-25 14:03:24 +01:00
2023-12-05 10:33:48 +01:00
Photos = {
id = "mjibc-ustcg";
type = "receiveonly";
path = "/vault/syncthing/Photos";
2024-07-16 18:05:48 +02:00
devices = [
"panacea"
"caravanserai"
];
2023-12-05 10:33:48 +01:00
};
2020-02-25 14:03:24 +01:00
2023-12-05 10:33:48 +01:00
Projects = {
id = "cjhmu-avy9v";
type = "receiveonly";
path = "/vault/syncthing/Projects";
devices = [ "panacea" ];
};
2020-12-22 03:45:30 +01:00
2023-12-05 10:33:48 +01:00
Phone = {
id = "m2007j20cg_vc7r-photos";
type = "receiveonly";
path = "/vault/syncthing/Photos/Phone";
2024-07-16 18:05:48 +02:00
devices = [
"panacea"
"caravanserai"
];
2023-12-05 10:33:48 +01:00
};
2020-12-22 03:45:30 +01:00
2023-12-05 10:33:48 +01:00
Files = {
id = "tsk52-u6rbk";
type = "receiveonly";
path = "/vault/syncthing/Files";
2024-07-16 18:05:48 +02:00
devices = [
"panacea"
"caravanserai"
];
2023-12-05 10:33:48 +01:00
};
2023-12-05 10:33:48 +01:00
Phone-screenshots = {
id = "pp70r-pbr70";
type = "receiveonly";
path = "/vault/syncthing/Photos/Phone-screenshots";
2024-07-16 18:05:48 +02:00
devices = [
"panacea"
"caravanserai"
];
2023-12-05 10:33:48 +01:00
};
2023-08-08 03:37:41 +02:00
2023-12-05 10:33:48 +01:00
Audio = {
id = "tarrs-5mxck";
type = "receiveonly";
path = "/vault/syncthing/Audio";
2024-07-16 18:05:48 +02:00
devices = [
"panacea"
"caravanserai"
];
2023-12-05 10:33:48 +01:00
};
2023-08-08 03:37:41 +02:00
};
2019-11-07 14:25:27 +01:00
};
};
# Enable Radicale
services.radicale = {
enable = true;
settings = {
server.hosts = [ "127.0.0.1:5232" ];
auth = {
type = "htpasswd";
htpasswd_filename = "/vault/radicale/users";
htpasswd_encryption = "md5";
delay = 1;
};
storage.filesystem_folder = "/vault/radicale/collections";
};
2019-11-07 14:25:27 +01:00
};
# ZFS automatic snapshots
services.zfs.autoSnapshot = {
2020-06-20 02:00:59 +02:00
enable = true;
frequent = 4;
hourly = 24;
daily = 7;
weekly = 4;
monthly = 12;
2020-06-20 02:00:59 +02:00
};
2023-06-08 18:30:16 +02:00
# Start services after ZFS mount
2024-07-16 18:05:48 +02:00
systemd.services.syncthing.unitConfig.RequiresMountsFor = [ /vault/syncthing ];
systemd.services.radicale.unitConfig.RequiresMountsFor = [ /vault/radicale ];
2023-06-08 18:30:16 +02:00
2019-11-07 14:25:27 +01:00
}