aa122cbae7
This CL can be used to compare the style of nixpkgs-fmt against other formatters (nixpkgs, alejandra). Change-Id: I87c6abff6bcb546b02ead15ad0405f81e01b6d9e Reviewed-on: https://cl.tvl.fyi/c/depot/+/4397 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org> Reviewed-by: lukegb <lukegb@tvl.fyi> Reviewed-by: wpcarro <wpcarro@gmail.com> Reviewed-by: Profpatsch <mail@profpatsch.de> Reviewed-by: kanepyork <rikingcoding@gmail.com> Reviewed-by: tazjin <tazjin@tvl.su> Reviewed-by: cynthia <cynthia@tvl.fyi> Reviewed-by: edef <edef@edef.eu> Reviewed-by: eta <tvl@eta.st> Reviewed-by: grfn <grfn@gws.fyi>
81 lines
2.1 KiB
Nix
81 lines
2.1 KiB
Nix
# Configures an OpenLDAP instance for TVL
|
|
#
|
|
# TODO(tazjin): Configure ldaps://
|
|
{ depot, lib, pkgs, ... }:
|
|
|
|
with depot.nix.yants;
|
|
|
|
let
|
|
user = struct {
|
|
username = string;
|
|
email = string;
|
|
password = string;
|
|
displayName = option string;
|
|
};
|
|
|
|
toLdif = defun [ user string ] (u: ''
|
|
dn: cn=${u.username},ou=users,dc=tvl,dc=fyi
|
|
objectClass: organizationalPerson
|
|
objectClass: inetOrgPerson
|
|
sn: ${u.username}
|
|
cn: ${u.username}
|
|
displayName: ${u.displayName or u.username}
|
|
mail: ${u.email}
|
|
userPassword: ${u.password}
|
|
'');
|
|
|
|
inherit (depot.ops) users;
|
|
|
|
in
|
|
{
|
|
services.openldap = {
|
|
enable = true;
|
|
|
|
settings.children = {
|
|
"olcDatabase={1}mdb".attrs = {
|
|
objectClass = [ "olcDatabaseConfig" "olcMdbConfig" ];
|
|
olcDatabase = "{1}mdb";
|
|
olcDbDirectory = "/var/lib/openldap";
|
|
olcSuffix = "dc=tvl,dc=fyi";
|
|
olcAccess = "to * by * read";
|
|
olcRootDN = "cn=admin,dc=tvl,dc=fyi";
|
|
olcRootPW = "{ARGON2}$argon2id$v=19$m=65536,t=2,p=1$OfcgkOQ96VQ3aJj7NfA9vQ$oS6HQOkYl/bUYg4SejpltQYy7kvqx/RUxvoR4zo1vXU";
|
|
};
|
|
|
|
"cn=module{0}".attrs = {
|
|
objectClass = "olcModuleList";
|
|
olcModuleLoad = "pw-argon2";
|
|
};
|
|
|
|
"cn=schema".includes =
|
|
map (schema: "${pkgs.openldap}/etc/schema/${schema}.ldif")
|
|
[ "core" "cosine" "inetorgperson" "nis" ];
|
|
};
|
|
|
|
# Contents are immutable at runtime, and adding user accounts etc.
|
|
# is done statically in the LDIF-formatted contents in this folder.
|
|
declarativeContents."dc=tvl,dc=fyi" = ''
|
|
dn: dc=tvl,dc=fyi
|
|
dc: tvl
|
|
o: TVL LDAP server
|
|
description: Root entry for tvl.fyi
|
|
objectClass: top
|
|
objectClass: dcObject
|
|
objectClass: organization
|
|
|
|
dn: ou=users,dc=tvl,dc=fyi
|
|
ou: users
|
|
description: All users in TVL
|
|
objectClass: top
|
|
objectClass: organizationalUnit
|
|
|
|
dn: ou=groups,dc=tvl,dc=fyi
|
|
ou: groups
|
|
description: All groups in TVL
|
|
objectClass: top
|
|
objectClass: organizationalUnit
|
|
|
|
${lib.concatStringsSep "\n" (map toLdif users)}
|
|
'';
|
|
};
|
|
}
|