summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-02-04 22:42:38 +0100
committerLudovic Courtès <ludo@gnu.org>2015-02-04 22:49:35 +0100
commit4aee6e60033786e1fa09595f116199a17516e64e (patch)
treea147cf218c461c60e199d582dca02bbe14444f7a /gnu
parent996ed73948e92eb2005a2a282856753d707f452c (diff)
downloadguix-4aee6e60033786e1fa09595f116199a17516e64e.tar.gz
services: nscd-service: Add #:name-services parameter.
* gnu/services/base.scm (nscd-service): Add #:name-services parameter.
  In 'start' field, set LD_LIBRARY_PATH based on #:name-services.
* doc/guix.texi (Base Services): Document it.
  (Name Service Switch): Link to 'nscd-service'.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/services/base.scm17
1 files changed, 14 insertions, 3 deletions
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 32eb9035d4..94abef65c8 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -492,9 +492,12 @@ the ``message of the day''."
                                 (map cache->config caches)))))))
 
 (define* (nscd-service #:optional (config %nscd-default-configuration)
-                       #:key (glibc (canonical-package glibc)))
+                       #:key (glibc (canonical-package glibc))
+                       (name-services '()))
   "Return a service that runs libc's name service cache daemon (nscd) with the
-given @var{config}---an @code{<nscd-configuration>} object."
+given @var{config}---an @code{<nscd-configuration>} object.  Optionally,
+@code{#:name-services} is a list of packages that provide name service switch
+ (NSS) modules needed by nscd."
   (mlet %store-monad ((nscd.conf (nscd.conf-file config)))
     (return (service
              (documentation "Run libc's name service cache daemon (nscd).")
@@ -507,7 +510,15 @@ given @var{config}---an @code{<nscd-configuration>} object."
 
              (start #~(make-forkexec-constructor
                        (list (string-append #$glibc "/sbin/nscd")
-                             "-f" #$nscd.conf "--foreground")))
+                             "-f" #$nscd.conf "--foreground")
+
+                       #:environment-variables
+                       (list (string-append "LD_LIBRARY_PATH="
+                                            (string-join
+                                             (map (lambda (dir)
+                                                    (string-append dir "/lib"))
+                                                  (list #$@name-services))
+                                             ":")))))
              (stop #~(make-kill-destructor))
 
              (respawn? #f)))))