Subject: Re: bug#45692: [PATCH 0/4] Even Better ZFS Support on Guix

From: raid5atemyhomework <[email-masked]>
Date: Wed, 10 Feb 2021 14:46:43 +0000

> Why do we need to extend with symbols?
>
> In general it’s much clearer if extensions receive only one type of
> object (<file-system> records in this case). It’s also best to avoid
> passing around symbolic names (that’s why we extend with <file-system>
> records rather than with Shepherd service names or whatever.)

For this case, how would it be done?

ZFS file system, on other operating systems and distributions, is documented as automatically mounting filesystems, without management in an `fstab` or similar file, because the intent is that you would make lots of filesystems for various uses and managing an `fstab` would be too onerous.  Thus, ZFS file system expects to mount multiple file systems with a single `zfs mount -a` command at startup.

Would the below sketch be acceptable?

```scheme
; gnu/system/file-systems.scm
(define-record-type* file-system #;...
  #;...
  (has-fstab-entry?   file-system-has-fstab-entry?  (default #t)))

;...
; gnu/services/base,scm

(define file-system-service-type
  (service-type
    #;...
    (extensions
      (list #;...
            (service-extension fstab-service-type
                               (lambda (file-systems)
                                 (filter file-system-has-fstab-entry?
                                         file-systems)))
            #;...))
    #;...))

;...
; gnu/services/file-systems.scm

(define zfs-service-type
  (service-type
     #;...
     (extensions (list #;...
                       (service-extension file-system-service-type
                                          (const (list (file-system
                                                         (device "dummy")
                                                         (mount-point "zfs/*")
                                                         (has-fstab-entry? #f)))))))
    #;...))
```

Then there will be a Shepherd service providing `file-system-zfs/*` which would perform `zfs mount -a -l` on `start` and `zfs unmount -a -f` on `stop`.

Would that be acceptable?  I am wary of this since it creates a dummy file-system and needs an additional field on every `file-system` record, one which is *only* used by ZFS.  I feel the `file-system-target-service-type` is more generic and does not use trickery.

Thanks
raid5atemyhomework