unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH 1/2] doc: "Various Services" -> "Miscellaneous Services"
@ 2016-09-10 19:18 John Darrington
  2016-09-10 19:18 ` [PATCH 2/2] gnu: Add GSSD and Pipefs services John Darrington
  2016-09-13 11:28 ` [PATCH 1/2] doc: "Various Services" -> "Miscellaneous Services" Ludovic Courtès
  0 siblings, 2 replies; 25+ messages in thread
From: John Darrington @ 2016-09-10 19:18 UTC (permalink / raw)
  To: guix-devel; +Cc: John Darrington

* doc/guix.texi (Services): "Various" -> "Miscellaneous"
---
 doc/guix.texi | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 3923627..9f57744 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -219,7 +219,7 @@ Services
 * Database Services::           SQL databases.
 * Mail Services::               IMAP, POP3, SMTP, and all that.
 * Web Services::                Web servers.
-* Various Services::            Other services.
+* Miscellaneous Services::      Other services.
 
 Defining Services
 
@@ -7561,7 +7561,7 @@ declaration.
 * Database Services::           SQL databases.
 * Mail Services::               IMAP, POP3, SMTP, and all that.
 * Web Services::                Web servers.
-* Various Services::            Other services.
+* Miscellaneous Services::      Other services.
 @end menu
 
 @node Base Services
@@ -10091,8 +10091,8 @@ directories are created when the service is activated.
 
 @end deffn
 
-@node Various Services
-@subsubsection Various Services
+@node Miscellaneous Services
+@subsubsection Miscellaneous Services
 
 
 @subsubheading RPC Bind Service
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 2/2] gnu: Add GSSD and Pipefs services
  2016-09-10 19:18 [PATCH 1/2] doc: "Various Services" -> "Miscellaneous Services" John Darrington
@ 2016-09-10 19:18 ` John Darrington
  2016-09-13 11:45   ` Ludovic Courtès
  2016-09-13 11:28 ` [PATCH 1/2] doc: "Various Services" -> "Miscellaneous Services" Ludovic Courtès
  1 sibling, 1 reply; 25+ messages in thread
From: John Darrington @ 2016-09-10 19:18 UTC (permalink / raw)
  To: guix-devel; +Cc: John Darrington

* gnu/services/nfs.scm (pipefs-service-type): New Variable,
(gss-service-type): New Variable.
---
 doc/guix.texi        | 48 +++++++++++++++++++++++++++++++++++----
 gnu/services/nfs.scm | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 107 insertions(+), 5 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 9f57744..f812a81 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -219,6 +219,7 @@ Services
 * Database Services::           SQL databases.
 * Mail Services::               IMAP, POP3, SMTP, and all that.
 * Web Services::                Web servers.
+* NFS Services::                NFS related services.
 * Miscellaneous Services::      Other services.
 
 Defining Services
@@ -7561,6 +7562,7 @@ declaration.
 * Database Services::           SQL databases.
 * Mail Services::               IMAP, POP3, SMTP, and all that.
 * Web Services::                Web servers.
+* NFS Services::                NFS Related Serivices.
 * Miscellaneous Services::      Other services.
 @end menu
 
@@ -10091,15 +10093,49 @@ directories are created when the service is activated.
 
 @end deffn
 
-@node Miscellaneous Services
-@subsubsection Miscellaneous Services
+@node NFS Services
+@subsubsection NFS Services
+@cindex nfs
+
+The @code{(gnu services nfs)} module provides the following services,
+which are most commonly used in relation to mouting or exporting NFS
+filesystems.
+
+@subsubheading GSS Daemon Service
+@cindex gssd
+@cindex gss
+
+@defvr {Scheme Variable} gss-service-type
+A service type  for the RPC Global Security System (GSS) daemon.
+@end defvr
+
+@deftp {Data Type} gss-configuration
+Data type representing the configuration of the RPC GSS Daemon service.
+This type has the following parameters:
+@table @asis
+@item @code{nfs-utils} (default: @code{nfs-utils})
+The package in which the @command{rpc.gssd} command is to be found.
+
+@end table
+@end deftp
+
+
+@subsubheading Pipefs Pseudo Filesystem
+@cindex pipefs
+@cindex rpc_pipefs
 
+@defvr {Scheme Variable} pipefs-service-type
+A service type for the pipefs pseudo filesystem.
+@end defvr
+
+@deftp {Data Type} pipefs-configuration
+Data type representing the configuration of the pipefs service.
+There are no configurable parameters to this type.
+@end deftp
 
 @subsubheading RPC Bind Service
 @cindex rpcbind
 
-The @code{(gnu services nfs)} module provides the following:
-
 @defvr {Scheme Variable} rpcbind-service-type
 A service type  for the RPC portmapper daemon.
 @end defvr
@@ -10119,6 +10155,10 @@ instance.
 @end table
 @end deftp
 
+@node Miscellaneous Services
+@subsubsection Miscellaneous Services
+
+
 @cindex lirc
 @subsubheading Lirc Service
 
diff --git a/gnu/services/nfs.scm b/gnu/services/nfs.scm
index 82713d8..0fa613a 100644
--- a/gnu/services/nfs.scm
+++ b/gnu/services/nfs.scm
@@ -20,11 +20,22 @@
   #:use-module (gnu)
   #:use-module (gnu services shepherd)
   #:use-module (gnu packages onc-rpc)
+  #:use-module (gnu packages linux)
   #:use-module (guix)
   #:use-module (guix records)
+  #:use-module (ice-9 match)
+  #:use-module (gnu build file-systems)
   #:export (rpcbind-service-type
             rpcbind-configuration
-            rpcbind-configuration?))
+            rpcbind-configuration?
+
+            pipefs-service-type
+            pipefs-configuration
+            pipefs-configuration?
+
+            gss-service-type
+            gss-configuration
+            gss-configuration?))
 
 (define-record-type* <rpcbind-configuration>
   rpcbind-configuration make-rpcbind-configuration
@@ -52,3 +63,54 @@
 
       (start #~(make-forkexec-constructor #$rpcbind-command))
       (stop #~(make-kill-destructor))))))
+
+\f
+
+(define-record-type* <pipefs-configuration>
+  pipefs-configuration make-pipefs-configuration
+  pipefs-configuration?)
+
+(define pipefs-service-type
+  (shepherd-service-type
+   'pipefs
+   (lambda (config)
+     (with-imported-modules '((gnu build file-systems)
+                              (guix build bournish))
+       (define pipefs-dir "/var/lib/nfs/rpc_pipefs")
+
+       (shepherd-service
+        (documentation "Mount the pipefs pseudo filesystem.")
+        (provision '(rpc-pipefs))
+
+        (start #~(lambda ()
+                   (mkdir-p #$pipefs-dir)
+                   (mount "rpc_pipefs" #$pipefs-dir "rpc_pipefs")))
+        (stop #~(lambda (pid . args)
+                  (umount #$pipefs-dir MNT_DETACH))))))))
+
+\f
+
+(define-record-type* <gss-configuration>
+  gss-configuration make-gss-configuration
+  gss-configuration?
+  (nfs-utils             gss-configuration-gss
+                         (default nfs-utils)))
+
+(define gss-service-type
+  (shepherd-service-type
+   'gss
+   (lambda (config)
+     (define pkg
+       (gss-configuration-gss config))
+
+     (define gss-command
+       #~(list (string-append #$pkg "/sbin/rpc.gssd") "-f"))
+
+     (shepherd-service
+      (documentation "Start the RPC GSS daemon.")
+      (requirement '(rpcbind-daemon rpc-pipefs))
+      (provision '(gss-daemon))
+
+      (start #~(make-forkexec-constructor #$gss-command))
+      (stop #~(make-kill-destructor))))))
+
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* Re: [PATCH 1/2] doc: "Various Services" -> "Miscellaneous Services"
  2016-09-10 19:18 [PATCH 1/2] doc: "Various Services" -> "Miscellaneous Services" John Darrington
  2016-09-10 19:18 ` [PATCH 2/2] gnu: Add GSSD and Pipefs services John Darrington
@ 2016-09-13 11:28 ` Ludovic Courtès
  2016-09-13 12:18   ` John Darrington
  1 sibling, 1 reply; 25+ messages in thread
From: Ludovic Courtès @ 2016-09-13 11:28 UTC (permalink / raw)
  To: John Darrington; +Cc: guix-devel

John Darrington <jmd@gnu.org> skribis:

> * doc/guix.texi (Services): "Various" -> "Miscellaneous"

How does the meaning of these two words differ?  (I’m not a native
speaker, so I’m curious.)

Ludo’.

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 2/2] gnu: Add GSSD and Pipefs services
  2016-09-10 19:18 ` [PATCH 2/2] gnu: Add GSSD and Pipefs services John Darrington
@ 2016-09-13 11:45   ` Ludovic Courtès
  2016-09-13 13:53     ` [PATCH 2/2] gnu: Add GSSD and Pipefs services (Usage of @var) John Darrington
                       ` (2 more replies)
  0 siblings, 3 replies; 25+ messages in thread
From: Ludovic Courtès @ 2016-09-13 11:45 UTC (permalink / raw)
  To: John Darrington; +Cc: guix-devel

John Darrington <jmd@gnu.org> skribis:

> * gnu/services/nfs.scm (pipefs-service-type): New Variable,
> (gss-service-type): New Variable.

Nice!  Minor comments below:

> -@node Miscellaneous Services
> -@subsubsection Miscellaneous Services
> +@node NFS Services
> +@subsubsection NFS Services

I would call it “Network File System Services” or just “Network File
System”.

> +@cindex nfs

NFS.

> +The @code{(gnu services nfs)} module provides the following services,
> +which are most commonly used in relation to mouting or exporting NFS
> +filesystems.

“… to mounting or exporting files using the @dfn{Network File System}
(NFS).”

(Always write “file system” as two words.)

> +@subsubheading GSS Daemon Service
> +@cindex gssd
> +@cindex gss
> +
> +@defvr {Scheme Variable} gss-service-type
> +A service type  for the RPC Global Security System (GSS) daemon.
                 ^^
Extra space.

Is “RPC” needed here, or is it more generic?

Would be nice to add a sentence like “The GSS daemon provides mechanism
XYZ, which can be used to implement FOOBAR.”, where FOOBAR has some
connection with NFS.  I don’t know myself what to put in here but
hopefully there’s a README or something that can shed some light.  :-)

> +@deftp {Data Type} gss-configuration
> +Data type representing the configuration of the RPC GSS Daemon service.
> +This type has the following parameters:
> +@table @asis
> +@item @code{nfs-utils} (default: @code{nfs-utils})
                                    ^^^^^
Should be @var, because here we’re talking about the value of the
‘nfs-utils’ global variable.

> +@defvr {Scheme Variable} pipefs-service-type
> +A service type for the pipefs pseudo filesystem.
                                           ^^
s/pipefs pseudo filesystem/@code{rpc_pipefs} pseudo file system/
+ “… implemented by the kernel Linux.”
+ “The @command{rpc_pipefs} allows for communication between the kernel
and the user-land NFS daemons.”

> +@deftp {Data Type} pipefs-configuration
> +Data type representing the configuration of the pipefs service.
> +There are no configurable parameters to this type.
> +@end deftp

Not necessary (see below).

> +@node Miscellaneous Services
> +@subsubsection Miscellaneous Services

Oops!

> +(define-record-type* <pipefs-configuration>
> +  pipefs-configuration make-pipefs-configuration
> +  pipefs-configuration?)

Since there’s really no configuration here, it’s not needed.

> +(define pipefs-service-type
> +  (shepherd-service-type
> +   'pipefs
> +   (lambda (config)
> +     (with-imported-modules '((gnu build file-systems)
> +                              (guix build bournish))
> +       (define pipefs-dir "/var/lib/nfs/rpc_pipefs")
> +
> +       (shepherd-service
> +        (documentation "Mount the pipefs pseudo filesystem.")
> +        (provision '(rpc-pipefs))
> +
> +        (start #~(lambda ()
> +                   (mkdir-p #$pipefs-dir)
> +                   (mount "rpc_pipefs" #$pipefs-dir "rpc_pipefs")))
> +        (stop #~(lambda (pid . args)
> +                  (umount #$pipefs-dir MNT_DETACH))))))))

You could achieve something similar by extending ‘file-system-service’,
like ‘elogind-service-type’ does.  Could you try if it works here?

In that case, the name of the Shepherd service would become
“file-system-/var/lib/nfs/rpc_pipefs”.

> +     (define pkg
> +       (gss-configuration-gss config))

s/pkg/nfs-utils/

Could you send an updated patch?

Thanks for working on it!

Ludo’.

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 1/2] doc: "Various Services" -> "Miscellaneous Services"
  2016-09-13 11:28 ` [PATCH 1/2] doc: "Various Services" -> "Miscellaneous Services" Ludovic Courtès
@ 2016-09-13 12:18   ` John Darrington
  2016-09-13 12:31     ` Alex Sassmannshausen
                       ` (2 more replies)
  0 siblings, 3 replies; 25+ messages in thread
From: John Darrington @ 2016-09-13 12:18 UTC (permalink / raw)
  To: Ludovic Court??s; +Cc: guix-devel, John Darrington

[-- Attachment #1: Type: text/plain, Size: 939 bytes --]

On Tue, Sep 13, 2016 at 01:28:01PM +0200, Ludovic Court??s wrote:
     John Darrington <jmd@gnu.org> skribis:
     
     > * doc/guix.texi (Services): "Various" -> "Miscellaneous"
     
     How does the meaning of these two words differ?  (I???m not a native
     speaker, so I???m curious.)

It is a subtle nuance.

What I understand from "Various Services" is "A group of services which I chose arbitrarily".
Wheras "Miscellaneous Services" means to me: "Services which don't fit into any of the
hitherto mentioned categories".

Perhaps there is no formal difference, but "various" sounds odd to me in that context.
I think that "miscellaneous" is more common in such use cases.

J'



-- 
Avoid eavesdropping.  Send strong encrypted email.
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://sks-keyservers.net or any PGP keyserver for public key.


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 1/2] doc: "Various Services" -> "Miscellaneous Services"
  2016-09-13 12:18   ` John Darrington
@ 2016-09-13 12:31     ` Alex Sassmannshausen
  2016-09-13 17:10     ` Leo Famulari
  2016-09-13 21:57     ` Ludovic Courtès
  2 siblings, 0 replies; 25+ messages in thread
From: Alex Sassmannshausen @ 2016-09-13 12:31 UTC (permalink / raw)
  To: John Darrington; +Cc: guix-devel, John Darrington

John Darrington writes:

> On Tue, Sep 13, 2016 at 01:28:01PM +0200, Ludovic Court??s wrote:
>      John Darrington <jmd@gnu.org> skribis:
>      
>      > * doc/guix.texi (Services): "Various" -> "Miscellaneous"
>      
>      How does the meaning of these two words differ?  (I???m not a native
>      speaker, so I???m curious.)
>
> It is a subtle nuance.
>
> What I understand from "Various Services" is "A group of services which I chose arbitrarily".
> Wheras "Miscellaneous Services" means to me: "Services which don't fit into any of the
> hitherto mentioned categories".

+1

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 2/2] gnu: Add GSSD and Pipefs services (Usage of @var)
  2016-09-13 11:45   ` Ludovic Courtès
@ 2016-09-13 13:53     ` John Darrington
  2016-09-14 14:42       ` Ludovic Courtès
  2016-09-15  5:06     ` "filesystem" vs. "file system" John Darrington
  2016-09-25  8:21     ` [PATCH] gnu: Add NFS related services John Darrington
  2 siblings, 1 reply; 25+ messages in thread
From: John Darrington @ 2016-09-13 13:53 UTC (permalink / raw)
  To: Ludovic Court??s; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1268 bytes --]

On Tue, Sep 13, 2016 at 01:45:19PM +0200, Ludovic Court??s wrote:
     John Darrington <jmd@gnu.org> skribis:

     > +@item @code{nfs-utils} (default: @code{nfs-utils})
                                         ^^^^^
     Should be @var, because here we???re talking about the value of the
     ???nfs-utils??? global variable.

I think you are mistaken here.  Quoting from the Texinfo manual:

    Use the @var command to indicate metasyntactic variables. A metasyntactic 
   variable is something that stands for another piece of text. For example, you
   should use a metasyntactic variable in the documentation of a function to 
   describe the arguments that are passed to that function.

    Do not use @var for the names of normal variables in computer programs. These
   are specific names, so @code is correct for them (@code).  For example, the 
   Emacs Lisp variable texinfo-tex-command is not a metasyntactic variable; it 
   is properly formatted using @code.

Or have I got it wrong?

J'


     

-- 
Avoid eavesdropping.  Send strong encrypted email.
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://sks-keyservers.net or any PGP keyserver for public key.


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 1/2] doc: "Various Services" -> "Miscellaneous Services"
  2016-09-13 12:18   ` John Darrington
  2016-09-13 12:31     ` Alex Sassmannshausen
@ 2016-09-13 17:10     ` Leo Famulari
  2016-09-13 17:42       ` John Darrington
  2016-09-13 21:57     ` Ludovic Courtès
  2 siblings, 1 reply; 25+ messages in thread
From: Leo Famulari @ 2016-09-13 17:10 UTC (permalink / raw)
  To: John Darrington; +Cc: guix-devel, John Darrington

[-- Attachment #1: Type: text/plain, Size: 918 bytes --]

On Tue, Sep 13, 2016 at 02:18:20PM +0200, John Darrington wrote:
> On Tue, Sep 13, 2016 at 01:28:01PM +0200, Ludovic Court??s wrote:
>      John Darrington <jmd@gnu.org> skribis:
>      
>      > * doc/guix.texi (Services): "Various" -> "Miscellaneous"
>      
>      How does the meaning of these two words differ?  (I???m not a native
>      speaker, so I???m curious.)
> 
> It is a subtle nuance.
> 
> What I understand from "Various Services" is "A group of services which I chose arbitrarily".
> Wheras "Miscellaneous Services" means to me: "Services which don't fit into any of the
> hitherto mentioned categories".
> 
> Perhaps there is no formal difference, but "various" sounds odd to me in that context.
> I think that "miscellaneous" is more common in such use cases.

I don't find this use of "various" to be confusing or strange, but
"miscellaneous" is more idiomatic in this context.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 1/2] doc: "Various Services" -> "Miscellaneous Services"
  2016-09-13 17:10     ` Leo Famulari
@ 2016-09-13 17:42       ` John Darrington
  2016-09-13 17:53         ` Leo Famulari
  0 siblings, 1 reply; 25+ messages in thread
From: John Darrington @ 2016-09-13 17:42 UTC (permalink / raw)
  To: Leo Famulari; +Cc: guix-devel, John Darrington

[-- Attachment #1: Type: text/plain, Size: 1744 bytes --]

On Tue, Sep 13, 2016 at 01:10:44PM -0400, Leo Famulari wrote:
     On Tue, Sep 13, 2016 at 02:18:20PM +0200, John Darrington wrote:
     > On Tue, Sep 13, 2016 at 01:28:01PM +0200, Ludovic Court??s wrote:
     >      John Darrington <jmd@gnu.org> skribis:
     >      
     >      > * doc/guix.texi (Services): "Various" -> "Miscellaneous"
     >      
     >      How does the meaning of these two words differ?  (I???m not a native
     >      speaker, so I???m curious.)
     > 
     > It is a subtle nuance.
     > 
     > What I understand from "Various Services" is "A group of services which I chose arbitrarily".
     > Wheras "Miscellaneous Services" means to me: "Services which don't fit into any of the
     > hitherto mentioned categories".
     > 
     > Perhaps there is no formal difference, but "various" sounds odd to me in that context.
     > I think that "miscellaneous" is more common in such use cases.
     
     I don't find this use of "various" to be confusing or strange, but
     "miscellaneous" is more idiomatic in this context.

There is no idiom involved.  Both words ("various" and "miscellaneous") are used with
their literal meanings - and both are correct.  It is just that, to me, "miscellaneous"
sounds more natural in the context it is meant.   When I see "Various Services" at
the end of this section, I thought perhaps at first it was a tutorial section giving
some examples of the services already discussed in previous subsections.

J'



-- 
Avoid eavesdropping.  Send strong encrypted email.
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://sks-keyservers.net or any PGP keyserver for public key.


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 1/2] doc: "Various Services" -> "Miscellaneous Services"
  2016-09-13 17:42       ` John Darrington
@ 2016-09-13 17:53         ` Leo Famulari
  0 siblings, 0 replies; 25+ messages in thread
From: Leo Famulari @ 2016-09-13 17:53 UTC (permalink / raw)
  To: John Darrington; +Cc: guix-devel, John Darrington

[-- Attachment #1: Type: text/plain, Size: 1309 bytes --]

On Tue, Sep 13, 2016 at 07:42:33PM +0200, John Darrington wrote:
> On Tue, Sep 13, 2016 at 01:10:44PM -0400, Leo Famulari wrote:
>      On Tue, Sep 13, 2016 at 02:18:20PM +0200, John Darrington wrote:
>      > On Tue, Sep 13, 2016 at 01:28:01PM +0200, Ludovic Court??s wrote:
>      >      John Darrington <jmd@gnu.org> skribis:
>      >      
>      >      > * doc/guix.texi (Services): "Various" -> "Miscellaneous"
>      >      
>      >      How does the meaning of these two words differ?  (I???m not a native
>      >      speaker, so I???m curious.)
>      > 
>      > It is a subtle nuance.
>      > 
>      > What I understand from "Various Services" is "A group of services which I chose arbitrarily".
>      > Wheras "Miscellaneous Services" means to me: "Services which don't fit into any of the
>      > hitherto mentioned categories".
>      > 
>      > Perhaps there is no formal difference, but "various" sounds odd to me in that context.
>      > I think that "miscellaneous" is more common in such use cases.
>      
>      I don't find this use of "various" to be confusing or strange, but
>      "miscellaneous" is more idiomatic in this context.
> 
> There is no idiom involved. 

I just meant that it sounds more "natural" to a native speaker of the
language.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 1/2] doc: "Various Services" -> "Miscellaneous Services"
  2016-09-13 12:18   ` John Darrington
  2016-09-13 12:31     ` Alex Sassmannshausen
  2016-09-13 17:10     ` Leo Famulari
@ 2016-09-13 21:57     ` Ludovic Courtès
  2 siblings, 0 replies; 25+ messages in thread
From: Ludovic Courtès @ 2016-09-13 21:57 UTC (permalink / raw)
  To: John Darrington; +Cc: guix-devel, John Darrington

John Darrington <john@darrington.wattle.id.au> skribis:

> On Tue, Sep 13, 2016 at 01:28:01PM +0200, Ludovic Court??s wrote:
>      John Darrington <jmd@gnu.org> skribis:
>      
>      > * doc/guix.texi (Services): "Various" -> "Miscellaneous"
>      
>      How does the meaning of these two words differ?  (I???m not a native
>      speaker, so I???m curious.)
>
> It is a subtle nuance.
>
> What I understand from "Various Services" is "A group of services which I chose arbitrarily".
> Wheras "Miscellaneous Services" means to me: "Services which don't fit into any of the
> hitherto mentioned categories".
>
> Perhaps there is no formal difference, but "various" sounds odd to me in that context.
> I think that "miscellaneous" is more common in such use cases.

I see.  Go for it!

Thanks everyone!  :-)

Ludo’.

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 2/2] gnu: Add GSSD and Pipefs services (Usage of @var)
  2016-09-13 13:53     ` [PATCH 2/2] gnu: Add GSSD and Pipefs services (Usage of @var) John Darrington
@ 2016-09-14 14:42       ` Ludovic Courtès
  2016-09-21 18:29         ` John Darrington
  0 siblings, 1 reply; 25+ messages in thread
From: Ludovic Courtès @ 2016-09-14 14:42 UTC (permalink / raw)
  To: John Darrington; +Cc: guix-devel

John Darrington <john@darrington.wattle.id.au> skribis:

> On Tue, Sep 13, 2016 at 01:45:19PM +0200, Ludovic Court??s wrote:
>      John Darrington <jmd@gnu.org> skribis:
>
>      > +@item @code{nfs-utils} (default: @code{nfs-utils})
>                                          ^^^^^
>      Should be @var, because here we???re talking about the value of the
>      ???nfs-utils??? global variable.
>
> I think you are mistaken here.  Quoting from the Texinfo manual:
>
>     Use the @var command to indicate metasyntactic variables. A metasyntactic 
>    variable is something that stands for another piece of text. For example, you
>    should use a metasyntactic variable in the documentation of a function to 
>    describe the arguments that are passed to that function.
>
>     Do not use @var for the names of normal variables in computer programs. These
>    are specific names, so @code is correct for them (@code).  For example, the 
>    Emacs Lisp variable texinfo-tex-command is not a metasyntactic variable; it 
>    is properly formatted using @code.
>
> Or have I got it wrong?

Dunno, my interpretation is that ‘nfs-utils’ here denotes the value of
the ‘nfs-utils’ variable, so it “stands for another piece of text”,
which is (package (name "nfs-utils") …).

No big deal, but we should settle on a single convention and so far
we’ve used @var in such cases.

Ludo’.

^ permalink raw reply	[flat|nested] 25+ messages in thread

* "filesystem" vs. "file system"
  2016-09-13 11:45   ` Ludovic Courtès
  2016-09-13 13:53     ` [PATCH 2/2] gnu: Add GSSD and Pipefs services (Usage of @var) John Darrington
@ 2016-09-15  5:06     ` John Darrington
  2016-09-15 20:27       ` Ludovic Courtès
  2016-09-25  8:21     ` [PATCH] gnu: Add NFS related services John Darrington
  2 siblings, 1 reply; 25+ messages in thread
From: John Darrington @ 2016-09-15  5:06 UTC (permalink / raw)
  To: Ludovic Court??s; +Cc: guix-devel, John Darrington

[-- Attachment #1: Type: text/plain, Size: 773 bytes --]

On Tue, Sep 13, 2016 at 01:45:19PM +0200, Ludovic Court??s wrote:
     John Darrington <jmd@gnu.org> skribis:
     
     
     > +The @code{(gnu services nfs)} module provides the following services,
     > +which are most commonly used in relation to mouting or exporting NFS
     > +filesystems.
     
     (Always write ???file system??? as two words.)


I agree that we should be consistent about this.  There are numerous examples
where we have used "filesystem" whilst others use "file system".

Shall I checkin a fix?


-- 
Avoid eavesdropping.  Send strong encrypted email.
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://sks-keyservers.net or any PGP keyserver for public key.


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: "filesystem" vs. "file system"
  2016-09-15  5:06     ` "filesystem" vs. "file system" John Darrington
@ 2016-09-15 20:27       ` Ludovic Courtès
  0 siblings, 0 replies; 25+ messages in thread
From: Ludovic Courtès @ 2016-09-15 20:27 UTC (permalink / raw)
  To: John Darrington; +Cc: guix-devel, John Darrington

John Darrington <john@darrington.wattle.id.au> skribis:

> On Tue, Sep 13, 2016 at 01:45:19PM +0200, Ludovic Court??s wrote:
>      John Darrington <jmd@gnu.org> skribis:
>      
>      
>      > +The @code{(gnu services nfs)} module provides the following services,
>      > +which are most commonly used in relation to mouting or exporting NFS
>      > +filesystems.
>      
>      (Always write ???file system??? as two words.)
>
>
> I agree that we should be consistent about this.  There are numerous examples
> where we have used "filesystem" whilst others use "file system".
>
> Shall I checkin a fix?

Sure.  We have to be careful not to modify it in places where it
shouldn’t, such as URLs, file names, or identifiers.

Cheers,
Ludo’.

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 2/2] gnu: Add GSSD and Pipefs services (Usage of @var)
  2016-09-14 14:42       ` Ludovic Courtès
@ 2016-09-21 18:29         ` John Darrington
  2016-09-24  3:03           ` Ludovic Courtès
  0 siblings, 1 reply; 25+ messages in thread
From: John Darrington @ 2016-09-21 18:29 UTC (permalink / raw)
  To: Ludovic Court??s; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 4407 bytes --]

On Wed, Sep 14, 2016 at 04:42:11PM +0200, Ludovic Court??s wrote:
     John Darrington <john@darrington.wattle.id.au> skribis:
     
     > On Tue, Sep 13, 2016 at 01:45:19PM +0200, Ludovic Court??s wrote:
     >      John Darrington <jmd@gnu.org> skribis:
     >
     >      > +@item @code{nfs-utils} (default: @code{nfs-utils})
     >                                          ^^^^^
     >      Should be @var, because here we???re talking about the value of the
     >      ???nfs-utils??? global variable.
     >
     > I think you are mistaken here.  Quoting from the Texinfo manual:
     >
     >     Use the @var command to indicate metasyntactic variables. A metasyntactic 
     >    variable is something that stands for another piece of text. For example, you
     >    should use a metasyntactic variable in the documentation of a function to 
     >    describe the arguments that are passed to that function.
     >
     >     Do not use @var for the names of normal variables in computer programs. These
     >    are specific names, so @code is correct for them (@code).  For example, the 
     >    Emacs Lisp variable texinfo-tex-command is not a metasyntactic variable; it 
     >    is properly formatted using @code.
     >
     > Or have I got it wrong?
     
     Dunno, my interpretation is that ???nfs-utils??? here denotes the value of
     the ???nfs-utils??? variable, so it ???stands for another piece of text???,
     which is (package (name "nfs-utils") ???).


I don't understand what you are saying.  The text says:

  This type has the following parameters:
  @item @code{nfs-utils} (default: @code{nfs-utils})

(I think it's a little confusing that both the parameter and its default value are both called 
"nfs-utils" - but that is another issue).

The first instance of @code{nfs-utils} is the name of the parameter.  It does not stand for
something else.  That is what it is really called.  Similarly, the second instance
(default: @code{nfs-utils})  also does not stand for something else.  It is literally the default
value of the parameter.


     No big deal, but we should settle on a single convention and so far
     we???ve used @var in such cases.

Well looking at other sections I see that we have been far from consistent.  Some have used @code
and others have used @var.


Now here is an example from the manual where we have correctly used @var:

   The following command-line options are supported:

   @item --build-users-group=@var{group}
   Take users from @var{group} to run build processes 

This is correct usage of @var, because here "group" is a metasyntactical variable.  That is to say we
don't intend the user to literally type "group" --- we mean him to substitute it with whatever
group name he has chosen for his builders.

However, here is a different example:

    @example
    
    (define-public hello
      (package
        (name "hello")
        (version "2.10")
        (source (origin
                  (method url-fetch)
                  (uri (string-append "mirror://gnu/hello/hello-" version
                                      ".tar.gz"))
                  (sha256
                   (base32
                    "0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i"))))
        (build-system gnu-build-system)
        (home-page "http://www.gnu.org/software/hello/")
        (license gpl3+)))
    @end example
    
    In the example above, @var{hello} is defined in a module of its own,
    @code{(gnu packages hello)}.  
    

This, as I understand it, is incorrect use of @var because "hello" does not stand
for something else.  It refers litererally to  the text "hello" and we should put it in @code
to indicate that it is a fragment of code.  It is a variable which is part of guix.

I think the passage from the Texinfo manual  which I quoted is quite clear.


But I agree that we need to be consistent.  We should be consistent both within Guix and
be consistent with other projects which use Texinfo.  If you like I can checkin a change
to fixup the current inconsistencies.

J'
    
    
-- 
Avoid eavesdropping.  Send strong encrypted email.
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://sks-keyservers.net or any PGP keyserver for public key.


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 2/2] gnu: Add GSSD and Pipefs services (Usage of @var)
  2016-09-21 18:29         ` John Darrington
@ 2016-09-24  3:03           ` Ludovic Courtès
  0 siblings, 0 replies; 25+ messages in thread
From: Ludovic Courtès @ 2016-09-24  3:03 UTC (permalink / raw)
  To: John Darrington; +Cc: guix-devel

Hi!

John Darrington <john@darrington.wattle.id.au> skribis:

> On Wed, Sep 14, 2016 at 04:42:11PM +0200, Ludovic Court??s wrote:
>      John Darrington <john@darrington.wattle.id.au> skribis:
>      
>      > On Tue, Sep 13, 2016 at 01:45:19PM +0200, Ludovic Court??s wrote:
>      >      John Darrington <jmd@gnu.org> skribis:
>      >
>      >      > +@item @code{nfs-utils} (default: @code{nfs-utils})
>      >                                          ^^^^^
>      >      Should be @var, because here we???re talking about the value of the
>      >      ???nfs-utils??? global variable.
>      >
>      > I think you are mistaken here.  Quoting from the Texinfo manual:
>      >
>      >     Use the @var command to indicate metasyntactic variables. A metasyntactic 
>      >    variable is something that stands for another piece of text. For example, you
>      >    should use a metasyntactic variable in the documentation of a function to 
>      >    describe the arguments that are passed to that function.
>      >
>      >     Do not use @var for the names of normal variables in computer programs. These
>      >    are specific names, so @code is correct for them (@code).  For example, the 
>      >    Emacs Lisp variable texinfo-tex-command is not a metasyntactic variable; it 
>      >    is properly formatted using @code.
>      >
>      > Or have I got it wrong?
>      
>      Dunno, my interpretation is that ???nfs-utils??? here denotes the value of
>      the ???nfs-utils??? variable, so it ???stands for another piece of text???,
>      which is (package (name "nfs-utils") ???).
>
>
> I don't understand what you are saying.  The text says:
>
>   This type has the following parameters:
>   @item @code{nfs-utils} (default: @code{nfs-utils})
>
> (I think it's a little confusing that both the parameter and its default value are both called 
> "nfs-utils" - but that is another issue).
>
> The first instance of @code{nfs-utils} is the name of the parameter.  It does not stand for
> something else.  That is what it is really called.  Similarly, the second instance
> (default: @code{nfs-utils})  also does not stand for something else.  It is literally the default
> value of the parameter.

The 2nd instance means “the value of the ‘nfs-utils’ global variable.”

> Now here is an example from the manual where we have correctly used @var:
>
>    The following command-line options are supported:
>
>    @item --build-users-group=@var{group}
>    Take users from @var{group} to run build processes 
>
> This is correct usage of @var, because here "group" is a metasyntactical variable.  That is to say we
> don't intend the user to literally type "group" --- we mean him to substitute it with whatever
> group name he has chosen for his builders.

Agreed.

> However, here is a different example:
>
>     @example
>     
>     (define-public hello
>       (package
>         (name "hello")
>         (version "2.10")
>         (source (origin
>                   (method url-fetch)
>                   (uri (string-append "mirror://gnu/hello/hello-" version
>                                       ".tar.gz"))
>                   (sha256
>                    (base32
>                     "0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i"))))
>         (build-system gnu-build-system)
>         (home-page "http://www.gnu.org/software/hello/")
>         (license gpl3+)))
>     @end example
>     
>     In the example above, @var{hello} is defined in a module of its own,
>     @code{(gnu packages hello)}.  
>     
>
> This, as I understand it, is incorrect use of @var because "hello" does not stand
> for something else.

Oh, I finally got it, thanks for persevering.  :-)

Regarding the pipefs patch, you can safely ignore my comment.

OK, so I think you’re right and my understanding of @var was flawed.  So
forget my initial comment.  We should eventually fix invalid uses, but
no rush here.

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH] gnu: Add NFS related services.
  2016-09-13 11:45   ` Ludovic Courtès
  2016-09-13 13:53     ` [PATCH 2/2] gnu: Add GSSD and Pipefs services (Usage of @var) John Darrington
  2016-09-15  5:06     ` "filesystem" vs. "file system" John Darrington
@ 2016-09-25  8:21     ` John Darrington
  2016-09-30 12:02       ` Ludovic Courtès
  2 siblings, 1 reply; 25+ messages in thread
From: John Darrington @ 2016-09-25  8:21 UTC (permalink / raw)
  To: guix-devel; +Cc: John Darrington

Another draft for review ...





* gnu/services/nfs.scm (pipefs-service-type): New Variable,
(gss-service-type): New Variable, (idmap-service-type) New Variable.
---
 doc/guix.texi        |  98 ++++++++++++++++++++++++++++++++++--
 gnu/services/nfs.scm | 138 +++++++++++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 230 insertions(+), 6 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 808fbdc..67bf3fb 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -219,6 +219,7 @@ Services
 * Database Services::           SQL databases.
 * Mail Services::               IMAP, POP3, SMTP, and all that.
 * Web Services::                Web servers.
+* Network File System::         NFS related services.
 * Miscellaneous Services::      Other services.
 
 Defining Services
@@ -7587,6 +7588,7 @@ declaration.
 * Database Services::           SQL databases.
 * Mail Services::               IMAP, POP3, SMTP, and all that.
 * Web Services::                Web servers.
+* Network File System::         NFS related services.
 * Miscellaneous Services::      Other services.
 @end menu
 
@@ -10166,14 +10168,21 @@ directories are created when the service is activated.
 
 @end deffn
 
-@node Miscellaneous Services
-@subsubsection Miscellaneous Services
+@node Network File System 
+@subsubsection Network File System
+@cindex NFS
 
+The @code{(gnu services nfs)} module provides the following services,
+which are most commonly used in relation to mounting or exporting NFS
+file systems.
 
 @subsubheading RPC Bind Service
 @cindex rpcbind
 
-The @code{(gnu services nfs)} module provides the following:
+The RPC Bind service provides a facility to map program numbers into
+universal addresses.
+Many NFS related services use this facility.  Hence it is automatically
+started when a dependent service starts.
 
 @defvr {Scheme Variable} rpcbind-service-type
 A service type  for the RPC portmapper daemon.
@@ -10194,6 +10203,89 @@ instance.
 @end table
 @end deftp
 
+
+@subsubheading Pipefs Pseudo File System
+@cindex pipefs
+@cindex rpc_pipefs
+
+The pipefs file system is used to transfer NFS related data
+between the kernel and user space programs.
+
+@defvr {Scheme Variable} pipefs-service-type
+A service type for the pipefs pseudo file system.
+@end defvr
+
+@deftp {Data Type} pipefs-configuration
+Data type representing the configuration of the pipefs pseudo file system service.
+This type has the following parameters:
+@table @asis
+@item @code{mount-point} (default: @code{"/var/lib/nfs/rpc_pipefs"})
+The directory to which the file system is to be attached.
+@end table
+@end deftp
+
+
+@subsubheading GSS Daemon Service
+@cindex GSSD
+@cindex GSS
+
+The GSS daemon provides strong security for RPC based protocols.
+Before exchanging RPC requests an RPC client must establish a security
+context.  Typically this is done using the Kerberos command @command{kinit}
+or automatically at login time using PAM services.
+ 
+@defvr {Scheme Variable} gss-service-type
+A service type for the Global Security System (GSS) daemon.
+@end defvr
+
+@deftp {Data Type} gss-configuration
+Data type representing the configuration of the GSS daemon service.
+This type has the following parameters:
+@table @asis
+@item @code{nfs-utils} (default: @code{nfs-utils})
+The package in which the @command{rpc.gssd} command is to be found.
+
+@item @code{pipefs-dir} (default: @code{"/var/lib/nfs/rpc_pipefs"})
+The directory where the pipefs file system is mounted.
+
+@end table
+@end deftp
+
+
+@subsubheading IDMAP Daemon Service
+@cindex idmapd
+@cindex name mapper
+
+The idmap daemon service provides mapping between user IDs and user names.
+Typically it is required in order to access file systems mounted via NFSv4.
+
+@defvr {Scheme Variable} idmap-service-type
+A service type for the Identity Mapper (IDMAP) daemon.
+@end defvr
+
+@deftp {Data Type} idmap-configuration
+Data type representing the configuration of the IDMAP daemon service.
+This type has the following parameters:
+@table @asis
+@item @code{nfs-utils} (default: @code{nfs-utils})
+The package in which the @command{rpc.idmapd} command is to be found.
+
+@item @code{pipefs-dir} (default: @code{"/var/lib/nfs/rpc_pipefs"})
+The directory where the pipefs file system is mounted.
+
+@item @code{domain} (default: @code{#f})
+The local NFSv4 domain name.
+This must be a string or @code{#f}.
+If it is @code{#f} then the daemon will use the host's fully qualified domain name.
+
+@end table
+@end deftp
+
+
+@node Miscellaneous Services
+@subsubsection Miscellaneous Services
+
+
 @cindex lirc
 @subsubheading Lirc Service
 
diff --git a/gnu/services/nfs.scm b/gnu/services/nfs.scm
index 82713d8..e0905f5 100644
--- a/gnu/services/nfs.scm
+++ b/gnu/services/nfs.scm
@@ -20,11 +20,31 @@
   #:use-module (gnu)
   #:use-module (gnu services shepherd)
   #:use-module (gnu packages onc-rpc)
+  #:use-module (gnu packages linux)
   #:use-module (guix)
   #:use-module (guix records)
+  #:use-module (ice-9 match)
+  #:use-module (gnu build file-systems)
   #:export (rpcbind-service-type
             rpcbind-configuration
-            rpcbind-configuration?))
+            rpcbind-configuration?
+
+            pipefs-service-type
+            pipefs-configuration
+            pipefs-configuration?
+
+            idmap-service-type
+            idmap-configuration
+            idmap-configuration?
+
+            gss-service-type
+            gss-configuration
+            gss-configuration?))
+
+
+(define default-pipefs-dir "/var/lib/nfs/rpc_pipefs")
+
+\f
 
 (define-record-type* <rpcbind-configuration>
   rpcbind-configuration make-rpcbind-configuration
@@ -38,11 +58,11 @@
   (shepherd-service-type
    'rpcbind
    (lambda (config)
-     (define pkg
+     (define nfs-utils
        (rpcbind-configuration-rpcbind config))
 
      (define rpcbind-command
-       #~(list (string-append #$pkg "/bin/rpcbind") "-f"
+       #~(list (string-append #$nfs-utils "/bin/rpcbind") "-f"
                #$@(if (rpcbind-configuration-warm-start? config) '("-w") '())))
 
      (shepherd-service
@@ -52,3 +72,115 @@
 
       (start #~(make-forkexec-constructor #$rpcbind-command))
       (stop #~(make-kill-destructor))))))
+
+\f
+
+(define-record-type* <pipefs-configuration>
+  pipefs-configuration make-pipefs-configuration
+  pipefs-configuration?
+  (mount-point           pipefs-configuration-mount-point
+                         (default default-pipefs-dir)))
+
+(define pipefs-service-type
+  (shepherd-service-type
+   'pipefs
+   (lambda (config)
+
+     (define pipefs-dir (pipefs-configuration-mount-point config))
+
+     (shepherd-service
+        (documentation "Mount the pipefs pseudo filesystem.")
+        (provision '(rpc-pipefs))
+
+        (start #~(lambda ()
+                   (mkdir-p #$pipefs-dir)
+                   (mount "rpc_pipefs" #$pipefs-dir "rpc_pipefs")))
+        (stop #~(lambda (pid . args)
+                  (umount #$pipefs-dir MNT_DETACH)))))))
+
+\f
+
+(define-record-type* <gss-configuration>
+  gss-configuration make-gss-configuration
+  gss-configuration?
+  (pipefs-dir            gss-configuration-pipefs-dir
+                         (default default-pipefs-dir))
+  (nfs-utils             gss-configuration-gss
+                         (default nfs-utils)))
+
+(define gss-service-type
+  (shepherd-service-type
+   'gss
+   (lambda (config)
+     (define nfs-utils
+       (gss-configuration-gss config))
+
+     (define pipefs-dir
+       (gss-configuration-pipefs-dir config))
+
+     (define gss-command
+       #~(list (string-append #$nfs-utils "/sbin/rpc.gssd") "-f"
+               "-p" #$pipefs-dir))
+
+     (shepherd-service
+      (documentation "Start the RPC GSS daemon.")
+      (requirement '(rpcbind-daemon rpc-pipefs))
+      (provision '(gss-daemon))
+
+      (start #~(make-forkexec-constructor #$gss-command))
+      (stop #~(make-kill-destructor))))))
+
+\f
+
+(define-record-type* <idmap-configuration>
+  idmap-configuration make-idmap-configuration
+  idmap-configuration?
+  (pipefs-dir            idmap-configuration-pipefs-dir
+                         (default default-pipefs-dir))
+  (domain                idmap-configuration-domain
+                           (default #f))
+  (nfs-utils             idmap-configuration-idmap
+                         (default nfs-utils)))
+
+(define idmap-service-type
+  (shepherd-service-type
+   'idmap
+   (lambda (config)
+
+     (define nfs-utils
+       (idmap-configuration-idmap config))
+
+     (define pipefs-dir
+       (idmap-configuration-pipefs-dir config))
+
+     (define conf-file "/etc/guix-idmapd.conf")
+
+     (define idmap-command
+       #~(list (string-append #$nfs-utils "/sbin/rpc.idmapd") "-f"
+               "-p" #$pipefs-dir
+               "-c" #$conf-file))
+
+     (define domain (idmap-configuration-domain config))
+
+     (shepherd-service
+      (documentation "Start the RPC IDMAP daemon.")
+      (requirement '(rpcbind-daemon rpc-pipefs))
+      (provision '(idmap-daemon))
+
+      (start #~(lambda ()
+                 (let ((pid (primitive-fork)))
+                   (if (zero? pid)
+                       (begin
+                         (call-with-output-file #$conf-file
+                           (lambda (port)
+                             (format port "\n[General]\n")
+                             (if #$domain
+                                 (format port "Domain = ~a\n" #$domain))
+                             (format port "\n[Mapping]\n")
+                             (format port "Nobody-User = nobody\n")
+                             (format port "Nobody-Group = nogroup\n")))
+                         (exec-command #$idmap-command))
+                       pid))))
+
+      (stop #~(make-kill-destructor))))))
+
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* Re: [PATCH] gnu: Add NFS related services.
  2016-09-25  8:21     ` [PATCH] gnu: Add NFS related services John Darrington
@ 2016-09-30 12:02       ` Ludovic Courtès
  2016-09-30 14:35         ` John Darrington
  2016-10-06  2:08         ` [PATCH (3)] gnu: Add NFS related services (moved idmap.conf out of /etc, added texinfo markup to documentation, s/dir/directory) John Darrington
  0 siblings, 2 replies; 25+ messages in thread
From: Ludovic Courtès @ 2016-09-30 12:02 UTC (permalink / raw)
  To: John Darrington; +Cc: guix-devel

John Darrington <jmd@gnu.org> skribis:

> Another draft for review ...

Could you please include an iteration number in the subject line, and a
terse summary of the changes compared to the previous iteration?

That would be greatly helpful—I’m getting lost in a maze of unrelated
patch series and sometimes have a hard time remembering where we are and
what it is that I’m doing here.  ;-)

>
>
>
>
> * gnu/services/nfs.scm (pipefs-service-type): New Variable,
> (gss-service-type): New Variable, (idmap-service-type) New Variable.
> ---
>  doc/guix.texi        |  98 ++++++++++++++++++++++++++++++++++--
>  gnu/services/nfs.scm | 138 +++++++++++++++++++++++++++++++++++++++++++++++++--
>  2 files changed, 230 insertions(+), 6 deletions(-)

Please also mention the idmap things, the doc/guix.texi changes, etc.

> +@subsubheading GSS Daemon Service
> +@cindex GSSD
> +@cindex GSS
> +
> +The GSS daemon provides strong security for RPC based protocols.

“The @dfn{global security system} (GSS) daemon provides …”

>  
>  (define-record-type* <rpcbind-configuration>
>    rpcbind-configuration make-rpcbind-configuration
> @@ -38,11 +58,11 @@
>    (shepherd-service-type
>     'rpcbind
>     (lambda (config)
> -     (define pkg
> +     (define nfs-utils
>         (rpcbind-configuration-rpcbind config))
>  
>       (define rpcbind-command
> -       #~(list (string-append #$pkg "/bin/rpcbind") "-f"
> +       #~(list (string-append #$nfs-utils "/bin/rpcbind") "-f"

Should have been part of a previous patch I guess, but that’s fine.

> +(define-record-type* <pipefs-configuration>
> +  pipefs-configuration make-pipefs-configuration
> +  pipefs-configuration?
> +  (mount-point           pipefs-configuration-mount-point
> +                         (default default-pipefs-dir)))

Seems to me we don’t even need <pipefs-configuration>; a string would be
enough, no?

> +(define-record-type* <gss-configuration>
> +  gss-configuration make-gss-configuration
> +  gss-configuration?
> +  (pipefs-dir            gss-configuration-pipefs-dir
> +                         (default default-pipefs-dir))

s/dir/directory/

> +(define-record-type* <idmap-configuration>
> +  idmap-configuration make-idmap-configuration
> +  idmap-configuration?
> +  (pipefs-dir            idmap-configuration-pipefs-dir
> +                         (default default-pipefs-dir))
> +  (domain                idmap-configuration-domain
> +                           (default #f))
> +  (nfs-utils             idmap-configuration-idmap
> +                         (default nfs-utils)))
> +
> +(define idmap-service-type
> +  (shepherd-service-type
> +   'idmap
> +   (lambda (config)
> +
> +     (define nfs-utils
> +       (idmap-configuration-idmap config))
> +
> +     (define pipefs-dir
> +       (idmap-configuration-pipefs-dir config))
> +
> +     (define conf-file "/etc/guix-idmapd.conf")
> +
> +     (define idmap-command
> +       #~(list (string-append #$nfs-utils "/sbin/rpc.idmapd") "-f"
> +               "-p" #$pipefs-dir
> +               "-c" #$conf-file))
> +
> +     (define domain (idmap-configuration-domain config))
> +
> +     (shepherd-service
> +      (documentation "Start the RPC IDMAP daemon.")
> +      (requirement '(rpcbind-daemon rpc-pipefs))
> +      (provision '(idmap-daemon))
> +
> +      (start #~(lambda ()
> +                 (let ((pid (primitive-fork)))
> +                   (if (zero? pid)
> +                       (begin
> +                         (call-with-output-file #$conf-file
> +                           (lambda (port)
> +                             (format port "\n[General]\n")
> +                             (if #$domain
> +                                 (format port "Domain = ~a\n" #$domain))
> +                             (format port "\n[Mapping]\n")
> +                             (format port "Nobody-User = nobody\n")
> +                             (format port "Nobody-Group = nogroup\n")))
> +                         (exec-command #$idmap-command))
> +                       pid))))

I think the configuration file should be created elsewhere, in the
store:

  (define (idmap-config-file config)
    (plain-file "idmap.conf"
                (string-append "[General]" …)))

and then:

  (define idmap-command
    #~(list … "-c" #$(idmap-config-file config)))

  (shepherd-service
    ;; …
    (start #~(make-forkexec-constructor #$idmap-command)))

In general we should avoid populating /etc.

Could you send an updated patch?

Overall this seems to be almost ready, no?  Since this is a pretty
involved service composition, I think it would be fruitful in the future
to add a full test case in (gnu tests nfs) where we would export an NFS
tree and mount it.

Thank you!

Ludo’.

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH] gnu: Add NFS related services.
  2016-09-30 12:02       ` Ludovic Courtès
@ 2016-09-30 14:35         ` John Darrington
  2016-10-06  2:08         ` [PATCH (3)] gnu: Add NFS related services (moved idmap.conf out of /etc, added texinfo markup to documentation, s/dir/directory) John Darrington
  1 sibling, 0 replies; 25+ messages in thread
From: John Darrington @ 2016-09-30 14:35 UTC (permalink / raw)
  To: Ludovic Court??s; +Cc: guix-devel

On Fri, Sep 30, 2016 at 02:02:37PM +0200, Ludovic Court??s wrote:
> John Darrington <jmd@gnu.org> skribis:
> 
> > Another draft for review ...
> 
> Could you please include an iteration number in the subject line, and a
> terse summary of the changes compared to the previous iteration?
> 
> That would be greatly helpful???I???m getting lost in a maze of unrelated
> patch series and sometimes have a hard time remembering where we are and
> what it is that I???m doing here.  ;-)
> 

OK


> Please also mention the idmap things, the doc/guix.texi changes, etc.

OK


> ???The @dfn{global security system} (GSS) daemon provides ??????

OK

> 
> > +(define-record-type* <pipefs-configuration>
> > +  pipefs-configuration make-pipefs-configuration
> > +  pipefs-configuration?
> > +  (mount-point           pipefs-configuration-mount-point
> > +                         (default default-pipefs-dir)))
> 
> Seems to me we don???t even need <pipefs-configuration>; a string would be
> enough, no?

We could.  But then if somebody wanted to mount it in a non-standard
place they wouldn't be able to override that from /etc/config.scm


> Overall this seems to be almost ready, no?  Since this is a pretty
> involved service composition, I think it would be fruitful in the future
> to add a full test case in (gnu tests nfs) where we would export an NFS
> tree and mount it.

I agree.  However that will mean having to first implement the server side
NFS stuff which is a whole other can of worms....

J'

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH (3)] gnu: Add NFS related services (moved idmap.conf out of /etc, added texinfo markup to documentation, s/dir/directory)
  2016-09-30 12:02       ` Ludovic Courtès
  2016-09-30 14:35         ` John Darrington
@ 2016-10-06  2:08         ` John Darrington
  2016-10-06 19:49           ` Ludovic Courtès
  1 sibling, 1 reply; 25+ messages in thread
From: John Darrington @ 2016-10-06  2:08 UTC (permalink / raw)
  To: guix-devel; +Cc: John Darrington

* gnu/services/nfs.scm (pipefs-service-type): New Variable,
(gss-service-type): New Variable, (idmap-service-type) New Variable.

* doc/guix.texi (Network File system): New Node.
---
 doc/guix.texi        | 100 ++++++++++++++++++++++++++++++++++++++--
 gnu/services/nfs.scm | 127 ++++++++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 223 insertions(+), 4 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 9bd8b43..704868a 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -221,6 +221,7 @@ Services
 * Database Services::           SQL databases.
 * Mail Services::               IMAP, POP3, SMTP, and all that.
 * Web Services::                Web servers.
+* Network File System::         NFS related services.
 * Miscellaneous Services::      Other services.
 
 Defining Services
@@ -7590,6 +7591,7 @@ declaration.
 * Database Services::           SQL databases.
 * Mail Services::               IMAP, POP3, SMTP, and all that.
 * Web Services::                Web servers.
+* Network File System::         NFS related services.
 * Miscellaneous Services::      Other services.
 @end menu
 
@@ -10309,14 +10311,21 @@ directories are created when the service is activated.
 
 @end deffn
 
-@node Miscellaneous Services
-@subsubsection Miscellaneous Services
+@node Network File System
+@subsubsection Network File System
+@cindex NFS
 
+The @code{(gnu services nfs)} module provides the following services,
+which are most commonly used in relation to mounting or exporting NFS
+file systems.
 
 @subsubheading RPC Bind Service
 @cindex rpcbind
 
-The @code{(gnu services nfs)} module provides the following:
+The RPC Bind service provides a facility to map program numbers into
+universal addresses.
+Many NFS related services use this facility.  Hence it is automatically
+started when a dependent service starts.
 
 @defvr {Scheme Variable} rpcbind-service-type
 A service type  for the RPC portmapper daemon.
@@ -10337,6 +10346,91 @@ instance.
 @end table
 @end deftp
 
+
+@subsubheading Pipefs Pseudo File System
+@cindex pipefs
+@cindex rpc_pipefs
+
+The pipefs file system is used to transfer NFS related data
+between the kernel and user space programs.
+
+@defvr {Scheme Variable} pipefs-service-type
+A service type for the pipefs pseudo file system.
+@end defvr
+
+@deftp {Data Type} pipefs-configuration
+Data type representing the configuration of the pipefs pseudo file system service.
+This type has the following parameters:
+@table @asis
+@item @code{mount-point} (default: @code{"/var/lib/nfs/rpc_pipefs"})
+The directory to which the file system is to be attached.
+@end table
+@end deftp
+
+
+@subsubheading GSS Daemon Service
+@cindex GSSD
+@cindex GSS
+@cindex global security system
+
+The @dfn{global security system} (GSS) daemon provides strong security for RPC
+based protocols.
+Before exchanging RPC requests an RPC client must establish a security
+context.  Typically this is done using the Kerberos command @command{kinit}
+or automatically at login time using PAM services.
+
+@defvr {Scheme Variable} gss-service-type
+A service type for the Global Security System (GSS) daemon.
+@end defvr
+
+@deftp {Data Type} gss-configuration
+Data type representing the configuration of the GSS daemon service.
+This type has the following parameters:
+@table @asis
+@item @code{nfs-utils} (default: @code{nfs-utils})
+The package in which the @command{rpc.gssd} command is to be found.
+
+@item @code{pipefs-directory} (default: @code{"/var/lib/nfs/rpc_pipefs"})
+The directory where the pipefs file system is mounted.
+
+@end table
+@end deftp
+
+
+@subsubheading IDMAP Daemon Service
+@cindex idmapd
+@cindex name mapper
+
+The idmap daemon service provides mapping between user IDs and user names.
+Typically it is required in order to access file systems mounted via NFSv4.
+
+@defvr {Scheme Variable} idmap-service-type
+A service type for the Identity Mapper (IDMAP) daemon.
+@end defvr
+
+@deftp {Data Type} idmap-configuration
+Data type representing the configuration of the IDMAP daemon service.
+This type has the following parameters:
+@table @asis
+@item @code{nfs-utils} (default: @code{nfs-utils})
+The package in which the @command{rpc.idmapd} command is to be found.
+
+@item @code{pipefs-directory} (default: @code{"/var/lib/nfs/rpc_pipefs"})
+The directory where the pipefs file system is mounted.
+
+@item @code{domain} (default: @code{#f})
+The local NFSv4 domain name.
+This must be a string or @code{#f}.
+If it is @code{#f} then the daemon will use the host's fully qualified domain name.
+
+@end table
+@end deftp
+
+
+@node Miscellaneous Services
+@subsubsection Miscellaneous Services
+
+
 @cindex lirc
 @subsubheading Lirc Service
 
diff --git a/gnu/services/nfs.scm b/gnu/services/nfs.scm
index b1e1f53..94982d7 100644
--- a/gnu/services/nfs.scm
+++ b/gnu/services/nfs.scm
@@ -20,11 +20,31 @@
   #:use-module (gnu)
   #:use-module (gnu services shepherd)
   #:use-module (gnu packages onc-rpc)
+  #:use-module (gnu packages linux)
   #:use-module (guix)
   #:use-module (guix records)
+  #:use-module (ice-9 match)
+  #:use-module (gnu build file-systems)
   #:export (rpcbind-service-type
             rpcbind-configuration
-            rpcbind-configuration?))
+            rpcbind-configuration?
+
+            pipefs-service-type
+            pipefs-configuration
+            pipefs-configuration?
+
+            idmap-service-type
+            idmap-configuration
+            idmap-configuration?
+
+            gss-service-type
+            gss-configuration
+            gss-configuration?))
+
+
+(define default-pipefs-directory "/var/lib/nfs/rpc_pipefs")
+
+\f
 
 (define-record-type* <rpcbind-configuration>
   rpcbind-configuration make-rpcbind-configuration
@@ -52,3 +72,108 @@
 
       (start #~(make-forkexec-constructor #$rpcbind-command))
       (stop #~(make-kill-destructor))))))
+
+\f
+
+(define-record-type* <pipefs-configuration>
+  pipefs-configuration make-pipefs-configuration
+  pipefs-configuration?
+  (mount-point           pipefs-configuration-mount-point
+                         (default default-pipefs-directory)))
+
+(define pipefs-service-type
+  (shepherd-service-type
+   'pipefs
+   (lambda (config)
+
+     (define pipefs-directory (pipefs-configuration-mount-point config))
+
+     (shepherd-service
+        (documentation "Mount the pipefs pseudo filesystem.")
+        (provision '(rpc-pipefs))
+
+        (start #~(lambda ()
+                   (mkdir-p #$pipefs-directory)
+                   (mount "rpc_pipefs" #$pipefs-directory "rpc_pipefs")))
+        (stop #~(lambda (pid . args)
+                  (umount #$pipefs-directory MNT_DETACH)))))))
+
+\f
+
+(define-record-type* <gss-configuration>
+  gss-configuration make-gss-configuration
+  gss-configuration?
+  (pipefs-directory            gss-configuration-pipefs-directory
+                         (default default-pipefs-directory))
+  (nfs-utils             gss-configuration-gss
+                         (default nfs-utils)))
+
+(define gss-service-type
+  (shepherd-service-type
+   'gss
+   (lambda (config)
+     (define nfs-utils
+       (gss-configuration-gss config))
+
+     (define pipefs-directory
+       (gss-configuration-pipefs-directory config))
+
+     (define gss-command
+       #~(list (string-append #$nfs-utils "/sbin/rpc.gssd") "-f"
+               "-p" #$pipefs-directory))
+
+     (shepherd-service
+      (documentation "Start the RPC GSS daemon.")
+      (requirement '(rpcbind-daemon rpc-pipefs))
+      (provision '(gss-daemon))
+
+      (start #~(make-forkexec-constructor #$gss-command))
+      (stop #~(make-kill-destructor))))))
+
+\f
+
+(define-record-type* <idmap-configuration>
+  idmap-configuration make-idmap-configuration
+  idmap-configuration?
+  (pipefs-directory            idmap-configuration-pipefs-directory
+                         (default default-pipefs-directory))
+  (domain                idmap-configuration-domain
+                           (default #f))
+  (nfs-utils             idmap-configuration-idmap
+                         (default nfs-utils)))
+
+(define idmap-service-type
+  (shepherd-service-type
+   'idmap
+   (lambda (config)
+
+     (define nfs-utils
+       (idmap-configuration-idmap config))
+
+     (define pipefs-directory
+       (idmap-configuration-pipefs-directory config))
+
+     (define domain (idmap-configuration-domain config))
+
+     (define (idmap-config-file config)
+       (plain-file "idmapd.conf"
+                   (string-append
+                    "\n[General]\n"
+                    (if domain
+                        (format #f "Domain = ~a\n" domain))
+                    "\n[Mapping]\n"
+                    "Nobody-User = nobody\n"
+                    "Nobody-Group = nogroup\n")))
+
+     (define idmap-command
+       #~(list (string-append #$nfs-utils "/sbin/rpc.idmapd") "-f"
+               "-p" #$pipefs-directory
+               "-c" #$(idmap-config-file config)))
+
+     (shepherd-service
+      (documentation "Start the RPC IDMAP daemon.")
+      (requirement '(rpcbind-daemon rpc-pipefs))
+      (provision '(idmap-daemon))
+      (start #~(make-forkexec-constructor #$idmap-command))
+      (stop #~(make-kill-destructor))))))
+
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* Re: [PATCH (3)] gnu: Add NFS related services (moved idmap.conf out of /etc, added texinfo markup to documentation, s/dir/directory)
  2016-10-06  2:08         ` [PATCH (3)] gnu: Add NFS related services (moved idmap.conf out of /etc, added texinfo markup to documentation, s/dir/directory) John Darrington
@ 2016-10-06 19:49           ` Ludovic Courtès
  2016-10-08 10:19             ` John Darrington
                               ` (2 more replies)
  0 siblings, 3 replies; 25+ messages in thread
From: Ludovic Courtès @ 2016-10-06 19:49 UTC (permalink / raw)
  To: John Darrington; +Cc: guix-devel

Hi!

John Darrington <jmd@gnu.org> skribis:

> * gnu/services/nfs.scm (pipefs-service-type): New Variable,
> (gss-service-type): New Variable, (idmap-service-type) New Variable.
>
> * doc/guix.texi (Network File system): New Node.

Minor issues, and a suggestion for the pipefs service:

> +The @code{(gnu services nfs)} module provides the following services,
> +which are most commonly used in relation to mounting or exporting NFS
> +file systems.

Rather something like:
“mounting or exporting directory trees as @dfn{network file systems} (NFS).”

>  @subsubheading RPC Bind Service
>  @cindex rpcbind
>  
> -The @code{(gnu services nfs)} module provides the following:
> +The RPC Bind service provides a facility to map program numbers into

s/program numbers/ONC@tie{}RPC program numbers/

> +universal addresses.

“IP addresses”?

+ “ (RPC stands for @dfn{remote procedure call})”

> +     (shepherd-service
> +        (documentation "Mount the pipefs pseudo filesystem.")
          ^
Extra space.

> +        (provision '(rpc-pipefs))
> +
> +        (start #~(lambda ()
> +                   (mkdir-p #$pipefs-directory)
> +                   (mount "rpc_pipefs" #$pipefs-directory "rpc_pipefs")))
> +        (stop #~(lambda (pid . args)
> +                  (umount #$pipefs-directory MNT_DETACH)))))))

There’s the problem that ‘start’ must return a truth value (to tell the
Shepherd that the service was correctly “started”), so it’s better to
add an explicit #t at the end; conversely, ‘stop’ must return #f to
denote a successful stop.

However, as mentioned at
<https://lists.gnu.org/archive/html/guix-devel/2016-09/msg01096.html>, I
think it would be best to achieve this by extending
‘file-system-service-type’.

Could you try that?  If it works, I don’t have any further comments.

> +     (define idmap-command
> +       #~(list (string-append #$nfs-utils "/sbin/rpc.idmapd") "-f"

                  #$(file-append nfs-utils "/sbin/rpc.idmapd")

> +     (shepherd-service
> +      (documentation "Start the RPC IDMAP daemon.")
        ^
Missing space this time.  :-)

Thank you!

Ludo’.

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH (3)] gnu: Add NFS related services (moved idmap.conf out of /etc, added texinfo markup to documentation, s/dir/directory)
  2016-10-06 19:49           ` Ludovic Courtès
@ 2016-10-08 10:19             ` John Darrington
  2016-10-09  5:47             ` John Darrington
  2016-10-11  6:37             ` [PATCH (4)] gnu: Add NFS related services. (minor improvements to documentation; Added test to ensure that pipefs mount/umount succeeded() John Darrington
  2 siblings, 0 replies; 25+ messages in thread
From: John Darrington @ 2016-10-08 10:19 UTC (permalink / raw)
  To: Ludovic Court??s; +Cc: guix-devel, John Darrington

[-- Attachment #1: Type: text/plain, Size: 836 bytes --]

On Thu, Oct 06, 2016 at 09:49:36PM +0200, Ludovic Court??s wrote:
     
     However, as mentioned at
     <https://lists.gnu.org/archive/html/guix-devel/2016-09/msg01096.html>, I
     think it would be best to achieve this by extending
     ???file-system-service-type???.
     
     Could you try that?  If it works, I don???t have any further comments.
     

I did try it when you first mentioned it.  However I couldn't work out how
to make the other services then depend upon the so configured file-system.
I will have another look and see if I can see how it should work.

J'
     

-- 
Avoid eavesdropping.  Send strong encrypted email.
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://sks-keyservers.net or any PGP keyserver for public key.


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH (3)] gnu: Add NFS related services (moved idmap.conf out of /etc, added texinfo markup to documentation, s/dir/directory)
  2016-10-06 19:49           ` Ludovic Courtès
  2016-10-08 10:19             ` John Darrington
@ 2016-10-09  5:47             ` John Darrington
  2016-10-11  6:37             ` [PATCH (4)] gnu: Add NFS related services. (minor improvements to documentation; Added test to ensure that pipefs mount/umount succeeded() John Darrington
  2 siblings, 0 replies; 25+ messages in thread
From: John Darrington @ 2016-10-09  5:47 UTC (permalink / raw)
  To: Ludovic Court??s; +Cc: guix-devel, John Darrington

[-- Attachment #1: Type: text/plain, Size: 1012 bytes --]

On Thu, Oct 06, 2016 at 09:49:36PM +0200, Ludovic Court??s wrote:
     Hi!
     
     > +The RPC Bind service provides a facility to map program numbers into
     
     s/program numbers/ONC@tie{}RPC program numbers/
     
     > +universal addresses.
     
     ???IP addresses????

No.  These are not IP addresses.  Here the term "address" it used in a very 
general sense.  (in most uses the "addresses" are in fact program names - 
but they could be anything).
     
     + ??? (RPC stands for @dfn{remote procedure call})???
     
     > +     (shepherd-service
     > +      (documentation "Start the RPC IDMAP daemon.")
             ^
     Missing space this time.  :-)
     
Somebody needs to send a patch to emacs if this is important.

J'
     

-- 
Avoid eavesdropping.  Send strong encrypted email.
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://sks-keyservers.net or any PGP keyserver for public key.


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH (4)] gnu: Add NFS related services. (minor improvements to documentation; Added test to ensure that pipefs mount/umount succeeded()
  2016-10-06 19:49           ` Ludovic Courtès
  2016-10-08 10:19             ` John Darrington
  2016-10-09  5:47             ` John Darrington
@ 2016-10-11  6:37             ` John Darrington
  2016-10-11 20:30               ` Ludovic Courtès
  2 siblings, 1 reply; 25+ messages in thread
From: John Darrington @ 2016-10-11  6:37 UTC (permalink / raw)
  To: guix-devel; +Cc: John Darrington

Yet another patch.  Here I check that the mount/umount succeeds by testing that 
/var/lib/nfs/pipefs is a member of the list returned by (mount-points).

Regarding Ludo's suggestion to use a filesystem extention a la elogind - I have
looked into that possibility, but so far as I can see using a service extension 
does not allow a "provision" field, so I don't know how to make the other services
dependent upon it.  Also I don't see from the elogind example how to specify an 
alternative mount point and then to pass that mount point to dependent services.
(I cannot imagine why anyone would want to do that, but hey - guix is supposed to
be hackable!)   I'd be happy to change it later if someone can explain how to do it.





* gnu/services/nfs.scm (pipefs-service-type): New Variable,
(gss-service-type): New Variable, (idmap-service-type) New Variable.

* doc/guix.texi (Network File system): New Node.
---
 doc/guix.texi        | 100 +++++++++++++++++++++++++++++++++++++--
 gnu/services/nfs.scm | 129 ++++++++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 225 insertions(+), 4 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 57821c5..1f6e0bb 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -221,6 +221,7 @@ Services
 * Database Services::           SQL databases.
 * Mail Services::               IMAP, POP3, SMTP, and all that.
 * Web Services::                Web servers.
+* Network File System::         NFS related services.
 * Miscellaneous Services::      Other services.
 
 Defining Services
@@ -7647,6 +7648,7 @@ declaration.
 * Database Services::           SQL databases.
 * Mail Services::               IMAP, POP3, SMTP, and all that.
 * Web Services::                Web servers.
+* Network File System::         NFS related services.
 * Miscellaneous Services::      Other services.
 @end menu
 
@@ -10366,14 +10368,21 @@ directories are created when the service is activated.
 
 @end deffn
 
-@node Miscellaneous Services
-@subsubsection Miscellaneous Services
+@node Network File System
+@subsubsection Network File System
+@cindex NFS
 
+The @code{(gnu services nfs)} module provides the following services,
+which are most commonly used in relation to mounting or exporting
+directory trees as @dfn{network file systems} (NFS).
 
 @subsubheading RPC Bind Service
 @cindex rpcbind
 
-The @code{(gnu services nfs)} module provides the following:
+The RPC Bind service provides a facility to map program numbers into
+universal addresses.
+Many NFS related services use this facility.  Hence it is automatically
+started when a dependent service starts.
 
 @defvr {Scheme Variable} rpcbind-service-type
 A service type  for the RPC portmapper daemon.
@@ -10394,6 +10403,91 @@ instance.
 @end table
 @end deftp
 
+
+@subsubheading Pipefs Pseudo File System
+@cindex pipefs
+@cindex rpc_pipefs
+
+The pipefs file system is used to transfer NFS related data
+between the kernel and user space programs.
+
+@defvr {Scheme Variable} pipefs-service-type
+A service type for the pipefs pseudo file system.
+@end defvr
+
+@deftp {Data Type} pipefs-configuration
+Data type representing the configuration of the pipefs pseudo file system service.
+This type has the following parameters:
+@table @asis
+@item @code{mount-point} (default: @code{"/var/lib/nfs/rpc_pipefs"})
+The directory to which the file system is to be attached.
+@end table
+@end deftp
+
+
+@subsubheading GSS Daemon Service
+@cindex GSSD
+@cindex GSS
+@cindex global security system
+
+The @dfn{global security system} (GSS) daemon provides strong security for RPC
+based protocols.
+Before exchanging RPC requests an RPC client must establish a security
+context.  Typically this is done using the Kerberos command @command{kinit}
+or automatically at login time using PAM services.
+
+@defvr {Scheme Variable} gss-service-type
+A service type for the Global Security System (GSS) daemon.
+@end defvr
+
+@deftp {Data Type} gss-configuration
+Data type representing the configuration of the GSS daemon service.
+This type has the following parameters:
+@table @asis
+@item @code{nfs-utils} (default: @code{nfs-utils})
+The package in which the @command{rpc.gssd} command is to be found.
+
+@item @code{pipefs-directory} (default: @code{"/var/lib/nfs/rpc_pipefs"})
+The directory where the pipefs file system is mounted.
+
+@end table
+@end deftp
+
+
+@subsubheading IDMAP Daemon Service
+@cindex idmapd
+@cindex name mapper
+
+The idmap daemon service provides mapping between user IDs and user names.
+Typically it is required in order to access file systems mounted via NFSv4.
+
+@defvr {Scheme Variable} idmap-service-type
+A service type for the Identity Mapper (IDMAP) daemon.
+@end defvr
+
+@deftp {Data Type} idmap-configuration
+Data type representing the configuration of the IDMAP daemon service.
+This type has the following parameters:
+@table @asis
+@item @code{nfs-utils} (default: @code{nfs-utils})
+The package in which the @command{rpc.idmapd} command is to be found.
+
+@item @code{pipefs-directory} (default: @code{"/var/lib/nfs/rpc_pipefs"})
+The directory where the pipefs file system is mounted.
+
+@item @code{domain} (default: @code{#f})
+The local NFSv4 domain name.
+This must be a string or @code{#f}.
+If it is @code{#f} then the daemon will use the host's fully qualified domain name.
+
+@end table
+@end deftp
+
+
+@node Miscellaneous Services
+@subsubsection Miscellaneous Services
+
+
 @cindex lirc
 @subsubheading Lirc Service
 
diff --git a/gnu/services/nfs.scm b/gnu/services/nfs.scm
index b1e1f53..8f58920 100644
--- a/gnu/services/nfs.scm
+++ b/gnu/services/nfs.scm
@@ -20,11 +20,31 @@
   #:use-module (gnu)
   #:use-module (gnu services shepherd)
   #:use-module (gnu packages onc-rpc)
+  #:use-module (gnu packages linux)
   #:use-module (guix)
   #:use-module (guix records)
+  #:use-module (ice-9 match)
+  #:use-module (gnu build file-systems)
   #:export (rpcbind-service-type
             rpcbind-configuration
-            rpcbind-configuration?))
+            rpcbind-configuration?
+
+            pipefs-service-type
+            pipefs-configuration
+            pipefs-configuration?
+
+            idmap-service-type
+            idmap-configuration
+            idmap-configuration?
+
+            gss-service-type
+            gss-configuration
+            gss-configuration?))
+
+
+(define default-pipefs-directory "/var/lib/nfs/rpc_pipefs")
+
+\f
 
 (define-record-type* <rpcbind-configuration>
   rpcbind-configuration make-rpcbind-configuration
@@ -52,3 +72,110 @@
 
       (start #~(make-forkexec-constructor #$rpcbind-command))
       (stop #~(make-kill-destructor))))))
+
+\f
+
+(define-record-type* <pipefs-configuration>
+  pipefs-configuration make-pipefs-configuration
+  pipefs-configuration?
+  (mount-point           pipefs-configuration-mount-point
+                         (default default-pipefs-directory)))
+
+(define pipefs-service-type
+  (shepherd-service-type
+   'pipefs
+   (lambda (config)
+     (define pipefs-directory (pipefs-configuration-mount-point config))
+
+     (shepherd-service
+      (documentation "Mount the pipefs pseudo filesystem.")
+      (provision '(rpc-pipefs))
+
+      (start #~(lambda ()
+                 (mkdir-p #$pipefs-directory)
+                 (mount "rpc_pipefs" #$pipefs-directory "rpc_pipefs")
+                 (member #$pipefs-directory (mount-points))))
+
+      (stop #~(lambda (pid . args)
+                (umount #$pipefs-directory MNT_DETACH)
+                (not (member #$pipefs-directory (mount-points)))))))))
+
+\f
+
+(define-record-type* <gss-configuration>
+  gss-configuration make-gss-configuration
+  gss-configuration?
+  (pipefs-directory            gss-configuration-pipefs-directory
+                         (default default-pipefs-directory))
+  (nfs-utils             gss-configuration-gss
+                         (default nfs-utils)))
+
+(define gss-service-type
+  (shepherd-service-type
+   'gss
+   (lambda (config)
+     (define nfs-utils
+       (gss-configuration-gss config))
+
+     (define pipefs-directory
+       (gss-configuration-pipefs-directory config))
+
+     (define gss-command
+       #~(list (string-append #$nfs-utils "/sbin/rpc.gssd") "-f"
+               "-p" #$pipefs-directory))
+
+     (shepherd-service
+      (documentation "Start the RPC GSS daemon.")
+      (requirement '(rpcbind-daemon rpc-pipefs))
+      (provision '(gss-daemon))
+
+      (start #~(make-forkexec-constructor #$gss-command))
+      (stop #~(make-kill-destructor))))))
+
+\f
+
+(define-record-type* <idmap-configuration>
+  idmap-configuration make-idmap-configuration
+  idmap-configuration?
+  (pipefs-directory            idmap-configuration-pipefs-directory
+                         (default default-pipefs-directory))
+  (domain                idmap-configuration-domain
+                           (default #f))
+  (nfs-utils             idmap-configuration-idmap
+                         (default nfs-utils)))
+
+(define idmap-service-type
+  (shepherd-service-type
+   'idmap
+   (lambda (config)
+
+     (define nfs-utils
+       (idmap-configuration-idmap config))
+
+     (define pipefs-directory
+       (idmap-configuration-pipefs-directory config))
+
+     (define domain (idmap-configuration-domain config))
+
+     (define (idmap-config-file config)
+       (plain-file "idmapd.conf"
+                   (string-append
+                    "\n[General]\n"
+                    (if domain
+                        (format #f "Domain = ~a\n" domain))
+                    "\n[Mapping]\n"
+                    "Nobody-User = nobody\n"
+                    "Nobody-Group = nogroup\n")))
+
+     (define idmap-command
+       #~(list (string-append #$nfs-utils "/sbin/rpc.idmapd") "-f"
+               "-p" #$pipefs-directory
+               "-c" #$(idmap-config-file config)))
+
+     (shepherd-service
+       (documentation "Start the RPC IDMAP daemon.")
+       (requirement '(rpcbind-daemon rpc-pipefs))
+       (provision '(idmap-daemon))
+       (start #~(make-forkexec-constructor #$idmap-command))
+       (stop #~(make-kill-destructor))))))
+
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* Re: [PATCH (4)] gnu: Add NFS related services. (minor improvements to documentation; Added test to ensure that pipefs mount/umount succeeded()
  2016-10-11  6:37             ` [PATCH (4)] gnu: Add NFS related services. (minor improvements to documentation; Added test to ensure that pipefs mount/umount succeeded() John Darrington
@ 2016-10-11 20:30               ` Ludovic Courtès
  0 siblings, 0 replies; 25+ messages in thread
From: Ludovic Courtès @ 2016-10-11 20:30 UTC (permalink / raw)
  To: John Darrington; +Cc: guix-devel

Hi,

John Darrington <jmd@gnu.org> skribis:

> Yet another patch.  Here I check that the mount/umount succeeds by testing that 
> /var/lib/nfs/pipefs is a member of the list returned by (mount-points).

OK.

> Regarding Ludo's suggestion to use a filesystem extention a la elogind - I have
> looked into that possibility, but so far as I can see using a service extension 
> does not allow a "provision" field, so I don't know how to make the other services
> dependent upon it.  Also I don't see from the elogind example how to specify an 
> alternative mount point and then to pass that mount point to dependent services.
> (I cannot imagine why anyone would want to do that, but hey - guix is supposed to
> be hackable!)   I'd be happy to change it later if someone can explain how to do it.

Yes, let’s keep it for later.

For future reference, as I wrote in
<https://lists.gnu.org/archive/html/guix-devel/2016-09/msg01096.html>,
the Shepherd service corresponding to the file system object would be
called ‘file-system-/var/lib/nfs/pipefs’.  This is the name you would
write in ‘requirement’.

>
>
>
>
> * gnu/services/nfs.scm (pipefs-service-type): New Variable,
> (gss-service-type): New Variable, (idmap-service-type) New Variable.
>
> * doc/guix.texi (Network File system): New Node.

No need to capitalize “node” and “variable.”

OK with this patch, thank you!

Ludo’.

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2016-10-11 20:30 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-10 19:18 [PATCH 1/2] doc: "Various Services" -> "Miscellaneous Services" John Darrington
2016-09-10 19:18 ` [PATCH 2/2] gnu: Add GSSD and Pipefs services John Darrington
2016-09-13 11:45   ` Ludovic Courtès
2016-09-13 13:53     ` [PATCH 2/2] gnu: Add GSSD and Pipefs services (Usage of @var) John Darrington
2016-09-14 14:42       ` Ludovic Courtès
2016-09-21 18:29         ` John Darrington
2016-09-24  3:03           ` Ludovic Courtès
2016-09-15  5:06     ` "filesystem" vs. "file system" John Darrington
2016-09-15 20:27       ` Ludovic Courtès
2016-09-25  8:21     ` [PATCH] gnu: Add NFS related services John Darrington
2016-09-30 12:02       ` Ludovic Courtès
2016-09-30 14:35         ` John Darrington
2016-10-06  2:08         ` [PATCH (3)] gnu: Add NFS related services (moved idmap.conf out of /etc, added texinfo markup to documentation, s/dir/directory) John Darrington
2016-10-06 19:49           ` Ludovic Courtès
2016-10-08 10:19             ` John Darrington
2016-10-09  5:47             ` John Darrington
2016-10-11  6:37             ` [PATCH (4)] gnu: Add NFS related services. (minor improvements to documentation; Added test to ensure that pipefs mount/umount succeeded() John Darrington
2016-10-11 20:30               ` Ludovic Courtès
2016-09-13 11:28 ` [PATCH 1/2] doc: "Various Services" -> "Miscellaneous Services" Ludovic Courtès
2016-09-13 12:18   ` John Darrington
2016-09-13 12:31     ` Alex Sassmannshausen
2016-09-13 17:10     ` Leo Famulari
2016-09-13 17:42       ` John Darrington
2016-09-13 17:53         ` Leo Famulari
2016-09-13 21:57     ` Ludovic Courtès

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).