-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathradicale.nix
105 lines (98 loc) · 2.34 KB
/
radicale.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
{
config,
globals,
...
}:
let
radicaleDomain = "radicale.${globals.domains.personal}";
in
{
wireguard.proxy-sentinel = {
client.via = "sentinel";
firewallRuleForNode.sentinel.allowedTCPPorts = [ 8000 ];
};
globals.services.radicale.domain = radicaleDomain;
globals.monitoring.http.radicale = {
url = "https://${radicaleDomain}";
expectedBodyRegex = "Radicale Web Interface";
network = "internet";
};
nodes.sentinel = {
services.nginx = {
upstreams.radicale = {
servers."${config.wireguard.proxy-sentinel.ipv4}:8000" = { };
extraConfig = ''
zone radicale 64k;
keepalive 2;
'';
monitoring = {
enable = true;
expectedBodyRegex = "Radicale Web Interface";
};
};
virtualHosts.${radicaleDomain} = {
forceSSL = true;
useACMEWildcardHost = true;
extraConfig = ''
client_max_body_size 16M;
'';
locations."/".proxyPass = "http://radicale";
};
};
};
age.secrets.radicale-users = {
rekeyFile = config.node.secretsDir + "/radicale-users.age";
mode = "440";
group = "radicale";
};
environment.persistence."/persist".directories = [
{
directory = "/var/lib/radicale";
user = "radicale";
group = "radicale";
mode = "0700";
}
];
topology.self.services.radicale.info = "https://" + radicaleDomain;
services.radicale = {
enable = true;
settings = {
server = {
hosts = [
"0.0.0.0:8000"
"[::]:8000"
];
};
auth = {
type = "htpasswd";
htpasswd_filename = config.age.secrets.radicale-users.path;
htpasswd_encryption = "bcrypt";
};
storage = {
filesystem_folder = "/var/lib/radicale/collections";
};
};
rights = {
root = {
user = ".+";
collection = "";
permissions = "R";
};
principal = {
user = ".+";
collection = "{user}";
permissions = "RW";
};
calendars = {
user = ".+";
collection = "{user}/[^/]+";
permissions = "rw";
};
};
};
systemd.services.radicale.serviceConfig.RestartSec = "60"; # Retry every minute
backups.storageBoxes.dusk = {
subuser = "radicale";
paths = [ "/var/lib/radicale" ];
};
}