radicale-fix

This commit is contained in:
2026-04-14 15:13:39 +02:00
parent fa2c5b9139
commit 3630b9583b
+5 -4
View File
@@ -6,8 +6,9 @@
}: }:
let let
cfg = config.mailserver; cfg = config.mailserver;
hasMailDiscoveryConfig = cfg.enable && cfg.fqdn != null && cfg.domains != [ ];
in in
lib.mkIf cfg.enable ( lib.mkIf hasMailDiscoveryConfig (
let let
domain = builtins.head cfg.domains; domain = builtins.head cfg.domains;
radicaleHost = "cal.${domain}"; radicaleHost = "cal.${domain}";
@@ -22,9 +23,9 @@ lib.mkIf cfg.enable (
accountHash = accountHash =
mail: account: mail: account:
if account ? hashedPassword then if account.hashedPassword != null then
account.hashedPassword account.hashedPassword
else if account ? hashedPasswordFile then else if account.hashedPasswordFile != null then
lib.removeSuffix "\n" (builtins.readFile account.hashedPasswordFile) lib.removeSuffix "\n" (builtins.readFile account.hashedPasswordFile)
else else
throw "Radicale requires ${mail} to define hashedPassword or hashedPasswordFile"; throw "Radicale requires ${mail} to define hashedPassword or hashedPasswordFile";
@@ -57,7 +58,7 @@ lib.mkIf cfg.enable (
settings = { settings = {
auth = { auth = {
type = "htpasswd"; type = "htpasswd";
htpasswd_filename = htpasswd; htpasswd_filename = "${htpasswd}";
htpasswd_encryption = "bcrypt"; htpasswd_encryption = "bcrypt";
}; };
}; };