all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: zimoun <zimon.toutoune@gmail.com>
To: 52578@debbugs.gnu.org
Cc: jean-francois.guillaume@univ-nantes.fr
Subject: [bug#52578] [PATCH v2 2/2] DRAFT services: Add openldap service.
Date: Fri, 25 Mar 2022 16:35:17 +0100	[thread overview]
Message-ID: <20220325153517.1478717-2-zimon.toutoune@gmail.com> (raw)
In-Reply-To: <20220325153517.1478717-1-zimon.toutoune@gmail.com>

From: Jean-François Guillaume <jean-francois.guillaume@univ-nantes.fr>

* gnu/services/openlda.scm (<openldap-configuration>): New record.
(openldap-shepherd-service): New procedure.
(%openldap-activation, openldap-service-type): New variable.
---
 gnu/services/openldap.scm | 84 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 84 insertions(+)
 create mode 100644 gnu/services/openldap.scm

diff --git a/gnu/services/openldap.scm b/gnu/services/openldap.scm
new file mode 100644
index 0000000000..dc5ae3fa8f
--- /dev/null
+++ b/gnu/services/openldap.scm
@@ -0,0 +1,84 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2022 Jean-François Guillaume <jean-francois.guillaume@univ-nantes.fr>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu services openldap)
+  #:use-module (gnu packages openldap)
+  #:use-module (gnu services)
+  #:use-module (gnu services shepherd)
+  #:use-module (guix)
+  #:use-module (guix records)
+  #:use-module (ice-9 match)
+  #:export (openldap-configuration
+            openldap-configuration?
+            openldap-service-type
+
+            ))
+
+(define-record-type* <openldap-configuration>
+  openldap-configuration make-openldap-configuration
+  openldap-configuration?
+  (openldap    openldap-configuration-openldap
+               (default openldap))
+  (uri         openldap-configuration-uri
+               (default "ldapi:// ldap://"))
+  (logflags    openldap-configuration-logflags
+               (default "0"))
+  (pid-file    openldap-configuration-pid-file
+               (default "/var/run/openldap/slapd.pid"))
+  (config-file openldap-configuration-config-file
+               (default (file-append openldap "/etc/openldap/slapd.conf")))
+  (log-file    openldap-configuration-log-file
+               (default "/var/log/slapd.log")))
+
+(define openldap-shepherd-service
+  (match-lambda
+    (($ <openldap-configuration> openldap uri logflags pid-file config-file log-file)
+      (list
+        (shepherd-service
+          (provision '(slapd) )
+          (documentation "Run OpenLDAP.")
+          (requirement '(user-processes))
+          (respawn? #t)
+          (start #~(make-forkexec-constructor
+                    (list
+                     #$(file-append openldap "/libexec/slapd")
+                     "-h" #$uri
+                     "-d" #$logflags
+                     "-f" #$config-file)
+                    #:pid-file #$pid-file
+                    #:log-file #$log-file))
+          (stop #~(make-kill-destructor)))))))
+
+(define %openldap-activation
+  (with-imported-modules '((guix build utils))
+    #~(begin
+        (use-modules (guix build utils))
+        (mkdir-p "/var/run/openldap")
+        (mkdir-p "/var/lib/ldap")
+        #t)))
+
+(define openldap-service-type
+  (service-type (name 'slapd)
+    (extensions
+      (list
+        (service-extension shepherd-root-service-type
+                           openldap-shepherd-service)
+        (service-extension activation-service-type
+                           (const %openldap-activation))))
+    (description
+     "Run @uref{https://www.openldap.org, OpenLDAP}.")))
-- 
2.34.0





      reply	other threads:[~2022-03-25 15:36 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-17 13:52 [bug#52578] [PATCH] updating openldap and adding service definition Jean-Francois GUILLAUME
2021-12-17 22:39 ` Maxime Devos
2021-12-18 10:53   ` zimoun
2021-12-17 22:46 ` Maxime Devos
2021-12-18 10:22 ` zimoun
2021-12-18 11:09   ` Jean-Francois GUILLAUME
2021-12-18 10:37 ` Jean-Francois GUILLAUME
2021-12-18 10:49   ` Jean-Francois GUILLAUME
2022-03-25 15:34 ` [bug#52578] [PATCH v2 0/2] OpenLDAP service zimoun
2022-03-28  8:38   ` Jean-Francois GUILLAUME
2024-05-16 21:08     ` Ludovic Courtès
2024-05-17 12:04       ` Simon Tournier
2024-05-22 10:18       ` Jean-Francois GUILLAUME
2024-05-23  7:12         ` Ludovic Courtès
2022-03-25 15:35 ` [bug#52578] [PATCH v2 1/2] DRAFT gnu: Add openldap-for-services zimoun
2022-03-25 15:35   ` zimoun [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220325153517.1478717-2-zimon.toutoune@gmail.com \
    --to=zimon.toutoune@gmail.com \
    --cc=52578@debbugs.gnu.org \
    --cc=jean-francois.guillaume@univ-nantes.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.