summaryrefslogtreecommitdiff
path: root/guix/profiles.scm
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2020-03-27 00:12:15 +0100
committerMarius Bakke <mbakke@fastmail.com>2020-03-27 00:12:15 +0100
commit18af6870370226b4d502d7372844e7f2aded5887 (patch)
tree749d93209bd0cb9710ccaae2207df670f37eaa36 /guix/profiles.scm
parent0ab8ad46322bea331ed5f5592843ba35e7f38b37 (diff)
parent3089b70d766bd9ec70e1464867130b7b864fbe17 (diff)
downloadguix-patches-18af6870370226b4d502d7372844e7f2aded5887.tar
guix-patches-18af6870370226b4d502d7372844e7f2aded5887.tar.gz
Merge branch 'master' into core-updates
Conflicts: gnu/packages/icu4c.scm gnu/packages/man.scm gnu/packages/python-xyz.scm guix/scripts/environment.scm guix/scripts/pack.scm guix/scripts/package.scm guix/scripts/pull.scm guix/store.scm
Diffstat (limited to 'guix/profiles.scm')
-rw-r--r--guix/profiles.scm58
1 files changed, 56 insertions, 2 deletions
diff --git a/guix/profiles.scm b/guix/profiles.scm
index fbe34c8455..2a838d3a9a 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:
;;;
@@ -1139,6 +1142,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
@@ -1546,7 +1594,13 @@ are cross-built for TARGET."
;; Disable substitution because it would trigger a
;; connection to the substitute server, which is likely
;; to have no substitute to offer.
- #:substitutable? #f)))
+ #:substitutable? #f
+
+ #:properties `((type . profile)
+ (profile
+ (count
+ . ,(length
+ (manifest-entries manifest))))))))
(define* (profile-search-paths profile
#:optional (manifest (profile-manifest profile))