services/calendar: init w/ radicale

This commit is contained in:
kat witch 2021-04-30 20:35:43 +01:00
parent d721a1ff60
commit 24b44264d2
No known key found for this signature in database
GPG key ID: 1B477797DCA5EC72
2 changed files with 45 additions and 0 deletions

44
services/calendar.nix Normal file
View file

@ -0,0 +1,44 @@
{ config, pkgs, lib, ... }:
with lib;
let
mailAccounts = config.mailserver.loginAccounts;
htpasswd = pkgs.writeText "radicale.users" (concatStrings
(flip mapAttrsToList mailAccounts (mail: user:
mail + ":" + user.hashedPassword + "\n"
))
);
in {
services.radicale = {
enable = true;
config = ''
[auth]
type = htpasswd
htpasswd_filename = ${htpasswd}
htpasswd_encryption = bcrypt
'';
};
services.nginx.virtualHosts = {
"cal.kittywit.ch" = {
forceSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://localhost:5232/";
extraConfig = ''
proxy_set_header X-Script-Name /;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass_header Authorization;
'';
};
};
};
deploy.tf.dns.records.kittywitch_cal = {
tld = "kittywit.ch.";
domain = "cal";
cname.target = "athame.kittywit.ch.";
};
}