nix-conf/systems/hetzner/radicale.nix

48 lines
925 B
Nix
Raw Normal View History

2024-07-10 23:02:54 +02:00
{
config,
pkgs,
lib,
...
}:
2024-05-03 08:59:02 +02:00
with lib;
let
mailAccounts = config.mailserver.loginAccounts;
2024-07-10 23:02:54 +02:00
htpasswd = pkgs.writeText "radicale.users" (
concatStrings (
flip mapAttrsToList mailAccounts (mail: user: mail + ":" + user.hashedPassword + "\n")
)
2024-05-03 08:59:02 +02:00
);
2024-07-10 23:02:54 +02:00
in
{
2024-05-03 08:59:02 +02:00
services.radicale = {
enable = true;
2024-05-03 09:16:50 +02:00
settings = {
auth = {
type = "htpasswd";
htpasswd_filename = "${htpasswd}";
htpasswd_encryption = "bcrypt";
};
};
2024-05-03 08:59:02 +02:00
};
services.nginx = {
virtualHosts = {
"cal.missing.ninja" = {
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;
'';
};
};
};
};
}