chore: restructure LDAP related nix files

This commit is contained in:
Alexander Tomokhov
2024-12-26 18:27:25 +04:00
parent 5d76f456c1
commit 3a904f599e
10 changed files with 178 additions and 240 deletions

View File

@@ -0,0 +1,25 @@
{ config, pkgs, ... }:
rec {
auth-passthru = config.passthru.selfprivacy.auth;
domain = config.selfprivacy.domain;
is-auth-enabled = config.selfprivacy.modules.auth.enable;
appendLdapBindPwd =
{ 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}
'';
}