2024-12-26 18:27:25 +04:00
|
|
|
{ config, pkgs, ... }:
|
2024-12-20 18:41:07 +04:00
|
|
|
rec {
|
2025-02-03 00:57:08 +04:00
|
|
|
auth-passthru = config.selfprivacy.passthru.auth;
|
2024-12-20 18:41:07 +04:00
|
|
|
domain = config.selfprivacy.domain;
|
2025-01-31 14:31:09 +04:00
|
|
|
group = "dovecot2";
|
2025-01-29 18:17:17 +04:00
|
|
|
is-auth-enabled =
|
2025-02-03 01:35:21 +04:00
|
|
|
config.selfprivacy.modules.simple-nixos-mailserver.enableSso
|
|
|
|
&& config.selfprivacy.sso.enable;
|
2024-12-20 18:41:07 +04:00
|
|
|
|
2025-01-31 14:31:09 +04:00
|
|
|
appendSetting =
|
2024-12-20 18:41:07 +04:00
|
|
|
{ name, file, prefix, suffix ? "", passwordFile, destination }:
|
|
|
|
pkgs.writeScript "append-ldap-bind-pwd-in-${name}" ''
|
|
|
|
#!${pkgs.stdenv.shell}
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
baseDir=$(dirname ${destination})
|
|
|
|
if (! test -d "$baseDir"); then
|
|
|
|
mkdir -p $baseDir
|
|
|
|
chmod 755 $baseDir
|
|
|
|
fi
|
|
|
|
|
|
|
|
cat ${file} > ${destination}
|
|
|
|
echo -n '${prefix}' >> ${destination}
|
|
|
|
cat ${passwordFile} >> ${destination}
|
|
|
|
echo -n '${suffix}' >> ${destination}
|
|
|
|
chmod 600 ${destination}
|
|
|
|
'';
|
|
|
|
}
|