Subject: bug#40272: linux-module-build-system don't support an inferior package as a kernel

From: Brice Waegeneire <[email-masked]>
Date: Sat, 28 Mar 2020 12:58:40 +0000

Message Body
Hello,

The linux-module-build-system crash when using an inferior package as 
the
kernel. I have first reported the issue in the second part of[0] and
latter, reading[1] made me realize that the root cause was in `(guix
`build-system linux-module)' and not directly related to the
`kernel-loadable-modules' field.

I tried fixing it myself but (guix inferior) seems to be missing some
important procedures so I can manage to do it by myself - I don't have 
the
skills to modify that part of the code base. A way to make a package by
inheriting from a inferior-package would greatly help because
`make-linux-module-builder' assume that it's argument is straight 
forward
package.

Following is the file `linux-module-inferior.scm' to reproduce the 
error:

--8<---------------cut here---------------start------------->8---
(use-modules (gnu)
              (gnu system)
              (srfi srfi-1)
              (guix inferior)
              (guix utils)
              (guix packages)
              (guix channels))
(use-package-modules linux)

(define channels
   (list (channel
          (name 'guix)
          (url "https://git.savannah.gnu.org/git/guix.git")
          (commit
           "591faabd8c93bfb6879910d8a424f0db835066c2"))))

(define my-linux
   (let ((inferior (inferior-for-channels channels)))
     (first (lookup-inferior-packages inferior "linux-libre" 
"4.4.217"))))

(package/inherit ddcci-driver-linux
                (arguments
                 (ensure-keyword-arguments
                  (package-arguments ddcci-driver-linux)
                  ;; `(#:linux ,(specification->package 
"[email-masked]")) ; NOTE It works
                  `(#:linux ,my-linux) ; NOTE It doesn't work
                  )))
--8<---------------cut here---------------end--------------->8---

Here is the error:

--8<---------------cut here---------------start------------->8---
LANGUAGE=C guix build  -f linux-module-inferior.scm
Updating channel 'guix' from Git repository at 
'https://git.savannah.gnu.org/git/guix.git'...
Backtrace:
            1 (primitive-load "/home/bricewge/.config/guix/current/bi…")
In guix/ui.scm:
   1894:12  0 (run-guix-command _ . _)
--8<---------------cut here---------------end--------------->8---

[0]: https://lists.gnu.org/archive/html/guix-devel/2020-03/msg00381.html
[1]: https://issues.guix.info/issue/33719

Brice.