summaryrefslogtreecommitdiff
path: root/nongnu/packages/linux.scm
diff options
context:
space:
mode:
Diffstat (limited to 'nongnu/packages/linux.scm')
-rw-r--r--nongnu/packages/linux.scm67
1 files changed, 49 insertions, 18 deletions
diff --git a/nongnu/packages/linux.scm b/nongnu/packages/linux.scm
index 011818f..095e697 100644
--- a/nongnu/packages/linux.scm
+++ b/nongnu/packages/linux.scm
@@ -19,6 +19,7 @@
19;;; Copyright © 2022 Simen Endsjø <simendsjo@gmail.com> 19;;; Copyright © 2022 Simen Endsjø <simendsjo@gmail.com>
20;;; Copyright © 2022 Leo Famulari <leo@famulari.name> 20;;; Copyright © 2022 Leo Famulari <leo@famulari.name>
21;;; Copyright © 2023 Morgan Smith <Morgan.J.Smith@outlook.com> 21;;; Copyright © 2023 Morgan Smith <Morgan.J.Smith@outlook.com>
22;;; Copyright © 2023 Jelle Licht <jlicht@fsfe.org>
22 23
23(define-module (nongnu packages linux) 24(define-module (nongnu packages linux)
24 #:use-module (gnu packages) 25 #:use-module (gnu packages)
@@ -37,28 +38,58 @@
37 #:use-module (guix build-system trivial) 38 #:use-module (guix build-system trivial)
38 #:use-module (ice-9 match) 39 #:use-module (ice-9 match)
39 #:use-module (nonguix licenses) 40 #:use-module (nonguix licenses)
41 #:use-module (srfi srfi-1)
40 #:export (corrupt-linux)) 42 #:export (corrupt-linux))
41 43
42(define (linux-urls version) 44(define (linux-url version)
43 "Return a list of URLS for Linux VERSION." 45 "Return a URL for Linux VERSION."
44 (list (string-append "https://www.kernel.org/pub/linux/kernel/v" 46 (string-append "mirror://kernel.org"
45 (version-major version) ".x/linux-" version ".tar.xz"))) 47 "/linux/kernel/v" (version-major version) ".x"
48 "/linux-" version ".tar.xz"))
46 49
47(define* (corrupt-linux freedo #:key (name "linux")) 50(define* (corrupt-linux freedo #:key (name "linux"))
48 (package 51
49 (inherit 52 ;; TODO: This very directly depends on guix internals.
50 (customize-linux 53 ;; Throw it all out when we manage kernel hashes.
51 #:name name 54 (define gexp-inputs (@@ (guix gexp) gexp-inputs))
52 #:source (origin (inherit (package-source freedo)) 55
53 (method url-fetch) 56 (define extract-gexp-inputs
54 (uri (linux-urls (package-version freedo))) 57 (compose gexp-inputs force origin-uri))
55 (patches '())))) 58
56 (version (package-version freedo)) 59 (define gexp-input->origin
57 (home-page "https://www.kernel.org/") 60 (match-lambda
58 (synopsis "Linux kernel with nonfree binary blobs included") 61 ((? origin? source) source)
59 (description 62 (_ #f)))
60 "The unmodified Linux kernel, including nonfree blobs, for running Guix 63
61System on hardware which requires nonfree software to function."))) 64 (define (find-source-hash sources url)
65 (let ((versioned-origin
66 (find (lambda (source)
67 (let ((uri (origin-uri source)))
68 (and (string? uri) (string=? uri url)))) sources)))
69 (if versioned-origin
70 (origin-hash versioned-origin)
71 #f)))
72
73 (let* ((version (package-version freedo))
74 (url (linux-url version))
75 (pristine-source (package-source freedo))
76 (inputs (map gexp-input-thing (extract-gexp-inputs pristine-source)))
77 (sources (filter origin? inputs))
78 (hash (find-source-hash sources url)))
79 (package
80 (inherit
81 (customize-linux
82 #:name name
83 #:source (origin
84 (method url-fetch)
85 (uri url)
86 (hash hash))))
87 (version version)
88 (home-page "https://www.kernel.org/")
89 (synopsis "Linux kernel with nonfree binary blobs included")
90 (description
91 "The unmodified Linux kernel, including nonfree blobs, for running Guix System
92on hardware which requires nonfree software to function."))))
62 93
63(define-public linux-6.1 94(define-public linux-6.1
64 (corrupt-linux linux-libre-6.1)) 95 (corrupt-linux linux-libre-6.1))