From 27414c4656cb8bf4afba7c28d868b91869b1201e Mon Sep 17 00:00:00 2001 From: Rickard Nilsson Date: Sun, 27 Jan 2013 20:07:37 +0100 Subject: [PATCH] nslcd: Adjust service definition to systemd --- modules/config/ldap.nix | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/modules/config/ldap.nix b/modules/config/ldap.nix index 1e115943f231..603ad8407cd1 100644 --- a/modules/config/ldap.nix +++ b/modules/config/ldap.nix @@ -220,18 +220,15 @@ mkIf cfg.enable { }; }; - jobs = mkIf cfg.daemon.enable { + systemd.services = mkIf cfg.daemon.enable { nslcd = { - startOn = "filesystem"; - - stopOn = "stopping network-interfaces"; - - daemonType = "fork"; - + wantedBy = [ "nss-user-lookup.target" ]; + path = [ nss_pam_ldapd ]; preStart = '' mkdir -p /run/nslcd + rm -f /run/nslcd/nslcd.pid; chown nslcd.nslcd /run/nslcd ${optionalString (cfg.bind.distinguishedName != "") '' if test -s "${cfg.bind.password}" ; then @@ -239,10 +236,14 @@ mkIf cfg.enable { fi ''} ''; - - postStop = "rm -f /run/nslcd/nslcd.pid"; - - exec = "nslcd"; + + script = "nslcd"; + + serviceConfig = { + Type = "forking"; + PIDFile = "/run/nslcd/nslcd.pid"; + Restart = "always"; + }; }; }; }