Subject: [bug#45403] [PATCH] gnu: zfs: Split into packages specific for each of our major supported kernel versions.

From: Danny Milosavljevic <[email-masked]>
Date: Mon, 4 Jan 2021 14:58:18 +0100

On Fri, 25 Dec 2020 05:09:44 +0100
Tobias Geerinckx-Rice via Guix-patches via <[email-masked]> wrote:

> Worse, there's no such thing as ‘a 5.10’ Linux module that loads 
> on ‘a 5.10’ Linux kernel.  We still need an easy generic method to 
> build modules against their chosen kernel and configuration.
> 
> As your patch illustrates, that already exists:
> 
> > (define (make-linux-zfs linux-libre)
> >   (package
> >     (inherit zfs-base)
> >     (arguments
> >      `(#:linux ,linux-libre)
> >        ,@(package-arguments zfs-base))  
> 
> It just belongs in your system.scm, not in Guix itself.

Why is this needed?  KERNEL-LOADABLE-MODULES are already automatically
adapted in this way.

See this in gnu/system.scm :

(define* (operating-system-directory-base-entries os)
  "Return the basic entries of the 'system' directory of OS for use as the
value of the SYSTEM-SERVICE-TYPE service."
  (let* ((locale  (operating-system-locale-directory os))
         (kernel  (operating-system-kernel os))
         (hurd    (operating-system-hurd os))
         (modules (operating-system-kernel-loadable-modules os))
         (kernel  (if hurd
                      kernel
                      (profile
                       (content (packages->manifest
                                 (cons kernel
                                       (map (lambda (module)
                                              (if (package? module)
                                                  (package-for-kernel kernel    <-----
                                                                      module)
                                                  module))
                                            modules))))
                       (hooks (list linux-module-database)))))
         (initrd  (and (not hurd) (operating-system-initrd-file os)))
         (params  (operating-system-boot-parameters-file os)))
    `(("kernel" ,kernel)
      ,@(if hurd `(("hurd" ,hurd)) '())
      ("parameters" ,params)
      ,@(if initrd `(("initrd" ,initrd)) '())
      ("locale" ,locale))))   ;used by libc