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'.
This commit is contained in:
Ludovic Courtès 2015-02-04 22:42:38 +01:00
parent 996ed73948
commit 4aee6e6003
2 changed files with 25 additions and 6 deletions

View File

@ -4319,9 +4319,12 @@ the ``message of the day''.
@cindex name service cache daemon @cindex name service cache daemon
@cindex nscd @cindex nscd
@deffn {Monadic Procedure} nscd-service [@var{config}] [#:glibc glibc] @deffn {Monadic Procedure} nscd-service [@var{config}] [#:glibc glibc] @
Return a service that runs libc's name service cache daemon (nscd) with the [#:name-services '()]
given @var{config}---an @code{<nscd-configuration>} object. Return a service that runs libc's name service cache daemon (nscd) with
the 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.
@end deffn @end deffn
@defvr {Scheme Variable} %nscd-default-configuration @defvr {Scheme Variable} %nscd-default-configuration
@ -4753,6 +4756,11 @@ associated lookup action.
A string denoting the name service (@pxref{Services in the NSS A string denoting the name service (@pxref{Services in the NSS
configuration,,, libc, The GNU C Library Reference Manual}). configuration,,, libc, The GNU C Library Reference Manual}).
Note that name services listed here must be visible to nscd. This is
achieved by passing the @code{#:name-services} argument to
@code{nscd-service} the list of packages providing the needed name
services (@pxref{Base Services, @code{nscd-service}}).
@item reaction @item reaction
An action specified using the @code{lookup-specification} macro An action specified using the @code{lookup-specification} macro
(@pxref{Actions in the NSS configuration,,, libc, The GNU C Library (@pxref{Actions in the NSS configuration,,, libc, The GNU C Library

View File

@ -492,9 +492,12 @@ the ``message of the day''."
(map cache->config caches))))))) (map cache->config caches)))))))
(define* (nscd-service #:optional (config %nscd-default-configuration) (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 "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))) (mlet %store-monad ((nscd.conf (nscd.conf-file config)))
(return (service (return (service
(documentation "Run libc's name service cache daemon (nscd).") (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 (start #~(make-forkexec-constructor
(list (string-append #$glibc "/sbin/nscd") (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)) (stop #~(make-kill-destructor))
(respawn? #f))))) (respawn? #f)))))