[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] gnu: Add rpc-daemon service
From: |
John Darrington |
Subject: |
[PATCH] gnu: Add rpc-daemon service |
Date: |
Mon, 5 Sep 2016 21:22:11 +0200 |
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
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
address@hidden rpcbind
address@hidden Rpcbind Service
+
+The @code{(gnu services rpcbind)} module provides the following service.
+
address@hidden {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.
address@hidden 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 <address@hidden>
+;;;
+;;; 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)))))
--
2.1.4