zion/modules/datasync.nix

66 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 = "QGDGEZQ-INE7XDY-DNX2QI4-QI7ANQJ-57REEO2-FUMH545-FZS5RYU-ULF7HA2"; };
roamer = { id = "DS3PJH3-J6SNMHM-XUJTDLO-DHGJL5U-J3RUMAG-4OSJWIK-VSJSDVJ-PIHZ2QP"; };
unit = { id = "VYHHL4A-KJ6WUYQ-4SNWNA3-YRCFTHE-52ZTRLP-4LV6ZDV-4VAJLHC-RJXYYQY"; };
};
folders = {
"Documents" = { devices = [ "monolith" "roamer" "unit" ]; id = "wusdj-bfjkr"; };
"Notes" = { devices = [ "monolith" "roamer" "unit" ]; id = "kafhz-bfmzm"; };
"Music" = { devices = [ "monolith" "roamer" "unit" ]; id = "2aqt7-vpprc"; };
"Photos" = { devices = [ "monolith" "roamer" "unit" ]; id = "mjibc-ustcg"; };
"Security" = { devices = [ "monolith" "roamer" "unit" ]; id = "z4lpn-pmm3v"; };
"Projects" = { devices = [ "monolith" "unit" ]; id = "cjhmu-avy9v"; };
Documents.type = "receiveonly";
Notes.type = "receiveonly";
Music.type = "receiveonly";
Photos.type = "receiveonly";
Security.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";
};
};
};
# 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
'';
};
}