zion/modules/datasync.nix

70 lines
1.9 KiB
Nix

# syncthingthing and Radicale configuration
{ config, pkgs, lib, ... }:
{
environment.systemPackages = with pkgs; [
syncthing
syncthing-relay
syncthing-discovery
radicale
];
# Enable syncthingthing
services.syncthing = {
enable = true;
openDefaultPorts = true;
guiAddress = "0.0.0.0:8384";
dataDir = "/vault/syncthing";
declarative = {
devices = {
monolith = { id = "QGDGEZQ-INE7XDY-DNX2QI4-QI7ANQJ-57REEO2-FUMH545-FZS5RYU-ULF7HA2"; };
roamer = { id = "DS3PJH3-J6SNMHM-XUJTDLO-DHGJL5U-J3RUMAG-4OSJWIK-VSJSDVJ-PIHZ2QP"; };
};
#cert = "";
#key = "";
folders = {
"Documents" = { devices = [ "monolith" ]; id = "wusdj-bfjkr"; };
"Notes" = { devices = [ "monolith" "roamer" ]; id = "2aqt7-vpprc"; };
"Music" = { devices = [ "monolith" ]; id = "kafhz-bfmzm"; };
"Photos" = { devices = [ "monolith" "roamer" ]; id = "mjibc-ustcg"; };
"Security" = { devices = [ "monolith" ]; id = "z4lpn-pmm3v"; };
"Projects" = { devices = [ "monolith" ]; id = "cjhmu-avy9v"; };
Documents.type = "receiveonly";
Projects.type = "receiveonly";
Documents.path = "/vault/syncthing/Documents";
Notes.path = "/vault/syncthing/Notes";
Music.path = "/vault/syncthing/Music";
Photos.path = "/vault/syncthing/Photos";
Security.path = "/vault/syncthing/Security";
Projects.path = "/vault/syncthing/Projects";
};
};
relay = {
enable = true;
pools = [ "" ];
listenAddress = "0.0.0.0";
};
};
# Enable Radicale
services.radicale = {
enable = true;
config = ''
[server]
hosts = 0.0.0.0:5232
max_connections = 20
max_content_length = 100000000
timeout = 30
[auth]
type = htpasswd
htpasswd_filename = /var/lib/radicale/radicale.users
htpasswd_encryption = plain
delay = 1
'';
};
}