depot/lib/identity.nix

38 lines
1 KiB
Nix
Raw Permalink Normal View History

2023-08-31 01:55:45 +03:00
{ lib, ... }:
{
lib = { config, ... }: with config.identity; {
identity = {
inherit (config.meta) domain;
autoDomain = name: "${builtins.hashString "md5" name}.dev.${domain}";
ldap = {
server = with ldap.server; {
# TODO: unhardcode everything here
protocol = "ldaps";
2023-10-25 20:30:00 +03:00
hostname = "idm-ldap.internal.${domain}";
2023-08-31 01:55:45 +03:00
port = 636;
url = "${protocol}://${connectionString}";
connectionString = "${hostname}:${builtins.toString port}";
};
accounts = with ldap.accounts; {
domainComponents = ldap.lib.convertDomain domain;
2023-10-25 20:30:00 +03:00
uidAttribute = "name";
2023-08-31 01:55:45 +03:00
uidFilter = "(${uidAttribute}=%u)";
2023-10-25 20:30:00 +03:00
userSearchBase = "${domainComponents}";
2023-08-31 01:55:45 +03:00
};
lib = {
convertDomain = domain: with builtins; lib.pipe domain [
(split "\\.")
(filter isString)
(map (x: "dc=${x}"))
(concatStringsSep ",")
];
};
};
};
};
}