diff mbox series

[bug#71064,7/7] gnu: services: nscd: add Nsncd optional support.

Message ID cb8c3c48fb9affbab0a748be01f4afa743ad6ff2.1716121731.git.picnoir@alternativebit.fr
State New
Headers show
Series Nsncd: Introduce package + nscd service update | expand

Commit Message

Félix Baylac Jacqué May 19, 2024, 12:46 p.m. UTC
From: Picnoir <picnoir@alternativebit.fr>

* gnu/services/base.scm (services: nscd: add Nsncd optional support): Add a
new nscd-use-nscd? field in the Nscd configuration record. When set to #t, the
nscd service will use Nsncd in place of the Glibc's Nscd. I'm not 100% sure
adding this to the existing Nscd service is a good idea, it's however the most
convenient option for now. Or is it? :)

Change-Id: I73d03bd149ff005130e1ed2532e1b4b0e3d572f5
---
 gnu/services/base.scm | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Comments

Ludovic Courtès June 2, 2024, 6:55 p.m. UTC | #1
Hi,

picnoir@alternativebit.fr skribis:

> From: Picnoir <picnoir@alternativebit.fr>
>
> * gnu/services/base.scm (services: nscd: add Nsncd optional support): Add a
> new nscd-use-nscd? field in the Nscd configuration record. When set to #t, the
> nscd service will use Nsncd in place of the Glibc's Nscd. I'm not 100% sure
> adding this to the existing Nscd service is a good idea, it's however the most
> convenient option for now. Or is it? :)

Well, there needs to be a flag somehow.  :-)

Nitpick: could you describe the changes at a syntactic level in the
commit log?  I know our conventions aren’t common today, so whoever
commits it can eventually tweak it on your behalf if needed.

> +  (use-nsncd?  nscd-use-nsncd?                     ;boolean
> +               (default #t))

I’m tempted to make it:

  (implementation nscd-implementation (default 'glibc))

And thus 'nsncd would be the other supported value.

Do you think that makes sense?

Anyhow, could you adjust doc/guix.texi to mention the new field?

Apart from that, the patch looks good to me.  Could you send an updated
version?

Thanks!

Ludo’.
diff mbox series

Patch

diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 85160bd3ab..66306384c0 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -79,6 +79,7 @@  (define-module (gnu services base)
                 #:select (bcachefs-tools exfat-utils jfsutils zfs))
   #:use-module (gnu packages fonts)
   #:use-module (gnu packages terminals)
+  #:use-module (gnu packages nss)
   #:use-module ((gnu packages wm) #:select (sway))
   #:use-module ((gnu build file-systems)
                 #:select (mount-flags->bit-mask
@@ -1284,6 +1285,8 @@  (define-deprecated (mingetty-service config)
 (define-record-type* <nscd-configuration> nscd-configuration
   make-nscd-configuration
   nscd-configuration?
+  (use-nsncd?  nscd-use-nsncd?                     ;boolean
+               (default #t))
   (log-file    nscd-configuration-log-file        ;string
                (default "/var/log/nscd.log"))
   (debug-level nscd-debug-level                   ;integer
@@ -1447,12 +1450,14 @@  (define (nscd-shepherd-service config)
            (requirement '(user-processes syslogd))
 
            (start #~(make-forkexec-constructor
-                     (list #$nscd "-f" #$nscd.conf "--foreground")
+                     #$(if (nscd-use-nsncd? config)
+                         #~(list #$(file-append nsncd "/bin/nsncd"))
+                         #~(list #$nscd "-f" #$nscd.conf "--foreground"))
 
                      ;; Wait for the PID file.  However, the PID file is
                      ;; written before nscd is actually listening on its
                      ;; socket (XXX).
-                     #:pid-file "/var/run/nscd/nscd.pid"
+                     #$@(if (nscd-use-nsncd? config) '() '(#:pid-file  "/var/run/nscd/nscd.pid"))
 
                      #:environment-variables
                      (list (string-append "LD_LIBRARY_PATH="