From 885d4e047b807719996a0c497b63ab6d77eba439 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Thu, 19 May 2022 22:06:41 +0200 Subject: [PATCH] nixos/openldap: use upstream unit defaults MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit OpenLDAP since version 2.5.4ยน supports sd_notify, so we should make use of it. Also updates the unit description and documentation with the values upstream provides. Starts slapd only after reaching `network-online.target`, which ensures binding to specific ip addresses is possible, since `network.target` only guarantees interfaces exist, but not that addressing is finished. [1] https://bugs.openldap.org/show_bug.cgi?id=8707 --- nixos/modules/services/databases/openldap.nix | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/nixos/modules/services/databases/openldap.nix b/nixos/modules/services/databases/openldap.nix index 2c1e25d4308..1967a2371bd 100644 --- a/nixos/modules/services/databases/openldap.nix +++ b/nixos/modules/services/databases/openldap.nix @@ -268,9 +268,14 @@ in { }; systemd.services.openldap = { - description = "LDAP server"; + description = "OpenLDAP Server Daemon"; + documentation = [ + "man:slapd" + "man:slapd-config" + "man:slapd-mdb" + ]; wantedBy = [ "multi-user.target" ]; - after = [ "network.target" ]; + after = [ "network-online.target" ]; preStart = let settingsFile = pkgs.writeText "config.ldif" (lib.concatStringsSep "\n" (attrsToLdif "cn=config" cfg.settings)); @@ -306,7 +311,7 @@ in { "${openldap}/libexec/slapd" "-u" cfg.user "-g" cfg.group "-F" configDir "-h" (lib.concatStringsSep " " cfg.urlList) ]); - Type = "forking"; + Type = "notify"; PIDFile = cfg.settings.attrs.olcPidFile; }; };