From 4aac110f17f0528d90510eec00c9a8df60bcf04f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Fri, 17 May 2019 10:26:33 +0200 Subject: Remove direct dependency to myconfig in database modules --- modules/private/databases/openldap/default.nix | 36 +++++++++++++++++++++----- 1 file changed, 30 insertions(+), 6 deletions(-) (limited to 'modules/private/databases/openldap') diff --git a/modules/private/databases/openldap/default.nix b/modules/private/databases/openldap/default.nix index 46f85d2..e048d56 100644 --- a/modules/private/databases/openldap/default.nix +++ b/modules/private/databases/openldap/default.nix @@ -1,4 +1,4 @@ -{ lib, pkgs, config, myconfig, ... }: +{ lib, pkgs, config, ... }: let cfg = config.myServices.databases.openldap; ldapConfig = let @@ -27,8 +27,8 @@ let moduleload memberof database hdb - suffix "${myconfig.env.ldap.base}" - rootdn "${myconfig.env.ldap.root_dn}" + suffix "${cfg.baseDn}" + rootdn "${cfg.rootDn}" include ${config.secrets.location}/ldap/password directory ${cfg.dataDir} overlay memberof @@ -53,6 +53,30 @@ in description = "Whether to enable ldap"; type = lib.types.bool; }; + baseDn = lib.mkOption { + type = lib.types.str; + description = '' + Base DN for LDAP + ''; + }; + rootDn = lib.mkOption { + type = lib.types.str; + description = '' + Root DN + ''; + }; + rootPw = lib.mkOption { + type = lib.types.str; + description = '' + Root (Hashed) password + ''; + }; + accessFile = lib.mkOption { + type = lib.types.path; + description = '' + The file path that defines the access + ''; + }; dataDir = lib.mkOption { type = lib.types.path; default = "/var/lib/openldap"; @@ -89,14 +113,14 @@ in permissions = "0400"; user = "openldap"; group = "openldap"; - text = "rootpw ${myconfig.env.ldap.root_pw}"; + text = "rootpw ${cfg.rootPw}"; } { - dest = "ldap/access "; + dest = "ldap/access"; permissions = "0400"; user = "openldap"; group = "openldap"; - text = builtins.readFile "${myconfig.privateFiles}/ldap.conf"; + text = builtins.readFile "${cfg.accessFile}"; } ]; users.users.openldap.extraGroups = [ "keys" ]; -- cgit v1.2.3