summary refs log tree commit diff stats
path: root/modules/caldav.nix
blob: 6701648f3eb3d283fdd40fa5cec1a3b1a5818513 (plain) (blame)
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
{ config, pkgs, libs, ... }:
{

  services.radicale = {
    enable = true;
    settings.server.hosts = [ "0.0.0.0:5232" ];
    settings.server.ssl = "False";
    settings.auth = {
      type = "htpasswd";
      htpasswd_filename = "/secret/caldav_users";
    };
  };

  services.nginx.virtualHosts."caldav.krinitsin.com" = {
    forceSSL = true;
    useACMEHost = "krinitsin.com";
    locations."/" = {
      proxyPass = "http://localhost:5232";
      recommendedProxySettings = true;
    };
  };

  security.acme.certs."krinitsin.com".extraDomainNames = [ "caldav.krinitsin.com" ];

  services.monit.config = ''
    check process radicale with matching "radicale"
    start program = "${pkgs.systemd}/bin/systemctl start radicale"
    stop program = "${pkgs.systemd}/bin/systemctl stop radicale"
  '';

}