aboutsummaryrefslogtreecommitdiff
path: root/gnu/system.scm
diff options
context:
space:
mode:
authorDanny Milosavljevic <dannym@scratchpost.org>2020-04-22 22:58:11 +0200
committerDanny Milosavljevic <dannym@scratchpost.org>2020-04-22 22:59:39 +0200
commitf91ad0b13d8d3d5b1ae92e209b1be6e8473385ba (patch)
tree63a580834adc1bb782fa948b8b2ca6c34d53a788 /gnu/system.scm
parent2213d00faca72029dc54b559dd6124059c6c0881 (diff)
downloadguix-f91ad0b13d8d3d5b1ae92e209b1be6e8473385ba.tar
guix-f91ad0b13d8d3d5b1ae92e209b1be6e8473385ba.tar.gz
system: Automatically adjust linux-module packages to use the
operating-system's kernel. * gnu/system.scm (package-for-kernel): New procedure. (operating-system-directory-base-entries): Use it. * gnu/tests/linux-module.scm: Test it.
Diffstat (limited to 'gnu/system.scm')
-rw-r--r--gnu/system.scm18
1 files changed, 17 insertions, 1 deletions
diff --git a/gnu/system.scm b/gnu/system.scm
index 3ee2c84235..29e622872d 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -33,6 +33,7 @@
#:use-module (guix derivations)
#:use-module (guix profiles)
#:use-module (guix ui)
+ #:use-module (guix utils)
#:use-module (gnu packages base)
#:use-module (gnu packages bash)
#:use-module (gnu packages guile)
@@ -477,6 +478,16 @@ OS."
(file-append (operating-system-kernel os)
"/" (system-linux-image-file-name)))
+(define (package-for-kernel target-kernel module-package)
+ "Return a package like MODULE-PACKAGE, adapted for TARGET-KERNEL, if
+possible (that is if there's a LINUX keyword argument in the build system)."
+ (package
+ (inherit module-package)
+ (arguments
+ (substitute-keyword-arguments (package-arguments module-package)
+ ((#:linux kernel #f)
+ target-kernel)))))
+
(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."
@@ -487,7 +498,12 @@ value of the SYSTEM-SERVICE-TYPE service."
(kernel
(profile-derivation
(packages->manifest
- (cons kernel modules))
+ (cons kernel
+ (map (lambda (module)
+ (if (package? module)
+ (package-for-kernel kernel module)
+ module))
+ modules)))
#:hooks (list linux-module-database)))
(initrd -> (operating-system-initrd-file os))
(params -> (operating-system-boot-parameters-file os)))