Subject: [bug#45592] [PATCH] gnu, doc: Create and document procedure to compile ZFS for specific kernel.

From: raid5atemyhomework <[email-masked]>
Date: Sat, 02 Jan 2021 19:08:37 +0000

An alternative interface for installing ZFS would be something like this:

@deffn (Scheme Procedure) install-zfs-on-operating-system @var{kernel} @var{base-operating-system}
Modifies the given @code{base-operating-system} to include support for ZFS pools and filesystems.
The operating system kernel will be forced to the given @code{kernel}, and a kernel-specific
version of the @code{zfs} package will be compiled and loaded into the operating system at startup.
The userland tools for ZFS will also be globally installed.
@end deffn

@lisp
(use-package-modules
  ; @dots{}
  linux
  file-systems)

;; @dots{}

(install-zfs-on-operating-system
  linux-libre-5.4
  (operating-system
    ;; @dots{}
    ))
@end lisp

This reduces the number of modifications that the end-user has to make in the configuration file, but at the cost of requiring an extra layer of indents.

Here;s a sketch of what it would be like:

```scheme
(define-public (install-zfs-on-operating-system kernel base-operating-system)

  (define system-zfs (make-zfs-package kernel))

  (operating-system
    (inherit base-operating-system)
    (kernel kernel)
    (kernel-loadable-modules (cons (list system-zfs "module")
                                   (operating-system-kernel-loadable-modules base-operating-system)))
    (packages (cons system-zfs (operating-system-packages base-operating-system)))
    (services (cons (service zfs-loader-service-type system-zfs)
                    (operating-system-services base-operating-system)))
    (location (operating-system-location base-operating-system))))
```