summaryrefslogtreecommitdiff
path: root/guix/profiles.scm
diff options
context:
space:
mode:
authorDanny Milosavljevic <dannym@scratchpost.org>2020-02-18 10:42:07 +0100
committerDanny Milosavljevic <dannym@scratchpost.org>2020-03-22 12:51:50 +0100
commit5c79f238634c5adb6657f1b4b1bb4ddb8bb73ef1 (patch)
tree9aa461be2cf3ede11048d3e7c4280b89de4ac73b /guix/profiles.scm
parent66a198c8075f02d7075a555b48dd3adde88ebbbf (diff)
downloadpatches-5c79f238634c5adb6657f1b4b1bb4ddb8bb73ef1.tar
patches-5c79f238634c5adb6657f1b4b1bb4ddb8bb73ef1.tar.gz
system: Add kernel-loadable-modules to operating-system.
* gnu/system.scm (<operating-system>): Add kernel-loadable-modules. (operating-system-directory-base-entries): Use it. * doc/guix.texi (operating-system Reference): Document KERNEL-LOADABLE-MODULES. * gnu/build/linux-modules.scm (depmod): New procedure. (make-linux-module-directory): New procedure. Export it. * guix/profiles.scm (linux-module-database): New procedure. Export it. * gnu/tests/linux-modules.scm: New file. * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. * gnu/packages/linux.scm (make-linux-libre*)[arguments]<#:phases>[install]: Disable depmod. Remove "build" and "source" symlinks. [native-inputs]: Remove kmod.
Diffstat (limited to 'guix/profiles.scm')
-rw-r--r--guix/profiles.scm50
1 files changed, 49 insertions, 1 deletions
diff --git a/guix/profiles.scm b/guix/profiles.scm
index 0d38b2513f..20a2973579 100644
--- a/guix/profiles.scm
+++ b/guix/profiles.scm
@@ -10,6 +10,7 @@
;;; Copyright © 2017 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2019 Kyle Meyer <kyle@kyleam.com>
;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
+;;; Copyright © 2020 Danny Milosavljevic <dannym@scratchpost.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -139,7 +140,9 @@
%current-profile
ensure-profile-directory
canonicalize-profile
- user-friendly-profile))
+ user-friendly-profile
+
+ linux-module-database))
;;; Commentary:
;;;
@@ -1137,6 +1140,51 @@ for both major versions of GTK+."
(hook . gtk-im-modules)))
(return #f)))))
+(define (linux-module-database manifest)
+ "Return a derivation that unites all the kernel modules of the manifest
+and creates the dependency graph of all these kernel modules.
+
+This is meant to be used as a profile hook."
+ (define kmod ; lazy reference
+ (module-ref (resolve-interface '(gnu packages linux)) 'kmod))
+ (define build
+ (with-imported-modules
+ (source-module-closure '((guix build utils)
+ (gnu build linux-modules)))
+ #~(begin
+ (use-modules (ice-9 ftw)
+ (ice-9 match)
+ (srfi srfi-1) ; append-map
+ (gnu build linux-modules))
+ (let* ((inputs '#$(manifest-inputs manifest))
+ (module-directories
+ (map (lambda (directory)
+ (string-append directory "/lib/modules"))
+ inputs))
+ (directory-entries
+ (lambda (directory)
+ (scandir directory (lambda (basename)
+ (not
+ (string-prefix? "." basename))))))
+ ;; Note: Should usually result in one entry.
+ (versions (delete-duplicates
+ (append-map directory-entries
+ module-directories))))
+ (match versions
+ ((version)
+ (let ((old-path (getenv "PATH")))
+ (setenv "PATH" #+(file-append kmod "/bin"))
+ (make-linux-module-directory inputs version #$output)
+ (setenv "PATH" old-path)))
+ (_ (error "Specified Linux kernel and Linux kernel modules
+are not all of the same version")))))))
+ (gexp->derivation "linux-module-database" build
+ #:local-build? #t
+ #:substitutable? #f
+ #:properties
+ `((type . profile-hook)
+ (hook . linux-module-database))))
+
(define (xdg-desktop-database manifest)
"Return a derivation that builds the @file{mimeinfo.cache} database from
desktop files. It's used to query what applications can handle a given