Commit | Line | Data |
---|---|---|
d6a07ee6 JD |
1 | ;;; GNU Guix --- Functional package management for GNU |
2 | ;;; Copyright © 2016 John Darrington <jmd@gnu.org> | |
3 | ;;; | |
4 | ;;; This file is part of GNU Guix. | |
5 | ;;; | |
6 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
7 | ;;; under the terms of the GNU General Public License as published by | |
8 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
9 | ;;; your option) any later version. | |
10 | ;;; | |
11 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
12 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | ;;; GNU General Public License for more details. | |
15 | ;;; | |
16 | ;;; You should have received a copy of the GNU General Public License | |
17 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
18 | ||
19 | (define-module (gnu services nfs) | |
20 | #:use-module (gnu) | |
21 | #:use-module (gnu services shepherd) | |
22 | #:use-module (gnu packages onc-rpc) | |
23 | #:use-module (guix) | |
24 | #:use-module (guix records) | |
25 | #:export (rpcbind-service-type | |
26 | rpcbind-configuration | |
27 | rpcbind-configuration?)) | |
28 | ||
29 | (define-record-type* <rpcbind-configuration> | |
30 | rpcbind-configuration make-rpcbind-configuration | |
31 | rpcbind-configuration? | |
32 | (rpcbind rpcbind-configuration-rpcbind | |
33 | (default rpcbind)) | |
34 | (warm-start? rpcbind-configuration-warm-start? | |
35 | (default #t))) | |
36 | ||
37 | (define rpcbind-service-type | |
38 | (shepherd-service-type | |
39 | 'rpcbind | |
40 | (lambda (config) | |
41 | (define pkg | |
42 | (rpcbind-configuration-rpcbind config)) | |
43 | ||
44 | (define rpcbind-command | |
45 | #~(list (string-append #$pkg "/bin/rpcbind") "-f" | |
46 | #$@(if (rpcbind-configuration-warm-start? config) '("-w") '()))) | |
47 | ||
48 | (shepherd-service | |
49 | (documentation "Start the RPC bind daemon.") | |
50 | (requirement '(networking)) | |
51 | (provision '(rpcbind-daemon)) | |
52 | ||
53 | (start #~(make-forkexec-constructor #$rpcbind-command)) | |
54 | (stop #~(make-kill-destructor)))))) |