Add radicale

This commit is contained in:
Bun 2025-03-19 21:17:08 -04:00
parent 9b49b26673
commit 904ff3a16d
5 changed files with 63 additions and 23 deletions

View file

@ -0,0 +1,25 @@
{ config, lib, pkgs, ... }:
{
imports = [ ./nginx ];
services = lib.mkIf config.services.mailserver.enable {
radicale = {
enable = true;
settings = {
auth = {
type = "htpasswd";
htpasswd_filename = let
mailAccounts = config.mailserver.loginAccounts;
htpasswd = with lib; pkgs.writeText "radicale.users" (concatStrings
(flip mapAttrsToList mailAccounts (mail: user:
mail + ":" + user.hashedPassword + "\n"
))
);
in "${htpasswd}";
htpasswd_encryption = "bcrypt";
};
};
};
cloudflare-dyndns.domains = [ "cal.nixfox.ca" ];
};
}

View file

@ -0,0 +1,16 @@
{ config, lib, ... }:
{
services.nginx.virtualHosts."cal.nixfox.ca" = lib.mkIf config.services.go-autoconfig.enable {
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "http://127.0.0.1:5232";
proxyWebsockets = true;
extraConfig = ''
proxy_set_header X-Script-Name /;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass_header Authorization;
'';
};
};
}