summary refs log tree commit diff
path: root/gnu/packages/linux.scm
diff options
context:
space:
mode:
authorMark H Weaver <mhw@netris.org>2016-02-02 01:11:12 -0500
committerMark H Weaver <mhw@netris.org>2016-02-02 03:12:29 -0500
commit17db07061f07a99d9134709554c29a693dabc80e (patch)
tree47eec2a0be098ade88b012a3b5541e5c5560c7b0 /gnu/packages/linux.scm
parent5e764e2b6f2357aac9dae3c8921e24c43ed8f2ba (diff)
downloadguix-17db07061f07a99d9134709554c29a693dabc80e.tar.gz
gnu: linux-libre: Generalize 'kernel-config' to support variants.
* gnu/packages/linux.scm (kernel-config): Rewrite to support optional
  #:variant keyword argument.
Diffstat (limited to 'gnu/packages/linux.scm')
-rw-r--r--gnu/packages/linux.scm31
1 files changed, 18 insertions, 13 deletions
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 136daf0952..baa5996dac 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -66,6 +66,7 @@
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system python)
   #:use-module (guix build-system trivial)
+  #:use-module (srfi srfi-2)
   #:use-module (srfi srfi-26)
   #:use-module (ice-9 match))
 
@@ -196,20 +197,24 @@
      (base32
       "1hk9swxxc80bmn2zd2qr5ccrjrk28xkypwhl4z0qx4hbivj7qm06"))))
 
-(define (kernel-config system)
+(define* (kernel-config system #:key variant)
   "Return the absolute file name of the Linux-Libre build configuration file
-for SYSTEM, or #f if there is no configuration for SYSTEM."
-  (define (lookup file)
-    (let ((file (string-append "gnu/packages/" file)))
-      (search-path %load-path file)))
-
-  (match system
-    ("i686-linux"
-     (lookup "linux-libre-i686.conf"))
-    ("x86_64-linux"
-     (lookup "linux-libre-x86_64.conf"))
-    (_
-     #f)))
+for SYSTEM and optionally VARIANT, or #f if there is no such configuration."
+  (and-let* ((arch (match system
+                     ("i686-linux"
+                      "i686")
+                     ("x86_64-linux"
+                      "x86_64")
+                     (_
+                      #f)))
+             (name (string-append "linux-libre-"
+                                  (if variant
+                                      (string-append variant "-")
+                                      "")
+                                  arch
+                                  ".conf"))
+             (file (string-append "gnu/packages/" name)))
+    (search-path %load-path file)))
 
 (define-public linux-libre
   (let* ((version "4.4.1")