[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] gnu: Add rpc-daemon service
From: |
Ludovic Courtès |
Subject: |
Re: [PATCH] gnu: Add rpc-daemon service |
Date: |
Sat, 03 Sep 2016 16:11:53 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
John Darrington <address@hidden> skribis:
> * gnu/services/nfs: New file.
^^
> * gnu/local.mk (GNU_SYSTEM_MODULES): Add it.
For the final patch, please make sure to mention it in guix.texi.
> --- /dev/null
> +++ b/gnu/services/nfs.scm
Missing license.
> @@ -0,0 +1,25 @@
> +(define-module (gnu services nfs)
> + #:use-module (gnu)
> + #:use-module (gnu services shepherd)
> + #:use-module (gnu packages onc-rpc)
> + #:use-module (guix)
> + #:export (rpc-service))
> +
> +(define (rpc-shepherd-service config) ; Config is ignored
> + (list (shepherd-service
> + (provision '(rpc-daemon))
> + (requirement '(networking))
> + (start #~(make-forkexec-constructor
> + (list (string-append #$rpcbind "/bin/rpcbind") "-d"
> "-f")))
> + (stop #~(make-kill-destructor)))))
> +
> +(define rpc-service-type
> + (service-type
> + (name 'rpc)
> + (extensions (list (service-extension shepherd-root-service-type
> + rpc-shepherd-service)))))
In this case, you can simply write:
(define rpcbind-service-type
(shepherd-service-type
'rpcbind
(lambda (config)
(shepherd-service …))))
I think the service should be called “rpcbind”, and not “rpc” (there are
other ONC RPC and NFS daemons, such as mountd and statd, so we need to
use clear names.)
> +(define* (rpc-service config)
> + "Run the rpc daemon. Config is ignored."
> + (service rpc-service-type config))
There’s at least one bit of config needed: the ‘rpcbind’ package to
use. So I would write it as:
(service rpcbind-service-type rpcbind)
and then honor this argument.
Also, the preferred way now is to expose service-type objects and not
provide procedures like the one above. So you can omit this procedure
and instead make sure to #:export (rpcbind-service-type).
Could you send an updated patch?
If you’re willing to play a bit, it would be nice to have a system test
that spawns a GuixSD with this service, and then makes sure that, say,
the ‘rpcinfo’ program is able to connect to the daemon. But that’s
bonus. :-)
Thanks!
Ludo’.