zion/modules/datasync.nix

81 lines
2.0 KiB
Nix

# Syncthing and Radicale configuration
{ config, pkgs, lib, ... }:
{
environment.systemPackages = with pkgs; [
syncthing
radicale
];
# Enable syncthing
services.syncthing = {
enable = true;
openDefaultPorts = true;
guiAddress = "0.0.0.0:8384";
dataDir = "/vault/syncthing";
declarative = {
devices = {
monolith = { id = "64P2YDH-S5V7PKM-XXBOSXC-WEXUSC7-B553ELI-6IJ3CPJ-ZFB3YA5-MTKAFAH"; };
roamer = { id = "7CDUG25-KGBOIA7-Y73TZGA-NEHYLZP-OEOEWVN-DMS5U7K-QNNMPKY-YNGEWQL"; };
unit = { id = "VYHHL4A-KJ6WUYQ-4SNWNA3-YRCFTHE-52ZTRLP-4LV6ZDV-4VAJLHC-RJXYYQY"; };
};
folders = {
Documents = {
id = "wusdj-bfjkr";
type = "receiveonly";
path = "/vault/syncthing/Documents";
devices = [ "monolith" "roamer" "unit" ];
};
Notes = {
id = "kafhz-bfmzm";
type = "receiveonly";
path = "/vault/syncthing/Notes";
devices = [ "monolith" "roamer" "unit" ];
};
Music = {
id = "2aqt7-vpprc";
type = "receiveonly";
path = "/vault/syncthing/Music";
devices = [ "monolith" "roamer" "unit" ];
};
Photos = {
id = "mjibc-ustcg";
type = "receiveonly";
path = "/vault/syncthing/Photos";
devices = [ "monolith" "roamer" "unit" ];
};
Projects = {
devices = [ "monolith" "unit" ];
id = "cjhmu-avy9v";
type = "receiveonly";
path = "/vault/syncthing/Projects";
watch = false;
};
};
};
};
# 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
'';
};
}