summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2020-03-16 17:45:32 +0100
committerLudovic Courtès <ludo@gnu.org>2020-03-16 22:58:37 +0100
commite28770df718b733959a4cae933e9c2e8d32715be (patch)
treef2af71a79bde8da899631e6dc7935bf227eb7ba0 /gnu
parenta55472955d7dbe7385fb25a5c31b26f8ebfa6e93 (diff)
downloadguix-e28770df718b733959a4cae933e9c2e8d32715be.tar.gz
services: nfs: Move activation snippet out of line.
* gnu/services/nfs.scm (%nfs-activation): New variable.
(nfs-service-type)[extensions]: Refer to %NFS-ACTIVATION.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/services/nfs.scm42
1 files changed, 23 insertions, 19 deletions
diff --git a/gnu/services/nfs.scm b/gnu/services/nfs.scm
index 140a11856a..3b7dd78eca 100644
--- a/gnu/services/nfs.scm
+++ b/gnu/services/nfs.scm
@@ -360,31 +360,35 @@
                 #t))
            (respawn? #f)))))
 
+(define %nfs-activation
+  (with-imported-modules '((guix build utils))
+    #~(begin
+        (use-modules (guix build utils))
+
+        (system* "mount" "-t" "nfsd"
+                 "nfsd" "/proc/fs/nfsd")
+
+        (mkdir-p "/var/lib/nfs")
+        ;; directory containing monitor list
+        (mkdir-p "/var/lib/nfs/sm")
+        ;; Needed for client recovery tracking
+        (mkdir-p "/var/lib/nfs/v4recovery")
+        (let ((user (getpw "nobody")))
+          (chown "/var/lib/nfs"
+                 (passwd:uid user)
+                 (passwd:gid user))
+          (chown "/var/lib/nfs/v4recovery"
+                 (passwd:uid user)
+                 (passwd:gid user)))
+        #t)))
+
 (define nfs-service-type
   (service-type
    (name 'nfs)
    (extensions
     (list
      (service-extension shepherd-root-service-type nfs-shepherd-services)
-     (service-extension activation-service-type
-                        (const #~(begin
-                                   (use-modules (guix build utils))
-                                   (system* "mount" "-t" "nfsd"
-                                            "nfsd" "/proc/fs/nfsd")
-
-                                   (mkdir-p "/var/lib/nfs")
-                                   ;; directory containing monitor list
-                                   (mkdir-p "/var/lib/nfs/sm")
-                                   ;; Needed for client recovery tracking
-                                   (mkdir-p "/var/lib/nfs/v4recovery")
-                                   (let ((user (getpw "nobody")))
-                                     (chown "/var/lib/nfs"
-                                            (passwd:uid user)
-                                            (passwd:gid user))
-                                     (chown "/var/lib/nfs/v4recovery"
-                                            (passwd:uid user)
-                                            (passwd:gid user)))
-                                   #t)))
+     (service-extension activation-service-type (const %nfs-activation))
      (service-extension etc-service-type
                         (lambda (config)
                           `(("exports"