Files

35 lines
849 B
Nix
Raw Permalink Normal View History

{ config, pkgs, ... }:
2024-12-20 18:41:07 +04:00
rec {
auth-passthru = config.selfprivacy.passthru.auth;
2024-12-20 18:41:07 +04:00
domain = config.selfprivacy.domain;
group = "dovecot2";
is-auth-enabled =
2025-06-18 19:53:44 +03:00
config.selfprivacy.modules.simple-nixos-mailserver.enableSso && config.selfprivacy.sso.enable;
2024-12-20 18:41:07 +04:00
appendSetting =
2025-06-18 19:53:44 +03:00
{
name,
file,
prefix,
suffix ? "",
passwordFile,
destination,
}:
2024-12-20 18:41:07 +04:00
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}
'';
}