services: nfs: Move activation snippet out of line.

* gnu/services/nfs.scm (%nfs-activation): New variable.
(nfs-service-type)[extensions]: Refer to %NFS-ACTIVATION.
This commit is contained in:
Ludovic Courtès 2020-03-16 17:45:32 +01:00
parent a55472955d
commit e28770df71
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -360,31 +360,35 @@ (define (nfs-shepherd-services config)
#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"