zion/modules/datasync.nix

107 lines
2.5 KiB
Nix

# Syncthing and Radicale configuration
{ config, pkgs, lib, ... }: {
# Enable syncthing
services.syncthing = {
enable = true;
openDefaultPorts = true;
guiAddress = "0.0.0.0:8384";
dataDir = "/vault/syncthing";
declarative = {
devices = {
panacea = {
id =
"UNZIABR-GEQ4AWT-XKFADLW-HW3SQ3Y-BEYZ56A-W530DLS-DXGQWKK-2QQ4RQ6";
};
prosorinos = {
id =
"3VO3M5I-FXJXPFZ-HSSBQIJ-4ZK4ALK-O3MI2CL-TS7BNBC-Z5OLGE2-MO7K3QK ";
};
};
folders = {
Documents = {
id = "wusdj-bfjkr";
type = "receiveonly";
path = "/vault/syncthing/Documents";
devices = [ "panacea" "prosorinos" ];
};
Notes = {
id = "kafhz-bfmzm";
type = "receiveonly";
path = "/vault/syncthing/Notes";
devices = [ "panacea" "prosorinos" ];
};
Music = {
id = "2aqt7-vpprc";
type = "receiveonly";
path = "/vault/syncthing/Music";
devices = [ "panacea" "prosorinos" ];
};
Photos = {
id = "mjibc-ustcg";
type = "receiveonly";
path = "/vault/syncthing/Photos";
devices = [ "panacea" "prosorinos" ];
};
Projects = {
id = "cjhmu-avy9v";
type = "receiveonly";
path = "/vault/syncthing/Projects";
devices = [ "panacea" ];
};
};
};
};
# Enable Radicale
services.radicale = {
enable = true;
config = ''
[server]
hosts = 127.0.0.1:5232
max_connections = 20
max_content_length = 100000000
timeout = 30
[auth]
type = htpasswd
htpasswd_filename = /var/lib/radicale/users
htpasswd_encryption = plain
delay = 1
'';
};
# ZFS automatic snapshotting
services.znapzend = {
enable = true;
autoCreation = true;
features = {
compressed = true;
recvu = true;
};
zetup = {
"vault/backups" = {
plan = "1day=>1hour,1month=>1day,1year=>1month";
recursive = true;
mbuffer.enable = true;
};
"vault/syncthing" = {
plan = "1hour=>15min,1day=>15min,1month=>1day,1year=>1month";
recursive = true;
mbuffer.enable = true;
};
"vault/git" = {
plan = "1hour=>15min,1day=>1hour,1month=>1day,1year=>1month";
recursive = true;
mbuffer.enable = true;
};
};
};
}