22
0
mirror of https://github.com/SuperSandro2000/nixos-modules.git synced 2024-06-11 10:44:10 +02:00
nixos-modules/modules/hedgedoc.nix

35 lines
1.0 KiB
Nix
Raw Normal View History

{ config, lib, libS, ... }:
2023-06-05 19:53:21 +02:00
let
2023-06-28 01:00:14 +02:00
cfg = config.services.hedgedoc.ldap;
2023-06-05 19:53:21 +02:00
inherit (config.security) ldap;
in
{
options = {
services.hedgedoc.ldap = {
enable = lib.mkEnableOption (lib.mdDoc ''
login only via LDAP.
Use `service.hedgedoc.environmentFile` in format `bindCredentials=password` to set the credentials used by the search user
'');
2023-06-28 01:00:14 +02:00
userGroup = libS.ldap.mkUserGroupOption;
2023-06-05 19:53:21 +02:00
};
};
config.services.hedgedoc.settings.ldap = lib.mkIf cfg.enable {
url = "ldaps://${ldap.domainName}:${toString ldap.port}";
bindDn = ldap.bindDN;
bindCredentials = "$bindCredentials";
searchBase = ldap.userBaseDN;
searchFilter = ldap.searchFilterWithGroupFilter cfg.userGroup (ldap.userFilter "{{username}}");
tlsca = "/etc/ssl/certs/ca-certificates.crt";
useridField = ldap.userField;
};
config.services.portunus.seedSettings.groups = lib.optional (cfg.userGroup != null) {
long_name = "Hedgedoc Users";
name = cfg.userGroup;
2024-01-08 14:47:38 +01:00
permissions = { };
2023-06-05 19:53:21 +02:00
};
}