zion/modules/datasync.nix

63 lines
1.9 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 = "XE6YPFU-TB7ARWF-7NDSJ35-2PBNNDS-VTXGGCH-KC2UBLE-UHWAXH3-MWD26A5"; };
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"; };
"Projects" = { devices = [ "monolith" "unit" ]; id = "cjhmu-avy9v"; };
Documents.type = "receiveonly";
Notes.type = "receiveonly";
Music.type = "receiveonly";
Photos.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";
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
'';
};
}