unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: John Darrington <jmd@gnu.org>
Cc: guix-devel@gnu.org
Subject: Re: [PATCH] gnu: Add rpc-daemon service
Date: Sat, 03 Sep 2016 16:11:53 +0200	[thread overview]
Message-ID: <871t11kr86.fsf@gnu.org> (raw)
In-Reply-To: <1472884782-27956-1-git-send-email-jmd@gnu.org> (John Darrington's message of "Sat, 3 Sep 2016 08:39:42 +0200")

John Darrington <jmd@gnu.org> 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’.

  reply	other threads:[~2016-09-03 14:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-03  6:39 [PATCH] gnu: Add rpc-daemon service John Darrington
2016-09-03 14:11 ` Ludovic Courtès [this message]
2016-09-03 14:54   ` John Darrington
2016-09-05 20:38     ` Ludovic Courtès
2016-09-05 19:22   ` John Darrington
2016-09-05 20:44     ` Ludovic Courtès
2016-09-06 16:50       ` John Darrington
2016-09-07 12:17         ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871t11kr86.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=guix-devel@gnu.org \
    --cc=jmd@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).