From 5c79f238634c5adb6657f1b4b1bb4ddb8bb73ef1 Mon Sep 17 00:00:00 2001 From: Danny Milosavljevic Date: Tue, 18 Feb 2020 10:42:07 +0100 Subject: system: Add kernel-loadable-modules to operating-system. * gnu/system.scm (): 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. --- guix/profiles.scm | 50 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) (limited to 'guix/profiles.scm') 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 ;;; Copyright © 2019 Kyle Meyer ;;; Copyright © 2019 Mathieu Othacehe +;;; Copyright © 2020 Danny Milosavljevic ;;; ;;; This file is part of GNU Guix. ;;; @@ -139,7 +140,9 @@ (define-module (guix profiles) %current-profile ensure-profile-directory canonicalize-profile - user-friendly-profile)) + user-friendly-profile + + linux-module-database)) ;;; Commentary: ;;; @@ -1137,6 +1140,51 @@ (define (build gtk gtk-version query) (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 -- cgit v1.2.3 From e7570ec2da04af83eba695ded92eb824172b15c3 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Thu, 26 Mar 2020 12:25:37 +0100 Subject: profiles: 'profile-derivation' sets a 'type' property. * guix/profiles.scm (profile-derivation): Pass #:properties to 'gexp->derivation'. --- guix/profiles.scm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'guix/profiles.scm') diff --git a/guix/profiles.scm b/guix/profiles.scm index 20a2973579..3a6498993c 100644 --- a/guix/profiles.scm +++ b/guix/profiles.scm @@ -1590,7 +1590,13 @@ (define search-paths ;; 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)) -- cgit v1.2.3