diff mbox

gnu: Add rpc-daemon service

Message ID 1473103331-25267-1-git-send-email-jmd@gnu.org
State New
Headers show

Commit Message

John Darrington Sept. 5, 2016, 7:22 p.m. UTC
Try this patch


* gnu/services/nfs.scm: New file.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add it.
---
 doc/guix.texi        | 16 +++++++++++++++
 gnu/local.mk         |  1 +
 gnu/services/nfs.scm | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 72 insertions(+)
 create mode 100644 gnu/services/nfs.scm

Comments

Ludovic Courtès Sept. 5, 2016, 8:44 p.m. UTC | #1
John Darrington <jmd@gnu.org> skribis:

> * gnu/services/nfs.scm: New file.
> * gnu/local.mk (GNU_SYSTEM_MODULES): Add it.

[...]

> +@cindex rpcbind
> +@subsubheading Rpcbind Service

s/Rpcbind/RPC Bind/
Also move the @cindex line after @subsubheading.

> +The @code{(gnu services rpcbind)} module provides the following service.
> +
> +@deffn {Scheme Procedure} rpcbind-service [#:rpcbind rpcbind] @
> +       [#:warm-start? #t]

This procedure no longer exists.  :-)

So instead, you need to add an @defvr for ‘rpcbind-service-type’ and an
@deftp for ‘rpcbind-configuration’, and a couple of sentences to glues
them together (see “Scheduled Job Execution” for an example.)

> +(define (rpcbind-shepherd-service config)
> +  (define pkg
> +    (rpcbind-configuration-rpcbind config))
> +
> +  (define rpcbind-command
> +    #~(list (string-append #$pkg "/bin/rpcbind") "-f"
> +            #$@(if (rpcbind-configuration-warm-start? config) '("-w") '())))
> +  
> +  (list (shepherd-service
> +         (provision '(rpcbind-daemon))
> +         (requirement '(networking))
> +         (start #~(make-forkexec-constructor #$rpcbind-command))
> +         (stop #~(make-kill-destructor)))))
> +
> +(define rpcbind-service-type
> +  (service-type
> +   (name 'rpcbind)
> +   (extensions (list (service-extension shepherd-root-service-type
> +                                        rpcbind-shepherd-service)))))

Better use ‘shepherd-service-type’ here, as noted at
<https://lists.gnu.org/archive/html/guix-devel/2016-09/msg00271.html>.

And then we’re done.  Could you send an updated patch?

Thank you for your patience!

Ludo’.
diff mbox

Patch

diff --git a/doc/guix.texi b/doc/guix.texi
index b6ca34a..7e3fbfc 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -9975,6 +9975,22 @@  directories are created when the service is activated.
 @node Various Services
 @subsubsection Various Services
 
+@cindex rpcbind
+@subsubheading Rpcbind Service
+
+The @code{(gnu services rpcbind)} module provides the following service.
+
+@deffn {Scheme Procedure} rpcbind-service [#:rpcbind rpcbind] @
+       [#:warm-start? #t]
+Return a service that runs @command{rpcbind}, a server which converts RPC
+program numbers to universal addresses.
+
+Optionally, the package where the daemon is to be found, @var{rpcbind}, may be
+specified.
+If @var{warm-start?} is true (the default), then it will read a state file on
+startup and thus reload state information saved saved by the previous instance.
+@end deffn
+
 @cindex lirc
 @subsubheading Lirc Service
 
diff --git a/gnu/local.mk b/gnu/local.mk
index 50363ef..9d284da 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -389,6 +389,7 @@  GNU_SYSTEM_MODULES =				\
   %D%/services/mail.scm				\
   %D%/services/mcron.scm			\
   %D%/services/networking.scm			\
+  %D%/services/nfs.scm			\
   %D%/services/shepherd.scm			\
   %D%/services/herd.scm				\
   %D%/services/spice.scm				\
diff --git a/gnu/services/nfs.scm b/gnu/services/nfs.scm
new file mode 100644
index 0000000..6084f69
--- /dev/null
+++ b/gnu/services/nfs.scm
@@ -0,0 +1,55 @@ 
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2016 John Darrington <jmd@gnu.org>
+;;;
+;;; 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 nfs)
+  #:use-module (gnu)
+  #:use-module (gnu services shepherd)
+  #:use-module (gnu packages onc-rpc)
+  #:use-module (guix)
+  #:use-module (guix records)
+  #:export (rpcbind-service-type
+            rpcbind-configuration
+            rpcbind-configuration?))
+
+(define-record-type* <rpcbind-configuration>
+  rpcbind-configuration make-rpcbind-configuration
+  rpcbind-configuration?
+  (rpcbind             rpcbind-configuration-rpcbind
+                       (default rpcbind))
+  (warm-start?         rpcbind-configuration-warm-start?
+                       (default #t)))
+
+(define (rpcbind-shepherd-service config)
+  (define pkg
+    (rpcbind-configuration-rpcbind config))
+
+  (define rpcbind-command
+    #~(list (string-append #$pkg "/bin/rpcbind") "-f"
+            #$@(if (rpcbind-configuration-warm-start? config) '("-w") '())))
+  
+  (list (shepherd-service
+         (provision '(rpcbind-daemon))
+         (requirement '(networking))
+         (start #~(make-forkexec-constructor #$rpcbind-command))
+         (stop #~(make-kill-destructor)))))
+
+(define rpcbind-service-type
+  (service-type
+   (name 'rpcbind)
+   (extensions (list (service-extension shepherd-root-service-type
+                                        rpcbind-shepherd-service)))))