projects/guix·blob perlssl · refs

12781 lines · 554.4 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2012-2021, 2021-2026 Ludovic Courtès <[email protected]>
3;;; Copyright © 2013, 2014, 2015, 2016 Andreas Enge <[email protected]>
4;;; Copyright © 2012 Nikita Karetnikov <[email protected]>
5;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020 Mark H Weaver <[email protected]>
6;;; Copyright © 2015 Federico Beffa <[email protected]>
7;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer <[email protected]>
8;;; Copyright © 2015-2018, 2020, 2022-2025 Efraim Flashner <[email protected]>
9;;; Copyright © 2016 Christine Lemmer-Webber <[email protected]>
10;;; Copyright © 2016–2022 Tobias Geerinckx-Rice <[email protected]>
11;;; Copyright © 2016, 2017 Alex Kost <[email protected]>
12;;; Copyright © 2016 Raymond Nicholson <[email protected]>
13;;; Copyright © 2016 Mathieu Lirzin <[email protected]>
14;;; Copyright © 2016, 2018-2023, 2025 Nicolas Goaziou <[email protected]>
15;;; Copyright © 2016, 2018, 2019, 2020, 2021, 2022, 2023 Ricardo Wurmus <[email protected]>
16;;; Copyright © 2016 David Craven <[email protected]>
17;;; Copyright © 2016 John Darrington <[email protected]>
18;;; Copyright © 2016-2023 Marius Bakke <[email protected]>
19;;; Copyright © 2016, 2018 Rene Saavedra <[email protected]>
20;;; Copyright © 2016 Carlos Sánchez de La Lama <[email protected]>
21;;; Copyright © 2016, 2017 Nikita <[email protected]>
22;;; Copyright © 2017, 2018, 2020, 2021, 2022 Leo Famulari <[email protected]>
23;;; Copyright © 2017 José Miguel Sánchez García <[email protected]>
24;;; Copyright © 2017 Gábor Boskovits <[email protected]>
25;;; Copyright © 2017, 2019, 2021 Mathieu Othacehe <[email protected]>
26;;; Copyright © 2017 Clément Lassieur <[email protected]>
27;;; Copyright © 2017, 2018, 2019 Rutger Helling <[email protected]>
28;;; Copyright © 2017 nee <[email protected]>
29;;; Copyright © 2017 Dave Love <[email protected]>
30;;; Copyright © 2018 Pierre-Antoine Rouby <[email protected]>
31;;; Copyright © 2018, 2020, 2022 Brendan Tildesley <[email protected]>
32;;; Copyright © 2018 Manuel Graf <[email protected]>
33;;; Copyright © 2018, 2019 Pierre Langlois <[email protected]>
34;;; Copyright © 2018 Vasile Dumitrascu <[email protected]>
35;;; Copyright © 2019 Tim Gesthuizen <[email protected]>
36;;; Copyright © 2019 mikadoZero <[email protected]>
37;;; Copyright © 2019-2025 Maxim Cournoyer <[email protected]>
38;;; Copyright © 2019 Stefan Stefanović <[email protected]>
39;;; Copyright © 2019-2022 Brice Waegeneire <[email protected]>
40;;; Copyright © 2019 Kei Kebreau <[email protected]>
41;;; Copyright © 2020, 2021, 2025 Oleg Pykhalov <[email protected]>
42;;; Copyright © 2020 Pierre Neidhardt <[email protected]>
43;;; Copyright © 2020 Chris Marusich <[email protected]>
44;;; Copyright © 2020 Vincent Legoll <[email protected]>
45;;; Copyright © 2020, 2023-2026 Janneke Nieuwenhuizen <[email protected]>
46;;; Copyright © 2020 Morgan Smith <[email protected]>
47;;; Copyright © 2020 John Soo <[email protected]>
48;;; Copyright © 2020, 2022 Michael Rohleder <[email protected]>
49;;; Copyright © 2020 Anders Thuné <[email protected]>
50;;; Copyright © 2020, 2021 Greg Hogan <[email protected]>
51;;; Copyright © 2020 Zhu Zihao <[email protected]>
52;;; Copyright © 2020 David Dashyan <[email protected]>
53;;; Copyright © 2020 pukkamustard <[email protected]>
54;;; Copyright © 2021 Solene Rapenne <[email protected]>
55;;; Copyright © 2021 B. Wilson <[email protected]>
56;;; Copyright © 2021 Ivan Gankevich <[email protected]>
57;;; Copyright © 2021 Maxime Devos <[email protected]>
58;;; Copyright © 2021, 2023 Guillaume Le Vaillant <[email protected]>
59;;; Copyright © 2021 Sarah Morgensen <[email protected]>
60;;; Copyright © 2021 Felix Gruber <[email protected]>
61;;; Copyright © 2021 Josselin Poiret <[email protected]>
62;;; Copyright © 2021 Olivier Dion <[email protected]>
63;;; Copyright © 2021 Solene Rapenne <[email protected]>
64;;; Copyright © 2021, 2022 Petr Hodina <[email protected]>
65;;; Copyright © 2021 Ryan Sundberg <[email protected]>
66;;; Copyright © 2022-2026 Artyom V. Poptsov <[email protected]>
67;;; Copyright © 2022 Rene Saavedra <[email protected]>
68;;; Copyright © 2022 muradm <[email protected]>
69;;; Copyright © 2022, 2023 Denis 'GNUtoo' Carikli <[email protected]>
70;;; Copyright © 2022 Hunter Jozwiak <[email protected]>
71;;; Copyright © 2022 Hilton Chain <[email protected]>
72;;; Copyright © 2022 Stefan <[email protected]>
73;;; Copyright © 2022, 2023 Demis Balbach <[email protected]>
74;;; Copyright © 2023 Bruno Victal <[email protected]>
75;;; Copyright © 2023 Yovan Naumovski <[email protected]>
76;;; Copyright © 2023, 2025 Zheng Junjie <[email protected]>
77;;; Copyright © 2023 dan <[email protected]>
78;;; Copyright © 2023 Foundation Devices, Inc. <[email protected]>
79;;; Copyright © 2023, 2024, 2026 Wilko Meyer <[email protected]>
80;;; Copyright © 2023 Jaeme Sifat <[email protected]>
81;;; Copyright © 2024 Gabriel Wicki <[email protected]>
82;;; Copyright © 2024 Sharlatan Hellseher <[email protected]>
83;;; Copyright © 2024 Arun Isaac <[email protected]>
84;;; Copyright © 2024-2026 Ashish SHUKLA <[email protected]>
85;;; Copyright © 2025 Nigko Yerden <[email protected]>
86;;; Copyright © 2025 Mathieu Laparie <[email protected]>
87;;; Copyright © 2025 John Kehayias <[email protected]>
88;;; Copyright © 2025 Arjan Adriaanse <[email protected]>
89;;; Copyright © 2026 Justin Veilleux <[email protected]>
90;;; Copyright © 2026 Simen Endsjø <[email protected]>
91;;;
92;;; This file is part of GNU Guix.
93;;;
94;;; GNU Guix is free software; you can redistribute it and/or modify it
95;;; under the terms of the GNU General Public License as published by
96;;; the Free Software Foundation; either version 3 of the License, or (at
97;;; your option) any later version.
98;;;
99;;; GNU Guix is distributed in the hope that it will be useful, but
100;;; WITHOUT ANY WARRANTY; without even the implied warranty of
101;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
102;;; GNU General Public License for more details.
103;;;
104;;; You should have received a copy of the GNU General Public License
105;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
106
107(define-module (gnu packages linux)
108 #:use-module (gnu packages acl)
109 #:use-module (gnu packages admin)
110 #:use-module (gnu packages algebra)
111 #:use-module (gnu packages apparmor)
112 #:use-module (gnu packages audio)
113 #:use-module (gnu packages autotools)
114 #:use-module (gnu packages backup)
115 #:use-module (gnu packages base)
116 #:use-module (gnu packages bash)
117 #:use-module (gnu packages bison)
118 #:use-module (gnu packages boost)
119 #:use-module (gnu packages calendar)
120 #:use-module (gnu packages check)
121 #:use-module (gnu packages compression)
122 #:use-module (gnu packages cpio)
123 #:use-module (gnu packages cpp)
124 #:use-module (gnu packages crypto)
125 #:use-module (gnu packages cryptsetup)
126 #:use-module (gnu packages curl)
127 #:use-module (gnu packages databases)
128 #:use-module (gnu packages datastructures)
129 #:use-module (gnu packages dbm)
130 #:use-module (gnu packages disk)
131 #:use-module (gnu packages dlang)
132 #:use-module (gnu packages dns)
133 #:use-module (gnu packages docbook)
134 #:use-module (gnu packages documentation)
135 #:use-module (gnu packages elf)
136 #:use-module (gnu packages file)
137 #:use-module (gnu packages compiler-tools)
138 #:use-module (gnu packages fontutils)
139 #:use-module (gnu packages freedesktop)
140 #:use-module (gnu packages gawk)
141 #:use-module (gnu packages gcc)
142 #:use-module (gnu packages gettext)
143 #:use-module (gnu packages glib)
144 #:use-module (gnu packages gnome)
145 #:use-module (gnu packages gnupg)
146 #:use-module (gnu packages golang)
147 #:use-module (gnu packages gperf)
148 #:use-module (gnu packages graphviz)
149 #:use-module (gnu packages groff)
150 #:use-module (gnu packages gstreamer)
151 #:use-module (gnu packages gtk)
152 #:use-module (gnu packages guile)
153 #:use-module (gnu packages haskell-apps)
154 #:use-module (gnu packages haskell-xyz)
155 #:use-module (gnu packages image)
156 #:use-module (gnu packages kde-frameworks)
157 #:use-module (gnu packages kde-graphics)
158 #:use-module (gnu packages libedit)
159 #:use-module (gnu packages libevent)
160 #:use-module (gnu packages libunwind)
161 #:use-module (gnu packages libusb)
162 #:use-module (gnu packages llvm)
163 #:use-module (gnu packages lsof)
164 #:use-module (gnu packages lua)
165 #:use-module (gnu packages m4)
166 #:use-module (gnu packages man)
167 #:use-module (gnu packages maths)
168 #:use-module (gnu packages multiprecision)
169 #:use-module (gnu packages ncurses)
170 #:use-module (gnu packages netpbm)
171 #:use-module (gnu packages networking)
172 #:use-module (gnu packages nss)
173 #:use-module (gnu packages onc-rpc)
174 #:use-module (gnu packages oneapi)
175 #:use-module (gnu packages pciutils)
176 #:use-module (gnu packages perl)
177 #:use-module (gnu packages pkg-config)
178 #:use-module (gnu packages polkit)
179 #:use-module (gnu packages popt)
180 #:use-module (gnu packages protobuf)
181 #:use-module (gnu packages pulseaudio)
182 #:use-module (gnu packages python)
183 #:use-module (gnu packages python-build)
184 #:use-module (gnu packages python-xyz)
185 #:use-module (gnu packages qt)
186 #:use-module (gnu packages readline)
187 #:use-module (gnu packages regex)
188 #:use-module (gnu packages rocm)
189 #:use-module (gnu packages rpc)
190 #:use-module (gnu packages rrdtool)
191 #:use-module (gnu packages rsync)
192 #:use-module (gnu packages rust-sources)
193 #:use-module (gnu packages samba)
194 #:use-module (gnu packages sdl)
195 #:use-module (gnu packages selinux)
196 #:use-module (gnu packages serialization)
197 #:use-module (gnu packages slang)
198 #:use-module (gnu packages sphinx)
199 #:use-module (gnu packages sqlite)
200 #:use-module (gnu packages swig)
201 #:use-module (gnu packages texinfo)
202 #:use-module (gnu packages textutils)
203 #:use-module (gnu packages tls)
204 #:use-module (gnu packages valgrind)
205 #:use-module (gnu packages video)
206 #:use-module (gnu packages vim)
207 #:use-module (gnu packages vulkan)
208 #:use-module (gnu packages web)
209 #:use-module (gnu packages xdisorg)
210 #:use-module (gnu packages xiph)
211 #:use-module (gnu packages xml)
212 #:use-module (gnu packages xorg)
213 #:use-module (gnu packages)
214 #:use-module (guix build-system cmake)
215 #:use-module (guix build-system copy)
216 #:use-module (guix build-system gnu)
217 #:use-module (guix build-system go)
218 #:use-module (guix build-system linux-module)
219 #:use-module (guix build-system meson)
220 #:use-module (guix build-system pyproject)
221 #:use-module (guix build-system qt)
222 #:use-module (guix build-system trivial)
223 #:use-module (guix deprecation) ;for libcap/next
224 #:use-module (guix download)
225 #:use-module (guix gexp)
226 #:use-module (guix git-download)
227 #:use-module ((guix licenses) #:prefix license:)
228 #:use-module (guix monads)
229 #:use-module (guix packages)
230 #:use-module (guix platform)
231 #:use-module (guix store)
232 #:use-module (guix utils)
233 #:use-module (ice-9 match)
234 #:use-module (ice-9 regex)
235 #:use-module (srfi srfi-1)
236 #:use-module (srfi srfi-2)
237 #:use-module (srfi srfi-26)
238 #:export (customize-linux
239 make-defconfig))
240
241
242
243;;;
244;;; Linux kernel customization functions.
245;;;
246
247(define* (customize-linux #:key name
248 (linux linux-libre)
249 source
250 defconfig
251 modconfig
252 (configs "")
253 extra-version)
254 "Make a customized Linux package NAME derived from the LINUX package.
255
256If NAME is not given, then it defaults to the same name as the LINUX package.
257
258Unless SOURCE is given the source of LINUX is used.
259
260A DEFCONFIG file to be used can be given as an origin, as a file-like object
261(file-append, local-file etc.), or as a string with the name of a defconfig file
262available in the Linux sources. If DEFCONFIG is not given, then a defconfig
263file will be saved from the LINUX package configuration.
264
265MODCONFIG is an origin or file-like object used for make localmodconfig to
266disable unlisted modules. For instance, this can come from using modprobed-db
267periodically on a running machine to find all loaded modules.
268
269Additional CONFIGS will be used to modify the given or saved defconfig, which
270will finally be used to build Linux.
271
272CONFIGS can be a list of strings, with one configuration per line. The usual
273defconfig syntax has to be used, but there is a special extension to ease the
274removal of configurations. Comment lines are supported as well.
275
276Here is an example:
277
278 '(;; This string defines the version tail in 'uname -r'.
279 \"CONFIG_LOCALVERSION=\\\"-handcrafted\\\"
280 ;; This '# CONFIG_... is not set' syntax has to match exactly!
281 \"# CONFIG_BOOT_CONFIG is not set\"
282 \"CONFIG_NFS_SWAP=y\"
283 ;; This is a multiline configuration:
284 \"CONFIG_E1000=y
285# This is a comment, below follows an extension to unset a configuration:
286CONFIG_CMDLINE_EXTEND\")
287
288A string of configurations instead of a list of configuration strings is also
289possible.
290
291EXTRA-VERSION can be a string overwriting the EXTRAVERSION setting of the LINUX
292package, after being prepended by a hyphen. It will be visible in the output
293of 'uname -r' behind the Linux version numbers."
294 (package
295 (inherit linux)
296 (name (or name (package-name linux)))
297 (source (or source (package-source linux)))
298 (arguments
299 (substitute-keyword-arguments
300 (package-arguments linux)
301 ((#:imported-modules imported-modules %default-gnu-imported-modules)
302 `((guix build kconfig) ,@imported-modules))
303 ((#:modules modules)
304 `((guix build kconfig) ,@modules))
305 ((#:phases phases)
306 #~(modify-phases #$phases
307 (replace 'configure
308 (lambda* (#:key inputs #:allow-other-keys #:rest arguments)
309 (setenv "EXTRAVERSION"
310 #$(and extra-version
311 (not (string-null? extra-version))
312 (string-append "-" extra-version)))
313 (let* ((configs (string-append "arch/" #$(linux-srcarch)
314 "/configs/"))
315 (guix_defconfig (string-append configs
316 "guix_defconfig")))
317 #$(cond
318 ((not defconfig)
319 #~(begin
320 ;; Call the original 'configure phase.
321 (apply (assoc-ref #$phases 'configure) arguments)
322 ;; Save a defconfig file.
323 (invoke "make" "savedefconfig")
324 ;; Move the saved defconfig to the proper location.
325 (rename-file "defconfig"
326 guix_defconfig)))
327 ((string? defconfig)
328 ;; Use another existing defconfig from the Linux sources.
329 #~(rename-file (string-append configs #$defconfig)
330 guix_defconfig))
331 (else
332 ;; Copy the defconfig input to the proper location.
333 #~(copy-file #$defconfig guix_defconfig)))
334 (chmod guix_defconfig #o644)
335 (modify-defconfig guix_defconfig '#$configs)
336 (invoke "make" "guix_defconfig")
337 (verify-config ".config" guix_defconfig)
338 ;; Minimize module building if provided e.g. a modprobed-db
339 ;; database.
340 (if #$modconfig
341 (invoke "make" (string-append "LSMOD=" #$modconfig)
342 "localmodconfig")))))))))))
343
344(define (make-defconfig uri sha256-as-base32)
345 (origin (method url-fetch)
346 (uri uri)
347 (sha256 (base32 sha256-as-base32))))
348
349(define (linux-srcarch)
350 "Return the linux SRCARCH name, which is set in the toplevel Makefile of
351Linux and denotes the architecture-specific directory name below arch/ in its
352source code. Some few architectures share a common folder. It resembles the
353definition of SRCARCH based on ARCH in the Makefile and may be used to place a
354defconfig file in the proper path."
355 (let ((linux-arch (platform-linux-architecture
356 (lookup-platform-by-target-or-system
357 (or (%current-target-system)
358 (%current-system))))))
359 (match linux-arch
360 ("i386" "x86")
361 ("x86_64" "x86")
362 ("sparc32" "sparc")
363 ("sparc64" "sparc")
364 ("sh64" "sh")
365 (_ linux-arch))))
366
367(define-public (system->defconfig system)
368 "Some systems (notably powerpc-linux) require a special target for kernel
369defconfig. Return the appropriate Make target if applicable, otherwise return
370\"defconfig\"."
371 (cond ((string-prefix? "powerpc-" system) "pmac32_defconfig")
372 ((string-prefix? "powerpc64-" system) "ppc64_defconfig")
373 ((string-prefix? "powerpc64le-" system) "ppc64_defconfig")
374 (else "defconfig")))
375
376
377;;;
378;;; Kernel source code deblobbing.
379;;;
380
381(define (linux-libre-deblob-scripts version gnu-revision
382 deblob-hash
383 deblob-check-hash)
384 (list (version-major+minor version)
385 (origin
386 (method url-fetch)
387 (uri (string-append "https://linux-libre.fsfla.org"
388 "/pub/linux-libre/releases/" version "-" gnu-revision "/"
389 "deblob-" (version-major+minor version)))
390 (file-name (string-append "linux-libre-deblob-"
391 version "-" gnu-revision))
392 (sha256 deblob-hash))
393 (origin
394 (method url-fetch)
395 (uri (string-append "https://linux-libre.fsfla.org"
396 "/pub/linux-libre/releases/" version "-" gnu-revision "/"
397 "deblob-check"))
398 (file-name (string-append "linux-libre-deblob-check-" version "-" gnu-revision))
399 (sha256 deblob-check-hash))))
400
401;; XXXX: Workaround 'snippet' limitations
402(define computed-origin-method (@@ (guix packages) computed-origin-method))
403
404(define (make-linux-libre-source version
405 upstream-source
406 deblob-scripts)
407 "Return a 'computed' origin that generates a Linux-libre tarball from the
408corresponding UPSTREAM-SOURCE (an origin), using the given DEBLOB-SCRIPTS."
409 (match deblob-scripts
410 ((deblob-version (? origin? deblob) (? origin? deblob-check))
411 (unless (string=? deblob-version (version-major+minor version))
412 ;; The deblob script cannot be expected to work properly on a
413 ;; different version (major+minor) of Linux, even if no errors
414 ;; are signaled during execution.
415 (error "deblob major+minor version mismatch"))
416 (origin
417 (method computed-origin-method)
418 (file-name (string-append "linux-libre-" version "-guix.tar.xz"))
419 (sha256 #f)
420 (uri
421 (delay
422 (with-imported-modules '((guix build utils))
423 #~(begin
424 (use-modules (guix build utils)
425 (srfi srfi-1)
426 (ice-9 match)
427 (ice-9 ftw))
428
429 (setvbuf (current-output-port) 'line)
430
431 (let ((dir (string-append "linux-" #$version)))
432
433 (mkdir "/tmp/bin")
434 (set-path-environment-variable
435 "PATH" '("bin")
436 (list "/tmp"
437 #+(canonical-package bash)
438 #+(canonical-package coreutils)
439 #+(canonical-package diffutils)
440 #+(canonical-package findutils)
441 #+(canonical-package patch)
442 #+(canonical-package xz)
443 #+(canonical-package sed)
444 #+(canonical-package grep)
445 #+(canonical-package bzip2)
446 #+(canonical-package gzip)
447 #+(canonical-package tar)
448 #+(canonical-package gawk)
449 #+python-wrapper))
450
451 (with-directory-excursion "/tmp/bin"
452
453 (copy-file #+deblob "deblob")
454 (chmod "deblob" #o755)
455 (substitute* "deblob"
456 (("/bin/sh") (which "sh")))
457
458 (copy-file #+deblob-check "deblob-check")
459 (chmod "deblob-check" #o755)
460 (substitute* "deblob-check"
461 (("/bin/sh") (which "sh"))
462 (("/bin/sed") (which "sed"))
463 (("/usr/bin/python") (which "python"))))
464
465 (if (file-is-directory? #+upstream-source)
466 (begin
467 (format #t "Copying upstream linux source...~%")
468 (invoke "cp" "--archive" #+upstream-source dir)
469 (invoke "chmod" "--recursive" "u+w" dir))
470 (begin
471 (format #t "Unpacking upstream linux tarball...~%")
472 (invoke "tar" "xf" #$upstream-source)
473 (match (scandir "."
474 (lambda (name)
475 (and (not (member name '("." "..")))
476 (file-is-directory? name))))
477 ((unpacked-dir)
478 (unless (string=? dir unpacked-dir)
479 (rename-file unpacked-dir dir)))
480 (dirs
481 (error "multiple directories found" dirs)))))
482
483 (with-directory-excursion dir
484 (format #t "Running deblob script...~%")
485 (invoke "/tmp/bin/deblob"))
486
487 (format #t "~%Packing new Linux-libre tarball...~%")
488 (invoke "tar" "cvfa" #$output
489 ;; Avoid non-determinism in the archive.
490 "--mtime=@0"
491 "--owner=root:0"
492 "--group=root:0"
493 "--sort=name"
494 "--hard-dereference"
495 dir)
496
497 (format #t "~%Scanning the generated tarball for blobs...~%")
498 (invoke "/tmp/bin/deblob-check" "--use-awk" "--list-blobs"
499 #$output))))))))))
500
501
502;;;
503;;; Kernel sources.
504;;;
505
506(define (linux-libre-urls version gnu-revision)
507 "Return a list of URLs for Linux-Libre VERSION."
508 (list (string-append
509 "https://linux-libre.fsfla.org/pub/linux-libre/releases/"
510 version "-" gnu-revision "/linux-libre-" version "-" gnu-revision ".tar.xz")
511
512 ;; XXX: Work around <http://bugs.gnu.org/14851>.
513 (string-append
514 "ftp://alpha.gnu.org/gnu/guix/mirror/linux-libre-"
515 version "-" gnu-revision ".tar.xz")
516
517 ;; Maybe this URL will become valid eventually.
518 (string-append
519 "mirror://gnu/linux-libre/" version "-" gnu-revision "/linux-libre-"
520 version "-" gnu-revision ".tar.xz")))
521
522(define (%upstream-linux-source version hash)
523 (origin
524 (method url-fetch)
525 (uri (string-append "mirror://kernel.org"
526 "/linux/kernel/v" (version-major version) ".x/"
527 "linux-" version ".tar.xz"))
528 (sha256 hash)))
529
530;; The current "mainline" kernel.
531
532(define-public linux-libre-7.0-version "7.0.13")
533(define-public linux-libre-7.0-gnu-revision "gnu")
534(define deblob-scripts-7.0
535 (linux-libre-deblob-scripts
536 linux-libre-7.0-version
537 linux-libre-7.0-gnu-revision
538 (base32 "0s4vh6yl425fp7x938r86ydc3kj5wn3465zbkb382fqkrk2zbmbn")
539 (base32 "0a7572zw5y3k4gs4p3h5w0s9bhd63pdjxz6vxbr96sq6r8b6k02n")))
540(define-public linux-libre-7.0-pristine-source
541 (let ((version linux-libre-7.0-version)
542 (hash (base32 "04wrz38ldls7pv1yxa1m7p2hqn1731l93xnz93fs7b0nyz8fv09w")))
543 (make-linux-libre-source version
544 (%upstream-linux-source version hash)
545 deblob-scripts-7.0)))
546
547;; The current "stable" kernels. That is, the most recently released major
548;; versions that are still supported upstream.
549
550(define-public linux-libre-6.19-version "6.19.14")
551(define-public linux-libre-6.19-gnu-revision "gnu")
552(define deblob-scripts-6.19
553 (linux-libre-deblob-scripts
554 linux-libre-6.19-version
555 linux-libre-6.19-gnu-revision
556 (base32 "0zl5352xsv12xkqrfygp5kd8nvjq718pg5iaz64y675abymacp8v")
557 (base32 "05jpciyypvmy6byaxjl49b1fvzxcnlhknf0xabrdj5152iznrzkh")))
558(define-public linux-libre-6.19-pristine-source
559 (let ((version linux-libre-6.19-version)
560 (hash (base32 "11giqsz9qa7s9lm94nn4h1bcb2411crsbfyvzrvhfjmy75kvzs6d")))
561 (make-linux-libre-source version
562 (%upstream-linux-source version hash)
563 deblob-scripts-6.19)))
564
565(define-public linux-libre-6.18-version "6.18.36")
566(define-public linux-libre-6.18-gnu-revision "gnu")
567(define deblob-scripts-6.18
568 (linux-libre-deblob-scripts
569 linux-libre-6.18-version
570 linux-libre-6.18-gnu-revision
571 (base32 "1piyq7183bdf169w66k62yr1vbs0ls7pqx3cyyk7hisw8vhy643j")
572 (base32 "0qlih8w8wg4v5cwbmd34rbhb6mjgbx69i9rx3s2vxw7h42q9l0ai")))
573(define-public linux-libre-6.18-pristine-source
574 (let ((version linux-libre-6.18-version)
575 (hash (base32 "0kn4r43lnd5nb5c298b30030qyaxv05s7k40n9si1j3iyk4qdazv")))
576 (make-linux-libre-source version
577 (%upstream-linux-source version hash)
578 deblob-scripts-6.18)))
579
580;; The "longterm" kernels — the older releases with long-term upstream support.
581;; Here are the support timelines:
582;; <https://www.kernel.org/category/releases.html>
583
584(define-public linux-libre-6.12-version "6.12.94")
585(define-public linux-libre-6.12-gnu-revision "gnu")
586(define deblob-scripts-6.12
587 (linux-libre-deblob-scripts
588 linux-libre-6.12-version
589 linux-libre-6.12-gnu-revision
590 (base32 "168aykyvyyp34549hqhlprl0n052q8wdb2y3vyxqw40wpf2vw3ln")
591 (base32 "1x48hpmvajz7v5wn1vdd7l5r14mq4ngzh5npz3pj81z4f1g61i0a")))
592(define-public linux-libre-6.12-pristine-source
593 (let ((version linux-libre-6.12-version)
594 (hash (base32 "1ln83ljmc7wr1nrjjq1hp1m1vx54j7i6i15m3hqb73a1p4ra5679")))
595 (make-linux-libre-source version
596 (%upstream-linux-source version hash)
597 deblob-scripts-6.12)))
598
599(define-public linux-libre-6.6-version "6.6.142")
600(define-public linux-libre-6.6-gnu-revision "gnu")
601(define deblob-scripts-6.6
602 (linux-libre-deblob-scripts
603 linux-libre-6.6-version
604 linux-libre-6.6-gnu-revision
605 (base32 "0y3lawljby2rl0mb0yjdyaasci4pl935y8xa0dnmbzff23knkxlw")
606 (base32 "1h0qybxvk1f2vvbajivxcyqha49zfh1as5053ww36klllyml3cpn")))
607(define-public linux-libre-6.6-pristine-source
608 (let ((version linux-libre-6.6-version)
609 (hash (base32 "0w1bdzp9x1sqcr9xlk7dvylhs7kycghjabfgd3iv49ydfmx61xmj")))
610 (make-linux-libre-source version
611 (%upstream-linux-source version hash)
612 deblob-scripts-6.6)))
613
614(define-public linux-libre-6.1-version "6.1.175")
615(define-public linux-libre-6.1-gnu-revision "gnu")
616(define deblob-scripts-6.1
617 (linux-libre-deblob-scripts
618 linux-libre-6.1-version
619 linux-libre-6.1-gnu-revision
620 (base32 "10gcbkd5jxfspa712kvb3qmsjgsapd9cz47pmpfk03bbfzf8ydlv")
621 (base32 "1w5pfws6l39dpc3lzazs1n6r4m96f6rdf6vb2scy5fhmrd933ldc")))
622(define-public linux-libre-6.1-pristine-source
623 (let ((version linux-libre-6.1-version)
624 (hash (base32 "11fapr04y96p9ja6mfzm7bcd3zb4dzyw6qrh7c11bss9wjlq9s9p")))
625 (make-linux-libre-source version
626 (%upstream-linux-source version hash)
627 deblob-scripts-6.1)))
628
629(define-public linux-libre-5.15-version "5.15.209")
630(define-public linux-libre-5.15-gnu-revision "gnu")
631(define deblob-scripts-5.15
632 (linux-libre-deblob-scripts
633 linux-libre-5.15-version
634 linux-libre-5.15-gnu-revision
635 (base32 "0b2gd83ihxlq490gpgq930misc6jrckw4rzl7fvwd0qzczqjvff5")
636 (base32 "1s6km2r2mad0wpf7nqn4rqsykw1lm386l1yskmil24239fbva1f1")))
637(define-public linux-libre-5.15-pristine-source
638 (let ((version linux-libre-5.15-version)
639 (hash (base32 "1d0yhbpqlkr1znahky15dfavr6dzb3wb8c15k9qqvkf2xb3pfv9l")))
640 (make-linux-libre-source version
641 (%upstream-linux-source version hash)
642 deblob-scripts-5.15)))
643
644(define-public linux-libre-5.10-version "5.10.258")
645(define-public linux-libre-5.10-gnu-revision "gnu1")
646(define deblob-scripts-5.10
647 (linux-libre-deblob-scripts
648 linux-libre-5.10-version
649 linux-libre-5.10-gnu-revision
650 (base32 "1wn9k4lbxcc9rzl1rqidlnb472wyayillrh57gyxnghi7j9ghqna")
651 (base32 "1hgza8fsps7bkjf4i0f2xgvrh1r183z3i6lxrr2nr8qbi5d13qs7")))
652(define-public linux-libre-5.10-pristine-source
653 (let ((version linux-libre-5.10-version)
654 (hash (base32 "1rdldzb3g33v6zvcmxafqpkjgqpp4n5qlxwb77wfd5jpzhgcnz4y")))
655 (make-linux-libre-source version
656 (%upstream-linux-source version hash)
657 deblob-scripts-5.10)))
658
659(define %boot-logo-patch
660 ;; Linux-Libre boot logo featuring Freedo and a gnu.
661 (origin
662 (method url-fetch)
663 (uri (string-append "http://www.fsfla.org/svn/fsfla/software/linux-libre/"
664 "lemote/gnewsense/branches/3.16/100gnu+freedo.patch"))
665 (sha256
666 (base32
667 "1hk9swxxc80bmn2zd2qr5ccrjrk28xkypwhl4z0qx4hbivj7qm06"))))
668
669(define %linux-libre-arm-export-__sync_icache_dcache-patch
670 (origin
671 (method url-fetch)
672 (uri (string-append
673 "https://salsa.debian.org/kernel-team/linux"
674 "/raw/34a7d9011fcfcfa38b68282fd2b1a8797e6834f0"
675 "/debian/patches/bugfix/arm/"
676 "arm-mm-export-__sync_icache_dcache-for-xen-privcmd.patch"))
677 (file-name "linux-libre-arm-export-__sync_icache_dcache.patch")
678 (sha256
679 (base32 "1ifnfhpakzffn4b8n7x7w5cps9mzjxlkcfz9zqak2vaw8nzvl39f"))))
680
681(define (source-with-patches source patches)
682 (origin
683 (inherit source)
684 (patches (append (origin-patches source)
685 patches))))
686
687(define-public linux-libre-7.0-source
688 (source-with-patches linux-libre-7.0-pristine-source
689 (append
690 (list %linux-libre-arm-export-__sync_icache_dcache-patch)
691 (search-patches "linux-shmem-hurd-xattr.patch"))))
692
693(define-public linux-libre-6.19-source
694 (source-with-patches linux-libre-6.19-pristine-source
695 (list %boot-logo-patch
696 %linux-libre-arm-export-__sync_icache_dcache-patch)))
697
698(define-public linux-libre-6.18-source
699 (source-with-patches linux-libre-6.18-pristine-source
700 (list %boot-logo-patch
701 %linux-libre-arm-export-__sync_icache_dcache-patch)))
702
703(define-public linux-libre-6.12-source
704 (source-with-patches linux-libre-6.12-pristine-source
705 (list %boot-logo-patch
706 %linux-libre-arm-export-__sync_icache_dcache-patch)))
707
708(define-public linux-libre-6.6-source
709 (source-with-patches linux-libre-6.6-pristine-source
710 (list %boot-logo-patch
711 %linux-libre-arm-export-__sync_icache_dcache-patch)))
712
713(define-public linux-libre-6.1-source
714 (source-with-patches linux-libre-6.1-pristine-source
715 (append
716 (list %boot-logo-patch
717 %linux-libre-arm-export-__sync_icache_dcache-patch)
718 (search-patches
719 "linux-libre-infodocs-target.patch"))))
720
721(define-public linux-libre-5.15-source
722 (source-with-patches linux-libre-5.15-pristine-source
723 (list %boot-logo-patch
724 %linux-libre-arm-export-__sync_icache_dcache-patch)))
725
726(define-public linux-libre-5.10-source
727 (source-with-patches linux-libre-5.10-pristine-source
728 (list %boot-logo-patch
729 %linux-libre-arm-export-__sync_icache_dcache-patch)))
730
731
732;;;
733;;; Kernel headers.
734;;;
735
736(define %linux-libre-timeout-properties
737 ;; Package properties for 'linux-libre' and 'linux-libre-headers' packages.
738 `((timeout . ,(* 8 3600)) ;deblob takes >5h on AArch64
739 (max-silent-time . ,(* 3 3600)))) ;don't time out on blob scan
740
741(define (make-linux-libre-headers version gnu-revision hash-string)
742 (make-linux-libre-headers* version gnu-revision
743 (origin
744 (method url-fetch)
745 (uri (linux-libre-urls version gnu-revision))
746 (sha256 (base32 hash-string)))))
747
748(define (make-linux-libre-headers* version gnu-revision source)
749 (package
750 (name "linux-libre-headers")
751 (version version)
752 (source source)
753 (build-system gnu-build-system)
754 (native-inputs `(("perl" ,perl)
755 ,@(if (version>=? version "4.16")
756 `(("flex" ,flex)
757 ("bison" ,bison))
758 '())))
759 (arguments
760 `(#:modules ((guix build gnu-build-system)
761 (guix build utils)
762 (srfi srfi-1)
763 (ice-9 match))
764 #:phases
765 (modify-phases %standard-phases
766 (delete 'configure)
767 (replace 'build
768 (lambda _
769 (let ((arch ,(platform-linux-architecture
770 (lookup-platform-by-target-or-system
771 (or (%current-target-system)
772 (%current-system)))))
773 (defconfig ,(system->defconfig
774 (or (%current-target-system)
775 (%current-system))))
776 (make-target ,(if (version>=? version "5.3")
777 "headers"
778 "headers_check")))
779 (setenv "ARCH" arch)
780 (format #t "`ARCH' set to `~a'~%" (getenv "ARCH"))
781 (invoke "make" defconfig)
782 (invoke "make" "mrproper" make-target))))
783 (replace 'install
784 (lambda* (#:key outputs #:allow-other-keys)
785 (let ((out (assoc-ref outputs "out")))
786
787 ;; Mimic the quiet_cmd_headers_install target to avoid a
788 ;; dependency on rsync.
789 (for-each (lambda (file)
790 (let ((destination (string-append
791 out "/include/"
792 ;; Drop the 'usr/include' prefix.
793 (match (string-split file #\/)
794 ((_ _ path ...)
795 (string-join path "/"))))))
796 (format #t "`~a' -> `~a'~%" file destination)
797 (install-file file (dirname destination))))
798 (find-files "usr/include" "\\.h$"))
799
800 (mkdir (string-append out "/include/config"))
801 (call-with-output-file
802 (string-append out
803 "/include/config/kernel.release")
804 (lambda (p)
805 (format p "~a-default~%" ,version)))))))
806 #:allowed-references ()
807 #:tests? #f))
808 (supported-systems (remove target-hurd? %supported-systems))
809 (properties %linux-libre-timeout-properties)
810 (home-page "https://www.gnu.org/software/linux-libre/")
811 (synopsis "GNU Linux-Libre kernel headers")
812 (description "Headers of the Linux-Libre kernel.")
813 (license license:gpl2)))
814
815(define-public linux-libre-headers-7.0
816 (make-linux-libre-headers* linux-libre-7.0-version
817 linux-libre-7.0-gnu-revision
818 linux-libre-7.0-source))
819
820(define-public linux-libre-headers-6.19
821 (make-linux-libre-headers* linux-libre-6.19-version
822 linux-libre-6.19-gnu-revision
823 linux-libre-6.19-source))
824
825(define-public linux-libre-headers-6.18
826 (make-linux-libre-headers* linux-libre-6.18-version
827 linux-libre-6.18-gnu-revision
828 linux-libre-6.18-source))
829
830(define-public linux-libre-headers-6.12
831 (make-linux-libre-headers* linux-libre-6.12-version
832 linux-libre-6.12-gnu-revision
833 linux-libre-6.12-source))
834
835(define-public linux-libre-headers-6.6
836 (make-linux-libre-headers* linux-libre-6.6-version
837 linux-libre-6.6-gnu-revision
838 linux-libre-6.6-source))
839
840(define-public linux-libre-headers-6.1
841 (make-linux-libre-headers* linux-libre-6.1-version
842 linux-libre-6.1-gnu-revision
843 linux-libre-6.1-source))
844
845(define-public linux-libre-headers-5.15
846 (make-linux-libre-headers* linux-libre-5.15-version
847 linux-libre-5.15-gnu-revision
848 linux-libre-5.15-source))
849
850(define-public linux-libre-headers-5.10
851 (make-linux-libre-headers* linux-libre-5.10-version
852 linux-libre-5.10-gnu-revision
853 linux-libre-5.10-source))
854
855;; The following package is used in the early bootstrap, and thus must be kept
856;; stable and with minimal build requirements.
857(define-public linux-libre-headers-6.12.17
858 (make-linux-libre-headers "6.12.17" "gnu"
859 "1j3iyivh8h9abryjqksf4k51wgwnwqy2l3zsc019bm84xmka38xm"))
860
861(define-public linux-libre-headers linux-libre-headers-6.12.17)
862;; linux-libre-headers-latest points to the latest headers package
863;; and should be used as a dependency for packages that depend on
864;; the headers.
865(define-public linux-libre-headers-latest linux-libre-headers-6.19)
866
867
868;;;
869;;; Kernel configurations.
870;;;
871
872(define* (kernel-config arch #:key variant)
873 "Return a file-like object of the Linux-Libre build configuration file for
874ARCH and optionally VARIANT, or #f if there is no such configuration."
875 (let* ((name (string-append (if variant (string-append variant "-") "")
876 (if (string=? "i386" arch) "i686" arch) ".conf"))
877 (file (string-append "linux-libre/" name))
878 (config (search-auxiliary-file file)))
879 (and config (local-file config))))
880
881(define (default-extra-linux-options version)
882 `(;; Make the kernel config available at /proc/config.gz
883 ("CONFIG_IKCONFIG" . #t)
884 ("CONFIG_IKCONFIG_PROC" . #t)
885 ;; Debugging options.
886 ("CONFIG_DEBUG_INFO" . #t) ;required by BTF
887 ,@(if (version>=? version "5.1")
888 '(("CONFIG_DEBUG_INFO_BTF" . #t))
889 '())
890 ,@(if (version>=? version "5.12")
891 '(("CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT" . #t))
892 '())
893 ("CONFIG_DEBUG_INFO_REDUCED" . #f) ;incompatible with BTF
894 ;; Tracing and related options.
895 ,@(if (version>=? version "5.1")
896 '(("CONFIG_BPF_JIT" . #t)
897 ("CONFIG_BPF_JIT_ALWAYS_ON" . #t)
898 ("CONFIG_BPF_SYSCALL" . #t))
899 '())
900 ,@(if (version>=? version "5.13")
901 '(("CONFIG_BPF_UNPRIV_DEFAULT_OFF" . #t))
902 '())
903 ("CONFIG_NET_CLS_BPF" . m) ;classify packets based on BPF filters
904 ("CONFIG_NET_ACT_BPF" . m) ;to execute BPF code on packets
905 ;; Compress kernel modules via Zstd.
906 ,(if (version>=? version "5.13")
907 '("CONFIG_MODULE_COMPRESS_ZSTD" . #t)
908 '("CONFIG_MODULE_COMPRESS_GZIP" . #t))
909 ;; Some very mild hardening.
910 ("CONFIG_SECURITY_DMESG_RESTRICT" . #t)
911 ;; All kernels should have NAMESPACES options enabled
912 ("CONFIG_NAMESPACES" . #t)
913 ("CONFIG_UTS_NS" . #t)
914 ("CONFIG_IPC_NS" . #t)
915 ("CONFIG_USER_NS" . #t)
916 ("CONFIG_PID_NS" . #t)
917 ("CONFIG_NET_NS" . #t)
918 ;; Various options needed for elogind service:
919 ;; https://issues.guix.gnu.org/43078
920 ("CONFIG_CGROUP_FREEZER" . #t)
921 ("CONFIG_BLK_CGROUP" . #t)
922 ("CONFIG_CGROUP_WRITEBACK" . #t)
923 ("CONFIG_CGROUP_SCHED" . #t)
924 ("CONFIG_CGROUP_PIDS" . #t)
925 ("CONFIG_CGROUP_FREEZER" . #t)
926 ("CONFIG_CGROUP_DEVICE" . #t)
927 ("CONFIG_CGROUP_CPUACCT" . #t)
928 ("CONFIG_CGROUP_PERF" . #t)
929 ("CONFIG_SOCK_CGROUP_DATA" . #t)
930 ("CONFIG_BLK_CGROUP_IOCOST" . #t)
931 ("CONFIG_CGROUP_NET_PRIO" . #t)
932 ("CONFIG_CGROUP_NET_CLASSID" . #t)
933 ("CONFIG_MEMCG" . #t)
934 ("CONFIG_MEMCG_SWAP" . #t)
935 ("CONFIG_MEMCG_KMEM" . #t)
936 ("CONFIG_CPUSETS" . #t)
937 ("CONFIG_PROC_PID_CPUSET" . #t)
938 ;; Allow disk encryption by default
939 ("CONFIG_DM_CRYPT" . m)
940 ;; Allow fscrypt filesystem encryption by default
941 ("CONFIG_FS_ENCRYPTION" . #t)
942 ;; Support zram on all kernel configs
943 ("CONFIG_ZSWAP" . #t)
944 ("CONFIG_ZSMALLOC" . #t)
945 ("CONFIG_ZRAM" . m)
946 ;; Accessibility support.
947 ("CONFIG_ACCESSIBILITY" . #t)
948 ("CONFIG_A11Y_BRAILLE_CONSOLE" . #t)
949 ("CONFIG_SPEAKUP" . m)
950 ("CONFIG_SPEAKUP_SYNTH_SOFT" . m)
951 ;; Modules required for initrd:
952 ("CONFIG_NET_9P" . m)
953 ("CONFIG_NET_9P_VIRTIO" . m)
954 ("CONFIG_VIRTIO_BLK" . m)
955 ("CONFIG_VIRTIO_NET" . m)
956 ("CONFIG_VIRTIO_PCI" . m)
957 ("CONFIG_VIRTIO_BALLOON" . m)
958 ("CONFIG_VIRTIO_MMIO" . m)
959 ("CONFIG_FUSE_FS" . m)
960 ("CONFIG_CIFS" . m)
961 ("CONFIG_9P_FS" . m)
962 ;; Enable DMABUF used by wayland, pipewire and libcamera
963 ;; https://codeberg.org/guix/guix/issues/5995
964 ("CONFIG_UDMABUF" . #t)
965 ("CONFIG_DMABUF_MOVE_NOTIFY" . #t)
966 ("CONFIG_DMABUF_HEAPS" . #t)
967 ("CONFIG_DMABUF_HEAPS_SYSTEM" . #t)
968 ("CONFIG_DMABUF_HEAPS_CMA" . #t)
969 ,@(if (version>=? version "6.17")
970 '(("CONFIG_DMABUF_HEAPS_CMA_LEGACY" . #t))
971 '())
972 ;; Enable sched_ext support for userspace schedulers
973 ;; Note: Depends on BPF tracing
974 ;; https://docs.kernel.org/scheduler/sched-ext.html
975 ,@(if (version>=? version "6.12")
976 '(("CONFIG_SCHED_CLASS_EXT" . #t))
977 '())
978 ;; Disable the EFI pstore storage backend to avoid causing
979 ;; unrecoverable failures on some EFI systems:
980 ;; https://lists.gnu.org/archive/html/help-guix/2025-01/msg00173.html
981 ("CONFIG_EFI_VARS_PSTORE_DEFAULT_DISABLE" . #t)
982 ;; Provide modules for wireguard and netfilter support
983 ("CONFIG_WIREGUARD" . m)
984 ("CONFIG_IP_NF_FILTER" . m)
985 ("CONFIG_NETFILTER_XT_MATCH_ADDRTYPE" . m)))
986
987(define (config->string options)
988 (string-join (map (match-lambda
989 ((option . 'm)
990 (string-append option "=m"))
991 ((option . #t)
992 (string-append option "=y"))
993 ((option . #f)
994 (string-append option "=n"))
995 ((option . string)
996 (string-append option "=\"" string "\"")))
997 options)
998 "\n"))
999
1000
1001;;;
1002;;; Kernel package utilities.
1003;;;
1004
1005(define (apply-infodoc-patch? version)
1006 ;; Versions older than 5.10 have different enough build scripts that the
1007 ;; infodocs patch doesn't apply.
1008 (and (version>=? version "5.10")
1009 (not (version>=? version "6.2")))) ;patch applied upstream
1010
1011
1012(define* (make-linux-libre version gnu-revision hash-string supported-systems
1013 #:key
1014 (extra-version #f)
1015 ;; A function that takes an arch and a variant, and
1016 ;; return a file-like object. See kernel-config
1017 ;; for an example.
1018 (configuration-file #f)
1019 (defconfig "defconfig")
1020 (extra-options (default-extra-linux-options version))
1021 (patches
1022 `(,%boot-logo-patch
1023 ,@(if (apply-infodoc-patch? version)
1024 (list (search-patch
1025 "linux-libre-infodocs-target.patch"))
1026 '()))))
1027 (make-linux-libre* version gnu-revision
1028 (origin
1029 (method url-fetch)
1030 (uri (linux-libre-urls version gnu-revision))
1031 (sha256 (base32 hash-string))
1032 (patches patches))
1033 supported-systems
1034 #:extra-version extra-version
1035 #:configuration-file configuration-file
1036 #:defconfig defconfig
1037 #:extra-options extra-options))
1038
1039(define* (make-linux-libre* version gnu-revision source supported-systems
1040 #:key
1041 (extra-version #f)
1042 ;; A function that takes an arch and a variant.
1043 ;; See kernel-config for an example.
1044 (configuration-file #f)
1045 (defconfig "defconfig")
1046 (extra-options (default-extra-linux-options version)))
1047 (package
1048 (name (if extra-version
1049 (string-append "linux-libre-" extra-version)
1050 "linux-libre"))
1051 (version version)
1052 (source source)
1053 (supported-systems supported-systems)
1054 (build-system gnu-build-system)
1055 (arguments
1056 (list
1057 #:modules '((guix build gnu-build-system)
1058 (guix build utils)
1059 (srfi srfi-1)
1060 (srfi srfi-26)
1061 (ice-9 ftw)
1062 (ice-9 match))
1063 #:tests? #f
1064 #:phases
1065 #~(modify-phases %standard-phases
1066 (add-after 'unpack 'patch-/bin/pwd
1067 (lambda _
1068 (substitute* (find-files
1069 "." "^Makefile(\\.include)?$")
1070 (("/bin/pwd") "pwd"))))
1071 (add-before 'configure 'set-environment
1072 (lambda* (#:key target #:allow-other-keys)
1073 ;; Avoid introducing timestamps.
1074 (setenv "KCONFIG_NOTIMESTAMP" "1")
1075 (setenv "KBUILD_BUILD_TIMESTAMP" (getenv "SOURCE_DATE_EPOCH"))
1076
1077 ;; Other variables useful for reproducibility.
1078 (setenv "KBUILD_BUILD_VERSION" "1")
1079 (setenv "KBUILD_BUILD_USER" "guix")
1080 (setenv "KBUILD_BUILD_HOST" "guix")
1081
1082 ;; Set ARCH and CROSS_COMPILE.
1083 (let ((arch #$(platform-linux-architecture
1084 (lookup-platform-by-target-or-system
1085 (or (%current-target-system)
1086 (%current-system))))))
1087 (setenv "ARCH" arch)
1088 (format #t "`ARCH' set to `~a'~%" (getenv "ARCH"))
1089 (when target
1090 (setenv "CROSS_COMPILE" (string-append target "-"))
1091 (format #t "`CROSS_COMPILE' set to `~a'~%"
1092 (getenv "CROSS_COMPILE"))))
1093
1094 ;; Allow EXTRAVERSION to be set via the environment.
1095 (substitute* "Makefile"
1096 (("^ *EXTRAVERSION[[:blank:]]*=")
1097 "EXTRAVERSION ?="))
1098 (setenv "EXTRAVERSION"
1099 #$(and extra-version
1100 (string-append "-" extra-version)))
1101 ;; Use the maximum compression available for Zstd-compressed
1102 ;; modules.
1103 (setenv "ZSTD_CLEVEL" "19")))
1104 (replace 'configure
1105 (lambda _
1106 (let ((config
1107 #$(match (let ((arch (platform-linux-architecture
1108 (lookup-platform-by-target-or-system
1109 (or (%current-target-system)
1110 (%current-system))))))
1111 (and configuration-file arch
1112 (configuration-file
1113 arch
1114 #:variant (version-major+minor version))))
1115 (#f ;no config for this platform
1116 #f)
1117 ((? file-like? config)
1118 config))))
1119 ;; Use a custom kernel configuration file or a default
1120 ;; configuration file.
1121 (if config
1122 (begin
1123 (copy-file config ".config")
1124 (chmod ".config" #o666))
1125 (invoke "make" #$defconfig))
1126 ;; Appending works even when the option wasn't in the file.
1127 ;; The last one prevails if duplicated.
1128 (let ((port (open-file ".config" "a"))
1129 (extra-configuration #$(config->string extra-options)))
1130 (display extra-configuration port)
1131 (close-port port))
1132 (invoke "make" "oldconfig"))))
1133 (replace 'install
1134 (lambda* (#:key make-flags parallel-build? #:allow-other-keys)
1135 (let ((moddir (string-append #$output "/lib/modules"))
1136 (dtbdir (string-append #$output "/lib/dtbs"))
1137 (make-flags
1138 (append make-flags
1139 (list "-j"
1140 (if parallel-build?
1141 (number->string (parallel-job-count))
1142 "1")))))
1143 ;; Install kernel image, kernel configuration and link map.
1144 (for-each (lambda (file) (install-file file #$output))
1145 (find-files "." "^(\\.config|bzImage|zImage|Image\
1146|vmlinuz|System\\.map|Module\\.symvers)$"))
1147 ;; Install device tree files
1148 (unless (null? (find-files "." "\\.dtb$"))
1149 (mkdir-p dtbdir)
1150 (apply invoke "make"
1151 (string-append "INSTALL_DTBS_PATH=" dtbdir)
1152 "dtbs_install" make-flags))
1153 ;; Install kernel modules
1154 (mkdir-p moddir)
1155 (apply invoke "make"
1156 ;; Disable depmod because the Guix system's module
1157 ;; directory is an union of potentially multiple
1158 ;; packages. It is not possible to use depmod to
1159 ;; usefully calculate a dependency graph while building
1160 ;; only one of them.
1161 "DEPMOD=true"
1162 (string-append "MODULE_DIR=" moddir)
1163 (string-append "INSTALL_PATH=" #$output)
1164 (string-append "INSTALL_MOD_PATH=" #$output)
1165 "INSTALL_MOD_STRIP=1"
1166 "modules_install" make-flags)
1167 (let* ((versions (filter (lambda (name)
1168 (not (string-prefix? "." name)))
1169 (scandir moddir)))
1170 (version (match versions
1171 ((x) x))))
1172 ;; There are symlinks to the build and source directory.
1173 ;; Both will point to target /tmp/guix-build* and thus not
1174 ;; be useful in a profile. Delete the symlinks.
1175 (false-if-file-not-found
1176 (delete-file
1177 (string-append moddir "/" version "/build")))
1178 (false-if-file-not-found
1179 (delete-file
1180 (string-append moddir "/" version "/source"))))))))))
1181 (native-inputs
1182 (list perl
1183 bc
1184 openssl
1185 elfutils ;needed to enable CONFIG_STACK_VALIDATION
1186 flex
1187 bison
1188 util-linux ;needed for hexdump
1189 ;; These are needed to compile the GCC plugins.
1190 gmp
1191 mpfr
1192 mpc
1193 ;; These are needed when building with the CONFIG_DEBUG_INFO_BTF
1194 ;; support.
1195 dwarves ;for pahole
1196 python-wrapper
1197 zlib
1198 ;; For Zstd compression of kernel modules.
1199 zstd))
1200 (home-page "https://www.gnu.org/software/linux-libre/")
1201 (synopsis "100% free redistribution of a cleaned Linux kernel")
1202 (description "GNU Linux-Libre is a free (as in freedom) variant of the
1203Linux kernel. It has been modified to remove all non-free binary blobs.")
1204 (license license:gpl2)
1205 (properties %linux-libre-timeout-properties)))
1206
1207
1208;;;
1209;;; Generic kernel packages.
1210;;;
1211
1212(define-public linux-libre-7.0
1213 (make-linux-libre* linux-libre-7.0-version
1214 linux-libre-7.0-gnu-revision
1215 linux-libre-7.0-source
1216 '("x86_64-linux" "i686-linux" "armhf-linux"
1217 "aarch64-linux" "powerpc64le-linux" "riscv64-linux")
1218 #:configuration-file kernel-config))
1219
1220(define-public linux-libre-version linux-libre-7.0-version)
1221(define-public linux-libre-gnu-revision linux-libre-7.0-gnu-revision)
1222(define-public linux-libre-pristine-source linux-libre-7.0-pristine-source)
1223(define-public linux-libre-source linux-libre-7.0-source)
1224(define-public linux-libre linux-libre-7.0)
1225
1226(define-public linux-libre-6.19
1227 (make-linux-libre* linux-libre-6.19-version
1228 linux-libre-6.19-gnu-revision
1229 linux-libre-6.19-source
1230 '("x86_64-linux" "i686-linux" "armhf-linux"
1231 "aarch64-linux" "powerpc64le-linux" "riscv64-linux")
1232 #:configuration-file kernel-config))
1233
1234(define-public linux-libre-6.18
1235 (make-linux-libre* linux-libre-6.18-version
1236 linux-libre-6.18-gnu-revision
1237 linux-libre-6.18-source
1238 '("x86_64-linux" "i686-linux" "armhf-linux"
1239 "aarch64-linux" "powerpc64le-linux" "riscv64-linux")
1240 #:configuration-file kernel-config))
1241
1242(define-public linux-libre-6.12
1243 (make-linux-libre* linux-libre-6.12-version
1244 linux-libre-6.12-gnu-revision
1245 linux-libre-6.12-source
1246 '("x86_64-linux" "i686-linux" "armhf-linux"
1247 "aarch64-linux" "powerpc64le-linux" "riscv64-linux")
1248 #:configuration-file kernel-config))
1249
1250(define-public linux-libre-6.6
1251 (make-linux-libre* linux-libre-6.6-version
1252 linux-libre-6.6-gnu-revision
1253 linux-libre-6.6-source
1254 '("x86_64-linux" "i686-linux" "armhf-linux"
1255 "aarch64-linux" "powerpc64le-linux" "riscv64-linux")
1256 #:configuration-file kernel-config))
1257
1258(define-public linux-libre-6.1
1259 (make-linux-libre* linux-libre-6.1-version
1260 linux-libre-6.1-gnu-revision
1261 linux-libre-6.1-source
1262 '("x86_64-linux" "i686-linux" "armhf-linux"
1263 "aarch64-linux" "powerpc64le-linux" "riscv64-linux")
1264 #:configuration-file kernel-config))
1265
1266(define-public linux-libre-5.15
1267 (make-linux-libre* linux-libre-5.15-version
1268 linux-libre-5.15-gnu-revision
1269 linux-libre-5.15-source
1270 '("x86_64-linux" "i686-linux" "armhf-linux"
1271 "aarch64-linux" "powerpc64le-linux" "riscv64-linux")
1272 #:configuration-file kernel-config))
1273
1274(define-public linux-libre-5.10
1275 (make-linux-libre* linux-libre-5.10-version
1276 linux-libre-5.10-gnu-revision
1277 linux-libre-5.10-source
1278 '("x86_64-linux" "i686-linux" "armhf-linux"
1279 "aarch64-linux" "powerpc64le-linux" "riscv64-linux")
1280 #:configuration-file kernel-config))
1281
1282;; Linux-Libre-LTS points to the *newest* released long-term support version of
1283;; Linux-Libre.
1284;; Reference: <https://www.kernel.org/category/releases.html>
1285
1286(define-public linux-libre-lts-version linux-libre-6.18-version)
1287(define-public linux-libre-lts-gnu-revision linux-libre-6.18-gnu-revision)
1288(define-public linux-libre-lts-pristine-source linux-libre-6.18-pristine-source)
1289(define-public linux-libre-lts-source linux-libre-6.18-source)
1290(define-public linux-libre-lts linux-libre-6.18)
1291
1292
1293;;;
1294;;; Specialized kernel variants.
1295;;;
1296
1297(define-public %dummy-linux-kernel-for-container
1298 (hidden-package
1299 (package
1300 (name "linux-dummy")
1301 (version "0.0.0")
1302 (source #f)
1303 (build-system copy-build-system)
1304 (arguments
1305 (list #:phases
1306 #~(modify-phases %standard-phases
1307 (delete 'unpack)
1308 (replace 'install
1309 (lambda _
1310 (mkdir-p #$output))))))
1311 (home-page "")
1312 (synopsis "Dummy Linux kernel for @command{guix system container}")
1313 (description "")
1314 (license #f))))
1315
1316(define-public linux-libre-arm-generic
1317 (make-linux-libre* linux-libre-version
1318 linux-libre-gnu-revision
1319 linux-libre-source
1320 '("armhf-linux")
1321 #:defconfig "multi_v7_defconfig"
1322 #:extra-version "arm-generic"
1323 #:extra-options
1324 (append
1325 `(;; needed to fix the RTC on rockchip platforms
1326 ("CONFIG_RTC_DRV_RK808" . #t))
1327 (default-extra-linux-options linux-libre-version))))
1328
1329(define-public linux-libre-arm-generic-5.10
1330 (make-linux-libre* linux-libre-5.10-version
1331 linux-libre-5.10-gnu-revision
1332 linux-libre-5.10-source
1333 '("armhf-linux")
1334 #:defconfig "multi_v7_defconfig"
1335 #:extra-version "arm-generic"
1336 #:extra-options
1337 (append
1338 (default-extra-linux-options linux-libre-5.10-version))))
1339
1340(define-public linux-libre-arm-omap2plus
1341 (make-linux-libre* linux-libre-version
1342 linux-libre-gnu-revision
1343 linux-libre-source
1344 '("armhf-linux")
1345 #:defconfig "omap2plus_defconfig"
1346 #:extra-version "arm-omap2plus"))
1347
1348(define pinebook-extra-modules
1349 `(;; Pinebook display, battery, charger and usb
1350 ("CONFIG_DRM_ANALOGIX_ANX6345" . m)
1351 ("CONFIG_CHARGER_AXP20X" . m)
1352 ("CONFIG_INPUT_AXP20X_PEK" . m)
1353 ("CONFIG_CHARGER_AXP20X" . m)
1354 ("CONFIG_BATTERY_AXP20X" . m)
1355 ("CONFIG_PINCTRL_AXP209" . m)
1356 ("CONFIG_AXP20X_POWER" . m)
1357 ("CONFIG_AXP20X_ADC" . m)
1358 ;; Pinebook PRO battery and sound support
1359 ("CONFIG_BATTERY_CW2015" . m)
1360 ("CONFIG_CHARGER_GPIO" . m)
1361 ("CONFIG_SND_SOC_ES8316" . m)))
1362
1363(define arm64-generic-extra-modules
1364 (append
1365 pinebook-extra-modules
1366 `(;; Provide support for ath9k wireless
1367 ("CONFIG_ATH9K_HTC" . m)
1368 ;; Support Orange Pi R1 Plus LTS ethernet PHY.
1369 ("CONFIG_MOTORCOMM_PHY" . m)
1370 ;; needed to fix the RTC on rockchip platforms
1371 ("CONFIG_RTC_DRV_RK808" . #t))))
1372
1373(define-public linux-libre-arm64-generic
1374 (make-linux-libre* linux-libre-version
1375 linux-libre-gnu-revision
1376 linux-libre-source
1377 '("aarch64-linux")
1378 #:defconfig "defconfig"
1379 #:extra-version "arm64-generic"
1380 #:extra-options
1381 (append
1382 arm64-generic-extra-modules
1383 (default-extra-linux-options linux-libre-version))))
1384
1385(define-public linux-libre-lts-arm64-generic
1386 (if (string=? linux-libre-lts-version linux-libre-version)
1387
1388 ;; Make it a strict alias so that the user interface does not see two
1389 ;; packages with the exact same name and version.
1390 linux-libre-arm64-generic
1391
1392 (make-linux-libre* linux-libre-lts-version
1393 linux-libre-lts-gnu-revision
1394 linux-libre-lts-source
1395 '("aarch64-linux")
1396 #:defconfig "defconfig"
1397 #:extra-version "arm64-generic"
1398 #:extra-options
1399 (append
1400 arm64-generic-extra-modules
1401 (default-extra-linux-options linux-libre-lts-version)))))
1402
1403(define-public linux-libre-arm64-generic-5.10
1404 (make-linux-libre* linux-libre-5.10-version
1405 linux-libre-5.10-gnu-revision
1406 linux-libre-5.10-source
1407 '("aarch64-linux")
1408 #:defconfig "defconfig"
1409 #:extra-version "arm64-generic"
1410 #:extra-options
1411 (append
1412 arm64-generic-extra-modules
1413 (default-extra-linux-options linux-libre-5.10-version))))
1414
1415(define-public linux-libre-arm64-honeycomb
1416 ;; Kernel for use on the HoneyComb LX2 boards:
1417 ;; <https://shop.solid-run.com/product/SRCFTXE000IV13/>.
1418 (make-linux-libre* linux-libre-lts-version
1419 linux-libre-lts-gnu-revision
1420 linux-libre-lts-source
1421 '("aarch64-linux")
1422 #:extra-version "arm64-honeycomb"
1423 #:extra-options
1424 ;; See
1425 ;; https://github.com/SolidRun/lx2160a_build/blob/master/configs/linux/lx2k_additions.config
1426 (append
1427 `(("CONFIG_GPIO_SYSFS" . #true)
1428 ("CONFIG_GPIO_MPC8XXX" . #true)
1429 ("CONFIG_NET_PKTGEN" . #true)
1430 ("CONFIG_USB_SERIAL" . #true)
1431 ("CONFIG_USB_SERIAL_CONSOLE" . #true)
1432 ("CONFIG_USB_SERIAL_GENERIC" . #true)
1433 ("CONFIG_USB_SERIAL_SIMPLE" . #true)
1434 ("CONFIG_USB_SERIAL_FTDI_SIO" . #true)
1435 ("CONFIG_USB_ACM" . #true)
1436 ("CONFIG_USB_NET_DRIVERS" . #true)
1437 ("CONFIG_USB_USBNET" . #true)
1438 ("CONFIG_USB_NET_CDCETHER" . #true)
1439 ("CONFIG_USB_NET_CDC_NCM" . #true)
1440 ("CONFIG_USB_NET_NET1080" . #true)
1441 ("CONFIG_USB_NET_CDC_SUBSET_ENABLE" . #true)
1442 ("CONFIG_USB_NET_CDC_SUBSET" . #true)
1443 ("CONFIG_USB_ARMLINUX" . #true)
1444 ("CONFIG_BLK_DEV_NVME" . #true)
1445 ("CONFIG_NVMEM_BCM_OCOTP" . #true)
1446 ("CONFIG_DRM_AMDGPU" . #true)
1447 ("CONFIG_DRM_AMDGPU_SI" . #true)
1448 ("CONFIG_DRM_AMDGPU_CIK" . #true)
1449 ("CONFIG_DRM_AMDGPU_USERPTR" . #true)
1450 ("CONFIG_DRM_AMD_DC" . #true)
1451 ("CONFIG_CHASH" . #true)
1452 ("CONFIG_PMBUS" . #true)
1453 ("CONFIG_SENSORS_PMBUS" . #true)
1454 ("CONFIG_REGULATOR" . #true)
1455 ("CONFIG_REGULATOR_FIXED_VOLTAGE" . #true)
1456 ("CONFIG_REGULATOR_PWM" . #true)
1457 ("CONFIG_SENSORS_AMC6821" . #true)
1458 ("CONFIG_SENSORS_LM90" . #true)
1459 ("CONFIG_SENSORS_LTC2978" . #true)
1460 ("CONFIG_SENSORS_LTC2978_REGULATOR" . #true)
1461 ("CONFIG_TMPFS" . #true)
1462 ("CONFIG_TMPFS_POSIX_ACL" . #true)
1463 ("CONFIG_TMPFS_XATTR" . #true)
1464 ;;("CONFIG_BLK_DEV_RAM_SIZE" . 524288)
1465 ("CONFIG_POWER_RESET_GPIO" . #true)
1466 ("CONFIG_CRYPTO_USER_API_HASH" . #true)
1467 ("CONFIG_CRYPTO_USER_API_SKCIPHER" . #true)
1468 ("CONFIG_CRYPTO_USER_API_RNG" . #true)
1469 ("CONFIG_CRYPTO_USER_API_AEAD" . #true)
1470
1471 ;; Fixes https://codeberg.org/guix/guix/issues/101
1472 ("CONFIG_KEY_DH_OPERATIONS" . #true)
1473
1474 ;; restool support
1475 ("CONFIG_FSL_MC_UAPI_SUPPORT" . #t)
1476 ("CONFIG_FSL_MC_BUS" . #t)
1477 ("CONFIG_VFIO_FSL_MC" . #t)
1478 ("CONFIG_FSL_MC_DPIO" . #t)
1479 ("CONFIG_ARM_GIC_V3_ITS_FSL_MC" . #t)
1480
1481 ;; vsockets support
1482 ;; TODO This seems to be enabled by default on other
1483 ;; architectures?
1484 ("CONFIG_VSOCKETS" . m)
1485 ("CONFIG_VSOCKETS_DIAG" . m)
1486 ("CONFIG_VSOCKETS_LOOPBACK" . m)
1487 ("CONFIG_VMWARE_VMCI_VSOCKETS" . m)
1488 ("CONFIG_VIRTIO_VSOCKETS" . m)
1489 ("CONFIG_VIRTIO_VSOCKETS_COMMON" . m)
1490 ("CONFIG_HYPERV_VSOCKETS" . m)
1491 ("CONFIG_VHOST_IOTLB" . m)
1492 ("CONFIG_VHOST_RING" . m)
1493 ("CONFIG_VHOST_TASK" . #true)
1494 ("CONFIG_VHOST" . m)
1495 ("CONFIG_VHOST_MENU" . #true)
1496 ("CONFIG_VHOST_NET" . m)
1497 ("CONFIG_VHOST_SCSI" . m)
1498 ("CONFIG_VHOST_VSOCK" . m)
1499 ("CONFIG_VHOST_VDPA" . m))
1500 (default-extra-linux-options linux-libre-lts-version))))
1501
1502(define-public reform-debian-packages-for-7.0
1503 (package
1504 (name "reform-debian-packages")
1505 (version "2023-07-10-559-gced99e4") ;from git describe
1506 (source
1507 (origin
1508 (method git-fetch)
1509 (uri (git-reference
1510 (url "https://source.mnt.re/reform/reform-debian-packages.git")
1511 (commit "ced99e4f4b1fa7294823ac57f1561490d5d4e1f1")))
1512 (file-name (git-file-name name version))
1513 (sha256
1514 (base32 "1rnk22dg0xrljpfzhc0lvlksd2zpddwhivvph3q6kgbac4afwv9r"))))
1515 (build-system copy-build-system)
1516 (arguments
1517 (list
1518 #:install-plan
1519 #~'(("linux/patches7.0/" "/patches7.0")
1520 ("linux/" "/dts/amlogic"
1521 #:include-regexp ("meson.*\\.dts$"))
1522 ("linux/" "/dts/freescale"
1523 #:include-regexp ("imx8.*\\.dts$"))
1524 ("linux/" "/dts/freescale"
1525 #:include-regexp ("fsl.*\\.dts$"))
1526 ("linux/" "/dts/rockchip"
1527 #:include-regexp ("rk3588.*\\.dts$"))
1528 ("linux/config" "config"))))
1529 (home-page "https://source.mnt.re/reform/reform-debian-packages")
1530 (synopsis
1531 "Linux kernel patches and device-trees used for MNT Reform systems")
1532 (description
1533 "Linux kernel patches and device-trees used for the MNT Reform systems")
1534 (license (list
1535 (license:fsf-free "file://filter-output"
1536 "https://www.gnu.org/prep/maintain/html_node/License-Notices-for-Other-Files.html")
1537 license:bsd-2
1538 license:expat
1539 license:gpl2
1540 license:gpl2+
1541 license:gpl3
1542 license:x11))))
1543
1544(define-public reform-debian-packages-for-6.19
1545 (package
1546 (name "reform-debian-packages")
1547 (version "2023-07-10-544-g702bad4") ;from git describe
1548 (source
1549 (origin
1550 (method git-fetch)
1551 (uri (git-reference
1552 (url "https://source.mnt.re/reform/reform-debian-packages.git")
1553 (commit "702bad4e35b22988d847284534ed308d1f527ed4")))
1554 (file-name (git-file-name name version))
1555 (sha256
1556 (base32 "0s5r08sv87mmr5b60mfz7gfpck0qgpcpgy8n6c9978cihm782jhn"))))
1557 (build-system copy-build-system)
1558 (arguments
1559 (list
1560 #:install-plan
1561 #~'(("linux/patches6.19/" "/patches6.19")
1562 ("linux/" "/dts/amlogic"
1563 #:include-regexp ("meson.*\\.dts$"))
1564 ("linux/" "/dts/freescale"
1565 #:include-regexp ("imx8.*\\.dts$"))
1566 ("linux/" "/dts/freescale"
1567 #:include-regexp ("fsl.*\\.dts$"))
1568 ("linux/" "/dts/rockchip"
1569 #:include-regexp ("rk3588.*\\.dts$"))
1570 ("linux/config" "config"))))
1571 (home-page "https://source.mnt.re/reform/reform-debian-packages")
1572 (synopsis
1573 "Linux kernel patches and device-trees used for MNT Reform systems")
1574 (description
1575 "Linux kernel patches and device-trees used for the MNT Reform systems")
1576 (license (list
1577 (license:fsf-free "file://filter-output"
1578 "https://www.gnu.org/prep/maintain/html_node/License-Notices-for-Other-Files.html")
1579 license:bsd-2
1580 license:expat
1581 license:gpl2
1582 license:gpl2+
1583 license:gpl3
1584 license:x11))))
1585
1586(define-public reform-debian-packages-for-6.18
1587 (package
1588 (name "reform-debian-packages")
1589 (version "2023-07-10-525-g7e8a95c") ;from git describe
1590 (source
1591 (origin
1592 (method git-fetch)
1593 (uri (git-reference
1594 (url "https://source.mnt.re/reform/reform-debian-packages.git")
1595 (commit "7e8a95c7babd9e1f4b307b6d146e0846c65fc9b8")))
1596 (file-name (git-file-name name version))
1597 (sha256
1598 (base32 "0g7lm7bfsjn6y77i1gk6wgpmghd36s3axqdqr1ahl9vhzw03cx0g"))))
1599 (build-system copy-build-system)
1600 (arguments
1601 (list
1602 #:install-plan
1603 #~'(("linux/patches6.18/" "/patches6.18")
1604 ("linux/" "/dts/amlogic"
1605 #:include-regexp ("meson.*\\.dts$"))
1606 ("linux/" "/dts/freescale"
1607 #:include-regexp ("imx8.*\\.dts$"))
1608 ("linux/" "/dts/freescale"
1609 #:include-regexp ("fsl.*\\.dts$"))
1610 ("linux/" "/dts/rockchip"
1611 #:include-regexp ("rk3588.*\\.dts$"))
1612 ("linux/config" "config"))))
1613 (home-page "https://source.mnt.re/reform/reform-debian-packages")
1614 (synopsis
1615 "Linux kernel patches and device-trees used for MNT Reform systems")
1616 (description
1617 "Linux kernel patches and device-trees used for the MNT Reform systems")
1618 (license (list
1619 (license:fsf-free "file://filter-output"
1620 "https://www.gnu.org/prep/maintain/html_node/License-Notices-for-Other-Files.html")
1621 license:bsd-2
1622 license:expat
1623 license:gpl2
1624 license:gpl2+
1625 license:gpl3
1626 license:x11))))
1627
1628(define-public reform-debian-packages-for-6.12
1629 (package
1630 (name "reform-debian-packages")
1631 (version "2023-07-10-320-gaf0a461") ;from git describe
1632 (source
1633 (origin
1634 (method git-fetch)
1635 (uri (git-reference
1636 (url "https://source.mnt.re/reform/reform-debian-packages.git")
1637 (commit "af0a461d38e13481323f061d9ff6827d1d13873b")))
1638 (file-name (git-file-name name version))
1639 (sha256
1640 (base32 "1cylprld2ri3mprj5cgwla1l8qv9iqqvcra7h64yarzs49zaa16m"))))
1641 (build-system copy-build-system)
1642 (arguments
1643 (list
1644 #:install-plan
1645 #~'(("linux/patches6.12/" "/patches6.12")
1646 ("linux/" "/dts/amlogic"
1647 #:include-regexp ("meson.*\\.dts$"))
1648 ("linux/" "/dts/freescale"
1649 #:include-regexp ("imx8.*\\.dts$"))
1650 ("linux/" "/dts/freescale"
1651 #:include-regexp ("fsl.*\\.dts$"))
1652 ("linux/" "/dts/rockchip"
1653 #:include-regexp ("rk3588.*\\.dts$"))
1654 ("linux/config" "config"))))
1655 (home-page "https://source.mnt.re/reform/reform-debian-packages")
1656 (synopsis
1657 "Linux kernel patches and device-trees used for MNT Reform systems")
1658 (description
1659 "Linux kernel patches and device-trees used for the MNT Reform systems")
1660 (license (list
1661 (license:fsf-free "file://filter-output"
1662 "https://www.gnu.org/prep/maintain/html_node/License-Notices-for-Other-Files.html")
1663 license:bsd-2
1664 license:expat
1665 license:gpl2
1666 license:gpl2+
1667 license:gpl3
1668 license:x11))))
1669
1670(define (mnt-reform-kernel-options version)
1671 `(("CONFIG_DRM_LVDS_CODEC" . m)
1672 ("CONFIG_DRM_CDNS_MHDP8546" . m)
1673 ("CONFIG_DRM_CDNS_HDMI_CEC" . m)
1674 ("CONFIG_DRM_IMX_CDNS_MHDP" . m)
1675 ("CONFIG_DRM_IMX_DCSS" . m)
1676 ("CONFIG_PHY_FSL_IMX8MQ_HDPTX" . m)
1677 ("CONFIG_DRM_PANEL_LVDS" . m)
1678 ("CONFIG_I2C_IMX_LPI2C" . m)
1679 ("CONFIG_I2C_MUX_REG" . m)
1680 ("CONFIG_INTERCONNECT_IMX" . #true)
1681 ("CONFIG_INTERCONNECT_IMX8MQ" . #true)
1682 ("CONFIG_MFD_WM8994" . m)
1683 ("CONFIG_MUX_GPIO" . m)
1684 ("CONFIG_MUX_MMIO" . m)
1685 ("CONFIG_RTC_DRV_PCF8523" . m)
1686 ("CONFIG_USB_EHCI_FSL" . m)
1687 ("CONFIG_NO_HZ_IDLE" . #true)
1688 ("CONFIG_SND_SOC_FSL_MICFIL" . m)
1689 ("CONFIG_SND_IMX_SOC" . m)
1690 ("CONFIG_SND_SOC_FSL_ASOC_CARD" . m)
1691 ("CONFIG_SND_SOC_IMX_AUDMIX" . m)
1692 ("CONFIG_SND_SOC_IMX_HDMI" . m)
1693 ("CONFIG_INPUT_JOYSTICK" . #true)
1694 ("CONFIG_JOYSTICK_XPAD" . m)
1695 ("CONFIG_JOYSTICK_XPAD_FF" . #true)
1696 ("CONFIG_JOYSTICK_XPAD_LEDS" . #true)
1697 ("CONFIG_INTERCONNECT_IMX8MP" . #true)
1698 ("CONFIG_SND_SOC_FSL_ASRC" . #true)
1699 ("CONFIG_DRM_IMX_LCDIF" . #true)
1700 ("CONFIG_DRM_IMX8MP_DW_HDMI_BRIDGE" . #true)
1701 ("CONFIG_DRM_IMX8MP_HDMI_PVI" . #true)
1702 ("CONFIG_IMX8MM_THERMAL" . #true)
1703 ("CONFIG_IMX2_WDT" . #true)
1704 ("CONFIG_DRM_SAMSUNG_DSIM" . #true)
1705 ("CONFIG_PHY_FSL_SAMSUNG_HDMI_PHY" . #true)
1706 ("CONFIG_DRM" . #true)
1707 ("CONFIG_DRM_PANEL_MNT_POCKET_REFORM" . #true)
1708 ("CONFIG_IMX8M_BLK_CTRL" . #true)
1709 ("CONFIG_IMX_GPCV2_PM_DOMAINS" . #true)
1710 ("CONFIG_DRM_DISPLAY_CONNECTOR" . #true)
1711 ("CONFIG_DRM_FSL_LDB" . #true)
1712 ("CONFIG_BACKLIGHT_CLASS_DEVICE" . #true)
1713 ("CONFIG_BACKLIGHT_PWM" . #true)
1714 ("CONFIG_BACKLIGHT_GPIO" . #true)
1715 ("CONFIG_BACKLIGHT_LED" . #true)
1716 ("CONFIG_CPU_FREQ_GOV_PERFORMANCE" . #true)
1717 ("CONFIG_CPU_FREQ_GOV_POWERSAVE" . #true)
1718 ("CONFIG_CPU_FREQ_GOV_USERSPACE" . #true)
1719 ("CONFIG_CPU_FREQ_GOV_ONDEMAND" . #true)
1720 ("CONFIG_CPU_FREQ_GOV_CONSERVATIVE" . #true)
1721 ("CONFIG_CPU_FREQ_GOV_SCHEDUTIL" . #true)
1722 ("CONFIG_ARM_IMX_CPUFREQ_DT" . #true)
1723 ("CONFIG_ARM_IMX_BUS_DEVFREQ" . #true)
1724 ("CONFIG_IMX_IRQSTEER" . #true)
1725 ("CONFIG_PCI_MESON" . #true)
1726 ("CONFIG_DWMAC_MESON" . #true)
1727 ("CONFIG_MDIO_BUS_MUX_MESON_G12A" . m)
1728 ("CONFIG_GPIO_ROCKCHIP" . #true)
1729 ("CONFIG_PL330_DMA" . #true)
1730 ("CONFIG_I2C_MESON" . #true)
1731 ("CONFIG_PWM_MESON" . #true)
1732 ("CONFIG_USB_DWC3_MESON_G12A" . #true)
1733 ("CONFIG_MMC_MESON_GX" . #true)
1734 ("CONFIG_MMC_MESON_MX_SDIO" . #true)
1735 ("CONFIG_MESON_DDR_PMU" . #true)
1736 ("CONFIG_RTW88_8822CS" . m)
1737 ("CONFIG_PWM_FSL_FTM" . #true)
1738 ("CONFIG_FSL_RCPM" . #true)
1739 ("CONFIG_VIDEO_DW100" . m)
1740 ("CONFIG_IMX_AIPSTZ" . m)
1741 ("CONFIG_IMX_DSP" . m)
1742 ("CONFIG_IMX_REMOTEPROC" . m)
1743 ("CONFIG_IMX_DSP_REMOTEPROC" . m)
1744 ("CONFIG_ARM_ROCKCHIP_CPUFREQ" . m)
1745 ("CONFIG_DRM_PANTHOR" . m)
1746 ("CONFIG_NVMEM_ROCKCHIP_OTP" . #true)
1747 ("CONFIG_PHY_ROCKCHIP_SAMSUNG_HDPTX" . m)
1748 ("CONFIG_PHY_ROCKCHIP_USBDP" . m)
1749 ("CONFIG_ROCKCHIP_REGULATOR_COUPLER" . #true)
1750 ("CONFIG_SPI_ROCKCHIP" . #true)
1751 ("CONFIG_SPI_ROCKCHIP_SFC" . m)
1752 ("CONFIG_ARM_SCMI_CPUFREQ" . m)
1753 ("CONFIG_PHY_ROCKCHIP_SAMSUNG_DCPHY" . #true)
1754 ("CONFIG_VIDEO_ROCKCHIP_VDEC2" . m)
1755 ("CONFIG_ROCKCHIP_DW_HDMI_QP" . #true)
1756 ;; Fixes https://codeberg.org/guix/guix/issues/101
1757 ("CONFIG_CRYPTO_USER_API_HASH" . #true)
1758 ("CONFIG_CRYPTO_USER_API_SKCIPHER" . #true)
1759 ("CONFIG_CRYPTO_USER_API_RNG" . #true)
1760 ("CONFIG_CRYPTO_USER_API_AEAD" . #true)
1761 ("CONFIG_KEY_DH_OPERATIONS" . #true)
1762 ;; nftables support
1763 ("CONFIG_NF_TABLES" . m)
1764 ("CONFIG_NF_TABLES_INET" . #true)
1765 ("CONFIG_NF_TABLES_NETDEV" . #true)
1766 ("CONFIG_NF_TABLES_IPV4" . #true)
1767 ("CONFIG_NF_TABLES_ARP" . #true)
1768 ("CONFIG_NF_TABLES_IPV6" . #true)
1769 ("CONFIG_NF_TABLES_BRIDGE" . m)
1770 ("CONFIG_NFT_NUMGEN" . m)
1771 ("CONFIG_NFT_CT" . m)
1772 ("CONFIG_NFT_FLOW_OFFLOAD" . m)
1773 ("CONFIG_NFT_CONNLIMIT" . m)
1774 ("CONFIG_NFT_LOG" . m)
1775 ("CONFIG_NFT_LIMIT" . m)
1776 ("CONFIG_NFT_MASQ" . m)
1777 ("CONFIG_NFT_REDIR" . m)
1778 ("CONFIG_NFT_NAT" . m)
1779 ("CONFIG_NFT_TUNNEL" . m)
1780 ("CONFIG_NFT_QUEUE" . m)
1781 ("CONFIG_NFT_QUOTA" . m)
1782 ("CONFIG_NFT_REJECT" . m)
1783 ("CONFIG_NFT_REJECT_INET" . m)
1784 ("CONFIG_NFT_COMPAT" . m)
1785 ("CONFIG_NFT_HASH" . m)
1786 ("CONFIG_NFT_FIB" . m)
1787 ("CONFIG_NFT_FIB_INET" . m)
1788 ("CONFIG_NFT_XFRM" . m)
1789 ("CONFIG_NFT_SOCKET" . m)
1790 ("CONFIG_NFT_OSF" . m)
1791 ("CONFIG_NFT_TPROXY" . m)
1792 ("CONFIG_NFT_SYNPROXY" . m)
1793 ("CONFIG_NFT_DUP_NETDEV" . m)
1794 ("CONFIG_NFT_FWD_NETDEV" . m)
1795 ("CONFIG_NFT_FIB_NETDEV" . m)
1796 ("CONFIG_NFT_REJECT_NETDEV" . m)
1797 ("CONFIG_NFT_REJECT_IPV4" . m)
1798 ("CONFIG_NFT_DUP_IPV4" . m)
1799 ("CONFIG_NFT_FIB_IPV4" . m)
1800 ("CONFIG_NFT_COMPAT_ARP" . m)
1801 ("CONFIG_NFT_REJECT_IPV6" . m)
1802 ("CONFIG_NFT_DUP_IPV6" . m)
1803 ("CONFIG_NFT_FIB_IPV6" . m)
1804 ("CONFIG_NFT_BRIDGE_META" . m)
1805 ("CONFIG_NFT_BRIDGE_REJECT" . m)
1806 ;; Provides support for FBCON options
1807 ("CONFIG_FRAMEBUFFER_CONSOLE_ROTATION" . #true)
1808 ("CONFIG_HIDRAW" . #true)
1809 ("CONFIG_FONT_SUPPORT" . #true)
1810 ("CONFIG_FONTS" . #true)
1811 ("CONFIG_FONT_8x8" . #true)
1812 ("CONFIG_FONT_8x16" . #true)
1813 ("CONFIG_FONT_TER10x18" . #true)
1814 ("CONFIG_FONT_TER16x32" . #true)
1815 ;; Provide support for USB tethering
1816 ("CONFIG_USB_NET_CDC_EEM" . m)
1817 ("CONFIG_USB_NET_RNDIS_HOST" . m)
1818 ("CONFIG_USB_WDM" . m)
1819 ("CONFIG_USB_GADGET" . m)
1820 ("CONFIG_USB_ETH" . m)
1821 ("CONFIG_USB_ETH_RNDIS" . m)
1822 ("CONFIG_USB_ETH_EEM" . m)
1823 ("CONFIG_USB_G_NCM" . m)
1824 ;; Provide support for ath9k wireless
1825 ("CONFIG_ATH9K" . m)
1826 ("CONFIG_ATH9K_HTC" . m)
1827 ,@(if (version>=? version "6.18")
1828 '(("CONFIG_ROCKCHIP_DW_MIPI_DSI2" . #true))
1829 ;; 6.12 or older gets this instead:
1830 '(("CONFIG_ROCKCHIP_INNO_HDMI" . #true)
1831 ("CONFIG_ROCKCHIP_LVDS" . #true)
1832 ("CONFIG_ROCKCHIP_DW_MIPI_DSI" . #true)))))
1833
1834(define-public linux-libre-arm64-mnt-reform-7.0
1835 ;; Kernel for use on the MNT/Reform systems
1836 ;; https://mntre.com/reform.html
1837 (let ((base (make-linux-libre* linux-libre-7.0-version
1838 linux-libre-7.0-gnu-revision
1839 linux-libre-7.0-source
1840 '("aarch64-linux")
1841 #:extra-version "arm64-mnt-reform"
1842 #:extra-options
1843 ;; https://source.mnt.re/reform/reform-debian-packages/-/blob/main/linux/config
1844 (append (mnt-reform-kernel-options
1845 linux-libre-7.0-version)
1846 (default-extra-linux-options
1847 linux-libre-7.0-version)))))
1848 (package
1849 (inherit base)
1850 (inputs (list reform-debian-packages-for-7.0))
1851 (synopsis (string-append (package-synopsis base)
1852 " for MNT/Reform systems"))
1853 (description (string-append (package-description base)
1854 " Configuration options and patches have been applied for use with MNT/Reform systems."))
1855 (arguments
1856 (substitute-keyword-arguments (package-arguments base)
1857 ((#:phases phases)
1858 #~(modify-phases #$phases
1859 (add-after 'unpack 'apply-reform-patches
1860 (lambda* (#:key inputs #:allow-other-keys)
1861 (for-each (lambda (patch)
1862 (invoke "patch" "-p1" "-i"
1863 (search-input-file inputs
1864 (string-append
1865 "patches7.0/" patch))))
1866 (list
1867 "imx8mp-mnt-pocket-reform/2ghz/0001-imx8mp-2ghz-clk.patch"
1868 "imx8mp-mnt-pocket-reform/2ghz/0002-imx8mp-2ghz-opp.patch"
1869 "imx8mp-mnt-pocket-reform/mmc-sdio/0001-sdhci-add-no-sd-uhs-sdr104-devicetree-property.patch"
1870 "imx8mp-mnt-pocket-reform/mmc-sdio/0002-During-the-card-init-the-host-side-sometimes-may-nee.patch"
1871 "imx8mp-mnt-pocket-reform/mmc-sdio/0003-USDHC-IP-has-one-limitation-the-tuning-circuit-can-t.patch"
1872 "imx8mp-mnt-pocket-reform/pocket-panel/0001-v5-add-multi-display-panel-driver.patch"
1873 "imx8mp-mnt-pocket-reform/pocket-panel/0002-pocket-panel-fix-sleep-add-orientation.patch"
1874 "imx8mp-mnt-reform2/0001-sn65dsi86-use-hs-clock-of-samsung-dsim-host-directly.patch"
1875 "imx8mp-mnt-reform2/0002-lcdif-dont-exceed-desired-pixel-clock.patch"
1876 "imx8mq-mnt-reform2/0001-imx8mq-mnt-reform2.dts-multiple-fixes-for-display-wi.patch"
1877 "imx8mq-mnt-reform2/0001-nwl-dsi-fixup-mode-only-for-LCDIF-input-not-DCSS.patch"
1878 "imx8mq-mnt-reform2/0002-Revert-drm-bridge-nwl-dsi-Use-vsync-hsync-polarity-f.patch"
1879 "imx8mq-mnt-reform2/0003-lcdif-fix-pcie-interference.patch"
1880 "imx8mq-mnt-reform2/0004-mnt4002-imx-gpcv2-wake-smccc.patch.patch"
1881 "imx8mq-mnt-reform2/0005-pci-imx6-add-support-for-internal-refclk-imx8mq.patch"
1882 "imx8mq-mnt-reform2/0006-imx8mq-import-HDMI-driver-and-make-DCSS-compatible-w.patch"
1883 "ls1028a-mnt-reform2/0000-dtsi-add-hdptx.patch"
1884 "meson-g12b-bananapi-cm4-mnt-pocket-reform/0001-a311d-viu-fifo-lines-config.patch"
1885 "meson-g12b-bananapi-cm4-mnt-pocket-reform/0002-a311d-viu-fifo-lines-config-header.patch"
1886 "meson-g12b-bananapi-cm4-mnt-pocket-reform/0003-tlv320aic31xx-add-1228800hz-support.patch"
1887 "meson-g12b-bananapi-cm4-mnt-reform2/0001-Revert-drm-bridge-synopsys-dw-mipi-dsi-enable-EoTp-b.patch"
1888 "meson-g12b-bananapi-cm4-mnt-reform2/0001-meson-g12b-bananapi-cm4-mnt-reform2.dts-fix-audio-an.patch"
1889 "meson-g12b-bananapi-cm4-mnt-reform2/0011-dw-mipi-dsi-phy-stop-wait-time.patch"
1890 "meson-g12b-bananapi-cm4-mnt-reform2/0012-innolux-n125hce-gn1-timing-tweaks.patch"
1891 "meson-g12b-bananapi-cm4-mnt-reform2/0013-meson-viu-hold-fifo-lines.patch"
1892 "meson-g12b-bananapi-cm4-mnt-reform2/0014-meson-venc-sync.patch.patch"
1893 "meson-g12b-bananapi-cm4-mnt-reform2/0015-meson-dw-mipi-dsi-sync-invert.patch"
1894 "meson-g12b-bananapi-cm4-mnt-reform2/0016-sn65dsi86-burst-mode-support.patch"
1895 "meson-g12b-bananapi-cm4-mnt-reform2/0018-sn65dsi86-never-turn-off.patch"
1896 "meson-g12b-bananapi-cm4-mnt-reform2/0020-LOCAL-ALSA-Assign-internal-PCM-chmap-ELD-IEC958-kctl.patch"
1897 "meson-g12b-bananapi-cm4-mnt-reform2/0021-HACK-of-partial-revert-of-fdt.c-changes.patch"
1898 "meson-g12b-bananapi-cm4-mnt-reform2/0022-add-bt-and-eth-resets.patch"
1899 "meson-g12b-bananapi-cm4-mnt-reform2/0023-sdio-pullups.patch"
1900 "meson-g12b-bananapi-cm4-mnt-reform2/0024-sdio-improve-wifi-speed.patch"
1901 "meson-g12b-bananapi-cm4-mnt-reform2/0030-WORKAROUND-meson-plane-disable-afbc-32x8.patch"
1902 "rk3588-mnt-reform2/0024-math.h-add-DIV_ROUND_UP_NO_OVERFLOW.patch"
1903 "rk3588-mnt-reform2/0025-clk-divider-Fix-divisor-masking-on-64-bit-platforms.patch"
1904 "rk3588-mnt-reform2/0026-clk-composite-replace-open-coded-abs_diff.patch"
1905 "rk3588-mnt-reform2/0029-PCI-dw-rockchip-Restore-vpcie3v3-regulator-handle.patch"
1906 "rk3588-mnt-reform2/0030-mfd-rk8xx-Fix-shutdown-handler.patch"
1907 "rk3588-mnt-reform2/0031-dt-bindings-display-vop2-Add-VP-clock-resets.patch"
1908 "rk3588-mnt-reform2/0032-drm-rockchip-vop2-Add-clock-resets-support.patch"
1909 "rk3588-mnt-reform2/0033-arm64-dts-rockchip-Add-VOP-clock-resets-for-rk3588s.patch"
1910 "rk3588-mnt-reform2/0035-drm-rockchip-vop2-Add-core-reset-support.patch"
1911 "rk3588-mnt-reform2/0062-PCI-dw-rockchip-Move-devm_phy_get-out-of-phy_init.patch"
1912 "rk3588-mnt-reform2/0063-PCI-dw-rockchip-Add-helper-function-for-enhanced-LTS.patch"
1913 "rk3588-mnt-reform2/0064-PCI-dw-rockchip-Add-helper-function-for-controller-m.patch"
1914 "rk3588-mnt-reform2/0065-PCI-dw-rockchip-Add-helper-function-for-DDL-indicato.patch"
1915 "rk3588-mnt-reform2/0066-PCI-dw-rockchip-Add-pme_turn_off-support.patch"
1916 "rk3588-mnt-reform2/0067-PCI-dw-rockchip-Add-system-PM-support.patch"
1917 "rk3588-mnt-reform2/0078-PCI-dw-rockchip-Fix-LTSSM-set-functions.patch"
1918 "rk3588-mnt-reform2/0079-RFC-PCI-dw-rockchip-port-some-suspend-code-from-vend.patch"
1919 "rk3588-mnt-reform2/0089-DEBUG-phy-rockchip-samsung-hdptx-Add-verbose-logging.patch"
1920 "rk3588-mnt-reform2/0092-drm-rockchip-dw_hdmi_qp-Do-not-send-HPD-events-for-a.patch"
1921 "rk3588-mnt-reform2/0093-drm-Add-CRTC-background-color-property.patch"
1922 "rk3588-mnt-reform2/0094-drm-rockchip-vop2-Support-setting-custom-background-.patch"
1923 "rk3588-mnt-reform2/0095-drm-bridge-Add-detect_ctx-hook-and-drm_bridge_detect.patch"
1924 "rk3588-mnt-reform2/0096-drm-bridge-connector-Switch-to-using-detect_ctx-hook.patch"
1925 "rk3588-mnt-reform2/0097-drm-bridge-dw-hdmi-qp-Add-high-TMDS-clock-ratio-and-.patch"
1926 "rk3588-mnt-reform2/0098-WIP-YUV420-drm-rockchip-vop2-Add-YUV420-output-forma.patch"
1927 "rk3588-mnt-reform2/0099-WIP-YUV420-drm-rockchip-dw_hdmi_qp-Add-YUV420-output.patch"
1928 "rk3588-mnt-reform2/0103-WIP-FRL-arm64-dts-rockchip-Assign-ACLK_VOP-to-750-MH.patch"
1929 "rk3588-mnt-reform2/0104-WIP-FRL-drm-connector-hdmi-Handle-FRL-in-hdmi_clock_.patch"
1930 "rk3588-mnt-reform2/0105-WIP-FRL-drm-bridge-dw-hdmi-qp-Add-HDMI-2.1-FRL-suppo.patch"
1931 "rk3588-mnt-reform2/0106-WIP-FRL-drm-rockchip-dw_hdmi_qp-Add-HDMI-2.1-FRL-sup.patch"
1932 "rk3588-mnt-reform2/0107-WIP-FRL-drm-rockchip-vop2-Add-HDMI-2.1-FRL-support.patch"
1933 "rk3588-mnt-reform2/0108-dt-bindings-phy-rockchip-usbdp-add-improved-ports-sc.patch"
1934 "rk3588-mnt-reform2/2001-drm-bridge-dw-hdmi-qp-Return-0-in-audio-prepare-when.patch"
1935 "rk3588-mnt-reform2/2003-drm-bridge-synopsys-Do-not-warn-about-audio-params-c.patch"
1936 "rk3588-mnt-reform2/5200-drm-rockchip-Set-dma-mask-to-64-bit.patch"))))
1937 (add-after 'apply-reform-patches 'copy-reform-dts-files
1938 (lambda* (#:key inputs #:allow-other-keys)
1939 (for-each (lambda (dts)
1940 (copy-file (search-input-file inputs
1941 (string-append
1942 "/dts/" dts))
1943 (string-append "arch/arm64/boot/dts/"
1944 dts)))
1945 (list
1946 "amlogic/meson-g12b-bananapi-cm4-mnt-pocket-reform.dts"
1947 "freescale/fsl-ls1028a-mnt-reform2.dts"
1948 "freescale/imx8mp-mnt-pocket-reform.dts"
1949 "freescale/imx8mp-mnt-reform2.dts"
1950 "freescale/imx8mq-mnt-reform2-hdmi.dts"
1951 "rockchip/rk3588-mnt-desktop-reform.dts"
1952 "rockchip/rk3588-mnt-pocket-reform.dts"
1953 "rockchip/rk3588-mnt-reform-next.dts"
1954 "rockchip/rk3588-mnt-reform2.dts"
1955 "rockchip/rk3588-mnt-reform2-dsi.dts"
1956 ))))
1957 (add-after 'apply-reform-patches 'adjust-makefiles-with-new-dtb
1958 (lambda _
1959 (substitute* "arch/arm64/boot/dts/amlogic/Makefile"
1960 (("meson-g12b-bananapi-cm4-mnt-reform2.dtb")
1961 "meson-g12b-bananapi-cm4-mnt-reform2.dtb
1962dtb-$(CONFIG_ARCH_MESON) += meson-g12b-bananapi-cm4-mnt-pocket-reform.dtb"))
1963 (substitute* "arch/arm64/boot/dts/freescale/Makefile"
1964 (("fsl-ls1028a-rdb.dtb")
1965 "fsl-ls1028a-rdb.dtb
1966dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-ls1028a-mnt-reform2.dtb"))
1967 (substitute* "arch/arm64/boot/dts/freescale/Makefile"
1968 (("imx8mq-mnt-reform2.dtb")
1969 "imx8mq-mnt-reform2.dtb
1970dtb-$(CONFIG_ARCH_MXC) += imx8mp-mnt-reform2.dtb
1971dtb-$(CONFIG_ARCH_MXC) += imx8mp-mnt-pocket-reform.dtb
1972dtb-$(CONFIG_ARCH_MXC) += imx8mq-mnt-reform2-hdmi.dtb"))
1973 (substitute* "arch/arm64/boot/dts/rockchip/Makefile"
1974 (("rk3588-mnt-reform2.dtb")
1975 "rk3588-mnt-reform2.dtb
1976dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-mnt-desktop-reform.dtb
1977dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-mnt-reform2-dsi.dtb
1978dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-mnt-reform-next.dtb
1979dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-mnt-pocket-reform.dtb")))))))))))
1980
1981(define-public linux-libre-arm64-mnt-reform linux-libre-arm64-mnt-reform-7.0)
1982
1983(define-public linux-libre-arm64-mnt-reform-6.19
1984 ;; Kernel for use on the MNT/Reform systems
1985 ;; https://mntre.com/reform.html
1986 (let ((base (make-linux-libre* linux-libre-6.19-version
1987 linux-libre-6.19-gnu-revision
1988 linux-libre-6.19-source
1989 '("aarch64-linux")
1990 #:extra-version "arm64-mnt-reform"
1991 #:extra-options
1992 ;; https://source.mnt.re/reform/reform-debian-packages/-/blob/main/linux/config
1993 (append (mnt-reform-kernel-options
1994 linux-libre-6.19-version)
1995 (default-extra-linux-options
1996 linux-libre-6.19-version)))))
1997 (package
1998 (inherit base)
1999 (inputs (list reform-debian-packages-for-6.19))
2000 (synopsis (string-append (package-synopsis base)
2001 " for MNT/Reform systems"))
2002 (description (string-append (package-description base)
2003 " Configuration options and patches have been applied for use with MNT/Reform systems."))
2004 (arguments
2005 (substitute-keyword-arguments (package-arguments base)
2006 ((#:phases phases)
2007 #~(modify-phases #$phases
2008 (add-after 'unpack 'apply-reform-patches
2009 (lambda* (#:key inputs #:allow-other-keys)
2010 (for-each (lambda (patch)
2011 (invoke "patch" "-p1" "-i"
2012 (search-input-file inputs
2013 (string-append
2014 "patches6.19/" patch))))
2015 (list
2016 "imx8mp-mnt-pocket-reform/2ghz/0001-imx8mp-2ghz-clk.patch"
2017 "imx8mp-mnt-pocket-reform/2ghz/0002-imx8mp-2ghz-opp.patch"
2018 "imx8mp-mnt-pocket-reform/mmc-sdio/0001-sdhci-add-no-sd-uhs-sdr104-devicetree-property.patch"
2019 "imx8mp-mnt-pocket-reform/mmc-sdio/0002-During-the-card-init-the-host-side-sometimes-may-nee.patch"
2020 "imx8mp-mnt-pocket-reform/mmc-sdio/0003-USDHC-IP-has-one-limitation-the-tuning-circuit-can-t.patch"
2021 "imx8mp-mnt-pocket-reform/pocket-panel/0001-v5-add-multi-display-panel-driver.patch"
2022 "imx8mp-mnt-pocket-reform/pocket-panel/0002-pocket-panel-fix-sleep-add-orientation.patch"
2023 "imx8mp-mnt-reform2/0001-sn65dsi86-use-hs-clock-of-samsung-dsim-host-directly.patch"
2024 "imx8mp-mnt-reform2/0002-lcdif-dont-exceed-desired-pixel-clock.patch"
2025 "imx8mq-mnt-reform2/0001-imx8mq-mnt-reform2.dts-multiple-fixes-for-display-wi.patch"
2026 "imx8mq-mnt-reform2/0001-nwl-dsi-fixup-mode-only-for-LCDIF-input-not-DCSS.patch"
2027 "imx8mq-mnt-reform2/0002-Revert-drm-bridge-nwl-dsi-Use-vsync-hsync-polarity-f.patch"
2028 "imx8mq-mnt-reform2/0003-lcdif-fix-pcie-interference.patch"
2029 "imx8mq-mnt-reform2/0004-mnt4002-imx-gpcv2-wake-smccc.patch.patch"
2030 "imx8mq-mnt-reform2/0005-pci-imx6-add-support-for-internal-refclk-imx8mq.patch"
2031 "imx8mq-mnt-reform2/0006-imx8mq-import-HDMI-driver-and-make-DCSS-compatible-w.patch"
2032 "ls1028a-mnt-reform2/0000-dtsi-add-hdptx.patch"
2033 "meson-g12b-bananapi-cm4-mnt-pocket-reform/0001-a311d-viu-fifo-lines-config.patch"
2034 "meson-g12b-bananapi-cm4-mnt-pocket-reform/0002-a311d-viu-fifo-lines-config-header.patch"
2035 "meson-g12b-bananapi-cm4-mnt-pocket-reform/0003-tlv320aic31xx-add-1228800hz-support.patch"
2036 "meson-g12b-bananapi-cm4-mnt-reform2/0001-Revert-drm-bridge-synopsys-dw-mipi-dsi-enable-EoTp-b.patch"
2037 "meson-g12b-bananapi-cm4-mnt-reform2/0001-meson-g12b-bananapi-cm4-mnt-reform2.dts-fix-audio-an.patch"
2038 "meson-g12b-bananapi-cm4-mnt-reform2/0011-dw-mipi-dsi-phy-stop-wait-time.patch"
2039 "meson-g12b-bananapi-cm4-mnt-reform2/0012-innolux-n125hce-gn1-timing-tweaks.patch"
2040 "meson-g12b-bananapi-cm4-mnt-reform2/0013-meson-viu-hold-fifo-lines.patch"
2041 "meson-g12b-bananapi-cm4-mnt-reform2/0014-meson-venc-sync.patch.patch"
2042 "meson-g12b-bananapi-cm4-mnt-reform2/0015-meson-dw-mipi-dsi-sync-invert.patch"
2043 "meson-g12b-bananapi-cm4-mnt-reform2/0016-sn65dsi86-burst-mode-support.patch"
2044 "meson-g12b-bananapi-cm4-mnt-reform2/0018-sn65dsi86-never-turn-off.patch"
2045 "meson-g12b-bananapi-cm4-mnt-reform2/0020-LOCAL-ALSA-Assign-internal-PCM-chmap-ELD-IEC958-kctl.patch"
2046 "meson-g12b-bananapi-cm4-mnt-reform2/0021-HACK-of-partial-revert-of-fdt.c-changes.patch"
2047 "meson-g12b-bananapi-cm4-mnt-reform2/0022-add-bt-and-eth-resets.patch"
2048 "meson-g12b-bananapi-cm4-mnt-reform2/0023-sdio-pullups.patch"
2049 "meson-g12b-bananapi-cm4-mnt-reform2/0024-sdio-improve-wifi-speed.patch"
2050 "meson-g12b-bananapi-cm4-mnt-reform2/0030-WORKAROUND-meson-plane-disable-afbc-32x8.patch"
2051 "rk3588-mnt-reform2/0001-FROM-UPSTREAM-drm-bridge-dw-hdmi-qp-Add-support-for-.patch"
2052 "rk3588-mnt-reform2/0024-math.h-add-DIV_ROUND_UP_NO_OVERFLOW.patch"
2053 "rk3588-mnt-reform2/0025-clk-divider-Fix-divisor-masking-on-64-bit-platforms.patch"
2054 "rk3588-mnt-reform2/0026-clk-composite-replace-open-coded-abs_diff.patch"
2055 "rk3588-mnt-reform2/0029-Revert-PCI-dw-rockchip-Simplify-regulator-setup-with.patch"
2056 "rk3588-mnt-reform2/0030-mfd-rk8xx-Fix-shutdown-handler.patch"
2057 "rk3588-mnt-reform2/0031-dt-bindings-display-vop2-Add-VP-clock-resets.patch"
2058 "rk3588-mnt-reform2/0032-drm-rockchip-vop2-Add-clock-resets-support.patch"
2059 "rk3588-mnt-reform2/0033-arm64-dts-rockchip-Add-VOP-clock-resets-for-rk3588s.patch"
2060 "rk3588-mnt-reform2/0035-drm-rockchip-vop2-Add-core-reset-support.patch"
2061 "rk3588-mnt-reform2/0062-PCI-dw-rockchip-Move-devm_phy_get-out-of-phy_init.patch"
2062 "rk3588-mnt-reform2/0063-PCI-dw-rockchip-Add-helper-function-for-enhanced-LTS.patch"
2063 "rk3588-mnt-reform2/0064-PCI-dw-rockchip-Add-helper-function-for-controller-m.patch"
2064 "rk3588-mnt-reform2/0065-PCI-dw-rockchip-Add-helper-function-for-DDL-indicato.patch"
2065 "rk3588-mnt-reform2/0066-PCI-dw-rockchip-Add-pme_turn_off-support.patch"
2066 "rk3588-mnt-reform2/0067-PCI-dw-rockchip-Add-system-PM-support.patch"
2067 "rk3588-mnt-reform2/0074-MERGED-phy-hdmi-Add-HDMI-2.1-FRL-configuration-optio.patch"
2068 "rk3588-mnt-reform2/0075-PCI-host-common-Add-an-API-to-check-for-any-device-u.patch"
2069 "rk3588-mnt-reform2/0076-PCI-qcom-Check-for-the-presence-of-a-device-instead-.patch"
2070 "rk3588-mnt-reform2/0077-PCI-dwc-Check-for-the-device-presence-during-suspend.patch"
2071 "rk3588-mnt-reform2/0078-PCI-dw-rockchip-Fix-LTSSM-set-functions.patch"
2072 "rk3588-mnt-reform2/0079-MERGED-phy-rockchip-samsung-hdptx-Use-usleep_range-i.patch"
2073 "rk3588-mnt-reform2/0079-WIP-PCI-dw-rockchip-port-some-suspend-code-from-vend.patch"
2074 "rk3588-mnt-reform2/0080-MERGED-phy-rockchip-samsung-hdptx-Fix-coding-style-a.patch"
2075 "rk3588-mnt-reform2/0081-MERGED-phy-rockchip-samsung-hdptx-Consistently-use-r.patch"
2076 "rk3588-mnt-reform2/0082-MERGED-phy-rockchip-samsung-hdptx-Enable-lane-output.patch"
2077 "rk3588-mnt-reform2/0083-MERGED-phy-rockchip-samsung-hdptx-Cleanup-_cmn_init_.patch"
2078 "rk3588-mnt-reform2/0084-MERGED-phy-rockchip-samsung-hdptx-Compute-clk-rate-f.patch"
2079 "rk3588-mnt-reform2/0085-MERGED-phy-rockchip-samsung-hdptx-Drop-hw_rate-drive.patch"
2080 "rk3588-mnt-reform2/0086-MERGED-phy-rockchip-samsung-hdptx-Switch-to-driver-s.patch"
2081 "rk3588-mnt-reform2/0087-MERGED-phy-rockchip-samsung-hdptx-Extend-rk_hdptx_ph.patch"
2082 "rk3588-mnt-reform2/0088-MERGED-phy-rockchip-samsung-hdptx-Add-HDMI-2.1-FRL-s.patch"
2083 "rk3588-mnt-reform2/0089-DEBUG-phy-rockchip-samsung-hdptx-Add-verbose-logging.patch"
2084 "rk3588-mnt-reform2/0092-drm-rockchip-dw_hdmi_qp-Do-not-send-HPD-events-for-a.patch"
2085 "rk3588-mnt-reform2/0093-drm-Add-CRTC-background-color-property.patch"
2086 "rk3588-mnt-reform2/0094-drm-rockchip-vop2-Support-setting-custom-background-.patch"
2087 "rk3588-mnt-reform2/0095-drm-bridge-Add-detect_ctx-hook-and-drm_bridge_detect.patch"
2088 "rk3588-mnt-reform2/0096-drm-bridge-connector-Switch-to-using-detect_ctx-hook.patch"
2089 "rk3588-mnt-reform2/0097-drm-bridge-dw-hdmi-qp-Add-high-TMDS-clock-ratio-and-.patch"
2090 "rk3588-mnt-reform2/0098-WIP-YUV420-drm-rockchip-vop2-Add-YUV420-output-forma.patch"
2091 "rk3588-mnt-reform2/0099-WIP-YUV420-drm-rockchip-dw_hdmi_qp-Add-YUV420-output.patch"
2092 "rk3588-mnt-reform2/0103-WIP-FRL-arm64-dts-rockchip-Assign-ACLK_VOP-to-750-MH.patch"
2093 "rk3588-mnt-reform2/0104-WIP-FRL-drm-connector-hdmi-Handle-FRL-in-hdmi_clock_.patch"
2094 "rk3588-mnt-reform2/0105-WIP-FRL-drm-bridge-dw-hdmi-qp-Add-HDMI-2.1-FRL-suppo.patch"
2095 "rk3588-mnt-reform2/0106-WIP-FRL-drm-rockchip-dw_hdmi_qp-Add-HDMI-2.1-FRL-sup.patch"
2096 "rk3588-mnt-reform2/0107-WIP-FRL-drm-rockchip-vop2-Add-HDMI-2.1-FRL-support.patch"
2097 "rk3588-mnt-reform2/0108-dt-bindings-phy-rockchip-usbdp-add-improved-ports-sc.patch"
2098 "rk3588-mnt-reform2/2001-drm-bridge-dw-hdmi-qp-Return-0-in-audio-prepare-when.patch"
2099 "rk3588-mnt-reform2/2003-drm-bridge-synopsys-Do-not-warn-about-audio-params-c.patch"
2100 "rk3588-mnt-reform2/5200-drm-rockchip-Set-dma-mask-to-64-bit.patch"))))
2101 (add-after 'apply-reform-patches 'copy-reform-dts-files
2102 (lambda* (#:key inputs #:allow-other-keys)
2103 (for-each (lambda (dts)
2104 (copy-file (search-input-file inputs
2105 (string-append
2106 "/dts/" dts))
2107 (string-append "arch/arm64/boot/dts/"
2108 dts)))
2109 (list
2110 "amlogic/meson-g12b-bananapi-cm4-mnt-pocket-reform.dts"
2111 "freescale/fsl-ls1028a-mnt-reform2.dts"
2112 "freescale/imx8mp-mnt-pocket-reform.dts"
2113 "freescale/imx8mp-mnt-reform2.dts"
2114 "freescale/imx8mq-mnt-reform2-hdmi.dts"
2115 "rockchip/rk3588-mnt-desktop-reform.dts"
2116 "rockchip/rk3588-mnt-pocket-reform.dts"
2117 "rockchip/rk3588-mnt-reform-next.dts"
2118 "rockchip/rk3588-mnt-reform2.dts"
2119 "rockchip/rk3588-mnt-reform2-dsi.dts"
2120 ))))
2121 (add-after 'apply-reform-patches 'adjust-makefiles-with-new-dtb
2122 (lambda _
2123 (substitute* "arch/arm64/boot/dts/amlogic/Makefile"
2124 (("meson-g12b-bananapi-cm4-mnt-reform2.dtb")
2125 "meson-g12b-bananapi-cm4-mnt-reform2.dtb
2126dtb-$(CONFIG_ARCH_MESON) += meson-g12b-bananapi-cm4-mnt-pocket-reform.dtb"))
2127 (substitute* "arch/arm64/boot/dts/freescale/Makefile"
2128 (("fsl-ls1028a-rdb.dtb")
2129 "fsl-ls1028a-rdb.dtb
2130dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-ls1028a-mnt-reform2.dtb"))
2131 (substitute* "arch/arm64/boot/dts/freescale/Makefile"
2132 (("imx8mq-mnt-reform2.dtb")
2133 "imx8mq-mnt-reform2.dtb
2134dtb-$(CONFIG_ARCH_MXC) += imx8mp-mnt-reform2.dtb
2135dtb-$(CONFIG_ARCH_MXC) += imx8mp-mnt-pocket-reform.dtb
2136dtb-$(CONFIG_ARCH_MXC) += imx8mq-mnt-reform2-hdmi.dtb"))
2137 (substitute* "arch/arm64/boot/dts/rockchip/Makefile"
2138 (("rk3588-mnt-reform2.dtb")
2139 "rk3588-mnt-reform2.dtb
2140dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-mnt-desktop-reform.dtb
2141dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-mnt-reform2-dsi.dtb
2142dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-mnt-reform-next.dtb
2143dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-mnt-pocket-reform.dtb")))))))))))
2144
2145(define-public linux-libre-arm64-mnt-reform-6.18
2146 ;; Kernel for use on the MNT/Reform systems
2147 ;; https://mntre.com/reform.html
2148 (let ((base (make-linux-libre* linux-libre-6.18-version
2149 linux-libre-6.18-gnu-revision
2150 linux-libre-6.18-source
2151 '("aarch64-linux")
2152 #:extra-version "arm64-mnt-reform"
2153 #:extra-options
2154 ;; https://source.mnt.re/reform/reform-debian-packages/-/blob/main/linux/config
2155 (append (mnt-reform-kernel-options
2156 linux-libre-6.18-version)
2157 (default-extra-linux-options
2158 linux-libre-6.18-version)))))
2159 (package
2160 (inherit base)
2161 (inputs (list reform-debian-packages-for-6.18))
2162 (synopsis (string-append (package-synopsis base)
2163 " for MNT/Reform systems"))
2164 (description (string-append (package-description base)
2165 " Configuration options and patches have been applied for use with MNT/Reform systems."))
2166 (arguments
2167 (substitute-keyword-arguments arguments
2168 ((#:phases phases)
2169 #~(modify-phases #$phases
2170 (add-after 'unpack 'apply-reform-patches
2171 (lambda* (#:key inputs #:allow-other-keys)
2172 (for-each (lambda (patch)
2173 (invoke "patch" "-p1" "-i"
2174 (search-input-file inputs
2175 (string-append
2176 "patches6.18/" patch))))
2177 (list
2178 "imx8mp-mnt-pocket-reform/2ghz/0001-imx8mp-2ghz-clk.patch"
2179 "imx8mp-mnt-pocket-reform/2ghz/0002-imx8mp-2ghz-opp.patch"
2180 "imx8mp-mnt-pocket-reform/audio/0000-revert-crashy-audiomix-pm-support.patch"
2181 "imx8mp-mnt-pocket-reform/mmc-sdio/0001-sdhci-add-no-sd-uhs-sdr104-devicetree-property.patch"
2182 "imx8mp-mnt-pocket-reform/mmc-sdio/0002-During-the-card-init-the-host-side-sometimes-may-nee.patch"
2183 "imx8mp-mnt-pocket-reform/mmc-sdio/0003-USDHC-IP-has-one-limitation-the-tuning-circuit-can-t.patch"
2184 "imx8mp-mnt-pocket-reform/pocket-panel/0001-v5-add-multi-display-panel-driver.patch"
2185 "imx8mp-mnt-pocket-reform/pocket-panel/0002-pocket-panel-fix-sleep-add-orientation.patch"
2186 "imx8mp-mnt-reform2/0001-sn65dsi86-use-hs-clock-of-samsung-dsim-host-directly.patch"
2187 "imx8mp-mnt-reform2/0002-lcdif-dont-exceed-desired-pixel-clock.patch"
2188 "imx8mq-mnt-reform2/0001-imx8mq-mnt-reform2.dts-multiple-fixes-for-display-wi.patch"
2189 "imx8mq-mnt-reform2/0001-nwl-dsi-fixup-mode-only-for-LCDIF-input-not-DCSS.patch"
2190 "imx8mq-mnt-reform2/0002-Revert-drm-bridge-nwl-dsi-Use-vsync-hsync-polarity-f.patch"
2191 "imx8mq-mnt-reform2/0003-lcdif-fix-pcie-interference.patch"
2192 "imx8mq-mnt-reform2/0004-mnt4002-imx-gpcv2-wake-smccc.patch.patch"
2193 "imx8mq-mnt-reform2/0005-pci-imx6-add-support-for-internal-refclk-imx8mq.patch"
2194 "imx8mq-mnt-reform2/0006-imx8mq-import-HDMI-driver-and-make-DCSS-compatible-w.patch"
2195 "ls1028a-mnt-reform2/0000-dtsi-add-hdptx.patch"
2196 "meson-g12b-bananapi-cm4-mnt-pocket-reform/0001-a311d-viu-fifo-lines-config.patch"
2197 "meson-g12b-bananapi-cm4-mnt-pocket-reform/0002-a311d-viu-fifo-lines-config-header.patch"
2198 "meson-g12b-bananapi-cm4-mnt-pocket-reform/0003-tlv320aic31xx-add-1228800hz-support.patch"
2199 "meson-g12b-bananapi-cm4-mnt-reform2/0001-meson-g12b-bananapi-cm4-mnt-reform2.dts-fix-audio-an.patch"
2200 "meson-g12b-bananapi-cm4-mnt-reform2/0001-Revert-drm-bridge-synopsys-dw-mipi-dsi-enable-EoTp-b.patch"
2201 "meson-g12b-bananapi-cm4-mnt-reform2/0011-dw-mipi-dsi-phy-stop-wait-time.patch"
2202 "meson-g12b-bananapi-cm4-mnt-reform2/0012-innolux-n125hce-gn1-timing-tweaks.patch"
2203 "meson-g12b-bananapi-cm4-mnt-reform2/0013-meson-viu-hold-fifo-lines.patch"
2204 "meson-g12b-bananapi-cm4-mnt-reform2/0014-meson-venc-sync.patch.patch"
2205 "meson-g12b-bananapi-cm4-mnt-reform2/0015-meson-dw-mipi-dsi-sync-invert.patch"
2206 "meson-g12b-bananapi-cm4-mnt-reform2/0016-sn65dsi86-burst-mode-support.patch"
2207 "meson-g12b-bananapi-cm4-mnt-reform2/0018-sn65dsi86-never-turn-off.patch"
2208 "meson-g12b-bananapi-cm4-mnt-reform2/0020-LOCAL-ALSA-Assign-internal-PCM-chmap-ELD-IEC958-kctl.patch"
2209 "meson-g12b-bananapi-cm4-mnt-reform2/0021-HACK-of-partial-revert-of-fdt.c-changes.patch"
2210 "meson-g12b-bananapi-cm4-mnt-reform2/0022-add-bt-and-eth-resets.patch"
2211 "meson-g12b-bananapi-cm4-mnt-reform2/0023-sdio-pullups.patch"
2212 "meson-g12b-bananapi-cm4-mnt-reform2/0024-sdio-improve-wifi-speed.patch"
2213 "meson-g12b-bananapi-cm4-mnt-reform2/0030-WORKAROUND-meson-plane-disable-afbc-32x8.patch"
2214 "rk3588-mnt-reform2/0001-MERGED-drm-bridge-Pass-down-connector-to-drm-bridge-.patch"
2215 "rk3588-mnt-reform2/0024-math.h-add-DIV_ROUND_UP_NO_OVERFLOW.patch"
2216 "rk3588-mnt-reform2/0025-clk-divider-Fix-divisor-masking-on-64-bit-platforms.patch"
2217 "rk3588-mnt-reform2/0026-clk-composite-replace-open-coded-abs_diff.patch"
2218 "rk3588-mnt-reform2/0030-mfd-rk8xx-Fix-shutdown-handler.patch"
2219 "rk3588-mnt-reform2/0031-dt-bindings-display-vop2-Add-VP-clock-resets.patch"
2220 "rk3588-mnt-reform2/0032-drm-rockchip-vop2-Add-clock-resets-support.patch"
2221 "rk3588-mnt-reform2/0033-arm64-dts-rockchip-Add-VOP-clock-resets-for-rk3588s.patch"
2222 "rk3588-mnt-reform2/0035-drm-rockchip-vop2-Add-core-reset-support.patch"
2223 "rk3588-mnt-reform2/0046-arm64-defconfig-Enable-Rockchip-RK3588-DisplayPort-C.patch"
2224 "rk3588-mnt-reform2/0055-phy-rockchip-usbdp-move-orientation-handling-further.patch"
2225 "rk3588-mnt-reform2/0056-phy-rockchip-usbdp-reset-USB3-and-reinit-on-orientat.patch"
2226 ;; "rk3588-mnt-reform2/0060-PCI-dw-rockchip-Rename-rockchip_pcie_get_ltssm-funct.patch"
2227 ;; "rk3588-mnt-reform2/0061-PCI-dw-rockchip-Support-get_ltssm-operation.patch"
2228 ;; "rk3588-mnt-reform2/0062-PCI-dw-rockchip-Move-devm_phy_get-out-of-phy_init.patch"
2229 ;; "rk3588-mnt-reform2/0063-PCI-dw-rockchip-Add-helper-function-for-enhanced-LTS.patch"
2230 ;; "rk3588-mnt-reform2/0064-PCI-dw-rockchip-Add-helper-function-for-controller-m.patch"
2231 ;; "rk3588-mnt-reform2/0065-PCI-dw-rockchip-Add-helper-function-for-DDL-indicato.patch"
2232 ;; "rk3588-mnt-reform2/0066-PCI-dw-rockchip-Add-pme_turn_off-support.patch"
2233 ;; "rk3588-mnt-reform2/0067-PCI-dw-rockchip-Add-system-PM-support.patch"
2234 "rk3588-mnt-reform2/0068-drm-bridge-dw-hdmi-qp-Add-CEC-support.patch"
2235 "rk3588-mnt-reform2/0069-drm-bridge-dw-hdmi-qp-Fixup-timer-base-setup.patch"
2236 "rk3588-mnt-reform2/0070-drm-rockchip-dw_hdmi_qp-Improve-error-handling-with-.patch"
2237 "rk3588-mnt-reform2/0071-drm-rockchip-dw_hdmi_qp-Provide-CEC-IRQ-in-dw_hdmi_q.patch"
2238 "rk3588-mnt-reform2/0072-drm-rockchip-dw_hdmi_qp-Provide-ref-clock-rate-in-dw.patch"
2239 "rk3588-mnt-reform2/0073-arm64-defconfig-Enable-DW-HDMI-QP-CEC-support.patch"
2240 "rk3588-mnt-reform2/0075-phy-hdmi-Add-HDMI-2.1-FRL-configuration-options.patch"
2241 "rk3588-mnt-reform2/0079-phy-rockchip-samsung-hdptx-Use-usleep_range-instead-.patch"
2242 "rk3588-mnt-reform2/0080-phy-rockchip-samsung-hdptx-Fix-coding-style-alignmen.patch"
2243 "rk3588-mnt-reform2/0081-phy-rockchip-samsung-hdptx-Consistently-use-rk_-hdpt.patch"
2244 "rk3588-mnt-reform2/0082-phy-rockchip-samsung-hdptx-Enable-lane-output-in-com.patch"
2245 "rk3588-mnt-reform2/0083-phy-rockchip-samsung-hdptx-Cleanup-_cmn_init_seq-lis.patch"
2246 "rk3588-mnt-reform2/0084-phy-rockchip-samsung-hdptx-Compute-clk-rate-from-PLL.patch"
2247 "rk3588-mnt-reform2/0085-phy-rockchip-samsung-hdptx-Drop-hw_rate-driver-data.patch"
2248 "rk3588-mnt-reform2/0086-phy-rockchip-samsung-hdptx-Switch-to-driver-specific.patch"
2249 "rk3588-mnt-reform2/0087-phy-rockchip-samsung-hdptx-Extend-rk_hdptx_phy_verif.patch"
2250 "rk3588-mnt-reform2/0088-phy-rockchip-samsung-hdptx-Add-HDMI-2.1-FRL-support.patch"
2251 "rk3588-mnt-reform2/0089-drm-rockchip-vop2-Check-bpc-before-switching-DCLK-so.patch"
2252 "rk3588-mnt-reform2/0090-drm-bridge-dw-hdmi-qp-Handle-platform-supported-form.patch"
2253 "rk3588-mnt-reform2/0091-drm-rockchip-dw_hdmi_qp-Switch-to-phy_configure.patch"
2254 "rk3588-mnt-reform2/0092-drm-rockchip-dw_hdmi_qp-Use-bit-macros-for-RK3576-re.patch"
2255 "rk3588-mnt-reform2/0093-drm-rockchip-dw_hdmi_qp-Add-high-color-depth-support.patch"
2256 "rk3588-mnt-reform2/0094-DEBUG-phy-rockchip-samsung-hdptx-Add-verbose-logging.patch"
2257 "rk3588-mnt-reform2/0095-WIP-SCRAMB-drm-bridge-Add-detect_ctx-hook.patch"
2258 "rk3588-mnt-reform2/0096-WIP-SCRAMB-drm-bridge-connector-Switch-from-detect-t.patch"
2259 "rk3588-mnt-reform2/0097-WIP-SCRAMB-drm-bridge-dw-hdmi-qp-Add-high-TMDS-clock.patch"
2260 "rk3588-mnt-reform2/0098-WIP-YUV420-drm-rockchip-vop2-Add-YUV420-output-forma.patch"
2261 "rk3588-mnt-reform2/0099-WIP-YUV420-drm-rockchip-dw_hdmi_qp-Add-YUV420-output.patch"
2262 "rk3588-mnt-reform2/0100-WIP-FRL-dt-bindings-display-rockchip-Add-tmds-enable.patch"
2263 "rk3588-mnt-reform2/0101-WIP-FRL-drm-rockchip-dw_hdmi_qp-Fixup-usage-of-enabl.patch"
2264 "rk3588-mnt-reform2/0103-WIP-FRL-arm64-dts-rockchip-Assign-ACLK_VOP-to-750-MH.patch"
2265 "rk3588-mnt-reform2/0104-WIP-FRL-drm-connector-hdmi-Handle-FRL-in-hdmi_clock_.patch"
2266 "rk3588-mnt-reform2/0105-WIP-FRL-drm-bridge-dw-hdmi-qp-Add-HDMI-2.1-FRL-suppo.patch"
2267 "rk3588-mnt-reform2/0106-WIP-FRL-drm-rockchip-dw_hdmi_qp-Add-HDMI-2.1-FRL-sup.patch"
2268 "rk3588-mnt-reform2/0107-WIP-FRL-drm-rockchip-vop2-Add-HDMI-2.1-FRL-support.patch"
2269 "rk3588-mnt-reform2/0108-dt-bindings-phy-rockchip-usbdp-add-improved-ports-sc.patch"
2270 "rk3588-mnt-reform2/0114-media-dt-bindings-video-interfaces-add-defines-for-s.patch"
2271 "rk3588-mnt-reform2/2001-drm-bridge-dw-hdmi-qp-Return-0-in-audio-prepare-when.patch"
2272 "rk3588-mnt-reform2/2003-drm-bridge-synopsys-Do-not-warn-about-audio-params-c.patch"
2273 "rk3588-mnt-reform2/5200-drm-rockchip-Set-dma-mask-to-64-bit.patch"
2274 "rk3588-mnt-reform2/7001-PCI-dw-rockchip-Disable-root-port-BARs.patch"))))
2275 (add-after 'apply-reform-patches 'copy-reform-dts-files
2276 (lambda* (#:key inputs #:allow-other-keys)
2277 (for-each (lambda (dts)
2278 (copy-file (search-input-file inputs
2279 (string-append
2280 "/dts/" dts))
2281 (string-append "arch/arm64/boot/dts/"
2282 dts)))
2283 (list
2284 "amlogic/meson-g12b-bananapi-cm4-mnt-pocket-reform.dts"
2285 "freescale/fsl-ls1028a-mnt-reform2.dts"
2286 "freescale/imx8mp-mnt-pocket-reform.dts"
2287 "freescale/imx8mp-mnt-reform2.dts"
2288 "freescale/imx8mq-mnt-reform2-hdmi.dts"
2289 "rockchip/rk3588-mnt-desktop-reform.dts"
2290 "rockchip/rk3588-mnt-pocket-reform.dts"
2291 "rockchip/rk3588-mnt-reform-next.dts"
2292 "rockchip/rk3588-mnt-reform2.dts"
2293 "rockchip/rk3588-mnt-reform2-dsi.dts"
2294 ))))
2295 (add-after 'apply-reform-patches 'adjust-makefiles-with-new-dtb
2296 (lambda _
2297 (substitute* "arch/arm64/boot/dts/amlogic/Makefile"
2298 (("meson-g12b-bananapi-cm4-mnt-reform2.dtb")
2299 "meson-g12b-bananapi-cm4-mnt-reform2.dtb
2300dtb-$(CONFIG_ARCH_MESON) += meson-g12b-bananapi-cm4-mnt-pocket-reform.dtb"))
2301 (substitute* "arch/arm64/boot/dts/freescale/Makefile"
2302 (("fsl-ls1028a-rdb.dtb")
2303 "fsl-ls1028a-rdb.dtb
2304dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-ls1028a-mnt-reform2.dtb"))
2305 (substitute* "arch/arm64/boot/dts/freescale/Makefile"
2306 (("imx8mq-mnt-reform2.dtb")
2307 "imx8mq-mnt-reform2.dtb
2308dtb-$(CONFIG_ARCH_MXC) += imx8mp-mnt-reform2.dtb
2309dtb-$(CONFIG_ARCH_MXC) += imx8mp-mnt-pocket-reform.dtb
2310dtb-$(CONFIG_ARCH_MXC) += imx8mq-mnt-reform2-hdmi.dtb"))
2311 (substitute* "arch/arm64/boot/dts/rockchip/Makefile"
2312 (("rk3588-mnt-reform2.dtb")
2313 "rk3588-mnt-reform2.dtb
2314dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-mnt-desktop-reform.dtb
2315dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-mnt-reform2-dsi.dtb
2316dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-mnt-reform-next.dtb
2317dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-mnt-pocket-reform.dtb")))))))))))
2318
2319(define-public linux-libre-arm64-mnt-reform-6.12
2320 ;; Kernel for use on the MNT/Reform systems
2321 ;; https://mntre.com/reform.html
2322 (let ((base (make-linux-libre* linux-libre-6.12-version
2323 linux-libre-6.12-gnu-revision
2324 (source-with-patches linux-libre-6.12-source
2325 ;; Revert upstream patches
2326 ;; that conflict with
2327 ;; MNT/Reform patches
2328 (search-patches
2329 "linux-libre-arm64-mnt-reform-revert-vop2-display-modes.patch"
2330 "linux-libre-arm64-mnt-reform-revert-phy-rockchip-samsung.patch"
2331 "linux-libre-arm64-mnt-reform-revert-rk-samsung-hdptx.patch"))
2332 '("aarch64-linux")
2333 #:extra-version "arm64-mnt-reform"
2334 #:extra-options
2335 ;; https://source.mnt.re/reform/reform-debian-packages/-/blob/main/linux/config
2336 (append (mnt-reform-kernel-options
2337 linux-libre-6.12-version)
2338 (default-extra-linux-options
2339 linux-libre-6.12-version)))))
2340 (package
2341 (inherit base)
2342 (inputs (list reform-debian-packages-for-6.12))
2343 (synopsis (string-append (package-synopsis base)
2344 " for MNT/Reform systems"))
2345 (description (string-append (package-description base)
2346 " Configuration options and patches have been applied for use with MNT/Reform systems."))
2347 (arguments
2348 (substitute-keyword-arguments arguments
2349 ((#:phases phases)
2350 #~(modify-phases #$phases
2351 (add-after 'unpack 'apply-reform-patches
2352 (lambda* (#:key inputs #:allow-other-keys)
2353 (for-each (lambda (patch)
2354 (invoke "patch" "-p1" "-i"
2355 (search-input-file inputs
2356 (string-append
2357 "patches6.12/" patch))))
2358 (list
2359 "imx8mp-mnt-pocket-reform/2ghz/0001-imx8mp-2ghz-clk.patch"
2360 "imx8mp-mnt-pocket-reform/2ghz/0002-imx8mp-2ghz-opp.patch"
2361 "imx8mp-mnt-pocket-reform/audio/0000-revert-crashy-audiomix-pm-support.patch"
2362 "imx8mp-mnt-pocket-reform/mmc-sdio/0001-sdhci-add-no-sd-uhs-sdr104-devicetree-property.patch"
2363 "imx8mp-mnt-pocket-reform/mmc-sdio/0002-During-the-card-init-the-host-side-sometimes-may-nee.patch"
2364 "imx8mp-mnt-pocket-reform/mmc-sdio/0003-USDHC-IP-has-one-limitation-the-tuning-circuit-can-t.patch"
2365 "imx8mp-mnt-pocket-reform/pocket-panel/0001-v5-add-multi-display-panel-driver.patch"
2366 "imx8mp-mnt-reform2/0001-sn65dsi86-use-hs-clock-of-samsung-dsim-host-directly.patch"
2367 "imx8mp-mnt-reform2/0002-lcdif-dont-exceed-desired-pixel-clock.patch"
2368 "imx8mq-mnt-reform2/0001-nwl-dsi-fixup-mode-only-for-LCDIF-input-not-DCSS.patch"
2369 "imx8mq-mnt-reform2/0002-pci-imx6-add-support-for-internal-refclk-imx8mq.patch"
2370 "imx8mq-mnt-reform2/0003-lcdif-fix-pcie-interference.patch"
2371 "imx8mq-mnt-reform2/0004-mnt4002-imx-gpcv2-wake-smccc.patch.patch"
2372 ;; Does not apply, needs further investigation
2373 ;; "imx8mq-mnt-reform2/v19_20241126_sandor_yu_initial_support_cadence_mhdp8501_hdmi_dp_for_i_mx8mq.mbx"
2374 "ls1028a-mnt-reform2/0000-dtsi-add-hdptx.patch"
2375 "meson-g12b-bananapi-cm4-mnt-pocket-reform/0001-a311d-viu-fifo-lines-config.patch"
2376 "meson-g12b-bananapi-cm4-mnt-pocket-reform/0002-a311d-viu-fifo-lines-config-header.patch"
2377 "meson-g12b-bananapi-cm4-mnt-pocket-reform/0003-tlv320aic31xx-add-1228800hz-support.patch"
2378 "meson-g12b-bananapi-cm4-mnt-reform2/0001-Revert-drm-bridge-synopsys-dw-mipi-dsi-enable-EoTp-b.patch"
2379 "meson-g12b-bananapi-cm4-mnt-reform2/0011-dw-mipi-dsi-phy-stop-wait-time.patch"
2380 "meson-g12b-bananapi-cm4-mnt-reform2/0012-innolux-n125hce-gn1-timing-tweaks.patch"
2381 "meson-g12b-bananapi-cm4-mnt-reform2/0013-meson-viu-hold-fifo-lines.patch"
2382 "meson-g12b-bananapi-cm4-mnt-reform2/0014-meson-venc-sync.patch.patch"
2383 "meson-g12b-bananapi-cm4-mnt-reform2/0015-meson-dw-mipi-dsi-sync-invert.patch"
2384 "meson-g12b-bananapi-cm4-mnt-reform2/0016-sn65dsi86-burst-mode-support.patch"
2385 "meson-g12b-bananapi-cm4-mnt-reform2/0018-sn65dsi86-never-turn-off.patch"
2386 "meson-g12b-bananapi-cm4-mnt-reform2/0020-LOCAL-ALSA-Assign-internal-PCM-chmap-ELD-IEC958-kctl.patch"
2387 "meson-g12b-bananapi-cm4-mnt-reform2/0021-HACK-of-partial-revert-of-fdt.c-changes.patch"
2388 "meson-g12b-bananapi-cm4-mnt-reform2/0022-add-bt-and-eth-resets.patch"
2389 "meson-g12b-bananapi-cm4-mnt-reform2/0023-sdio-pullups.patch"
2390 "meson-g12b-bananapi-cm4-mnt-reform2/0024-sdio-improve-wifi-speed.patch"
2391 "rk3588-mnt-reform2/0001-regulator-Add-of_regulator_get_optional-for-pure-DT-.patch"
2392 "rk3588-mnt-reform2/0001-scripts-package-builddeb-allow-hooks-also-in-usr-sha.patch"
2393 "rk3588-mnt-reform2/0002-regulator-Add-devres-version-of-of_regulator_get_opt.patch"
2394 "rk3588-mnt-reform2/0004-arm64-dts-rockchip-rk3588-rock5b-add-USB-C-support.patch"
2395 "rk3588-mnt-reform2/0005-math.h-add-DIV_ROUND_UP_NO_OVERFLOW.patch"
2396 "rk3588-mnt-reform2/0006-clk-divider-Fix-divisor-masking-on-64-bit-platforms.patch"
2397 "rk3588-mnt-reform2/0007-clk-composite-replace-open-coded-abs_diff.patch"
2398 "rk3588-mnt-reform2/0008-clk-rockchip-support-clocks-registered-late.patch"
2399 "rk3588-mnt-reform2/0009-clk-rockchip-rk3588-register-GATE_LINK-later.patch"
2400 "rk3588-mnt-reform2/0010-clk-rockchip-expose-rockchip_clk_set_lookup.patch"
2401 "rk3588-mnt-reform2/0011-clk-rockchip-implement-linked-gate-clock-support.patch"
2402 "rk3588-mnt-reform2/0012-clk-rockchip-rk3588-drop-RK3588_LINKED_CLK.patch"
2403 "rk3588-mnt-reform2/0013-arm64-dts-rockchip-rk3588-evb1-add-bluetooth-rfkill.patch"
2404 "rk3588-mnt-reform2/0014-arm64-dts-rockchip-rk3588-evb1-improve-PCIe-ethernet.patch"
2405 "rk3588-mnt-reform2/0015-arm64-dts-rockchip-Slow-down-EMMC-a-bit-to-keep-IO-s.patch"
2406 "rk3588-mnt-reform2/0016-vop2-Add-clock-resets-support.patch"
2407 "rk3588-mnt-reform2/0017-arm64-dts-rockchip-Add-VOP-clock-resets-for-rk3588s.patch"
2408 "rk3588-mnt-reform2/0018-dt-bindings-display-vop2-Add-VP-clock-resets.patch"
2409 "rk3588-mnt-reform2/0019-media-v4l2-ctrls-core-Set-frame_mbs_only_flag-by-def.patch"
2410 "rk3588-mnt-reform2/0020-media-rockchip-Move-H264-CABAC-table-to-header-file.patch"
2411 "rk3588-mnt-reform2/0021-media-rockchip-Introduce-the-rkvdec2-driver.patch"
2412 "rk3588-mnt-reform2/0022-media-dt-bindings-rockchip-Document-RK3588-Video-Dec.patch"
2413 "rk3588-mnt-reform2/0023-arm64-dts-rockchip-Add-rkvdec2-Video-Decoder-on-rk35.patch"
2414 "rk3588-mnt-reform2/0024-arm64-defconfig-enable-Rockchip-RK3588-video-decoder.patch"
2415 "rk3588-mnt-reform2/0025-mfd-rk8xx-Fix-shutdown-handler.patch"
2416 "rk3588-mnt-reform2/0026-WIP-phy-phy-rockchip-samsung-hdptx-Add-FRL-EARC-supp.patch"
2417 "rk3588-mnt-reform2/0027-TESTING-phy-phy-rockchip-samsung-hdptx-Add-verbose-l.patch"
2418 "rk3588-mnt-reform2/0028-WIP-dt-bindings-display-rockchip-drm-Add-optional-cl.patch"
2419 "rk3588-mnt-reform2/0029-WIP-drm-rockchip-vop2-Improve-display-modes-handling.patch"
2420 "rk3588-mnt-reform2/0030-arm64-dts-rockchip-Add-HDMI0-bridge-to-rk3588.patch"
2421 "rk3588-mnt-reform2/0031-arm64-dts-rockchip-Enable-HDMI0-on-rock-5b.patch"
2422 "rk3588-mnt-reform2/0032-arm64-dts-rockchip-Enable-HDMI0-on-rk3588-evb1.patch"
2423 "rk3588-mnt-reform2/0033-WIP-arm64-dts-rockchip-Enable-HDMI0-PHY-clk-provider.patch"
2424 "rk3588-mnt-reform2/0034-WIP-arm64-dts-rockchip-Make-use-of-HDMI0-PHY-PLL-on-.patch"
2425 "rk3588-mnt-reform2/0035-WIP-arm64-dts-rockchip-Make-use-of-HDMI0-PHY-PLL-on-.patch"
2426 "rk3588-mnt-reform2/0036-dt-bindings-display-bridge-Add-schema-for-Synopsys-D.patch"
2427 "rk3588-mnt-reform2/0037-dt-bindings-display-rockchip-Add-schema-for-RK3588-H.patch"
2428 "rk3588-mnt-reform2/0038-drm-bridge-synopsys-Add-DW-HDMI-QP-TX-controller-dri.patch"
2429 "rk3588-mnt-reform2/0039-drm-rockchip-Add-basic-RK3588-HDMI-output-support.patch"
2430 "rk3588-mnt-reform2/0040-arm64-defconfig-Enable-Rockchip-extensions-for-Synop.patch"
2431 "rk3588-mnt-reform2/0041-MAINTAINERS-Add-entry-for-Synopsys-DesignWare-HDMI-R.patch"
2432 "rk3588-mnt-reform2/0042-dt-bindings-media-Document-bindings-for-HDMI-RX-Cont.patch"
2433 "rk3588-mnt-reform2/0043-arm64-dts-rockchip-Add-device-tree-support-for-HDMI-.patch"
2434 "rk3588-mnt-reform2/0044-media-platform-synopsys-Add-support-for-HDMI-input-d.patch"
2435 "rk3588-mnt-reform2/0045-arm64-defconfig-Enable-Synopsys-HDMI-receiver.patch"
2436 "rk3588-mnt-reform2/0046-arm64-dts-rockchip-Enable-HDMI-receiver-on-rock-5b.patch"
2437 "rk3588-mnt-reform2/0047-arm64-dts-rockchip-Enable-HDMI-receiver-on-RK3588-EV.patch"
2438 "rk3588-mnt-reform2/0048-arm64-defconfig-Enable-default-EDID-for-Synopsys-HDM.patch"
2439 "rk3588-mnt-reform2/0049-regulator-Add-devm_-of_regulator_get.patch"
2440 "rk3588-mnt-reform2/0050-pmdomain-rockchip-cleanup-mutex-handling-in-rockchip.patch"
2441 "rk3588-mnt-reform2/0051-pmdomain-rockchip-forward-rockchip_do_pmu_set_power_.patch"
2442 "rk3588-mnt-reform2/0052-pmdomain-rockchip-reduce-indentation-in-rockchip_pd_.patch"
2443 "rk3588-mnt-reform2/0053-dt-bindings-power-rockchip-add-regulator-support.patch"
2444 "rk3588-mnt-reform2/0054-pmdomain-rockchip-add-regulator-support.patch"
2445 "rk3588-mnt-reform2/0055-arm64-dts-rockchip-Add-GPU-power-domain-regulator-de.patch"
2446 "rk3588-mnt-reform2/0056-dt-bindings-net-wireless-brcm4329-fmac-add-pci14e4-4.patch"
2447 "rk3588-mnt-reform2/0057-dt-bindings-net-wireless-brcm4329-fmac-add-clock-des.patch"
2448 "rk3588-mnt-reform2/0058-wifi-brcmfmac-Add-optional-lpo-clock-enable-support.patch"
2449 ;; does not apply cleanly due to DEBLOBBING
2450 ;; "rk3588-mnt-reform2/0059-wifi-brcmfmac-add-flag-for-random-seed-during-firmwa.patch"
2451 "rk3588-mnt-reform2/0060-arm64-dts-rockchip-rk3588-evb1-add-WLAN-controller.patch"
2452 "rk3588-mnt-reform2/0061-arm64-dts-rockchip-add-and-enable-gpu-node-for-Radxa.patch"
2453 "rk3588-mnt-reform2/0062-arm64-dts-rockchip-Enable-HDMI0-on-rock-5a.patch"
2454 "rk3588-mnt-reform2/0100-rk3588-dtsi-add-hdmi1-controller.patch"
2455 "rk3588-mnt-reform2/0102-drm-panthor-Actually-suspend-IRQs-in-the-unplug-path.patch"
2456 "rk3588-mnt-reform2/3001-display-rockchip-add-schema-for-rk3588-hdmi-tx.patch"
2457 "rk3588-mnt-reform2/4000-mnt-rk3588-dual-hdmi-qp-rockchip.patch"
2458 "rk3588-mnt-reform2/4001-mnt-rk3588-dual-hdmi-vop2-pll.patch"
2459 "rk3588-mnt-reform2/5001-rk3588-dsi2-driver.patch"
2460 "rk3588-mnt-reform2/5002-rk3588-dsi-dts-nodes.patch"
2461 "rk3588-mnt-reform2/5100-modernize-hdmi1-in-dtsi.patch"
2462 "rk3588-mnt-reform2/5110-hdptx-crash-workaround.patch"
2463 "rk3588-mnt-reform2/5200-drm-rockchip-Set-dma-mask-to-64-bit.patch"))))
2464 (add-after 'apply-reform-patches 'copy-reform-dts-files
2465 (lambda* (#:key inputs #:allow-other-keys)
2466 (for-each (lambda (dts)
2467 (copy-file (search-input-file inputs
2468 (string-append
2469 "/dts/" dts))
2470 (string-append "arch/arm64/boot/dts/"
2471 dts)))
2472 (list
2473 "amlogic/meson-g12b-bananapi-cm4-mnt-pocket-reform.dts"
2474 "amlogic/meson-g12b-bananapi-cm4-mnt-reform2.dts"
2475 "freescale/fsl-ls1028a-mnt-reform2.dts"
2476 "freescale/imx8mp-mnt-pocket-reform.dts"
2477 "freescale/imx8mp-mnt-reform2.dts"
2478 "freescale/imx8mq-mnt-reform2-hdmi.dts"
2479 "freescale/imx8mq-mnt-reform2.dts"
2480 "rockchip/rk3588-mnt-pocket-reform.dts"
2481 "rockchip/rk3588-mnt-reform-next.dts"
2482 "rockchip/rk3588-mnt-reform2.dts"))))
2483 (add-after 'apply-reform-patches 'adjust-makefiles-with-new-dtb
2484 (lambda _
2485 (substitute* "arch/arm64/boot/dts/amlogic/Makefile"
2486 (("meson-g12b-bananapi-cm4-mnt-reform2.dtb")
2487 "meson-g12b-bananapi-cm4-mnt-reform2.dtb
2488dtb-$(CONFIG_ARCH_MESON) += meson-g12b-bananapi-cm4-mnt-pocket-reform.dtb"))
2489 (substitute* "arch/arm64/boot/dts/freescale/Makefile"
2490 (("fsl-ls1028a-rdb.dtb")
2491 "fsl-ls1028a-rdb.dtb
2492dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-ls1028a-mnt-reform2.dtb"))
2493 (substitute* "arch/arm64/boot/dts/freescale/Makefile"
2494 (("imx8mq-mnt-reform2.dtb")
2495 "imx8mq-mnt-reform2.dtb
2496dtb-$(CONFIG_ARCH_MXC) += imx8mp-mnt-reform2.dtb
2497dtb-$(CONFIG_ARCH_MXC) += imx8mp-mnt-pocket-reform.dtb
2498dtb-$(CONFIG_ARCH_MXC) += imx8mq-mnt-reform2-hdmi.dtb"))
2499 (substitute* "arch/arm64/boot/dts/rockchip/Makefile"
2500 (("rk3588-rock-5b.dtb")
2501 "rk3588-rock-5b.dtb
2502dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-mnt-reform2.dtb
2503dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-mnt-reform-next.dtb
2504dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-mnt-pocket-reform.dtb")))))))))))
2505
2506(define-public linux-libre-riscv64-generic
2507 (make-linux-libre* linux-libre-version
2508 linux-libre-gnu-revision
2509 linux-libre-source
2510 '("riscv64-linux")
2511 #:extra-version "riscv64-generic"
2512 #:extra-options
2513 (append
2514 ;; required `guix system vm'
2515 `(("CONFIG_USB_HID" . m)
2516 ("CONFIG_HID_GEMBIRD" . m)
2517 ("CONFIG_AHCI_DWC" . m)
2518 ("CONFIG_SATA_AHCI" . m)
2519 ("CONFIG_CRYPTO_SERPENT" . m)
2520 ("CONFIG_CRYPTO_WP512" . m)
2521 ("CONFIG_USB_UAS" . m)
2522 ("CONFIG_USB_STORAGE" . m)
2523 ("CONFIG_HID_GENERIC" . m)
2524 ("CONFIG_DRM_CIRRUS_QEMU" . m)
2525 ("CONFIG_HW_RANDOM_VIRTIO" . m)
2526 ("CONFIG_VIRTIO_CONSOLE" . m)
2527 ("CONFIG_CRYPTO_XTS" . m))
2528 (default-extra-linux-options linux-libre-version))))
2529
2530(define-public linux-libre-mips64el-fuloong2e
2531 (make-linux-libre* linux-libre-version
2532 linux-libre-gnu-revision
2533 linux-libre-source
2534 '("mips64el-linux")
2535 #:defconfig "fuloong2e_defconfig"
2536 #:extra-version "mips64el-fuloong2e"
2537 #:extra-options
2538 (append
2539 `(("CONFIG_OVERLAY_FS" . m))
2540 (default-extra-linux-options linux-libre-version))))
2541
2542(define-deprecated-package linux-libre-with-bpf
2543 linux-libre)
2544
2545
2546;;;
2547;;; Linux kernel modules.
2548;;;
2549
2550(define-public acpi-call-linux-module
2551 (package
2552 (name "acpi-call-linux-module")
2553 (version "1.2.2")
2554 (source
2555 (origin
2556 (method git-fetch)
2557 (uri (git-reference
2558 (url "https://github.com/nix-community/acpi_call")
2559 (commit (string-append "v" version))))
2560 (file-name (git-file-name name version))
2561 (sha256
2562 (base32 "09ljx0jl987753r2kjqj5kxms95bijw0xn14kf82ryn38ck5c8cf"))))
2563 (build-system linux-module-build-system)
2564 (arguments
2565 (list #:tests? #f ; no tests
2566 #:phases
2567 #~(modify-phases %standard-phases
2568 (add-before 'install 'patch-shebangs-harder
2569 ;; The (only) shebangs in examples/ don't justify a reference.
2570 ;; However, do substitute a slightly more portable one.
2571 (lambda _
2572 (substitute* (find-files "examples" ".")
2573 (("^(#! *)/[^ ]*/" _ shebang)
2574 (string-append shebang "/usr/bin/env ")))))
2575 (add-after 'install 'install-documentation
2576 (lambda _
2577 (let* ((doc (string-append #$output "/share/doc/"
2578 #$name "-" #$version)))
2579 (for-each (lambda (file)
2580 (let ((target (string-append doc "/" file)))
2581 (mkdir-p (dirname target))
2582 (copy-recursively file target)))
2583 (list "README.md" "examples"))))))))
2584 (home-page "https://github.com/nix-community/acpi_call")
2585 (synopsis "Linux kernel module to perform ACPI method calls")
2586 (description
2587 "This simple Linux kernel module allows calls from user space to any
2588@acronym{ACPI, Advanced Configuration and Power Interface} method provided by
2589your computer's firmware, by writing to @file{/proc/acpi/call}. You can pass
2590any number of parameters of types @code{ACPI_INTEGER}, @code{ACPI_STRING},
2591and @code{ACPI_BUFFER}.
2592
2593It grants direct and undocumented access to your hardware that may cause damage
2594and should be used with caution, especially on untested models.")
2595 (license license:gpl3+))) ; see README.md (no licence headers)
2596
2597(define-public corefreq
2598 (package
2599 (name "corefreq")
2600 (version "2.1.0")
2601 (source
2602 (origin
2603 (method git-fetch)
2604 (uri (git-reference
2605 (url "https://github.com/cyring/CoreFreq")
2606 (commit version)))
2607 (file-name (git-file-name name version))
2608 (sha256
2609 (base32 "054rnrwvkbfmy2maxjk928fh1p346313ixhkbjwcq7qjz3idjixl"))))
2610 ;; The upstream Makefile is now such a proprietary mess that standard builds
2611 ;; as performed by our linux-module-build-system are more or less impossible
2612 ;; without heavy patching. However, we still keep it as the main build
2613 ;; system because lifting out LINUX-MODULE-BUILDER would be even messier.
2614 (build-system linux-module-build-system)
2615 (outputs (list "out" "linux-module"))
2616 (arguments
2617 (list #:imported-modules `((guix build gnu-build-system)
2618 ,@%linux-module-build-system-modules)
2619 #:modules `((guix build linux-module-build-system)
2620 ((guix build gnu-build-system) #:prefix gnu:)
2621 (guix build utils))
2622 #:make-flags
2623 #~(list (string-append "CC=" #$(cc-for-target))
2624 "OPTIM_LVL=3"
2625 (string-append "PREFIX=" #$output))
2626 #:tests? #f ;no test suite
2627 #:source-directory "../build" ;must contain modules.order
2628 #:phases
2629 #~(modify-phases %standard-phases
2630 (add-after 'unpack 'patch-Makefile
2631 (lambda* (#:key inputs #:allow-other-keys)
2632 (let ((dir (search-input-directory
2633 inputs "lib/modules/build")))
2634 (substitute* "Makefile"
2635 (("^(KERNELREL \\?= ).*" _ =)
2636 (string-append = (dirname dir) "\n"))
2637 (("^(KERNELDIR \\?= ).*" _ =)
2638 (string-append = dir "\n"))
2639 (("^([[:space:]]+)(.* modules_install.*)"
2640 _ indent command)
2641 (string-append indent "echo skipping " command))))))
2642 (add-before 'build 'prepare
2643 (lambda* (#:key source-directory #:allow-other-keys)
2644 ;; Lazily fix another mismatch between what the kernel module
2645 ;; build system expects and what this package provides.
2646 (symlink "source/build" source-directory)))
2647 (replace 'build (assoc-ref gnu:%standard-phases 'build))
2648 (add-before 'install 'resolve-symlink
2649 ;; The build system silently fails to install from a symlink.
2650 (lambda _
2651 (delete-file "../build")
2652 (copy-recursively "build" "../build")))
2653 (add-before 'install 'create-output
2654 (lambda _
2655 ;; Avoid installing the corefreq binary as …/bin.
2656 (mkdir-p (string-append #$output "/bin"))))
2657 (add-after 'install 'gnu:install
2658 (assoc-ref gnu:%standard-phases 'install))
2659 (add-after 'install 'separate-module
2660 (lambda* (#:key outputs #:allow-other-keys)
2661 ;; Adding INSTALL_MOD_PATH= to #:make-flags would still create an
2662 ;; empty <out>/lib/modules directory, so just do it all by hand.
2663 (let* ((output (assoc-ref outputs "out"))
2664 (module (assoc-ref outputs "linux-module")))
2665 (mkdir-p module)
2666 (rename-file (string-append output "/lib")
2667 (string-append module "/lib")))))
2668 (add-after 'install 'install-README
2669 ;; There is no proper documentation. Provide something.
2670 (lambda* (#:key outputs #:allow-other-keys)
2671 (let* ((out (assoc-ref outputs "out"))
2672 (doc (string-append out "/share/doc/"
2673 #$name "-" #$version)))
2674 (install-file "README.md" doc)))))))
2675 (home-page "https://github.com/cyring/CoreFreq")
2676 (synopsis
2677 "Measure performance data & tweak low-level settings on x86-64 CPUs")
2678 (description
2679 "CoreFreq is a CPU monitor that reports low-level processor settings and
2680performance data with notably high precision by using a loadable Linux kernel
2681module. Unlike most similar tools, it can be used to modify some settings if
2682supported by the hardware and at your own risk. It's designed for 64-bit x86
2683Intel processors (Atom, Core2, Nehalem, SandyBridge, and newer) and compatible
2684architectures like AMD@tie{}Zen and Hygon@tie{}Dhyana.
2685
2686Supported processor features include:
2687@enumerate
2688@item time spent in C-states, including C1/C3 Auto- and UnDemotion;
2689@item core temperatures, voltage, and tweaking thermal limits;
2690@item core frequencies, ratios, and base clock rate;
2691@item enabling, disabling, and testing SpeedStep (EIST), Turbo Boost, and
2692Hyper-Threading or SMT;
2693@item enabling or disabling data cache prefetching;
2694@item kernel assembly code to keep as near as possible readings of performance
2695counters such as the @acronym{TSC, Time Stamp Counter}, @acronym{UCC, Unhalted
2696Core Cycles}, and @acronym{URC, Unhalted Reference Cycles};
2697@item the number of instructions per cycle or second (IPS, IPC, and CPI);
2698@item memory controller geometry and RAM timings;
2699@item running processes' CPU affinity.
2700@end enumerate
2701
2702This package provides the @command{corefreqd} data collection daemon, the
2703@command{corefreq-cli} client to visualise and control it in real time, and the
2704@code{corefreqk} kernel module in its own separate output. Read the included
2705@file{README.md} before loading it.")
2706 (supported-systems (list "x86_64-linux"))
2707 (license license:gpl2)))
2708
2709(define-public tuxedo-keyboard
2710 (package
2711 (name "tuxedo-keyboard")
2712 (version "4.22.2")
2713 (source
2714 (origin
2715 (method git-fetch)
2716 (uri (git-reference
2717 (url "https://gitlab.com/tuxedocomputers/development/packages/tuxedo-drivers.git")
2718 (commit (string-append "v" version))))
2719 (file-name (git-file-name name version))
2720 (sha256
2721 (base32 "0akjyz8nhhpcr4y4xmhghd4253mndzhhi5qggr2z315vpxfr7rl4"))))
2722 (build-system linux-module-build-system)
2723 (arguments
2724 (list #:tests? #f)) ; no test suite
2725 ;; This package fails to build on aarch64, and the manufacturer only sells
2726 ;; machines based on Intel-compatible processors. For more information, see
2727 ;; <https://codeberg.org/guix/guix/pulls/1795>.
2728 (supported-systems '("i686-linux" "x86_64-linux"))
2729 (home-page "https://gitlab.com/tuxedocomputers/development/packages/tuxedo-drivers")
2730 (synopsis "Linux kernel modules to control keyboard on most Tuxedo computers")
2731 (description
2732 "This package provides the @code{tuxedo_keyboard}, @code{tuxedo_io},
2733@code{clevo_wmi} @acronym{WMI, Windows Management Engine} and the
2734@code{clevo_acpi} @acronym{ACPI, Advanced Configuration and Power Interface}
2735kernel modules to control the keyboard on most Tuxedo computers. The @code{tuxedo_io}
2736module is also needed for the @code{tuxedo-control-center} (short tcc) package.")
2737 (license license:gpl2+)))
2738
2739(define-public evdi
2740 (package
2741 (name "evdi")
2742 (version "1.14.15") ;inherited by libevdi
2743 (source
2744 (origin
2745 (method git-fetch)
2746 (uri (git-reference
2747 (url "https://github.com/DisplayLink/evdi")
2748 (commit (string-append "v" version))))
2749 (file-name (git-file-name name version))
2750 (sha256
2751 (base32 "065mfwmb4nw71s0f0ax9si8xpbr1sah1bhxvq1k81yicvi83wsxn"))))
2752 (build-system linux-module-build-system)
2753 (arguments
2754 (list #:tests? #f ;no test suite
2755 #:phases #~(modify-phases %standard-phases
2756 (add-after 'unpack 'chdir
2757 (lambda _
2758 (chdir "module")))
2759 ;; Looks like the value is only there to detect RHEL
2760 ;; derivatives, so we can safely delete the include.
2761 (add-after 'unpack 'embed-/etc/os-release
2762 (lambda _
2763 (substitute* "module/Makefile"
2764 (("include /etc/os-release") "")))))))
2765 (home-page "https://github.com/DisplayLink/evdi")
2766 (synopsis
2767 "@acronym{EVDI, Extensible Virtual Display Interface} Linux kernel module")
2768 (description
2769 "The @acronym{EVDI, Extensible Virtual Display Interface} is a Linux kernel
2770module that enables management of multiple screens, allowing user-space programs
2771to take control over what happens with the image. It is essentially a virtual
2772display for which applications using the @code{libevdi} library can add, remove,
2773and receive screen updates.
2774
2775The EVDI driver uses the standard Linux @acronym{DRM, Direct Rendering Manager}.
2776Its displays can be controlled by standard tools such as @command{xrandr} and
2777display settings applets in graphical environments.")
2778 (license license:gpl2)))
2779
2780(define-public libevdi
2781 (package
2782 (inherit evdi)
2783 (name "libevdi")
2784 (build-system gnu-build-system)
2785 (arguments
2786 (list #:tests? #f ;no test suite
2787 #:make-flags
2788 #~(list (string-append "CC=" #$(cc-for-target)))
2789 #:phases #~(modify-phases %standard-phases
2790 (delete 'configure)
2791 (add-after 'unpack 'chdir
2792 (lambda _
2793 (chdir "library")))
2794 (replace 'install
2795 (lambda* _
2796 (let* ((lib (string-append #$output "/lib")))
2797 (mkdir-p lib)
2798 (install-file "libevdi.so" lib)))))))
2799 (inputs (list libdrm))
2800 (native-inputs (list pkg-config))
2801 (synopsis
2802 "@acronym{EVDI, Extensible Virtual Display Interface} user-space library")
2803 (description
2804 "Libevdi is a library that gives applications easy access to
2805@acronym{EVDI, Extensible Virtual Display Interface} devices provided by the
2806@code{evdi} driver package.")
2807 (license license:lgpl2.1)))
2808
2809(define-public ec
2810 (package
2811 (name "ec")
2812 (version (package-version linux-libre))
2813 (source (package-source linux-libre))
2814 (build-system gnu-build-system)
2815 (arguments
2816 (list #:make-flags #~(list (string-append "sbindir="
2817 #$output "/sbin")
2818 "INSTALL=install" "STRIPCMD=true")
2819 #:phases #~(modify-phases %standard-phases
2820 (add-after 'unpack 'enter-subdirectory
2821 (lambda _
2822 (chdir "tools/power/acpi/tools/ec")))
2823 (delete 'configure)) ;no configure script
2824 #:tests? #f)) ;no tests
2825 (home-page (package-home-page linux-libre))
2826 (synopsis
2827 "Utility for reading or writing @acronym{EC, Embedded Controller} registers")
2828 (description
2829 "This utility can read or write specific registers or all the available
2830registers of the @acronym{EC, Embedded Controller} supported by the
2831@code{ec_sys} Linux driver.")
2832 (license license:gpl2)))
2833
2834(define-public bbswitch-module
2835 ;; Use "develop" branch since stable release does not build on Linux >= 5.6.
2836 ;; See https://github.com/Bumblebee-Project/bbswitch/issues/205.
2837 (let ((commit "19f60204596a6463b162fc7ca11f4946f5c20cea"))
2838 (package
2839 (name "bbswitch-module")
2840 (version (git-version "0.8" "2" commit))
2841 (source (origin
2842 (method git-fetch)
2843 (uri (git-reference
2844 ;; Use fork until
2845 ;; https://github.com/Bumblebee-Project/bbswitch/pull/219
2846 ;; is merged.
2847 (url "https://github.com/madchic/bbswitch")
2848 (commit commit)))
2849 (file-name (git-file-name name version))
2850 (sha256
2851 (base32
2852 "1pv41y02c9xg9k1bg4i4ll3w7hxxzdr651i08f092b9q5hr57mqn"))))
2853 (build-system linux-module-build-system)
2854 (arguments
2855 (list #:tests? #f)) ; no test suite
2856 (home-page "https://github.com/Bumblebee-Project/bbswitch")
2857 (synopsis "Kernel module that disables discrete Nvidia graphics cards")
2858 (description "The bbswitch module provides a way to toggle the Nvidia
2859graphics card on Optimus laptops.")
2860 (license license:gpl2))))
2861
2862(define-public bin-graph
2863 (package
2864 (name "bin-graph")
2865 (version "1.2.0")
2866 (source
2867 (origin
2868 (method git-fetch)
2869 (uri (git-reference
2870 (url "https://github.com/8dcc/bin-graph")
2871 (commit (string-append "v" version))))
2872 (file-name (git-file-name name version))
2873 (sha256
2874 (base32 "1msr4fj1nh6hf5h6j5pimfrgd37xy4xbik3iml9gd3b1fdkxsdv7"))))
2875 (arguments
2876 (list #:tests? #f ; no tests
2877 #:make-flags
2878 #~(list (string-append "CC=" #$(cc-for-target))
2879 (string-append "PREFIX=" #$output)
2880 (string-append "INSTALL_DIR=" #$output "/bin"))
2881 #:phases
2882 #~(modify-phases %standard-phases
2883 (delete 'configure)))) ; no configure script
2884 (build-system gnu-build-system)
2885 (inputs (list libpng))
2886 (home-page "https://github.com/8dcc/bin-graph")
2887 (synopsis "Visualize binary files")
2888 (description
2889 "@code{bin-graph} provides a simple way of visualizing the different regions
2890of a binary file.")
2891 (license license:gpl3)))
2892
2893(define-public ddcci-driver-linux
2894 (let ((revision "0")
2895 (commit "7f8f8e6c221a286d57a643c2909109a54e084eed"))
2896 (package
2897 (name "ddcci-driver-linux")
2898 (version (git-version "0.4.5" revision commit))
2899 (source
2900 (origin
2901 (method git-fetch)
2902 (uri
2903 (git-reference
2904 (url "https://gitlab.com/ddcci-driver-linux/ddcci-driver-linux.git")
2905 (commit commit)))
2906 (file-name (git-file-name name version))
2907 (sha256
2908 (base32 "0sgldghd8n4qjm5nv9dgxjibj1hg4kkk1811wndf3vx3dacsmkl9"))))
2909 (build-system linux-module-build-system)
2910 (arguments
2911 (list #:tests? #f ; no tests
2912 #:phases
2913 #~(modify-phases %standard-phases
2914 (replace 'build
2915 (lambda args
2916 (for-each
2917 (lambda (module)
2918 (with-directory-excursion module
2919 (apply (assoc-ref %standard-phases 'build) args)))
2920 '("ddcci" "ddcci-backlight"))))
2921 (replace 'install
2922 (lambda args
2923 (for-each
2924 (lambda (module)
2925 (with-directory-excursion module
2926 (apply (assoc-ref %standard-phases 'install) args)))
2927 '("ddcci" "ddcci-backlight")))))))
2928 (home-page "https://gitlab.com/ddcci-driver-linux/ddcci-driver-linux")
2929 (synopsis "Pair of Linux kernel drivers for DDC/CI monitors")
2930 (description "This package provides two Linux kernel drivers, ddcci and
2931ddcci-backlight, that allows the control of DDC/CI monitors through the sysfs
2932interface. The ddcci module creates a character device for each DDC/CI
2933monitors in @file{/dev/bus/ddcci/[I²C busnumber]}. While the ddcci-backlight
2934module allows the control of the backlight level or luminance property when
2935supported under @file{/sys/class/backlight/}.")
2936 (license license:gpl2+))))
2937
2938(define-public reform2-lpc-module
2939 (package
2940 (name "reform2-lpc-module")
2941 (version "1.79")
2942 (source
2943 (origin
2944 (method git-fetch)
2945 (uri (git-reference
2946 (url "https://source.mnt.re/reform/reform-tools.git")
2947 (commit version)))
2948 (file-name (git-file-name name version))
2949 (sha256
2950 (base32 "16xzdygf14zksvqjbp5gwiqsn0mb7kphvzrmqbl9db4kvyj4ajqa"))))
2951 (build-system linux-module-build-system)
2952 (arguments
2953 '(#:tests? #f ;no tests
2954 #:source-directory "lpc"))
2955 (synopsis "Linux kernel module for the Reform 2 system controller")
2956 (description
2957 "The reform2_lpc module allows for interaction with the NXP LPC11U24
2958Cortex-M0 MCU system controller in the Reform 2 open hardware laptop. It
2959provides battery status information and is necessary to completely shut down
2960the system when powering it off via userspace.")
2961 (home-page "https://source.mnt.re/reform/reform-tools/")
2962 (license license:gpl3+)))
2963
2964(define-public v4l2loopback-linux-module
2965 (package
2966 (name "v4l2loopback-linux-module")
2967 (version "0.15.3")
2968 (source (origin
2969 (method git-fetch)
2970 (uri (git-reference
2971 (url "https://github.com/v4l2loopback/v4l2loopback")
2972 (commit (string-append "v" version))))
2973 (file-name (git-file-name name version))
2974 (sha256
2975 (base32
2976 "1fpzsymsas4d2maj81k1al02m62d81ll4q15xwc4n0rhh88hkdv7"))))
2977 (build-system linux-module-build-system)
2978 (arguments
2979 (list #:tests? #f)) ; no test suite
2980 (home-page "https://github.com/v4l2loopback/v4l2loopback")
2981 (synopsis "Linux kernel module to create virtual V4L2 video devices")
2982 (description
2983 "This Linux module creates virtual video devices. @acronym{V4L2, Video
2984for Linux 2} applications will treat these as ordinary video devices but read
2985video data generated by another application, instead of a hardware device such
2986as a capture card.
2987
2988This lets you apply nifty effects to your Jitsi video, for example, but also
2989allows some more serious things like adding streaming capabilities to an
2990application by hooking GStreamer into the loopback device.")
2991 (license license:gpl2+)))
2992
2993(define-public xpadneo
2994 (package
2995 (name "xpadneo")
2996 (version "0.9.8")
2997 (source (origin
2998 (method git-fetch)
2999 (uri (git-reference
3000 (url "https://github.com/atar-axis/xpadneo")
3001 (commit (string-append "v" version))))
3002 (file-name (git-file-name name version))
3003 (sha256
3004 (base32
3005 "0928yr832may1ibximnvd6qjzr6sipyg8iclqgpcsa7wpxb4320b"))))
3006 (build-system linux-module-build-system)
3007 (arguments
3008 (list #:tests? #f ; no `check' target
3009 #:source-directory "hid-xpadneo/src"
3010 #:phases
3011 #~(modify-phases %standard-phases
3012 (add-after 'install 'post-install
3013 (lambda _
3014 (copy-recursively "hid-xpadneo/etc-modprobe.d"
3015 (string-append #$output "/etc/modprobe.d"))
3016 ;; udev-service-type takes its rules from /lib rather than
3017 ;; /etc, so copy it there instead
3018 (copy-recursively "hid-xpadneo/etc-udev-rules.d"
3019 (string-append #$output
3020 "/lib/udev/rules.d")))))))
3021 (home-page "https://atar-axis.github.io/xpadneo/")
3022 (synopsis "Xbox One Wireless Controller driver for the kernel Linux")
3023 (description
3024 "This package provides a driver for the XBox One S Wireless controller
3025and some newer models when connected via Bluetooth. In addition to the included
3026Linux kernel module, it also contains a modprobe configuration and udev rules,
3027which need to be installed separately.")
3028 (license license:gpl3+)))
3029
3030
3031;;;
3032;;; Pluggable authentication modules (PAM).
3033;;;
3034
3035(define-public linux-pam
3036 (package
3037 (name "linux-pam")
3038 (version "1.5.2")
3039 (source
3040 (origin
3041 (method url-fetch)
3042 (uri (string-append
3043 "https://github.com/linux-pam/linux-pam/releases/download/v"
3044 version "/Linux-PAM-" version ".tar.xz"))
3045 (sha256
3046 (base32
3047 "0kgrsj2scv5mx6w925h9hxf11jnqqs9z8s22aw94b90xm4qp3v74"))
3048 (patches (search-patches "linux-pam-unix_chkpwd.patch"
3049 "linux-pam-no-setfsuid.patch"))))
3050
3051 (build-system gnu-build-system)
3052 (inputs (list libxcrypt))
3053 (native-inputs
3054 (list flex
3055 ;; TODO: optional dependencies
3056 ;; ("cracklib" ,cracklib)
3057 ))
3058 (arguments
3059 (list
3060 ;; Most users, such as `shadow', expect the headers to be under
3061 ;; `security'.
3062 #:configure-flags #~(list (string-append "--includedir="
3063 (assoc-ref %outputs "out")
3064 "/include/security")
3065 ;; explicit libdir for pkgconfig files
3066 ;; drop with 1.5.3, which fixes
3067 ;; https://github.com/linux-pam/linux-pam/issues/466
3068 (string-append "--libdir="
3069 (assoc-ref %outputs "out")
3070 "/lib")
3071
3072 ;; XXX: <rpc/rpc.h> is missing from glibc when
3073 ;; cross-compiling, so we have to disable NIS
3074 ;; support altogether.
3075 #$@(if (%current-target-system)
3076 #~("--disable-nis")
3077 #~()))
3078
3079 #:phases (if (target-hurd?)
3080 #~(modify-phases %standard-phases
3081 (add-after 'unpack 'skip-pam-limits
3082 (lambda _
3083 ;; 'pam_limits.c' uses <sys/prctl.h>, which is
3084 ;; Linux-specific. Skip it on GNU/Hurd.
3085 (substitute* "modules/Makefile.in"
3086 (("pam_limits") "")))))
3087 #~%standard-phases)
3088
3089 ;; XXX: Tests won't run in chroot, presumably because /etc/pam.d
3090 ;; isn't available.
3091 #:tests? #f))
3092 (home-page "http://www.linux-pam.org/")
3093 (synopsis "Pluggable authentication modules for Linux")
3094 (description
3095 "A *Free* project to implement OSF's RFC 86.0.
3096Pluggable authentication modules are small shared object files that can
3097be used through the PAM API to perform tasks, like authenticating a user
3098at login. Local and dynamic reconfiguration are its key features.")
3099 (license license:bsd-3)))
3100
3101(define-public python-pamela
3102 (package
3103 (name "python-pamela")
3104 (version "1.0.0")
3105 (source
3106 (origin
3107 (method git-fetch)
3108 (uri (git-reference
3109 (url "https://github.com/minrk/pamela")
3110 (commit version)))
3111 (file-name (git-file-name name version))
3112 (sha256
3113 (base32 "0cg3w6np1fbjpvzhv54xg567hpf38szwp2d4gvzb9r736nxbv0vr"))))
3114 (build-system pyproject-build-system)
3115 (arguments
3116 (list
3117 #:tests? #f ;Test suite isn't designed to be run inside a container.
3118 #:phases
3119 #~(modify-phases %standard-phases
3120 (add-after 'unpack 'hardcode-pam.so
3121 (lambda* (#:key inputs #:allow-other-keys)
3122 (substitute* "pamela.py"
3123 (("find_library\\(\"pam\")")
3124 (format #f "~s"
3125 (search-input-file inputs "lib/libpam.so"))))))
3126 (replace 'check
3127 (lambda* (#:key tests? #:allow-other-keys)
3128 (when (and tests? (file-exists? "test_pamela.py"))
3129 (invoke "pytest" "--assert=plain" "test_pamela.py")
3130 (invoke "python" "-m" "pamela" "-a" "`whoami`")))))))
3131 (inputs (list linux-pam))
3132 (native-inputs (list python-pytest python-setuptools))
3133 (home-page "https://github.com/minrk/pamela")
3134 (synopsis "PAM interface using ctypes")
3135 (description "This package provides a PAM interface using @code{ctypes}.")
3136 (license license:expat)))
3137
3138(define-public pam-gnupg
3139 (package
3140 (name "pam-gnupg")
3141 (version "0.3")
3142 (source (origin
3143 (method git-fetch)
3144 (uri (git-reference
3145 (url "https://github.com/cruegge/pam-gnupg")
3146 (commit (string-append "v" version))))
3147 (file-name (git-file-name name version))
3148 (sha256
3149 (base32
3150 "1bf91gi6zmfzzmczxm7pajxdlgnikasvg5xsd3j0a368rcr7lf9l"))))
3151 (build-system gnu-build-system)
3152 (inputs
3153 (list gnupg linux-pam))
3154 (native-inputs
3155 (list autoconf automake libtool))
3156 (arguments
3157 `(#:tests? #f ;no tests suite
3158 #:configure-flags
3159 (list (string-append "--with-moduledir="
3160 (assoc-ref %outputs "out") "/lib/security"))))
3161
3162 (home-page "https://github.com/cruegge/pam-gnupg")
3163 (synopsis "Unlock GnuPG keys on login")
3164 (description "This package provides a PAM module that hands over your
3165login password to @code{gpg-agent}. This can be useful if you are using a
3166GnuPG-based password manager like @code{pass}.")
3167 (license license:gpl3+)))
3168
3169
3170;;;
3171;;; Kernel documentation
3172;;;
3173
3174(define-public linux-libre-documentation
3175 (package
3176 (inherit linux-libre)
3177 (name "linux-libre-documentation")
3178 (arguments
3179 (list
3180 #:tests? #f
3181 #:phases #~(modify-phases %standard-phases
3182 (delete 'configure)
3183 (replace 'build
3184 (lambda* (#:key parallel-build? #:allow-other-keys)
3185 (substitute* "Documentation/Makefile"
3186 ;; Remove problematic environment check script.
3187 ((".*sphinx-pre-install --version-check") ""))
3188 (invoke "make" "infodocs"
3189 "-j" (if parallel-build?
3190 (number->string (parallel-job-count))
3191 "1"))))
3192 (replace 'install
3193 (lambda _
3194 (let* ((info-dir (string-append #$output "/share/info"))
3195 (info (string-append info-dir
3196 "/TheLinuxKernel.info.gz")))
3197 (with-directory-excursion "Documentation/output"
3198 (invoke "make" "-C" "texinfo" "install-info"
3199 (string-append "infodir=" info-dir)))
3200 ;; Create a symlink, for convenience.
3201 (symlink info (string-append info-dir
3202 "/linux.info.gz"))))))))
3203 (native-inputs
3204 (list graphviz
3205 perl
3206 python
3207 python-sphinx
3208 python-pyyaml
3209 texinfo
3210 which))
3211 (synopsis "Documentation for the kernel Linux-Libre")
3212 (description "This package provides the documentation for the kernel
3213Linux-Libre, as an Info manual. To consult it, run @samp{info linux}.")))
3214
3215;;;
3216;;; Miscellaneous.
3217;;;
3218
3219(define-public powercap
3220 (package
3221 (name "powercap")
3222 (version "0.6.0")
3223 (source
3224 (origin
3225 (method git-fetch)
3226 (uri (git-reference
3227 (url "https://github.com/powercap/powercap")
3228 (commit (string-append "v" version))))
3229 (file-name (git-file-name name version))
3230 (sha256
3231 (base32 "087almlx34nzjbv8a40kxlmgy8691z2zlzkfyca8a2b7l0b2kqlp"))))
3232 (build-system cmake-build-system)
3233 (arguments
3234 (list #:configure-flags
3235 #~(list "-DBUILD_SHARED_LIBS=ON")))
3236 (home-page "https://github.com/powercap/powercap")
3237 (synopsis "Utilities for accessing the powercap Linux kernel feature")
3238 (description "This package contains utilities for accessing the powercap
3239Linux kernel feature through sysfs. It includes an implementation for working
3240with Intel @acronym{RAPL, Running Average Power Limit}.
3241It provides the commands @code{powercap-info} and @code{powercap-set}.")
3242 (license license:bsd-3)))
3243
3244(define-public powerstat
3245 (package
3246 (name "powerstat")
3247 (version "0.04.03")
3248 (source
3249 (origin
3250 (method git-fetch)
3251 (uri (git-reference
3252 (url "https://github.com/ColinIanKing/powerstat")
3253 (commit (string-append "V" version))))
3254 (file-name (git-file-name name version))
3255 (sha256
3256 (base32 "1a1fnw4rb8fx4wrcl0yc6dbjj49k6vagnq7diyw4fs4i5nin7mv3"))))
3257 (build-system gnu-build-system)
3258 (arguments
3259 `(#:make-flags
3260 (list (string-append "CC=" ,(cc-for-target))
3261 (string-append "prefix=" (assoc-ref %outputs "out")))
3262 #:tests? #f ; no test suite
3263 #:phases
3264 (modify-phases %standard-phases
3265 (delete 'configure)))) ; no configure script
3266 (home-page "https://kernel.ubuntu.com/~cking/powerstat/")
3267 (synopsis "Measure system power consumption")
3268 (description
3269 "Powerstat measures and reports your computer's power consumption in real
3270time. On mobile PCs, it uses ACPI battery information to measure the power
3271drain of the entire system.
3272
3273Powerstat can also report @acronym{RAPL, Running Average Power Limit} power
3274domain measurements. These are available only on some hardware such as Intel
3275Sandybridge and newer, and cover only part of the machine's components such as
3276CPU, DRAM, and graphics. However, they provide accurate and immediate readings
3277and don't require a battery at all.
3278
3279The output is like @command{vmstat} but also shows power consumption statistics:
3280at the end of a run, @command{powerstat} will calculate the average, standard
3281deviation, and minimum and maximum values. It can show a nice histogram too.")
3282 (license license:gpl2)))
3283
3284(define-public psmisc
3285 (package
3286 (name "psmisc")
3287 (version "23.7")
3288 (source
3289 (origin
3290 (method url-fetch)
3291 (uri (string-append "mirror://sourceforge/psmisc/psmisc/psmisc-"
3292 version ".tar.xz"))
3293 (sha256
3294 (base32 "09y30ywh1d4s4f0wgvki115kgpliq48rarmfmmjl0iq22jf5viaq"))))
3295 (build-system gnu-build-system)
3296 (arguments
3297 (list
3298 #:configure-flags
3299 (if (%current-target-system)
3300 #~(list "ac_cv_func_malloc_0_nonnull=yes"
3301 "ac_cv_func_realloc_0_nonnull=yes")
3302 #~'())))
3303 (inputs (list ncurses))
3304 (home-page "https://gitlab.com/psmisc/psmisc")
3305 (synopsis "Small utilities that use the proc file system")
3306 (description
3307 "psmisc is a set of small utilities that use the proc file system.
3308@itemize @bullet
3309@item @command{fuser} identifies processes using files or sockets;
3310@item @command{killall} kills processes by name;
3311@item @command{prtstat} prints statistics of a process;
3312@item @command{pslog} prints the log file(s) of a process;
3313@item @command{pstree} shows the currently running processes as a tree;
3314@item @command{peekfd} shows the data travelling over a file descriptor.
3315@end itemize")
3316 (license license:gpl2+)))
3317
3318(define-public util-linux
3319 (package
3320 (name "util-linux")
3321 (version "2.40.4")
3322 (source (origin
3323 (method url-fetch)
3324 (uri (string-append "mirror://kernel.org/linux/utils/"
3325 "util-linux/v" (version-major+minor version) "/"
3326 "util-linux-" version ".tar.xz"))
3327 (sha256
3328 (base32
3329 "0ygvflcr7v7x2rmr9h5mi07yx00i9368ggf3znd8bs847drsy7aw"))
3330 (patches (search-patches "util-linux-tests.patch"))
3331 (modules '((guix build utils)))
3332 (snippet
3333 ;; We take 'nologin' from Shadow, the 'logger' program from
3334 ;; GNU Inetutils and 'kill' from GNU Coreutils.
3335 '(begin
3336 (substitute* "configure"
3337 (("build_nologin=yes") "build_nologin=no")
3338 (("build_logger=yes") "build_logger=no")
3339 (("build_kill=yes") "build_kill=no"))))))
3340 (build-system gnu-build-system)
3341 (outputs '("out" ;6.4 MiB executables and documentation
3342 "lib" ;8.8 MiB shared libraries, headers and locales
3343 "static")) ;2.9 MiB static .a libraries
3344 (arguments
3345 (list #:configure-flags
3346 #~(list "--disable-use-tty-group"
3347 (string-append
3348 "--enable-fs-paths-default="
3349 "/run/setuid-programs"
3350 ":/run/current-system/profile/sbin")
3351 ;; Don't try to chown root:root mount and umount
3352 "--disable-makeinstall-chown"
3353 "--localstatedir=/var"
3354 (string-append "--localedir=" #$output:lib
3355 "/share/locale")
3356 ;; Install completions where our bash-completion package
3357 ;; expects them.
3358 (string-append "--with-bashcompletiondir=" #$output
3359 "/etc/bash_completion.d")
3360 ;; XXX: 32-bit Hurd platforms don't support 64bit time_t
3361 #$@(if (target-hurd32?)
3362 '("--disable-year2038")
3363 '()))
3364
3365 ;; FIXME: For now we cannot reliably run tests on GNU/Hurd:
3366 ;; <https://bugs.gnu.org/47791>.
3367 #:tests? (and (not (%current-target-system))
3368 (not (system-hurd?)))
3369
3370 #:phases
3371 #~(modify-phases %standard-phases
3372 (add-before 'configure 'patch-build-scripts
3373 (lambda _
3374 (substitute* "configure"
3375 ;; The build system assumes that we want to install
3376 ;; libraries below $exec_prefix when $libdir does not
3377 ;; match any of the "usual" locations. Fix that.
3378 (("usrlib_execdir='\\$\\{exec_prefix\\}'\\$libdir")
3379 "usrlib_execdir=$libdir"))))
3380 (add-before 'build 'set-umount-file-name
3381 (lambda _
3382 ;; Tell 'eject' the right file name of 'umount'.
3383 (substitute* "sys-utils/eject.c"
3384 (("\"/bin/umount\"")
3385 (string-append "\"" #$output "/bin/umount\"")))))
3386 (add-before 'check 'pre-check
3387 (lambda* (#:key native-inputs inputs #:allow-other-keys)
3388 (let ((services (search-input-file (or native-inputs inputs)
3389 "etc/services")))
3390 ;; Change the test to refer to the right file.
3391 (substitute* "tests/ts/misc/mcookie"
3392 (("/etc/services")
3393 services))
3394 (substitute* "tests/helpers/test_mkfds.c"
3395 (("/etc/fstab")
3396 (which "sh")))
3397 (substitute* "tests/helpers/test_enosys.c"
3398 (("/bin/false")
3399 (which "false"))))))
3400 (add-before 'check 'disable-setarch-test
3401 (lambda _
3402 ;; The setarch tests are unreliable in QEMU's user-mode
3403 ;; emulation, which is our primary method of building
3404 ;; ARMv7 packages. See
3405 ;; <https://github.com/karelzak/util-linux/issues/601>.
3406 (substitute* "tests/ts/misc/setarch"
3407 (("ts_init_subtest.*" all)
3408 (string-append
3409 all "\n"
3410 "ts_skip \"setarch tests are unreliable under QEMU\"")))))
3411 (add-before 'check 'disable-lsns-test
3412 (lambda _
3413 ;; The lsns tests can fail due to ioctl(_, NS_GET_USERNS)
3414 ;; returning ENOTTY, indicating this kernel does not
3415 ;; support user namespaces. Curiously, this test can fail
3416 ;; on i686 even if the same test passes on x86_64 on the
3417 ;; same machine. See <https://issues.guix.gnu.org/49933>.
3418 (delete-file "tests/ts/lsns/ioctl_ns")))
3419 #$@(if (target-ppc32?)
3420 #~((add-before 'check 'disable-enosys-ioctl
3421 ;; It is unclear why this test specifically
3422 ;; fails in Guix's port of powerpc-linux.
3423 (lambda _
3424 (substitute* "tests/ts/misc/enosys"
3425 (("ts_init_subtest ioctl")
3426 (string-append
3427 "ts_init_subtest ioctl\n\n"
3428 "ts_skip \"unexplained failure on powerpc\"\n"))))))
3429 #~())
3430 (add-after 'install 'move-static-libraries
3431 (lambda _
3432 (let ((lib #$output:lib)
3433 (static #$output:static))
3434
3435 ;; Move static libraries to the "static" output.
3436 (mkdir-p (string-append static "/lib"))
3437 (with-directory-excursion lib
3438 (for-each (lambda (file)
3439 (rename-file file
3440 (string-append static "/"
3441 file)))
3442 (find-files "lib" "\\.a$"))
3443
3444 ;; Remove references to the static library from the '.la'
3445 ;; files so that Libtool does the right thing when both
3446 ;; the shared and static library is available.
3447 (substitute* (find-files "lib" "\\.la$")
3448 (("old_library=.*") "old_library=''\n"))))))
3449 (add-after 'install 'adjust-pkg-config-files
3450 (lambda _
3451 ;; Drop the unused "prefix=" and "exec_prefix=" variables from
3452 ;; the pkg-config files to avoid a cyclic reference on "out".
3453 (substitute* (find-files (string-append #$output:lib
3454 "/lib/pkgconfig")
3455 "\\.pc$")
3456 (("^(exec_)?prefix=.*") "")))))))
3457 (inputs
3458 (list file ;for libmagic
3459 ncurses
3460 sqlite
3461 zlib))
3462 (native-inputs
3463 (list net-base ;for tests
3464 perl
3465 pkg-config))
3466 (home-page "https://www.kernel.org/pub/linux/utils/util-linux/")
3467 (synopsis "Collection of utilities for the Linux kernel")
3468 (description "Util-linux is a diverse collection of Linux kernel
3469utilities. It provides dmesg and includes tools for working with file systems,
3470block devices, UUIDs, TTYs, and many other tools.")
3471
3472 (properties '((upstream-name . "util-linux")))
3473 ;; Note that util-linux doesn't use the same license for all the
3474 ;; code. GPLv2+ is the default license for a code without an
3475 ;; explicitly defined license.
3476 (license (list license:gpl3+ license:gpl2+ license:gpl2 license:lgpl2.0+
3477 license:bsd-4 license:public-domain))))
3478
3479;; util-linux optionally supports udev, which allows lsblk to read file system
3480;; metadata without special privileges. Add it as a separate package to avoid
3481;; a circular dependency, and to keep the size small.
3482(define-public util-linux+udev
3483 (package/inherit
3484 util-linux
3485 (name "util-linux-with-udev")
3486 (inputs
3487 (modify-inputs inputs
3488 (prepend eudev)))))
3489
3490(define-public chimerautils
3491 (package
3492 (name "chimerautils")
3493 (version "15.0.3")
3494 (source
3495 (origin
3496 (method git-fetch)
3497 (uri (git-reference
3498 (url "https://github.com/chimera-linux/chimerautils")
3499 (commit (string-append "v" version))))
3500 (file-name (git-file-name name version))
3501 (sha256
3502 (base32 "1inagax7gg2rl2a9ymfxxk71xrwd4sngwc45ph61rlk345jhnxpw"))))
3503 (build-system meson-build-system)
3504 (arguments
3505 (list
3506 #:tests? #f)) ;no test suite
3507 (inputs (list acl
3508 libedit
3509 libxo
3510 ncurses
3511 openssl
3512 zlib
3513 (list zstd "lib")))
3514 (native-inputs (list flex bison pkg-config))
3515 (home-page "https://github.com/chimera-linux/chimerautils")
3516 (synopsis "The FreeBSD-based core Linux userland from Chimera Linux")
3517 (description
3518 "This is a port of the FreeBSD userland for Linux provided by
3519the Chimera Linux distribution. Essentially, it is a collection of UNIX tools
3520such as @command{grep}, @command{cp}, @command{vi}, etc. and can be used as an
3521alternative to the corresponding implementations from the GNU project.")
3522 (license license:bsd-2)))
3523
3524(define-public dislocker
3525 (package
3526 (name "dislocker")
3527 (version "0.7.3")
3528 (home-page "https://github.com/Aorimn/dislocker")
3529 (source (origin
3530 (method git-fetch)
3531 (uri (git-reference
3532 (url home-page)
3533 (commit (string-append "v" version))))
3534 (file-name (git-file-name name version))
3535 (sha256
3536 (base32
3537 "1ak68s1v5dwh8y2dy5zjybmrh0pnqralmyqzis67y21m87g47h2k"))))
3538 (build-system cmake-build-system)
3539 (arguments
3540 '(#:tests? #f)) ;no test suite
3541 (inputs (list fuse-2 mbedtls-lts))
3542 (synopsis "FUSE driver to read/write Windows BitLocker drives")
3543 (description
3544 "This package provides means to to read BitLocker encrypted
3545partitions. Write functionality is also provided but check the README.")
3546 (license license:gpl2+)))
3547
3548(define-public dwarves
3549 (package
3550 (name "dwarves")
3551 (version "1.29")
3552 (source (origin
3553 (method git-fetch)
3554 (uri (git-reference
3555 (url "https://github.com/acmel/dwarves")
3556 (commit (string-append "v" version))))
3557 (file-name (git-file-name name version))
3558 (sha256
3559 (base32
3560 "1ia3r77zyw7r8mydy1zrrdnqzm9ginsvf9pqviq48rglihhddvli"))
3561 (patches
3562 (search-patches "dwarves-threading-reproducibility.patch"))))
3563 (build-system cmake-build-system)
3564 (arguments (list #:configure-flags #~(list "-D__LIB=lib"
3565 "-DLIBBPF_EMBEDDED=OFF")
3566 #:tests? #f)) ;no test suite
3567 (native-inputs (list pkg-config))
3568 (inputs (list libbpf))
3569 (home-page "https://github.com/acmel/dwarves")
3570 (synopsis "Debugging information processing library and utilities")
3571 (description "Dwarves is a set of tools that use the debugging information
3572inserted in ELF binaries by compilers such as GCC, used by well known
3573debuggers such as GDB.
3574
3575Utilities in the Dwarves suite include @command{pahole}, that can be used to
3576find alignment holes in structures and classes in languages such as C, C++,
3577but not limited to these. These tools can also be used to encode and read the
3578BTF type information format used with the kernel Linux @code{bpf} syscall.
3579
3580The @command{codiff} command can be used to compare the effects changes in
3581source code generate on the resulting binaries.
3582
3583The @command{pfunct} command can be used to find all sorts of information
3584about functions, inlines, decisions made by the compiler about inlining, etc.
3585
3586The @command{pahole} command can be used to use all this type information to
3587pretty print raw data according to command line directions.
3588
3589Headers can have its data format described from debugging info and offsets from
3590it can be used to further format a number of records.
3591
3592Finally, the @command{btfdiff} command can be used to compare the output of
3593pahole from BTF and DWARF, to make sure they produce the same results.")
3594 (license license:gpl2+)))
3595
3596(define-public fbset
3597 (package
3598 (name "fbset")
3599 (version "2.1")
3600 (source
3601 (origin
3602 (method url-fetch)
3603 (uri (string-append "http://users.telenet.be/geertu/Linux/fbdev/fbset-"
3604 version ".tar.gz"))
3605 (sha256
3606 (base32 "080wnisi0jq7dp0jcwdp83rq8q8s3kw41vc712516xbv4jq4mzs0"))))
3607 (build-system gnu-build-system)
3608 (arguments
3609 '(#:modules ((guix build gnu-build-system)
3610 (guix build utils)
3611 (srfi srfi-26))
3612 #:phases
3613 (modify-phases %standard-phases
3614 (delete 'configure) ; no configure script
3615 (add-before 'install 'pre-install
3616 (lambda* (#:key outputs #:allow-other-keys)
3617 (let ((out (assoc-ref outputs "out")))
3618 (substitute* "Makefile"
3619 (("mknod ") "true ")
3620 ;; The Makefile doesn't honour PREFIX or similar.
3621 (("/usr") out))
3622 (mkdir out)
3623 (with-directory-excursion out
3624 (for-each mkdir-p (list "sbin"
3625 "man/man5"
3626 "man/man8")))
3627 #t)))
3628 (add-after 'install 'install-fb.modes
3629 (lambda* (#:key outputs #:allow-other-keys)
3630 (let* ((out (assoc-ref outputs "out"))
3631 (etc (string-append out "/etc")))
3632 (for-each (cut install-file <> etc)
3633 (find-files "etc" "^fb\\.modes"))
3634 (symlink "fb.modes.ATI"
3635 (string-append etc "/fb.modes"))
3636 #t))))
3637 ;; Parallel building races to create modes.tab.c.
3638 #:parallel-build? #f
3639 #:tests? #f)) ; no test suite
3640 (native-inputs
3641 (list bison flex))
3642 (home-page "http://users.telenet.be/geertu/Linux/fbdev/")
3643 (synopsis "Show and modify Linux frame buffer settings")
3644 (description
3645 "The kernel Linux's @dfn{frame buffers} provide a simple interface to
3646different kinds of graphic displays. The @command{fbset} utility can query and
3647change various device settings such as depth, virtual resolution, and timing
3648parameters.")
3649 (license license:gpl2)))
3650
3651(define-public procps
3652 (package
3653 (name "procps")
3654 (version "4.0.3")
3655 (source (origin
3656 (method url-fetch)
3657 (uri (string-append "mirror://sourceforge/procps-ng/Production/"
3658 "procps-ng-" version ".tar.xz"))
3659 (sha256
3660 (base32
3661 "14ms9mkqr1mgl3h5yl6w8m57cf39k382nv7qms78vqbaz728wg1h"))
3662 (patches (search-patches "procps-strtod-test.patch"))))
3663 (build-system gnu-build-system)
3664 (arguments
3665 (list #:modules '((guix build utils)
3666 (guix build gnu-build-system)
3667 (srfi srfi-1)
3668 (srfi srfi-26))
3669 #:configure-flags
3670 (if (%current-target-system)
3671 #~'("ac_cv_func_malloc_0_nonnull=yes"
3672 "ac_cv_func_realloc_0_nonnull=yes")
3673 #~'())
3674 #:phases
3675 #~(modify-phases %standard-phases
3676 (add-after 'install 'post-install
3677 ;; Remove commands and man pages redudant with
3678 ;; Coreutils.
3679 (lambda* (#:key outputs #:allow-other-keys)
3680 (let* ((out #$output)
3681 (dup (append-map (cut find-files out <>)
3682 '("^kill" "^uptime"))))
3683 (for-each delete-file dup))))
3684 #$@(if (system-hurd?)
3685 #~((add-after 'unpack 'skip-tests
3686 (lambda _
3687 (substitute* "library/tests/test_version.c"
3688 (("^int main\\(.*" all)
3689 (string-append all "{\n exit (77);//"))))))
3690 #~()))))
3691 (inputs (list ncurses))
3692 (native-inputs (list pkg-config))
3693 (home-page "https://gitlab.com/procps-ng/procps/")
3694 (synopsis "Utilities that give information about processes")
3695 (description
3696 "Procps is the package that has a bunch of small useful utilities
3697that give information about processes using the Linux /proc file system.
3698The package includes the programs free, pgrep, pidof, pkill, pmap, ps, pwdx,
3699slabtop, tload, top, vmstat, w, watch and sysctl.")
3700 (properties '((upstream-name . "procps-ng")))
3701 (license license:gpl2)))
3702
3703(define-public usbutils
3704 (package
3705 (name "usbutils")
3706 (version "018")
3707 (source
3708 (origin
3709 (method url-fetch)
3710 (uri (string-append "mirror://kernel.org/linux/utils/usb/usbutils/"
3711 "usbutils-" version ".tar.xz"))
3712 (sha256
3713 (base32 "14xd7j9fl3pm0z4dhqj3mf9paqk431kq4vi602f5hiw5nmcqpxl3"))))
3714 (build-system meson-build-system)
3715 (outputs (list "out" "python"))
3716 (arguments
3717 (list
3718 #:phases
3719 #~(modify-phases %standard-phases
3720 (add-after 'install 'separate-python-output
3721 ;; Separating one Python script shaves more than 106 MiB from :out.
3722 (lambda _
3723 (for-each (lambda (file)
3724 (let ((old (string-append #$output "/" file))
3725 (new (string-append #$output:python "/" file)))
3726 (mkdir-p (dirname new))
3727 (rename-file old new)))
3728 (list "bin/lsusb.py"))))
3729 (add-after 'install 'install-usbreset
3730 (lambda _
3731 (install-file "usbreset"
3732 (string-append #$output "/bin")))))))
3733 (native-inputs (list pkg-config))
3734 (inputs (list eudev libusb python))
3735 (home-page "http://www.linux-usb.org/")
3736 (synopsis
3737 "Tools for working with USB devices")
3738 (description
3739 "Collection of tools to query what type of USB devices are connected to
3740the system, including @command{lsusb}. The experimental @command{usbreset}
3741command included in the package, but be aware that it may not work for all
3742devices.")
3743 (license license:gpl2+)))
3744
3745(define-public usbip-utils
3746 (package
3747 (name "usbip-utils")
3748 (version (package-version linux-libre))
3749 (source (package-source linux-libre))
3750 (build-system gnu-build-system)
3751 (arguments
3752 '(#:configure-flags '("--disable-static")
3753 #:phases (modify-phases %standard-phases
3754 (add-after 'unpack 'enter-subdirectory
3755 (lambda _
3756 (chdir "tools/usb/usbip")
3757 #t)))))
3758 (native-inputs
3759 `(("automake" ,automake)
3760 ("autoreconf" ,autoconf)
3761 ("libtool" ,libtool)))
3762 (inputs (list eudev))
3763 (home-page (package-home-page linux-libre))
3764 (synopsis "Utilities for sharing USB devices over IP networks")
3765 (description
3766 "The USB/IP protocol enables to pass USB device from a server to
3767a client over the network. The server is a machine which shares an
3768USB device and the client is a machine which uses USB device provided by
3769a server over the network. The USB device may be either physical device
3770connected to a server or software entity created on a server using USB
3771gadget subsystem. The usbip-utils are userspace tools to used to handle
3772connection and management on both side. The client needs the @file{vhci-hcd}
3773Linux kernel module and the server needs the @file{usbip_host} Linux kernel
3774module.")
3775 (license license:gpl2)))
3776
3777(define-public e2fsprogs
3778 (package
3779 (name "e2fsprogs")
3780 (version "1.47.2")
3781 (source (origin
3782 (method url-fetch)
3783 (uri (string-append
3784 "mirror://kernel.org/linux/kernel/people/tytso/"
3785 "e2fsprogs/v" version "/"
3786 "e2fsprogs-" version ".tar.xz"))
3787 (sha256
3788 (base32
3789 "0g76fhnyzr2awwybd6c16439l80r5dv4kbfaq7cr908fr9j2w908"))))
3790 (build-system gnu-build-system)
3791 (inputs
3792 `((,util-linux "lib") ,@(if (target-hurd?) '() (list fuse))))
3793 (native-inputs (list pkg-config
3794 texinfo ;for the libext2fs Info manual
3795 ;; For tests.
3796 perl
3797 procps))
3798 (arguments
3799 `(;; util-linux is the preferred source for some of the libraries and
3800 ;; commands, so disable them (see, e.g.,
3801 ;; <http://git.buildroot.net/buildroot/commit/?id=e1ffc2f791b33633>.)
3802 #:configure-flags (list "--disable-libblkid"
3803 "--disable-libuuid" "--disable-uuidd"
3804 "--disable-fsck"
3805
3806 ;; Use symlinks instead of hard links for
3807 ;; 'fsck.extN' etc. This makes the resulting nar
3808 ;; smaller and is preserved across copies.
3809 "--enable-symlink-install"
3810
3811 (string-append "LDFLAGS=-Wl,-rpath="
3812 (assoc-ref %outputs "out")
3813 "/lib")
3814
3815 ;; Install libext2fs et al.
3816 "--enable-elf-shlibs")
3817
3818 #:phases
3819 (modify-phases %standard-phases
3820 (add-before 'configure 'patch-shells
3821 (lambda _
3822 (substitute* "configure"
3823 (("/bin/sh (.*)parse-types.sh" _ dir)
3824 (string-append (which "sh") " " dir
3825 "parse-types.sh")))
3826 (substitute* "MCONFIG.in"
3827 (("INSTALL_SYMLINK = /bin/sh")
3828 "INSTALL_SYMLINK = sh"))
3829 (substitute* (find-files "." "^Makefile.in$")
3830 (("#!/bin/sh")
3831 (string-append "#!" (which "sh"))))))
3832 (add-after 'install 'install-libs
3833 (lambda* (#:key outputs #:allow-other-keys)
3834 (let* ((out (assoc-ref outputs "out"))
3835 (lib (string-append out "/lib")))
3836 (invoke "make" "install-libs")
3837
3838 ;; Make the .a writable so that 'strip' works.
3839 ;; Failing to do that, due to debug symbols, we
3840 ;; retain a reference to the final
3841 ;; linux-libre-headers, which refer to the
3842 ;; bootstrap binaries.
3843 (let ((archives (find-files lib "\\.a$")))
3844 (for-each (lambda (file)
3845 (chmod file #o666))
3846 archives)))))
3847 ,@(if (system-hurd?)
3848 '((add-after 'unpack 'skip-tests
3849 (lambda _
3850 (with-directory-excursion "tests"
3851 (for-each
3852 (lambda (directory)
3853 (delete-file-recursively directory))
3854 '("d_bad_ostype"
3855 "f_detect_junk"
3856 "f_extent_oobounds"
3857 "j_ext_long_revoke_trans"
3858 "j_ext_long_trans"
3859 "j_long_revoke_trans"
3860 "j_long_revoke_trans_mcsum_32bit"
3861 "j_long_revoke_trans_mcsum_64bit"
3862 "j_long_trans"
3863 "j_long_trans_mcsum_32bit"
3864 "j_long_trans_mcsum_64bit"
3865 "j_short_revoke_trans"
3866 "j_short_revoke_trans_mcsum_64bit"
3867 "j_short_trans_64bit"
3868 "j_short_trans"
3869 "j_short_trans_mcsum_64bit"
3870 "j_short_trans_old_csum"
3871 "j_short_trans_open_recover"
3872 "j_short_trans_recover"
3873 "j_short_trans_recover_mcsum_64bit"
3874 "j_short_uncommitted_trans"
3875 "j_short_uncommitted_trans_mcsum_64bit"
3876 "m_error_behavior"
3877 "m_minrootdir"
3878 "m_rootdir"
3879 "r_32to64bit_expand_full"
3880 "r_expand_full"
3881 "r_fixup_lastbg_big"
3882 "t_change_uuid"
3883 "t_change_uuid_mcsum"
3884 "t_change_uuid_mcsum_mounted"
3885 "t_change_uuid_mcsum_seed_mounted"
3886 "t_change_uuid_mounted"
3887 "t_disable_changed_csum_seed"
3888 "t_disable_changed_csum_seed_mounted"
3889 "t_disable_csum_seed"
3890 "t_disable_meta_csum_and_seed"
3891 "t_enable_csum_seed"
3892 "t_format_csum_seed"
3893 "t_replay_and_set"
3894 "u_compound_rollback"
3895 "u_corrupt_blk_csum"
3896 "u_corrupt_blk_csum_force"
3897 "u_corrupt_key_csum"
3898 "u_debugfs_opt"
3899 "u_dryrun"
3900 "u_e2fsck_opt"
3901 "u_errorout"
3902 "u_force"
3903 "u_force_dryrun"
3904 "u_incomplete"
3905 "u_mke2fs_opt"
3906 "u_mke2fs_opt_oddsize"
3907 "u_offset"
3908 "u_onefile_bad"
3909 "u_resize2fs_opt"
3910 "u_revert_64bitmcsum_onefile"
3911 "u_revert_all_onefile"
3912 "u_revert_upgrade_to_64bitmcsum"
3913 "u_tune2fs_opt"
3914 "u_undo_undo"
3915 "u_wrong_fs"))))))
3916 '()))))
3917 (home-page "https://e2fsprogs.sourceforge.net/")
3918 (synopsis "Creating and checking ext2/ext3/ext4 file systems")
3919 (description
3920 "This package provides tools for manipulating ext2/ext3/ext4 file systems.")
3921 (license (list license:gpl2 ;programs
3922 license:lgpl2.0 ;libext2fs
3923 license:x11)))) ;libuuid
3924
3925(define e2fsprogs/static
3926 (static-package
3927 (package (inherit e2fsprogs)
3928 (arguments
3929 ;; Do not build shared libraries.
3930 (substitute-keyword-arguments arguments
3931 ((#:configure-flags _)
3932 '(list "--disable-blkid" "--disable-fuse2fs"))
3933 ((#:make-flags _)
3934 '(list)))))))
3935
3936(define-public e2fsck/static
3937 (package
3938 (name "e2fsck-static")
3939 (version (package-version e2fsprogs))
3940 (build-system trivial-build-system)
3941 (source #f)
3942 (inputs
3943 (list e2fsprogs/static))
3944 (arguments
3945 `(#:modules ((guix build utils))
3946 #:builder
3947 (begin
3948 (use-modules (guix build utils)
3949 (ice-9 ftw)
3950 (srfi srfi-26))
3951
3952 (let ((e2fsck (search-input-file %build-inputs "/sbin/e2fsck"))
3953 (bin (string-append (assoc-ref %outputs "out") "/sbin")))
3954 (mkdir-p bin)
3955 (with-directory-excursion bin
3956 (copy-file e2fsck "e2fsck")
3957 (remove-store-references "e2fsck")
3958 (chmod "e2fsck" #o555))
3959 #t))))
3960 (home-page (package-home-page e2fsprogs))
3961 (synopsis "Statically-linked e2fsck command from e2fsprogs")
3962 (description "This package provides statically-linked e2fsck command taken
3963from the e2fsprogs package. It is meant to be used in initrds.")
3964 (license (package-license e2fsprogs))))
3965
3966(define-public extundelete
3967 (package
3968 (name "extundelete")
3969 (version "0.2.4")
3970 (source
3971 (origin
3972 (method url-fetch)
3973 (uri (string-append "mirror://sourceforge/extundelete/"
3974 "extundelete/" version "/extundelete-"
3975 version ".tar.bz2"))
3976 (sha256
3977 (base32
3978 "1x0r7ylxlp9lbj3d7sqf6j2a222dwy2nfpff05jd6mkh4ihxvyd1"))
3979 (patches (search-patches "extundelete-e2fsprogs-1.44.patch"))))
3980 (build-system gnu-build-system)
3981 (inputs (list e2fsprogs))
3982 (home-page "https://extundelete.sourceforge.net/")
3983 (synopsis "Recover deleted files from ext2/3/4 partitions")
3984 (description
3985 "Extundelete is a set of tools that can recover deleted files from an
3986ext3 or ext4 partition.")
3987 (license license:gpl2)))
3988
3989(define-public zerofree
3990 (package
3991 (name "zerofree")
3992 (version "1.1.1")
3993 (home-page "https://frippery.org/uml/")
3994 (source
3995 (origin
3996 (method url-fetch)
3997 (uri (string-append home-page name "-" version ".tgz"))
3998 (sha256
3999 (base32 "0rrqfa5z103ws89vi8kfvbks1cfs74ix6n1wb6vs582vnmhwhswm"))))
4000 (build-system gnu-build-system)
4001 (arguments
4002 (list
4003 #:tests? #f ;no tests
4004 #:phases
4005 #~(modify-phases %standard-phases
4006 (delete 'configure) ;no configure script
4007 (replace 'install
4008 ;; The Makefile lacks an ‘install’ target.
4009 (lambda _
4010 (chmod "zerofree" #o555)
4011 (install-file "zerofree" (string-append #$output "/bin")))))))
4012 (inputs (list e2fsprogs))
4013 (synopsis "Zero non-allocated regions in ext2/ext3/ext4 file systems")
4014 (description
4015 "Zerofree finds the unallocated blocks with non-zero value content in an
4016ext2, ext3, or ext4 file system and fills them with zeroes (or another value).
4017This is a simple way to make disk images more compressible.
4018Zerofree requires the file system to be unmounted or mounted read-only.")
4019 (license license:gpl2)))
4020
4021(define-public strace
4022 (package
4023 (name "strace")
4024 (version "7.0")
4025 (source
4026 (origin
4027 (method git-fetch)
4028 (uri (git-reference
4029 (url "https://github.com/strace/strace")
4030 (commit (string-append "v" version))))
4031 (file-name (git-file-name name version))
4032 (sha256
4033 (base32 "1rrcak1kg2w2dc7dbj6vfyp6a3j0ad7b2jrv6wmkw8h9p8zscx02"))
4034 (patches (search-patches "strace-readlink-tests.patch"))))
4035 (build-system gnu-build-system)
4036 (arguments
4037 (list
4038 #:phases
4039 #~(modify-phases %standard-phases
4040 ;; Needed for the 'bootstrap phase.
4041 (add-after 'unpack 'patch-source-shebangs-initial
4042 (assoc-ref %standard-phases 'patch-source-shebangs))
4043 (add-after 'unpack 'patch-test-shebangs
4044 (lambda _
4045 (substitute* '("tests/detach-vfork.test"
4046 "tests/gen_tests.sh"
4047 "tests/kill-on-exit.sh")
4048 (("#!/bin/sh")
4049 (string-append "#!" (which "sh")))))))
4050 #:configure-flags
4051 ''("--with-libunwind"
4052 ;; Don't fail if the architecture doesn't support different
4053 ;; personalities.
4054 "--enable-mpers=check")
4055 ;; See <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=32459>.
4056 #:parallel-tests? #f)) ; undeterministic failures
4057 (inputs (list libunwind))
4058 (native-inputs
4059 (list autoconf
4060 automake
4061 perl
4062 m4
4063 ;; For some tests
4064 util-linux))
4065 (home-page "https://strace.io")
4066 (synopsis "System call tracer for Linux")
4067 (description
4068 "strace is a system call tracer, i.e. a debugging tool which prints out a
4069trace of all the system calls made by a another process/program.")
4070 (license license:lgpl2.1+)))
4071
4072(define-public ltrace
4073 (package
4074 (name "ltrace")
4075 (version "0.7.3")
4076 (source (origin
4077 (method url-fetch)
4078 (uri (string-append "http://www.ltrace.org/ltrace_" version
4079 ".orig.tar.bz2"))
4080 (sha256
4081 (base32
4082 "00wmbdghqbz6x95m1mcdd3wd46l6hgcr4wggdp049dbifh3qqvqf"))))
4083 (build-system gnu-build-system)
4084 (arguments
4085 ;; Compilation uses -Werror by default, but it fails.
4086 (list #:configure-flags #~'("--disable-werror")))
4087 (inputs (list elfutils))
4088 (home-page "https://www.ltrace.org/")
4089 (synopsis "Library call tracer for Linux")
4090 (description
4091 "ltrace intercepts and records dynamic library calls which are called by
4092an executed process and the signals received by that process. It can also
4093intercept and print the system calls executed by the program.")
4094 (license license:gpl2+)))
4095
4096(define-public alsa-ucm-conf
4097 (package
4098 (name "alsa-ucm-conf")
4099 (version "1.2.11")
4100 (source (origin
4101 (method url-fetch)
4102 (uri (string-append
4103 "ftp://ftp.alsa-project.org/pub/lib/" name "-"
4104 version ".tar.bz2"))
4105 (sha256
4106 (base32
4107 "10dfzvrmpp9swflw47nxf35an6gj3ilb4wlggdnng8g2637h2z1q"))))
4108 (build-system copy-build-system)
4109 (arguments
4110 '(#:install-plan
4111 '(("ucm" "share/alsa/ucm")
4112 ("ucm2" "share/alsa/ucm2"))))
4113 (home-page "https://www.alsa-project.org/wiki/Main_Page")
4114 (synopsis "The Advanced Linux Sound Architecture Use Case Manager")
4115 (description
4116 "This package contains Advanced Linux Sound Architecture Use Case Manager
4117configuration of audio input/output names and routing for specific audio
4118hardware.")
4119 (license license:bsd-3)))
4120
4121(define-public alsa-topology-conf
4122 (package
4123 (name "alsa-topology-conf")
4124 (version "1.2.4")
4125 (source (origin
4126 (method url-fetch)
4127 (uri (string-append
4128 "ftp://ftp.alsa-project.org/pub/lib/" name "-"
4129 version ".tar.bz2"))
4130 (sha256
4131 (base32
4132 "01zdg6q4s6d01k39z96wi4vbhrfw1i2g4yi5dijwfk6a5vjfdq2m"))))
4133 (build-system copy-build-system)
4134 (arguments
4135 '(#:install-plan
4136 '(("topology" "share/alsa/topology"))))
4137 (home-page "https://www.alsa-project.org/wiki/Main_Page")
4138 (synopsis "The Advanced Linux Sound Architecture libraries")
4139 (description
4140 "This package contains Advanced Linux Sound Architecture topology
4141configuration files that can be used for specific audio hardware.")
4142 (license license:bsd-3)))
4143
4144(define-public alsa-lib
4145 (package
4146 (name "alsa-lib")
4147 (version "1.2.11")
4148 (source (origin
4149 (method url-fetch)
4150 (uri (string-append
4151 "https://www.alsa-project.org/files/pub/lib/"
4152 name "-" version ".tar.bz2"))
4153 (sha256
4154 (base32
4155 "0kdvjlknc50fwfdkxj0z12xbz21skb3gnwlh6lvsvycmp5ljygwz"))))
4156 (build-system gnu-build-system)
4157 (arguments
4158 '(#:configure-flags (list (string-append "LDFLAGS=-Wl,-rpath="
4159 (assoc-ref %outputs "out")
4160 "/lib"))
4161 #:phases
4162 (modify-phases %standard-phases
4163 (add-before 'install 'pre-install
4164 (lambda* (#:key inputs outputs #:allow-other-keys)
4165 (let* ((ucm
4166 (string-append (assoc-ref inputs "alsa-ucm-conf")))
4167 (topology
4168 (string-append (assoc-ref inputs "alsa-topology-conf")))
4169 (alsa
4170 (string-append (assoc-ref outputs "out") "/share/alsa"))
4171 (ucm-share
4172 (string-append ucm "/share/alsa/ucm"))
4173 (ucm2-share
4174 (string-append ucm "/share/alsa/ucm2"))
4175 (topology-share
4176 (string-append topology "/share/alsa/topology")))
4177 (mkdir-p alsa)
4178 (symlink ucm-share (string-append alsa "/ucm"))
4179 (symlink ucm2-share (string-append alsa "/ucm2"))
4180 (symlink topology-share (string-append alsa "/topology")))
4181 #t)))))
4182 (inputs
4183 (list alsa-ucm-conf alsa-topology-conf))
4184 (home-page "https://www.alsa-project.org/wiki/Main_Page")
4185 (synopsis "The Advanced Linux Sound Architecture libraries")
4186 (description
4187 "The Advanced Linux Sound Architecture (ALSA) provides audio and
4188MIDI functionality to the Linux-based operating system.")
4189 (license license:lgpl2.1+)))
4190
4191(define-public alsa-utils
4192 (package
4193 (name "alsa-utils")
4194 (version "1.2.11")
4195 (source (origin
4196 (method url-fetch)
4197 (uri (string-append
4198 "https://www.alsa-project.org/files/pub/utils/"
4199 name "-" version ".tar.bz2"))
4200 (sha256
4201 (base32
4202 "19r8qi6b7sd2p1mhxfqrp18wrgjw5s6rp5ygimb1w59zi0xcmils"))))
4203 (build-system gnu-build-system)
4204 (arguments
4205 (list
4206 #:configure-flags
4207 #~(list
4208 ;; The udev rule is responsible for restoring the volume.
4209 (string-append "--with-udev-rules-dir=" #$output "/lib/udev/rules.d"))
4210 #:phases
4211 #~(modify-phases %standard-phases
4212 (add-before 'install 'pre-install
4213 (lambda _
4214 ;; Don't try to mkdir /var/lib/alsa.
4215 (substitute* "Makefile"
4216 (("\\$\\(MKDIR_P\\) .*ASOUND_STATE_DIR.*")
4217 "true\n")))))))
4218 (native-inputs
4219 (list docbook-xml-4.2 docbook-xsl xmlto
4220 gettext-minimal))
4221 (inputs
4222 (list libsamplerate ncurses alsa-lib))
4223 (home-page "http://www.alsa-project.org/")
4224 (synopsis "Utilities for the Advanced Linux Sound Architecture (ALSA)")
4225 (description
4226 "The Advanced Linux Sound Architecture (ALSA) provides audio and
4227MIDI functionality to the Linux-based operating system.")
4228
4229 ;; This is mostly GPLv2+ but a few files such as 'alsactl.c' are
4230 ;; GPLv2-only.
4231 (license license:gpl2)))
4232
4233(define-public alsa-plugins
4234 (package
4235 (name "alsa-plugins")
4236 (version "1.2.2")
4237 (source (origin
4238 (method url-fetch)
4239 (uri (string-append "ftp://ftp.alsa-project.org/pub/plugins/"
4240 name "-" version ".tar.bz2"))
4241 (sha256
4242 (base32
4243 "0z9k3ssbfk2ky2w13avgyf202j1drsz9sv3834bp33cj1i2hc3qw"))))
4244 (build-system gnu-build-system)
4245 ;; TODO: Split libavcodec and speex if possible. It looks like they can not
4246 ;; be split, there are references to both in files.
4247 ;; TODO: Remove OSS related plugins, they add support to run native
4248 ;; ALSA applications on OSS however we do not offer OSS and OSS is
4249 ;; obsolete.
4250 (outputs '("out" "pulseaudio" "jack"))
4251 (native-search-paths
4252 (list (search-path-specification
4253 (variable "ALSA_PLUGIN_DIR")
4254 (files '("lib/alsa-lib"))
4255 (separator #f))))
4256 (arguments
4257 `(#:configure-flags '(;; Do not install a "local" configuration targeted
4258 ;; for /etc/alsa. On Guix System plugins are loaded from
4259 ;; the ALSA service, and other distributions likely
4260 ;; won't use these files.
4261 "--with-alsalconfdir=/tmp/noop")
4262 #:phases
4263 (modify-phases %standard-phases
4264 (add-after 'install 'split
4265 (lambda* (#:key inputs outputs #:allow-other-keys)
4266 ;; Distribute the binaries to the various outputs.
4267 (let* ((out (assoc-ref outputs "out"))
4268 (jack (assoc-ref outputs "jack"))
4269 (jacklib (string-append jack "/lib/alsa-lib"))
4270 (pua (assoc-ref outputs "pulseaudio"))
4271 (pualib (string-append pua "/lib/alsa-lib")))
4272 ;; For jack.
4273 (mkdir-p jacklib)
4274 (for-each (lambda (file)
4275 (rename-file file (string-append jacklib "/" (basename file))))
4276 (find-files out ".*jack\\.(la|so)"))
4277 ;; For pulseaudio.
4278 (mkdir-p pualib)
4279 (for-each (lambda (file)
4280 (rename-file file (string-append pualib "/" (basename file))))
4281 (find-files out ".*pulse\\.(la|so)"))
4282 #t))))))
4283 (inputs
4284 (list alsa-lib
4285 jack-1
4286 speex ; libspeexdsp resampling plugin
4287 libsamplerate ; libsamplerate resampling plugin
4288 ffmpeg ; libavcodec resampling plugin, a52 plugin
4289 pulseaudio)) ; PulseAudio plugin
4290 (native-inputs
4291 (list pkg-config))
4292 (home-page "http://www.alsa-project.org/")
4293 (synopsis "Plugins for the Advanced Linux Sound Architecture (ALSA)")
4294 (description
4295 "The Advanced Linux Sound Architecture (ALSA) provides audio and
4296MIDI functionality to the Linux-based operating system. This package enhances ALSA
4297by providing additional plugins which include: upmixing, downmixing, jackd and
4298pulseaudio support for native alsa applications, format conversion (s16 to a52), and
4299external rate conversion.")
4300 (license (list license:gpl2+
4301 ;; `rate/rate_samplerate.c': LGPL v2.1 or later.
4302 license:lgpl2.1+))))
4303
4304(define-public snd-rane-sl3
4305 (let ((commit "01099892261b55ec5ee814292d840eeb664c1904")
4306 (revision "0"))
4307 (package
4308 (name "snd-rane-sl3")
4309 (version (git-version "0" revision commit))
4310 (source
4311 (origin
4312 (method git-fetch)
4313 (uri (git-reference
4314 (url "https://github.com/nvgeele/snd-rane-sl3")
4315 (commit commit)))
4316 (file-name (git-file-name name version))
4317 (sha256
4318 (base32 "1j2aan5xmbi8hgkzzwjb7rarqh4g65rg3s1qd1c8x5m6fpqdnvli"))))
4319 (build-system linux-module-build-system)
4320 (arguments
4321 (list
4322 #:tests? #f ;No tests.
4323 #:phases
4324 #~(modify-phases %standard-phases
4325 (delete 'configure)
4326 (add-before 'build 'change-directory
4327 (lambda _
4328 (chdir "snd-rane-sl3"))))))
4329 (inputs (list linux-libre-headers))
4330 (home-page "https://github.com/nvgeele/snd-rane-sl3")
4331 (synopsis
4332 "Linux ALSA kernel driver for the Rane SL3 USB Audio interface")
4333 (description
4334 "snd-rane-sl3 provides a native Linux kernel module that
4335enables the Rane SL3 to work as a standard ALSA audio device, supporting 6
4336channels (3 stereo pairs) of 24-bit PCM audio at 44.1kHz and 48kHz sample
4337rates.")
4338 (license license:gpl3))))
4339
4340(define-public iptables
4341 (package
4342 (name "iptables")
4343 (version "1.8.11")
4344 (source
4345 (origin
4346 (method url-fetch)
4347 (uri (list (string-append "mirror://netfilter.org/iptables/iptables-"
4348 version ".tar.xz")))
4349 (sha256
4350 (base32 "1cp7kw0d3fpmfmbl4adh88v02wnj4s5rfgyxsk52pjgqbvah6wyq"))))
4351 (build-system gnu-build-system)
4352 (native-inputs
4353 (list pkg-config flex bison))
4354 (inputs
4355 (list libmnl libnftnl/pinned))
4356 (arguments
4357 (list #:tests? #f ; no test suite
4358 #:configure-flags ; add $libdir to the RUNPATH of executables
4359 #~(list (string-append "LDFLAGS=-Wl,-rpath=" #$output "/lib"))))
4360 (home-page "https://www.netfilter.org/projects/iptables/index.html")
4361 (synopsis "Programs to configure Linux IP packet filtering rules")
4362 (description
4363 "@command{iptables} is the user-space command line program used to
4364configure the Linux 2.4.x and later IPv4 packet filtering ruleset
4365(@dfn{firewall}), including @dfn{NAT} (Network Address Translation).
4366
4367This package also includes @command{ip6tables}, which is used to configure the
4368IPv6 packet filter.
4369
4370Both commands are targeted at system administrators.")
4371 (properties
4372 '((release-monitoring-url . "https://www.netfilter.org/pub/iptables/")))
4373 (license license:gpl2+)))
4374
4375(define-public iptables-nft
4376 (package
4377 (inherit iptables)
4378 (name "iptables-nft")
4379 (source #f)
4380 (build-system copy-build-system)
4381 (arguments
4382 (list
4383 #:phases
4384 #~(modify-phases %standard-phases
4385 (delete 'unpack)
4386 (replace 'install
4387 (lambda* (#:key inputs #:allow-other-keys)
4388 (for-each
4389 (lambda (command-path)
4390 (let ((link-path (string-append #$output command-path)))
4391 (mkdir-p (dirname link-path))
4392 (symlink (search-input-file inputs "sbin/xtables-nft-multi")
4393 link-path)))
4394 (apply append
4395 '("/bin/iptables-xml")
4396 (map (lambda (xtables)
4397 (list (string-append "/sbin/" xtables)
4398 (string-append "/sbin/" xtables "-restore")
4399 (string-append "/sbin/" xtables "-save")))
4400 '("arptables"
4401 "ebtables"
4402 "iptables"
4403 "ip6tables")))))))))
4404 (inputs (list iptables))
4405 (native-inputs '())
4406 (synopsis
4407 "Programs to configure Linux IP packet filtering rules (nftables API)")))
4408
4409(define-public irqbalance
4410 (package
4411 (name "irqbalance")
4412 (version "1.9.4")
4413 (source
4414 (origin
4415 (method git-fetch)
4416 (uri (git-reference
4417 (url "https://github.com/irqbalance/irqbalance")
4418 (commit (string-append "v" version))))
4419 (file-name (git-file-name name version))
4420 (sha256
4421 (base32 "1jswxr0jcxz83j1nanl6xaxpw001l0hfb2xvvy2k970g1g1kpszd"))))
4422 (build-system gnu-build-system)
4423 (inputs (list glib ncurses libnl libcap-ng))
4424 (native-inputs (list autoconf automake libtool pkg-config))
4425 (home-page "https://irqbalance.github.io/irqbalance/")
4426 (synopsis "Daemon used to load balance CPU interrupts")
4427 (description
4428 "Irqbalance is a daemon to help balance the CPU load generated by
4429interrupts across all of a systems CPUs. Irqbalance identifies the highest
4430volume interrupt sources, and isolates each of them to a single unique CPU, so
4431that load is spread as much as possible over an entire processor set, while
4432minimizing cache miss rates for irq handlers.")
4433 (license license:gpl2)))
4434
4435(define-public bolt
4436 (package
4437 (name "bolt")
4438 (version "0.9.10")
4439 (source (origin
4440 (method git-fetch)
4441 (uri (git-reference
4442 (url "https://gitlab.freedesktop.org/bolt/bolt")
4443 (commit version)))
4444 (file-name (git-file-name name version))
4445 (sha256
4446 (base32
4447 "1vw4vzyhkpm73snnfciy7x88ja72cv5isc27k91jvmy2350b29yx"))))
4448 (build-system meson-build-system)
4449 (arguments
4450 (list #:configure-flags '(list "--localstatedir=/var")
4451 #:glib-or-gtk? #t ;To wrap binaries and/or compile schemas
4452 #:phases #~(modify-phases %standard-phases
4453 (add-after 'unpack 'replace-directories
4454 (lambda* (#:key outputs #:allow-other-keys)
4455 (substitute* "meson.build"
4456 (("udev.get_variable\\(pkgconfig: 'udevdir'\\)")
4457 (string-append "'" #$output "/lib/udev'"))
4458 ;; Don't install in /var
4459 (("not systemd\\.found\\(\\)")
4460 "false"))))
4461 (add-before 'install 'no-polkit-magic
4462 (lambda* (#:key outputs #:allow-other-keys)
4463 (setenv "PKEXEC_UID" "something"))))))
4464 (native-inputs (list pkg-config
4465 `(,glib "bin") python asciidoc umockdev))
4466 (inputs (list eudev dbus polkit))
4467 (synopsis "Thunderbolt 3 device manager")
4468 (description
4469 "This package provides @command{boltd}, a userspace daemon
4470for Thunderbolt devices, and @command{boltctl}, a command-line utility for
4471managing those devices.
4472
4473The daemon @command{boltd} exposes devices via D-Bus to clients. It also
4474stores a database of previously authorized devices and will, depending on the
4475policy set for the individual devices, automatically authorize newly connected
4476devices without user interaction.
4477
4478The command-line utility @command{boltctl} manages Thunderbolt devices via
4479@command{boltd}. It can list devices, monitor changes, and initiate
4480authorization of devices.")
4481 (home-page "https://gitlab.freedesktop.org/bolt/bolt")
4482 (properties `((lint-hidden-cpe-vendors . ("boltcms" "puppet"))))
4483 (license license:gpl2+)))
4484
4485(define-public jitterentropy-rngd
4486 (package
4487 (name "jitterentropy-rngd")
4488 (version "1.2.8")
4489 (source
4490 (origin
4491 (method git-fetch)
4492 (uri (git-reference
4493 (url "https://github.com/smuellerDD/jitterentropy-rngd")
4494 (commit (string-append "v" version))))
4495 (file-name (git-file-name name version))
4496 (sha256
4497 (base32 "13br8s6gqnfc844ps38ya5nny3pndsmskszv3dsp1cxcgvmscg1c"))))
4498 (build-system gnu-build-system)
4499 (arguments
4500 (list
4501 #:tests? #f ; no test suite
4502 #:make-flags
4503 #~(list (string-append "CC=" #$(cc-for-target))
4504 (string-append "PREFIX=" #$output)
4505 "UNITDIR=$(PREFIX)/lib/systemd/system")
4506 #:phases
4507 #~(modify-phases %standard-phases
4508 (delete 'configure)))) ; no ./configure script
4509 (home-page "https://www.chronox.de/jent.html")
4510 (synopsis "CPU jitter random number generator daemon")
4511 (description
4512 "This simple daemon feeds entropy from the CPU Jitter @acronym{RNG, random
4513number generator} core to the kernel Linux's entropy estimator. This prevents
4514the @file{/dev/random} device from blocking and should benefit users of the
4515preferred @file{/dev/urandom} and @code{getrandom()} interfaces too.
4516
4517The CPU Jitter RNG itself is part of the kernel and claims to provide good
4518entropy by collecting and magnifying differences in CPU execution time as
4519measured by the high-resolution timer built into modern CPUs. It requires no
4520additional hardware or external entropy source.
4521
4522The random bit stream generated by @command{jitterentropy-rngd} is not processed
4523by a cryptographically secure whitening function. Nonetheless, its authors
4524believe it to be a suitable source of cryptographically secure key material or
4525other cryptographically sensitive data.
4526
4527If you agree with them, start this daemon as early as possible to provide
4528properly seeded random numbers to services like SSH or those using TLS during
4529early boot when entropy may be low, especially in virtualised environments.")
4530 (license (list license:bsd-3 ; or
4531 license:gpl2+))))
4532
4533(define-public ebtables
4534 (package
4535 (name "ebtables")
4536 (version "2.0.11")
4537 (source (origin
4538 (method url-fetch)
4539 (uri (string-append
4540 "mirror://netfilter.org/ebtables/ebtables-"
4541 version ".tar.gz"))
4542 (sha256
4543 (base32
4544 "0apxgmkhsk3vxn9q3libxn3dgrdljrxyy4mli2gk49m7hi3na7xp"))))
4545 (build-system gnu-build-system)
4546 (inputs
4547 (list perl iptables))
4548 (synopsis "Ethernet bridge frame table administration")
4549 (home-page "https://ebtables.netfilter.org/")
4550 (description
4551 "ebtables is an application program used to set up and maintain the
4552tables of rules (inside the Linux kernel) that inspect Ethernet frames. It is
4553analogous to the iptables application, but less complicated, due to the fact
4554that the Ethernet protocol is much simpler than the IP protocol.")
4555 (license license:gpl2+)))
4556
4557(define-public iproute
4558 (package
4559 (name "iproute2")
4560 (version "6.4.0")
4561 (source (origin
4562 (method url-fetch)
4563 (uri (string-append
4564 "mirror://kernel.org/linux/utils/net/iproute2/iproute2-"
4565 version ".tar.xz"))
4566 (sha256
4567 (base32
4568 "0wm2g70vfhnf8wb6py3zmzwxp4zv1icny1pvkwaxmr67rggbhlac"))))
4569 (build-system gnu-build-system)
4570 (arguments
4571 (list
4572 ;; There is a test suite, but it wants network namespaces and sudo.
4573 #:tests? #f
4574 #:make-flags
4575 #~(let ((out #$output))
4576 (list (string-append "CC=" #$(cc-for-target))
4577 "HOSTCC=gcc"
4578 (string-append "BASH_COMPDIR=" out
4579 "/etc/bash_completion.d")
4580 (string-append "LIBDIR=" out "/lib")
4581 (string-append "HDRDIR=" out "/include")
4582 (string-append "SBINDIR=" out "/sbin")
4583 (string-append "CONFDIR=" out "/etc")
4584 (string-append "MANDIR=" out "/share/man")
4585 #$@(if (target-ppc64le?)
4586 '("CCOPTS=-O2 -pipe -Wno-incompatible-pointer-types")
4587 '())))
4588 #:phases
4589 #~(modify-phases %standard-phases
4590 (replace 'configure
4591 (lambda* (#:key (configure-flags #~'()) #:allow-other-keys)
4592 ;; The configure script does not understand some of the
4593 ;; default options of gnu-build-system.
4594 (setenv "PKG_CONFIG" #$(pkg-config-for-target))
4595 (apply invoke "./configure"
4596 "--prefix" #$output
4597 configure-flags)))
4598 (add-before 'install 'pre-install
4599 (lambda _
4600 ;; Don't attempt to create /var/lib/arpd.
4601 (substitute* "Makefile"
4602 (("^.*ARPDDIR.*$") "")))))))
4603 (inputs
4604 (list bdb iptables libmnl))
4605 (native-inputs
4606 (list bison flex pkg-config))
4607 ;; For tests.
4608 ;; ("libmnl" ,libmnl)
4609 ;; ("util-linux" ,util-linux)
4610 (home-page
4611 "https://wiki.linuxfoundation.org/networking/iproute2")
4612 (synopsis
4613 "Utilities for controlling TCP/IP networking and traffic in Linux")
4614 (description
4615 "Iproute2 is a collection of utilities for controlling TCP/IP networking
4616and traffic with the Linux kernel. The most important of these are
4617@command{ip}, which configures IPv4 and IPv6, and @command{tc} for traffic
4618control.
4619
4620Most network configuration manuals still refer to ifconfig and route as the
4621primary network configuration tools, but ifconfig is known to behave
4622inadequately in modern network environments, and both should be deprecated.")
4623 (license license:gpl2+)))
4624
4625(define-public net-tools
4626 ;; XXX: This package is basically unmaintained, but it provides a few
4627 ;; commands not yet provided by Inetutils, such as 'route', so we have to
4628 ;; live with it.
4629 (let ((commit "479bb4a7e11a4084e2935c0a576388f92469225b")
4630 (revision "0"))
4631 (package
4632 (name "net-tools")
4633 (version (string-append "1.60-" revision "." (string-take commit 7)))
4634 (source (origin
4635 (method url-fetch)
4636 (uri (string-append "https://sourceforge.net/code-snapshots/git/"
4637 "n/ne/net-tools/code.git/net-tools-code-"
4638 commit ".zip"))
4639 (file-name (string-append name "-" version ".zip"))
4640 (sha256
4641 (base32
4642 "0hz9fda9d78spp774b6rr5xaxav7cm4h0qcpxf70rvdbrf6qx7vy"))))
4643 (home-page "https://net-tools.sourceforge.net/")
4644 (build-system gnu-build-system)
4645 (arguments
4646 `(#:modules ((guix build gnu-build-system)
4647 (guix build utils)
4648 (srfi srfi-1)
4649 (srfi srfi-26))
4650 #:phases
4651 (modify-phases %standard-phases
4652 (replace 'configure
4653 (lambda* (#:key outputs #:allow-other-keys)
4654 (let ((out (assoc-ref outputs "out")))
4655 (mkdir-p (string-append out "/bin"))
4656 (mkdir-p (string-append out "/sbin"))
4657
4658 ;; Pretend we have everything...
4659 (system "yes | make config")
4660
4661 ;; ... except for the things we don't have.
4662 ;; HAVE_AFDECnet requires libdnet, which we don't have.
4663 ;; HAVE_HWSTRIP and HAVE_HWTR require kernel headers
4664 ;; that have been removed.
4665 ;; XXX SELINUX and AFBLUETOOTH are removed for now, but we should
4666 ;; think about adding them later.
4667 (substitute* '("config.make" "config.h")
4668 (("^.*HAVE_(AFDECnet|HWSTRIP|HWTR|SELINUX|AFBLUETOOTH)[ =]1.*$")
4669 ""))
4670 #t)))
4671 (add-after 'install 'remove-redundant-commands
4672 (lambda* (#:key outputs #:allow-other-keys)
4673 ;; Remove commands and man pages redundant with Inetutils.
4674 (let* ((out (assoc-ref outputs "out"))
4675 (dup (append-map (cut find-files out <>)
4676 '("^hostname"
4677 "^(yp|nis|dns)?domainname"))))
4678 (for-each delete-file dup)
4679 #t))))
4680 ;; Binaries that depend on libnet-tools.a don't declare that
4681 ;; dependency, making it parallel-unsafe.
4682 #:parallel-build? #f
4683
4684 #:tests? #f ; no test suite
4685 #:make-flags (let ((out (assoc-ref %outputs "out")))
4686 (list ,(string-append "CC=" (cc-for-target))
4687 (string-append "BASEDIR=" out)
4688 (string-append "INSTALLNLSDIR=" out "/share/locale")
4689 (string-append "mandir=/share/man")))))
4690 (native-inputs `(("gettext" ,gettext-minimal)
4691 ("unzip" ,unzip)))
4692 (supported-systems (remove target-hurd? %supported-systems))
4693 (synopsis "Tools for controlling the network subsystem in Linux")
4694 (description
4695 "This package includes the important tools for controlling the network
4696subsystem of the Linux kernel. This includes arp, ifconfig, netstat, rarp and
4697route. Additionally, this package contains utilities relating to particular
4698network hardware types (plipconfig, slattach) and advanced aspects of IP
4699configuration (iptunnel, ipmaddr).")
4700 (license license:gpl2+))))
4701
4702(define-public libcap
4703 (package
4704 (name "libcap")
4705 (version "2.64")
4706 (source (origin
4707 (method url-fetch)
4708 (uri (string-append
4709 "mirror://kernel.org/linux/libs/security/linux-privs/"
4710 "libcap2/libcap-" version ".tar.xz"))
4711 (sha256
4712 (base32
4713 "04qy0z6yhlljb29xxcb2srbdnymcrhsi28wrc705z3861cgmwin8"))))
4714 (build-system gnu-build-system)
4715 (arguments
4716 (list #:phases
4717 #~(modify-phases %standard-phases
4718 (delete 'configure)
4719 #$@(if (target-ppc32?)
4720 #~((add-after 'unpack 'apply-patch
4721 (lambda _
4722 (let ((patch
4723 #$(local-file
4724 (search-patch
4725 "libcap-magic-glibc-constant.patch"))))
4726 (invoke "patch" "--force" "-p1" "-i" patch)))))
4727 #~()))
4728 #:test-target "test"
4729 #:make-flags
4730 #~(list "lib=lib"
4731 (string-append "prefix=" #$output)
4732 (string-append "LDFLAGS=-Wl,-rpath=" #$output "/lib")
4733 "RAISE_SETFCAP=no"
4734 ;; Tell the makefile to use TARGET-gcc and friends
4735 ;; when cross-compiling.
4736 #$@(if (%current-target-system)
4737 `((string-append "CROSS_COMPILE="
4738 ,(%current-target-system) "-")
4739 "BUILD_CC=gcc")
4740 '()))))
4741 (native-inputs (list perl))
4742 (supported-systems (remove target-hurd? %supported-systems))
4743 (home-page "https://sites.google.com/site/fullycapable/")
4744 (synopsis "Library for working with POSIX capabilities")
4745 (description
4746 "Libcap2 provides a programming interface to POSIX capabilities on
4747Linux-based operating systems.")
4748
4749 ;; License is BSD-3 or GPLv2, at the user's choice.
4750 (license (list license:bsd-3 license:gpl2))))
4751
4752(define-public bridge-utils
4753 (package
4754 (name "bridge-utils")
4755 (version "1.7.1")
4756 (source
4757 (origin
4758 (method url-fetch)
4759 (uri (string-append "mirror://kernel.org/linux/utils/net/"
4760 "bridge-utils/bridge-utils-" version ".tar.xz"))
4761 (sha256
4762 (base32 "03p6cmhm6cqhnfsfa1wv7frhb361y12daf7gr1h5qh51y7j8n7d6"))))
4763 (build-system gnu-build-system)
4764
4765 ;; The tarball lacks all the generated files.
4766 (native-inputs (list autoconf automake))
4767 (arguments
4768 '(#:tests? #f)) ; no 'check' target
4769
4770 (home-page "https://wiki.linuxfoundation.org/networking/bridge")
4771 (synopsis "Manipulate Ethernet bridges")
4772 (description
4773 "Utilities for Linux's Ethernet bridging facilities. A bridge is a way
4774to connect two Ethernet segments together in a protocol independent way.
4775Packets are forwarded based on Ethernet address, rather than IP address (like
4776a router). Since forwarding is done at Layer 2, all protocols can go
4777transparently through a bridge.")
4778 (license license:gpl2+)))
4779
4780(define-public libnl
4781 (package
4782 (name "libnl")
4783 (version "3.12.0")
4784 (source (origin
4785 (method url-fetch)
4786 (uri (string-append
4787 "https://github.com/thom311/libnl/releases/download/"
4788 "libnl" (string-join (string-split version #\.) "_")
4789 "/libnl-" version ".tar.gz"))
4790 (sha256
4791 (base32
4792 "066xq01y2mx0xi7bwa5y6ciw1ygla15qdlzzyvyzb8zijrqwllgw"))))
4793 (build-system gnu-build-system)
4794 (native-inputs
4795 `(("bison" ,bison)
4796 ("flex" ,flex)
4797 ("pkg-config" ,pkg-config)
4798 ("swig" ,swig-4.0)
4799 ("libnl3-doc"
4800 ,(origin
4801 (method url-fetch)
4802 (uri (string-append
4803 "https://github.com/thom311/libnl/releases/download/libnl"
4804 (string-join (string-split version #\.) "_")
4805 "/libnl-doc-" version ".tar.gz"))
4806 (sha256
4807 (base32 "18f14pdycghy6fcd27faqgh19zpam6b45s8bgsk85kb9wwzq3yd4"))))))
4808 (outputs `("out" "doc"))
4809 (arguments
4810 `(#:phases
4811 (modify-phases %standard-phases
4812 (add-after 'install 'install-doc
4813 (lambda* (#:key inputs native-inputs outputs #:allow-other-keys)
4814 (let ((dest (string-append (assoc-ref outputs "doc")
4815 "/share/doc/libnl")))
4816 (mkdir-p dest)
4817 (invoke "tar" "xf" (assoc-ref
4818 (or native-inputs inputs)
4819 "libnl3-doc")
4820 "--strip-components=1" "-C" dest)))))))
4821 (home-page "https://www.infradead.org/~tgr/libnl/")
4822 (synopsis "NetLink protocol library suite")
4823 (description
4824 "The libnl suite is a collection of libraries providing APIs to netlink
4825protocol based Linux kernel interfaces. Netlink is an IPC mechanism primarily
4826between the kernel and user space processes. It was designed to be a more
4827flexible successor to ioctl to provide mainly networking related kernel
4828configuration and monitoring interfaces.")
4829
4830 ;; Most files are LGPLv2.1-only, but some are GPLv2-only (like
4831 ;; 'nl-addr-add.c'), so the result is GPLv2-only.
4832 (license license:gpl2)))
4833
4834;; libnl python extensions used to be outputs of libnl. However, as
4835;; cross-compiling python extensions is currently broken, create separate
4836;; packages for libnl python extensions.
4837(define (libnl-python-package python)
4838 (let ((name (string-append "libnl-" python)))
4839 (package
4840 (inherit libnl)
4841 (name name)
4842 (outputs '("out"))
4843 (arguments
4844 (list
4845 #:modules `((guix build gnu-build-system)
4846 (guix build utils)
4847 (srfi srfi-1))
4848 #:phases
4849 #~(modify-phases %standard-phases
4850 (replace 'install
4851 (lambda* (#:key inputs #:allow-other-keys)
4852 (define (python-inst python)
4853 (invoke python "setup.py" "build")
4854 (invoke python "setup.py" "install"
4855 (string-append "--prefix=" #$output))
4856 (invoke python "setup.py" "clean"))
4857 (let ((libdir (dirname (search-input-directory inputs
4858 "lib/libnl"))))
4859 (setenv "LDFLAGS" (string-append "-Wl,-rpath=" libdir)))
4860 (with-directory-excursion "./python"
4861 (python-inst #$python)))))))
4862 (inputs
4863 (append (cond
4864 ((string=? python "python2")
4865 (list python-2))
4866 ((string=? python "python3")
4867 (list python-setuptools python-wrapper)))
4868 (list libxcrypt))) ;required by Python.h
4869 (propagated-inputs (list libnl)))))
4870
4871(define-public libnl-python3 (libnl-python-package "python3"))
4872
4873(define-public iw
4874 (package
4875 (name "iw")
4876 (version "5.19")
4877 (source (origin
4878 (method url-fetch)
4879 (uri (string-append
4880 "mirror://kernel.org/software/network/iw/iw-"
4881 version ".tar.xz"))
4882 (sha256
4883 (base32
4884 "0kjdrihc7ibnjdpjqkq8sv0kmmvavgsww78cpjgbnlyx8zlvnrzi"))))
4885 (build-system gnu-build-system)
4886 (native-inputs (list pkg-config))
4887 (inputs (list libnl))
4888 (arguments
4889 (list #:make-flags
4890 #~(list
4891 (string-append "CC=" #$(cc-for-target))
4892 (string-append "PKG_CONFIG=" #$(pkg-config-for-target))
4893 (string-append "PREFIX=" (assoc-ref %outputs "out")))
4894 #:phases
4895 #~(modify-phases %standard-phases
4896 (delete 'configure)))) ; no configure script
4897 (home-page "https://wireless.wiki.kernel.org/")
4898 (synopsis "Tool for configuring wireless devices")
4899 (description
4900 "iw is a new nl80211 based CLI configuration utility for wireless
4901devices. It replaces @code{iwconfig}, which is deprecated.")
4902 (license license:isc)))
4903
4904(define-public powertop
4905 (package
4906 (name "powertop")
4907 (version "2.15")
4908 (source
4909 (origin
4910 (method git-fetch)
4911 (uri (git-reference
4912 (url "https://github.com/fenrus75/powertop")
4913 (commit (string-append "v" version))))
4914 (file-name (git-file-name name version))
4915 (sha256
4916 (base32 "10vbk4vplmzp3p1mhwnhj81g6i5xvam9pdvmiy6cmd0xvnmdyy77"))))
4917 (build-system gnu-build-system)
4918 (arguments
4919 (list
4920 #:configure-flags #~(list "LDFLAGS=-pthread")
4921 #:phases
4922 #~(modify-phases %standard-phases
4923 ;; TODO: Patch some hardcoded "wlan0" in calibrate/calibrate.cpp to
4924 ;; allow calibrating the network interface in Guix System.
4925 (add-after 'unpack 'patch-absolute-file-names
4926 (lambda* (#:key inputs #:allow-other-keys)
4927 (let ((kmod (assoc-ref inputs "kmod")))
4928 ;; Fix for using a more modern gettext.
4929 (substitute* "autogen.sh"
4930 (("autoreconf")
4931 "autoreconf --force"))
4932 (substitute* "configure.ac"
4933 (("^AM_GNU_GETTEXT_VERSION.*$")
4934 (string-append "AM_GNU_GETTEXT_VERSION(["
4935 #$(package-version (this-package-native-input "gettext-minimal"))
4936 "])\n")))
4937 ;; Give the right 'modprobe' file name so that essential
4938 ;; modules such as msr.ko can be loaded.
4939 (substitute* (find-files "src" "\\.cpp$")
4940 (("/sbin/modprobe") (string-append kmod "/bin/modprobe"))
4941 ;; These programs are only needed to calibrate, so using
4942 ;; relative file names avoids adding extra inputs. When they
4943 ;; are missing powertop gracefully handles it.
4944 (("/usr/s?bin/(hciconfig|hcitool|xset)" _ command)
4945 command
4946 command))))))))
4947 (native-inputs
4948 (list autoconf
4949 autoconf-archive
4950 automake
4951 gettext-minimal
4952 libtool
4953 pkg-config))
4954 (inputs
4955 (list kmod libnl ncurses pciutils zlib))
4956 (home-page "https://01.org/powertop/")
4957 (synopsis "Analyze power consumption on x86-based laptops")
4958 (description
4959 "PowerTOP is a Linux tool to diagnose issues with power consumption and
4960power management. In addition to being a diagnostic tool, PowerTOP also has
4961an interactive mode where the user can experiment various power management
4962settings for cases where the operating system has not enabled these
4963settings.")
4964 (license license:gpl2)))
4965
4966(define-public aumix
4967 (package
4968 (name "aumix")
4969 (version "2.9.1")
4970 (source (origin
4971 (method url-fetch)
4972 (uri (string-append
4973 "https://web.archive.org/web/20211201184543/"
4974 "http://www.jpj.net/~trevor/aumix/releases/aumix-"
4975 version ".tar.bz2"))
4976 (sha256
4977 (base32
4978 "0a8fwyxnc5qdxff8sl2sfsbnvgh6pkij4yafiln0fxgg6bal7knj"))))
4979 (build-system gnu-build-system)
4980 (arguments
4981 ;; Allow compilation with GCC 10.
4982 '(#:configure-flags '("CFLAGS=-O2 -g -fcommon")))
4983 (inputs (list ncurses))
4984 (home-page (string-append "https://web.archive.org/web/20211201184543/"
4985 "http://jpj.net/~trevor/aumix.html"))
4986 (synopsis "Audio mixer for X and the console")
4987 (description
4988 "Aumix adjusts an audio mixer from X, the console, a terminal,
4989the command line or a script.")
4990 (license license:gpl2+)))
4991
4992(define-public iotop-python
4993 ;; The last release is from 2013 and gives a misleading CONFIG_TASK_DELAY_ACCT
4994 ;; error on ‘newer’ kernels.
4995 (let ((revision "0")
4996 (commit "a14256a3ff74eeee59493ac088561f1bafab85a7"))
4997 (package
4998 (name "iotop-python")
4999 (version (git-version "0.6" revision commit))
5000 (source
5001 (origin
5002 (method git-fetch)
5003 (uri (git-reference
5004 (url "https://repo.or.cz/iotop.git")
5005 (commit commit)))
5006 (file-name (git-file-name name version))
5007 (sha256
5008 (base32 "00h5p8fk1zi237q8mqds8apqbis9iw0yih1hl0pr63dsnyzmmrpw"))))
5009 (build-system pyproject-build-system)
5010 (arguments
5011 (list
5012 #:tests? #f ; No tests.
5013 #:phases
5014 #~(modify-phases %standard-phases
5015 (add-after 'unpack 'fix-build-with-python3
5016 (lambda _
5017 (substitute* "setup.py"
5018 (("itervalues")
5019 "values")))))))
5020 (native-inputs (list python python-setuptools))
5021 (home-page "http://guichaz.free.fr/iotop/")
5022 (synopsis "Displays the IO activity of running processes")
5023 (description
5024 "Iotop is a Python program with a top like user interface to show the
5025processes currently causing I/O.")
5026 (license license:gpl2+))))
5027
5028(define-public iotop
5029 (package
5030 (name "iotop")
5031 (version "1.31")
5032 (source
5033 (origin
5034 (method git-fetch)
5035 (uri (git-reference
5036 (url "https://github.com/Tomas-M/iotop")
5037 (commit (string-append "v" version))))
5038 (file-name (git-file-name name version))
5039 (sha256
5040 (base32 "19ccdiw3flzk7gki90rc1nifmma79g2l87vhls4d2xr4z763m4nc"))))
5041 (build-system gnu-build-system)
5042 (arguments
5043 (list #:make-flags
5044 #~(list (string-append "CC=" #$(cc-for-target))
5045 (string-append "PREFIX=" #$output))
5046 #:tests? #f ; no tests
5047 #:phases
5048 #~(modify-phases %standard-phases
5049 (delete 'configure)))) ; no configure script
5050 (native-inputs (list pkg-config))
5051 (inputs (list ncurses))
5052 (home-page "https://github.com/Tomas-M/iotop")
5053 (synopsis "Interactive @command{top}-like input/output activity monitor")
5054 (description
5055 "iotop identifies which processes and threads are most responsible for
5056@acronym{I/O, input/output} activity such as disc reads and writes. It sorts
5057them in a live, interactive table overview similar to that of the well-known
5058@command{top}.
5059
5060This information makes it much easier for an administrator to see which tasks
5061are blocking others and adjust their priority (using @command{ionice}) or stop
5062or kill them altogether.")
5063 (license license:gpl2+)))
5064
5065(define-public fuse
5066 (package
5067 (name "fuse")
5068 (version "3.18.1")
5069 (source (origin
5070 (method url-fetch)
5071 (uri
5072 (string-append "https://github.com/libfuse/libfuse/releases/"
5073 "download/fuse-" version
5074 "/fuse-" version ".tar.gz"))
5075 (sha256
5076 (base32
5077 "0b1jp5gp2gv40gv6cvmv86rcr4l0mdh050qbvnxl0xcwya45qffx"))))
5078 (build-system meson-build-system)
5079 (outputs (list "out" "debug" "static"))
5080 (inputs
5081 (list bash-minimal util-linux))
5082 (arguments
5083 `(#:configure-flags
5084 ,#~(list
5085 (string-append "-Dudevrulesdir=" #$output "/udev/rules.d")
5086 "-Duseroot=false"
5087 ;; Build static libraries.
5088 "--default-library=both")
5089 #:tests? #f
5090 #:modules ((guix build meson-build-system)
5091 (guix build utils)
5092 (ice-9 ftw))
5093 #:phases
5094 ,#~(modify-phases %standard-phases
5095 (add-after 'unpack 'set-file-names
5096 (lambda* (#:key inputs #:allow-other-keys)
5097 ;; libfuse calls out to mount(8) and umount(8). Make sure
5098 ;; it refers to the right ones.
5099 (substitute* '("lib/mount_util.c")
5100 (("/bin/(u?)mount" _ maybe-u)
5101 (search-input-file inputs
5102 (string-append "bin/"
5103 maybe-u "mount"))))
5104 (substitute* '("util/mount.fuse.c")
5105 (("/bin/sh")
5106 (search-input-file inputs "/bin/sh")))
5107
5108 ;; This hack leads libfuse to search for 'fusermount' in
5109 ;; $PATH, where it may find a setuid-root binary, instead of
5110 ;; trying solely $out/sbin/fusermount and failing because
5111 ;; it's not setuid.
5112 (substitute* "lib/meson.build"
5113 (("-DFUSERMOUNT_DIR=[[:graph:]]+")
5114 "-DFUSERMOUNT_DIR=\"/var/empty\"'"))))
5115 (add-after 'unpack 'fix-install
5116 (lambda* (#:key inputs #:allow-other-keys)
5117 (substitute* '("util/meson.build")
5118 (("install_helper.sh") "true"))
5119 (substitute* '("util/meson.build")
5120 (("fuseconf_path = .*")
5121 "fuseconf_path = '/etc/fuse.conf'"))))
5122 (add-before 'configure 'set-paths
5123 (lambda* (#:key inputs outputs #:allow-other-keys)
5124 (let ((dummy-init.d
5125 (string-append (getcwd) "/etc/init.d")))
5126 (setenv "MOUNT_FUSE_PATH"
5127 (string-append #$output "/sbin"))
5128 (setenv "UDEV_RULES_PATH"
5129 (string-append #$output
5130 "/lib/udev/rules.d")))))
5131 (add-after 'install 'install-static-libraries
5132 (lambda* (#:key outputs #:allow-other-keys)
5133 (let ((out (assoc-ref outputs "out"))
5134 (static (assoc-ref outputs "static")))
5135 (mkdir-p (string-append static "/lib"))
5136 (for-each
5137 (lambda (static-library)
5138 (rename-file
5139 (string-append out "/lib/" static-library)
5140 (string-append static "/lib/" static-library)))
5141 (scandir (string-append out "/lib")
5142 (lambda (file-name)
5143 (string-suffix? ".a" file-name))))))))))
5144 (supported-systems (remove target-hurd? %supported-systems))
5145 (home-page "https://github.com/libfuse/libfuse")
5146 (synopsis "Support file systems implemented in user space")
5147 (description
5148 "As a consequence of its monolithic design, file system code for Linux
5149normally goes into the kernel itself---which is not only a robustness issue,
5150but also an impediment to system extensibility. FUSE, for \"file systems in
5151user space\", is a kernel module and user-space library that tries to address
5152part of this problem by allowing users to run file system implementations as
5153user-space processes.")
5154 (license (list license:lgpl2.1 ; library
5155 license:gpl2+)))) ; command-line utilities
5156
5157(define-public fuse-2
5158 (package
5159 (inherit fuse)
5160 (name "fuse")
5161 (version "2.9.9")
5162 (source
5163 (origin
5164 (method url-fetch)
5165 (uri (string-append "https://github.com/libfuse/libfuse/releases/"
5166 "download/fuse-" version
5167 "/fuse-" version ".tar.gz"))
5168 (sha256
5169 (base32 "1ddlq6kzxilccgbvxjfx80jx6kamgw4sv49phks2zhlcc1frvrnh"))
5170 (patches (search-patches "fuse-overlapping-headers.patch"
5171 "fuse-glibc-2.34.patch"))))
5172 (build-system gnu-build-system)
5173 (native-inputs
5174 (list autoconf automake gettext-minimal libtool))
5175 (arguments
5176 '(#:configure-flags (list (string-append "MOUNT_FUSE_PATH="
5177 (assoc-ref %outputs "out")
5178 "/sbin")
5179 (string-append "INIT_D_PATH="
5180 (assoc-ref %outputs "out")
5181 "/etc/init.d")
5182
5183 ;; The rule makes /dev/fuse 666.
5184 (string-append "UDEV_RULES_PATH="
5185 (assoc-ref %outputs "out")
5186 "/lib/udev/rules.d"))
5187 #:phases
5188 (modify-phases %standard-phases
5189 (add-before 'bootstrap 'force-bootstrap
5190 (lambda _
5191 ;; Force a bootstrap to make the patch changes effective.
5192 (delete-file "configure")))
5193 (add-before 'build 'set-file-names
5194 (lambda* (#:key inputs #:allow-other-keys)
5195 ;; libfuse calls out to mount(8) and umount(8). Make sure
5196 ;; it refers to the right ones.
5197 (substitute* '("lib/mount_util.c" "util/mount_util.c")
5198 (("/bin/(u?)mount" _ maybe-u)
5199 (search-input-file inputs
5200 (string-append "bin/"
5201 maybe-u "mount"))))
5202 (substitute* '("util/mount.fuse.c")
5203 (("/bin/sh")
5204 (search-input-file inputs "/bin/sh")))
5205
5206 ;; This hack leads libfuse to search for 'fusermount' in
5207 ;; $PATH, where it may find a setuid-root binary, instead of
5208 ;; trying solely $out/sbin/fusermount and failing because
5209 ;; it's not setuid.
5210 (substitute* "lib/Makefile"
5211 (("-DFUSERMOUNT_DIR=[[:graph:]]+")
5212 "-DFUSERMOUNT_DIR=\\\"/var/empty\\\"")))))))))
5213
5214(define-public unionfs-fuse
5215 (package
5216 (name "unionfs-fuse")
5217 (version "3.3")
5218 (source (origin
5219 (method git-fetch)
5220 (uri (git-reference
5221 (url "https://github.com/rpodgorny/unionfs-fuse")
5222 (commit (string-append "v" version))))
5223 (file-name (git-file-name name version))
5224 (sha256
5225 (base32
5226 "1wl5m5qnwf3s1792xphr35pb80sx8ybaqi3n3ddi5vvk3qjc4iws"))))
5227 (build-system cmake-build-system)
5228 (arguments
5229 (list
5230 #:phases
5231 #~(modify-phases %standard-phases
5232 (replace 'check
5233 ;; The epitome of ‘I tried’: run the 2 trivial tests that don't rely
5234 ;; on the fuse kernel module being loaded. All others would fail.
5235 (lambda* (#:key tests? #:allow-other-keys)
5236 (when tests?
5237 (invoke "pytest" "../source/test_all.py" "-k" "test_help")))))))
5238 (native-inputs
5239 (list pkg-config
5240
5241 ;; Only for the test ‘suite’.
5242 python
5243 python-pytest))
5244 (inputs
5245 (list fuse))
5246 (home-page "https://github.com/rpodgorny/unionfs-fuse")
5247 (synopsis "User-space union file system")
5248 (description
5249 "UnionFS-FUSE is a flexible union file system implementation in user
5250space, using the FUSE library. Mounting a union file system allows you to
5251\"aggregate\" the contents of several directories into a single mount point.
5252UnionFS-FUSE additionally supports copy-on-write.")
5253 (license license:bsd-3)))
5254
5255(define fuse-static
5256 (package (inherit fuse)
5257 (name "fuse-static")
5258 (source
5259 (origin
5260 (inherit (package-source fuse))
5261 (modules '((guix build utils)))
5262 (snippet
5263 #~(begin
5264 ;; Normally libfuse invokes mount(8) so that /etc/mtab is updated.
5265 ;; Change calls to 'mtab_needs_update' to 0 so that it doesn't do
5266 ;; that, allowing us to remove the dependency on util-linux
5267 ;; (something that is useful in initrds.)
5268 (substitute* "lib/mount_util.c"
5269 (("mtab_needs_update[[:blank:]]*\\([a-z_]+\\)") "0")
5270 (("/bin/") ""))))))
5271 (arguments
5272 (substitute-keyword-arguments arguments
5273 ((#:configure-flags flags '())
5274 #~(cons "-Ddefault_library=static"
5275 #$flags))))))
5276
5277(define-public unionfs-fuse/static
5278 (package (inherit unionfs-fuse)
5279 (synopsis "User-space union file system (statically linked)")
5280 (name (string-append (package-name unionfs-fuse) "-static"))
5281 (source
5282 (origin
5283 (inherit (package-source unionfs-fuse))
5284 (modules '((guix build utils)))
5285 (snippet
5286 #~(begin
5287 ;; Add -ldl to the libraries, because libfuse.a needs that.
5288 (substitute* "src/CMakeLists.txt"
5289 (("target_link_libraries(.*)\\)" _ libs)
5290 (string-append "target_link_libraries"
5291 libs " dl)")))))))
5292 (arguments
5293 (substitute-keyword-arguments arguments
5294 ((#:configure-flags flags #~'())
5295 #~(cons "-DCMAKE_EXE_LINKER_FLAGS=-static" #$flags))
5296 ((#:phases phases #~%standard-phases)
5297 #~(modify-phases #$phases
5298 (add-after 'install 'post-install
5299 (lambda _
5300 ;; By default, 'unionfs' keeps references to
5301 ;; $glibc/share/locale and similar stuff. Remove them.
5302 (remove-store-references (string-append #$output "/bin/unionfs"))
5303 ;; 'unionfsctl' has references to glibc as well. Since
5304 ;; we don't need it, remove it.
5305 (delete-file (string-append #$output "/bin/unionfsctl"))))))))
5306 (inputs (list fuse-static))))
5307
5308(define-public sshfs
5309 (package
5310 (name "sshfs")
5311 (version "3.7.5")
5312 (source (origin
5313 (method url-fetch)
5314 (uri (string-append "https://github.com/libfuse/sshfs/releases/"
5315 "download/sshfs-" version "/sshfs-" version
5316 ".tar.xz"))
5317 (sha256
5318 (base32
5319 "1fx8c4fkvmfi29iw8wz5dwnniq666ji4y4vl67dij2fhq9ixni8f"))))
5320 (build-system meson-build-system)
5321 (arguments
5322 ;; XXX: tests are skipped: FUSE kernel module does not seem to be loaded
5323 '(#:tests? #f))
5324 (inputs
5325 (list fuse glib))
5326 (native-inputs
5327 (list pkg-config
5328 ;; man page
5329 python-docutils))
5330 (home-page "https://github.com/libfuse/sshfs")
5331 (synopsis "Mount remote file systems over SSH")
5332 (description
5333 "This is a file system client based on the SSH File Transfer Protocol.
5334Since most SSH servers already support this protocol it is very easy to set
5335up: on the server side there's nothing to do; on the client side mounting the
5336file system is as easy as logging into the server with an SSH client.")
5337 (license license:gpl2+)))
5338
5339(define-public sshfs-fuse
5340 (package (inherit sshfs)
5341 (name "sshfs-fuse")
5342 (properties `((superseded . ,sshfs)))))
5343
5344(define-public archivemount
5345 (package
5346 (name "archivemount")
5347 (version "0.9.1")
5348 (source
5349 (origin
5350 (method url-fetch)
5351 (uri (string-append "https://www.cybernoia.de/software/archivemount/"
5352 "archivemount-" version ".tar.gz"))
5353 (sha256
5354 (base32 "1cy5b6qril9c3ry6fv7ir87s8iyy5vxxmbyx90dm86fbra0vjaf5"))))
5355 (build-system gnu-build-system)
5356 (inputs (list fuse-2 libarchive))
5357 (native-inputs (list pkg-config))
5358 (home-page "https://www.cybernoia.de/software/archivemount.html")
5359 (synopsis "Tool for mounting archive files with FUSE")
5360 (description "archivemount is a FUSE-based file system for Unix variants,
5361including Linux. Its purpose is to mount archives (i.e. tar, tar.gz, etc.) to a
5362mount point where it can be read from or written to as with any other file
5363system. This makes accessing the contents of the archive, which may be
5364compressed, transparent to other programs, without decompressing them.")
5365 (license license:lgpl2.0+)))
5366
5367(define-public numactl
5368 (package
5369 (name "numactl")
5370 (version "2.0.16")
5371 (source (origin
5372 (method url-fetch)
5373 (uri (string-append
5374 "https://github.com/numactl/numactl/releases/download/v"
5375 version "/numactl-" version ".tar.gz"))
5376 (sha256
5377 (base32
5378 "1j67wx3383fwqbvhg4nwqf72vpdgimmrvkpn3b9s2xzr7a4jy90v"))))
5379 (build-system gnu-build-system)
5380 (arguments
5381 `(,@(if (target-riscv64?)
5382 `(#:make-flags (list "LDFLAGS=-latomic"))
5383 '())
5384 ;; There's a 'test' target, but it requires NUMA support in the kernel
5385 ;; to run, which we can't assume to have.
5386 #:tests? #f))
5387 (home-page "https://github.com/numactl/numactl")
5388 (synopsis "Tools for non-uniform memory access (NUMA) machines")
5389 (description
5390 "NUMA stands for Non-Uniform Memory Access, in other words a system whose
5391memory is not all in one place. The @command{numactl} program allows you to
5392run your application program on specific CPUs and memory nodes. It does this
5393by supplying a NUMA memory policy to the operating system before running your
5394program.
5395
5396The package contains other commands, such as @command{numastat},
5397@command{memhog}, and @command{numademo} which provides a quick overview of
5398NUMA performance on your system.")
5399 (license (list license:gpl2 ;programs
5400 license:lgpl2.1)))) ;library
5401
5402(define-public kbd-neo
5403 (package
5404 (name "kbd-neo")
5405 (version "2486")
5406 (source
5407 (origin
5408 (method url-fetch)
5409 (uri (string-append "https://svn.neo-layout.org/!svn/bc/"
5410 version "/linux/console/neo.map"))
5411 (file-name (string-append name "-" version ".map"))
5412 (sha256
5413 (base32
5414 "19mfrd31vzpsjiwc7pshxm0b0sz5dd17xrz6k079cy4im1vf0r4g"))))
5415 (build-system trivial-build-system)
5416 (arguments
5417 `(#:modules ((guix build utils))
5418 #:builder (begin
5419 (use-modules (guix build utils))
5420 (let ((out (string-append %output "/share/keymaps"))
5421 (source (assoc-ref %build-inputs "source")))
5422 (mkdir-p out)
5423 (copy-file source (string-append out "/neo.map"))
5424 #t))))
5425 (home-page "https://neo-layout.org")
5426 (synopsis "Neo2 console layout")
5427 (description
5428 "Kbd-neo provides the Neo2 keyboard layout for use with
5429@command{loadkeys(1)} from @code{kbd(4)}.")
5430 ;; The file is located in an svn directory, the entire content of
5431 ;; the directory is licensed as GPL3.
5432 (license license:gpl3+)))
5433
5434(define-public kbd
5435 (package
5436 (name "kbd")
5437 (version "2.5.1")
5438 (source
5439 (origin
5440 (method url-fetch)
5441 (uri (string-append "mirror://kernel.org/linux/utils/kbd/kbd-" version
5442 ".tar.xz"))
5443 (sha256
5444 (base32 "10s608i4blprgy9nynlid0hglfdrrgln6wwjs9rhjf56hwilbpyc"))
5445 (modules '((guix build utils)))
5446 (snippet
5447 '(begin
5448 (substitute* '("src/unicode_start" "src/unicode_stop")
5449 ;; Assume the Coreutils are in $PATH.
5450 (("/usr/bin/tty")
5451 "tty"))))))
5452 (build-system gnu-build-system)
5453 (arguments
5454 (list
5455 #:phases
5456 #~(modify-phases %standard-phases
5457 (add-before 'build 'pre-build
5458 (lambda* (#:key inputs #:allow-other-keys)
5459 (substitute* "src/libkbdfile/kbdfile.c"
5460 (("bzip2")
5461 (search-input-file inputs "/bin/bzip2"))
5462 (("gzip")
5463 (search-input-file inputs "/bin/gzip"))
5464 (("xz -d")
5465 (string-append (search-input-file inputs "/bin/xz") " -d"))
5466 (("zstd")
5467 (search-input-file inputs "/bin/zstd")))))
5468 (add-after 'install 'post-install
5469 (lambda _
5470 ;; Make sure these programs find their comrades.
5471 (let ((bin (string-append #$output "/bin")))
5472 (for-each (lambda (prog)
5473 (wrap-program (string-append bin "/" prog)
5474 `("PATH" ":" prefix (,bin))))
5475 '("unicode_start" "unicode_stop"))))))))
5476 (native-inputs (list autoconf pkg-config))
5477 (inputs
5478 (list bash-minimal
5479 ;; for wrap-program
5480 bzip2
5481 gzip
5482 linux-pam
5483 xz
5484 zstd))
5485 (native-search-paths
5486 (list (search-path-specification
5487 (variable "LOADKEYS_KEYMAP_PATH")
5488 ;; Append ‘/**’ to recursively search all directories. One can then
5489 ;; run (for example) ‘loadkeys en-latin9’ instead of having to find
5490 ;; and type ‘i386/colemak/en-latin9’ on a mislabelled keyboard.
5491 (files (list "share/keymaps/**")))))
5492 (home-page "https://kbd-project.org/")
5493 (synopsis "Linux keyboard utilities and keyboard maps")
5494 (description
5495 "This package contains keytable files and keyboard utilities compatible
5496for systems using the Linux kernel. This includes commands such as
5497@code{loadkeys}, @code{setfont}, @code{kbdinfo}, and @code{chvt}.")
5498 (license license:gpl2+)))
5499
5500(define-public loadkeys-static
5501 (package
5502 (inherit kbd)
5503 (name "loadkeys-static")
5504 (arguments
5505 (substitute-keyword-arguments arguments
5506 ((#:configure-flags flags #~(list))
5507 #~(append '("LDFLAGS=-static" "--disable-shared" "--disable-nls"
5508 "--disable-vlock" ;so we don't need libpam
5509 "--disable-libkeymap")
5510 #$flags))
5511 ((#:make-flags flags #~(list))
5512 #~(cons "LDFLAGS=-all-static -lrt -lpthread" #$flags))
5513 ((#:phases phases #~%standard-phases)
5514 #~(modify-phases #$phases
5515 (replace 'install
5516 (lambda _
5517 ;; The binary keeps references to gzip, among other things,
5518 ;; which we don't need in the initrd, so strip references.
5519 (remove-store-references "src/loadkeys")
5520
5521 (install-file "src/loadkeys"
5522 (string-append #$output "/bin"))))
5523 (delete 'post-install)))
5524 ((#:strip-flags _ #~(list))
5525 #~(list "--strip-all"))
5526 ((#:allowed-references _ '())
5527 '())))
5528
5529 (synopsis "Statically-linked @command{loadkeys} program")
5530
5531 ;; This package is meant to be used internally in the initrd so don't
5532 ;; expose it.
5533 (properties '((hidden? . #t)))))
5534
5535(define-public inotify-tools
5536 (package
5537 (name "inotify-tools")
5538 (version "3.22.6.0")
5539 (source (origin
5540 (method git-fetch)
5541 (uri (git-reference
5542 (url "https://github.com/rvoicilas/inotify-tools")
5543 (commit version)))
5544 (file-name (git-file-name name version))
5545 (sha256
5546 (base32
5547 "1j9j8k5zjp8m4cl53zjncnll9z4dnvzr4ygmfcjk0ci81i59b18i"))))
5548 (build-system gnu-build-system)
5549 (native-inputs
5550 (list autoconf automake libtool))
5551 (arguments
5552 `(#:configure-flags
5553 (list "--disable-static")))
5554 (home-page "https://github.com/rvoicilas/inotify-tools/wiki")
5555 (synopsis "Monitor file accesses")
5556 (description
5557 "The inotify-tools packages provides a C library and command-line tools
5558to use Linux' inotify mechanism, which allows file accesses to be monitored.")
5559 (license license:gpl2+)))
5560
5561(define-public kmod
5562 (package
5563 (name "kmod")
5564 (version "29")
5565 (source (origin
5566 (method url-fetch)
5567 (uri
5568 (string-append "mirror://kernel.org/linux/utils/kernel/kmod/"
5569 "kmod-" version ".tar.xz"))
5570 (sha256
5571 (base32
5572 "0am54mi5rk72g5q7k6l6f36gw3r9vwgjmyna43ywcjhqmakyx00b"))
5573 (patches (search-patches "kmod-module-directory.patch"))))
5574 (build-system gnu-build-system)
5575 (arguments
5576 (list #:configure-flags #~(list "--with-xz" "--with-zlib" "--with-zstd"
5577 "--disable-test-modules")
5578 #:phases
5579 #~(modify-phases %standard-phases
5580 (add-after 'unpack 'disable-tests
5581 (lambda _
5582 ;; XXX: These tests need '--sysconfdir=/etc' to pass.
5583 (substitute* "Makefile.in"
5584 (("testsuite/test-modprobe") "")
5585 (("testsuite/test-depmod") "")
5586 (("testsuite/test-blacklist") ""))))
5587 (add-after 'install 'install-modprobe&co
5588 (lambda _
5589 (for-each (lambda (tool)
5590 (symlink "kmod"
5591 (string-append #$output "/bin/" tool)))
5592 '("insmod" "rmmod" "lsmod" "modprobe"
5593 "modinfo" "depmod")))))))
5594 (native-inputs (list pkg-config zstd)) ;zstd needed for tests
5595 (inputs (list xz zlib `(,zstd "lib")))
5596 (supported-systems (remove target-hurd? %supported-systems))
5597 (home-page "https://www.kernel.org/")
5598 (synopsis "Kernel module tools")
5599 (description "Kmod is a set of tools to handle common tasks with Linux
5600kernel modules like insert, remove, list, check properties, resolve
5601dependencies and aliases.
5602
5603These tools are designed on top of libkmod, a library that is shipped with
5604kmod. The aim is to be compatible with tools, configurations and indices
5605from the module-init-tools project.")
5606 (license license:gpl2+))) ; library under lgpl2.1+
5607
5608(define-public earlyoom
5609 (package
5610 (name "earlyoom")
5611 (version "1.7")
5612 (source (origin
5613 (method git-fetch)
5614 (uri (git-reference
5615 (url "https://github.com/rfjakob/earlyoom")
5616 (commit (string-append "v" version))))
5617 (file-name (git-file-name name version))
5618 (sha256
5619 (base32
5620 "1xqrs6wz59ks76hdgfd4vaj010kbvllilgam2xxyn0g56kai71zi"))))
5621 (build-system gnu-build-system)
5622 (arguments
5623 (list
5624 #:phases
5625 #~(modify-phases %standard-phases
5626 (delete 'configure) ; no configure script
5627 (add-before 'check 'set-go-HOME
5628 (lambda _
5629 (setenv "HOME" (getcwd))))
5630 (add-before 'check 'disable-failing-test
5631 (lambda _
5632 ;; This test relies on writing to /proc/%d/oom_score_adj.
5633 (substitute* "Makefile"
5634 (("go test -v" match)
5635 (string-append match " -vet=off -skip 'TestI'"))))))
5636 #:make-flags
5637 #~(list (string-append "CC=" #$(cc-for-target))
5638 (string-append "VERSION=v" #$version)
5639 (string-append "PREFIX=" #$output)
5640 (string-append "SYSCONFDIR=" #$output "/etc")
5641 "GO111MODULE=off")
5642 #:test-target "test"))
5643 (native-inputs
5644 (append
5645 ;; To generate the manpage.
5646 (if (or (target-x86-64?) (target-x86-32?))
5647 (list pandoc)
5648 '())
5649 (list
5650 ;; For the test suite.
5651 cppcheck
5652 go)))
5653 (home-page "https://github.com/rfjakob/earlyoom")
5654 (synopsis "Simple out of memory (OOM) daemon for the Linux kernel")
5655 (description "Early OOM is a minimalist out of memory (OOM) daemon that
5656runs in user space and provides a more responsive and configurable alternative
5657to the in-kernel OOM killer.")
5658 (license license:expat)))
5659
5660(define-public eudev
5661 (package
5662 (name "eudev")
5663 (version "3.2.14")
5664 (source (origin
5665 (method git-fetch)
5666 (uri (git-reference (url "https://github.com/eudev-project/eudev")
5667 (commit (string-append "v" version))))
5668 (file-name (git-file-name name version))
5669 (sha256
5670 (base32
5671 "1f6lz57igi7iw2ls3fpzgw42bfznam4nf9368h7x8yf1mb737yxz"))))
5672 (build-system gnu-build-system)
5673 (arguments
5674 (list
5675 ;; The binary should be built to look for its rules under
5676 ;; /etc/udev/rules.d, which is where the udev-shepherd-service keeps
5677 ;; them.
5678 #:make-flags #~(list "udevrulesdir=/etc/udev/rules.d")
5679 #:phases
5680 #~(modify-phases %standard-phases
5681 (add-before 'bootstrap 'patch-file-names
5682 (lambda* (#:key inputs native-inputs #:allow-other-keys)
5683 (substitute* "man/make.sh"
5684 (("/usr/bin/xsltproc")
5685 (search-input-file (or native-inputs inputs) "/bin/xsltproc")))))
5686 (add-before 'bootstrap 'install-in-lib
5687 (lambda _
5688 ;; When the udev-service-type instantiates /etc, it collects
5689 ;; hardware files from the <package>/lib/udev/hwdb.d directories
5690 ;; of different packages. Since we set sysconfdir to /etc, the
5691 ;; only package-dependent location we can install hwdb files is
5692 ;; in <package>/lib/udev/hwdb.d. Eudev is configured to install
5693 ;; these files in sysconfdir, but they should be placed into
5694 ;; udevlibexecdir.
5695 (copy-file "hwdb/Makefile.am" "hwdb/files.am")
5696 (call-with-output-file "hwdb/Makefile.am"
5697 (lambda (port)
5698 (format port "hardwarelibdir = $(udevlibexecdir)/hwdb.d\n")
5699 (format port "include ./files.am")))
5700 (substitute* "hwdb/files.am"
5701 (("dist_udevhwdb_DATA =")
5702 "dist_hardwarelib_DATA ="))
5703 ;; Do not install the empty udev.conf template.
5704 (substitute* "src/udev/Makefile.am"
5705 (("dist_udevconf_DATA =")
5706 "dist_noinst_DATA ="))
5707 ;; Do not ensure that /etc/udev/rules.d exists.
5708 (substitute* "rules/Makefile.am"
5709 (("\\$\\(MKDIR_P\\) \\$\\(DESTDIR\\)\\$\\(udevconfdir\\)/rules\\.d")
5710 "true"))))
5711 (add-after 'install 'move-static-library
5712 (lambda _
5713 (let ((source (string-append #$output "/lib/libudev.a"))
5714 (target (string-append #$output:static "/lib/libudev.a")))
5715 (mkdir-p (dirname target))
5716 (link source target)
5717 (delete-file source)
5718 ;; Remove reference to the static library from the .la file
5719 ;; such that Libtool looks for it in the usual places.
5720 (substitute* (string-append #$output "/lib/libudev.la")
5721 (("old_library=.*")
5722 "old_library=''\n")))))
5723 (replace 'install
5724 (lambda* (#:key make-flags #:allow-other-keys #:rest args)
5725 ;; Although the runtime udevrulesdir is set to
5726 ;; /etc/udev/rules.d, the package should provide its default
5727 ;; rules under $libdir/udev/rules.d.
5728 (let* ((default-udev-rules.d (string-append #$output
5729 "/lib/udev/rules.d"))
5730 (make-flags (cons (string-append "udevrulesdir="
5731 default-udev-rules.d)
5732 (delete "udevrulesdir=/etc/udev/rules.d"
5733 make-flags))))
5734 (apply (assoc-ref %standard-phases 'install)
5735 `(,@args #:make-flags ,make-flags))))))
5736 #:configure-flags
5737 #~(list "--enable-manpages"
5738 ;; By default, autoconf uses $prefix/etc. The udev-service-type
5739 ;; makes sure /etc is set up with rules and hardware file
5740 ;; descriptions.
5741 "--sysconfdir=/etc")))
5742 (native-search-paths
5743 (list (search-path-specification
5744 (variable "UDEV_HWDB_PATH")
5745 (files '("lib/udev/hwdb.d")))))
5746 (native-inputs
5747 (list autoconf
5748 automake
5749 gperf
5750 libtool
5751 pkg-config
5752 ;; For tests.
5753 perl
5754 python-wrapper
5755 ;; For documentation.
5756 docbook-xml-4.2
5757 docbook-xsl
5758 libxslt))
5759 (inputs
5760 ;; When linked against libblkid, eudev can populate /dev/disk/by-label
5761 ;; and similar; it also installs the '60-persistent-storage.rules' file,
5762 ;; which contains the rules to do that.
5763 (list `(,util-linux "lib") ;for blkid
5764 kmod))
5765 (outputs '("out" "static"))
5766 (home-page "https://github.com/eudev-project/eudev")
5767 (synopsis "Userspace device management")
5768 (description "Udev is a daemon which dynamically creates and removes
5769device nodes from /dev/, handles hotplug events and loads drivers at boot
5770time.")
5771 (license license:gpl2+)))
5772
5773(define-public python-evdev
5774 (package
5775 (name "python-evdev")
5776 (version "1.9.1")
5777 (source
5778 (origin
5779 (method git-fetch) ; no tests data in PyPi package
5780 (uri (git-reference
5781 (url "https://github.com/gvalkov/python-evdev")
5782 (commit (string-append "v" version))))
5783 (file-name (git-file-name name version))
5784 (sha256
5785 (base32 "09p7pj0xhv23hqlpx865klrxrf7x6sw1bdsgs6pq900jvz92pl16"))))
5786 (build-system pyproject-build-system)
5787 (arguments
5788 (list
5789 #:test-flags
5790 ;; Silent tests requiring access to /dev/uinput.
5791 #~(list "-k" (string-append "not test_open"
5792 " and not test_open_context"
5793 " and not test_enable_events"
5794 " and not test_abs_values"
5795 " and not test_write"))
5796 #:phases
5797 #~(modify-phases %standard-phases
5798 (add-before 'build 'fix-hard-coded-directory
5799 (lambda* (#:key inputs #:allow-other-keys)
5800 (substitute* "setup.py"
5801 (("/usr/include/linux")
5802 (string-append
5803 (assoc-ref inputs "kernel-headers") "/include/linux"))))))))
5804 (native-inputs
5805 (list python-pytest python-setuptools python-wheel))
5806 (home-page "https://github.com/gvalkov/python-evdev")
5807 (synopsis "Bindings to the Linux input handling subsystem")
5808 (description
5809 "Python-evdev provides bindings to the generic input event interface in
5810Linux. The @code{evdev} interface serves the purpose of passing events
5811generated in the kernel directly to userspace through character devices that
5812are typically located in @file{/dev/input/}.
5813
5814This package also comes with bindings to @code{uinput}, the userspace input
5815subsystem. @code{uinput} allows userspace programs to create and handle input
5816devices that can inject events directly into the input subsystem.")
5817 (license license:bsd-3)))
5818
5819(define-public interception-tools
5820 (package
5821 (name "interception-tools")
5822 (version "0.6.8")
5823 (home-page "https://gitlab.com/interception/linux/tools")
5824 (source (origin
5825 (method git-fetch)
5826 (uri (git-reference
5827 (url home-page)
5828 (commit (string-append "v" version))))
5829 (file-name (git-file-name name version))
5830 (sha256
5831 (base32
5832 "1sbidym6ld4c8cx2ww5i54zsv8v0kygv15zq1yimz44v4my605wf"))))
5833 (build-system cmake-build-system)
5834 (native-inputs
5835 (list pkg-config))
5836 (inputs
5837 (list boost libevdev eudev yaml-cpp))
5838 (arguments
5839 `(#:tests? #f)) ; no test suite
5840 (synopsis "Utilities for operating on input events of evdev devices")
5841 (description
5842 "Interception Tools provides a composable infrastructure on top of
5843@code{libudev} and @code{libevdev}. The following utilities are provided:
5844
5845@itemize
5846@item @command{udevmon} --- monitor input devices for launching tasks
5847@item @command{intercept} --- redirect device input events to stdout
5848@item @command{uinput} --- redirect device input events from stding to virtual device
5849@item @command{mux} --- mux streams of input events
5850@end itemize")
5851 ;; Dual-licensed under GPLv3+ or "something else" on request, per
5852 ;; 'README.md'.
5853 (license license:gpl3+)))
5854
5855(define-public interception-dual-function-keys
5856 (package
5857 (name "interception-dual-function-keys")
5858 (version "1.5.0")
5859 (home-page "https://gitlab.com/interception/linux/plugins/dual-function-keys")
5860 (source (origin
5861 (method git-fetch)
5862 (uri (git-reference
5863 (url home-page)
5864 (commit version)))
5865 (file-name (git-file-name name version))
5866 (sha256
5867 (base32
5868 "17jc02wh45yk427qryb0ydyim16607i31wyghbsahahd6mrh9ylv"))))
5869 (build-system gnu-build-system)
5870 (inputs
5871 (list libevdev yaml-cpp))
5872 (arguments
5873 `(#:make-flags (list ,(string-append "CC=" (cc-for-target))
5874 ,(string-append "CXX=" (cxx-for-target))
5875 (string-append "PREFIX=" %output))
5876 #:phases
5877 (modify-phases %standard-phases
5878 (add-after 'unpack 'fix-libevdev-path
5879 (lambda* (#:key inputs #:allow-other-keys)
5880 (let ((libevdev (assoc-ref inputs "libevdev")))
5881 (substitute* "config.mk"
5882 (("/usr/include/libevdev-1.0")
5883 (string-append libevdev "/include/libevdev-1.0")))
5884 #t)))
5885 ;; No configure script
5886 (delete 'configure))
5887 ;; No tests are included.
5888 #:tests? #f))
5889 (synopsis "Tap for one key, hold for another")
5890 (description
5891 "Dual Function Keys is a plugin for @code{interception-tools} that allows
5892one to send arbitrary keycodes when a given key is tapped or held.")
5893 (license license:expat)))
5894
5895(define-public lvm2
5896 (package
5897 (name "lvm2")
5898 (version "2.03.22")
5899 (source (origin
5900 (method url-fetch)
5901 (uri (list (string-append "https://sourceware.org/ftp/lvm2/LVM2."
5902 version ".tgz")
5903 (string-append "ftp://sources.redhat.com/pub/lvm2/releases/LVM2."
5904 version ".tgz")))
5905 (sha256
5906 (base32
5907 "0z6w6bknhwh1n3qfkb5ij6x57q3wjf28lq3l8kh7rkhsplinjnjc"))
5908 (patches (search-patches "lvm2-no-systemd.patch"))
5909 (modules '((guix build utils)))
5910 (snippet
5911 '(begin
5912 (use-modules (guix build utils))
5913
5914 ;; Honor sysconfdir.
5915 (substitute* "make.tmpl.in"
5916 (("^confdir = .*$")
5917 "confdir = @sysconfdir@\n")
5918 (("DEFAULT_SYS_DIR = @DEFAULT_SYS_DIR@")
5919 "DEFAULT_SYS_DIR = @sysconfdir@"))))))
5920 (build-system gnu-build-system)
5921 (arguments
5922 (list
5923 #:tests? #f ;The tests use 'mknod', which requires root access.
5924 #:configure-flags
5925 #~(list (string-append "--sysconfdir=" #$output "/etc/lvm")
5926 "--enable-udev_sync"
5927 "--enable-udev_rules"
5928 "--enable-pkgconfig"
5929 "--enable-cmdlib"
5930 "--enable-dmeventd" ;Requires '--enable-cmdlib'.
5931 ;; Make sure programs such as 'dmsetup' can
5932 ;; find libdevmapper.so.
5933 (string-append "LDFLAGS=-Wl,-rpath="
5934 #$output "/lib,-rpath="
5935 #$output "/lib/device-mapper")
5936 ;; This is needed when cross-compiling.
5937 #$@(if (%current-target-system)
5938 '("ac_cv_func_malloc_0_nonnull=yes"
5939 "ac_cv_func_realloc_0_nonnull=yes")
5940 '()))
5941 #:phases
5942 #~(modify-phases %standard-phases
5943 (add-after 'unpack 'update-config
5944 (lambda* (#:key inputs native-inputs #:allow-other-keys)
5945 (install-file (search-input-file (or native-inputs inputs)
5946 "/bin/config.sub")
5947 "autoconf")
5948 (install-file (search-input-file (or native-inputs inputs)
5949 "/bin/config.guess")
5950 "autoconf")))
5951 (add-after 'configure 'set-makefile-shell
5952 (lambda _
5953 ;; Use 'sh', not 'bash', so that '. lib/utils.sh' works as
5954 ;; expected.
5955 (setenv "SHELL" (which "sh"))
5956
5957 ;; Replace /bin/sh with the right file name.
5958 (patch-makefile-SHELL "make.tmpl"))))))
5959 (native-inputs (list config pkg-config procps)) ;tests use 'pgrep'
5960 (inputs (list libaio eudev))
5961 (supported-systems (remove target-hurd? %supported-systems))
5962 (home-page "https://sourceware.org/lvm2/")
5963 (synopsis "Logical volume management for Linux")
5964 (description
5965 "LVM2 is the logical volume management tool set for Linux-based systems.
5966This package includes the user-space libraries and tools, including the device
5967mapper. Kernel components are part of Linux-libre.")
5968
5969 ;; Libraries (liblvm2, libdevmapper) are LGPLv2.1.
5970 ;; Command-line tools are GPLv2.
5971 (license (list license:gpl2 license:lgpl2.1))))
5972
5973(define-public (libdevmapper-propagated-inputs)
5974 (list eudev))
5975
5976(define-public lvm2-static
5977 (package
5978 (inherit lvm2)
5979 (name "lvm2-static")
5980 (arguments
5981 (substitute-keyword-arguments arguments
5982 ((#:configure-flags flags #~(list))
5983 ;; LVM2 doesn't use Libtool, hence the custom option.
5984 #~(append (list "--enable-static_link")
5985 ;; Building dmeventd statically is complicated due to a
5986 ;; requirement on libdevmapper.a, which is being phased out
5987 ;; in favor of libdevice-mapper.a, which in turn is is not
5988 ;; easily made available at dmeventd build time. Just ignore
5989 ;; it until the situation improves.
5990 (delete "--enable-dmeventd" #$flags)))
5991 ((#:phases phases)
5992 #~(modify-phases #$phases
5993 (add-before 'configure 'adjust-Makefile
5994 (lambda _
5995 ;; These fixes are related to the upstream libdm->device_mapper
5996 ;; migration and will hopefully be fixed upstream in due time.
5997 (substitute* "tools/Makefile.in"
5998 ;; This variable is empty in a static configuration and causes
5999 ;; an erroneous GCC command line.
6000 (("-L\\$\\(interfacebuilddir\\)") "")
6001 ;; Remove obsolete reference to libdevmapper.a.
6002 (("-ldevmapper")
6003 ""))))
6004 (add-after 'install 'adjust-pkgconfig
6005 ;; The static eudev is missing its pkg config file, and I am not
6006 ;; rebuilding it at this point.
6007 (lambda* (#:key inputs #:allow-other-keys)
6008 (substitute* (string-append #$output
6009 "/lib/pkgconfig/devmapper.pc")
6010 (("Requires.private: .*")
6011 "")
6012 (("Libs.private:")
6013 (format #f "Libs.private: -L~a -ludev"
6014 (dirname
6015 (search-input-file inputs
6016 "lib/libudev.a")))))))))))
6017 (inputs (modify-inputs inputs
6018 (append (list eudev "static"))))
6019 (synopsis "Logical volume management for Linux (statically linked)")))
6020
6021(define-public thin-provisioning-tools
6022 (package
6023 (name "thin-provisioning-tools")
6024 (version "0.8.5")
6025 (source
6026 (origin
6027 (method git-fetch)
6028 (uri (git-reference
6029 (url "https://github.com/jthornber/thin-provisioning-tools")
6030 (commit (string-append "v" version))))
6031 (file-name (git-file-name name version))
6032 (sha256
6033 (base32 "01wl8c0cjbx1smbhj8dx6av5bnw5775m58gasc3vqwvsj0s9hq19"))))
6034 (build-system gnu-build-system)
6035 (arguments
6036 ;; Doesn't build with --enable-testing due to a function name collision
6037 ;; with glibc. Fixed upstream. TODO: Enable tests when 0.9.0 is released.
6038 (list #:tests? #f))
6039 (native-inputs (list autoconf automake))
6040 (inputs (list boost expat libaio))
6041 (synopsis "Tools for manipulating the metadata of device-mapper targets")
6042 (description "A suite of tools for manipulating the metadata of the
6043dm-thin, dm-cache and dm-era device-mapper targets.")
6044 (home-page "https://github.com/jthornber/thin-provisioning-tools")
6045 (license license:gpl3+)))
6046
6047(define-public watchdogd
6048 (package
6049 (name "watchdogd")
6050 (version "4.1")
6051 (source (origin
6052 (method git-fetch)
6053 (uri (git-reference
6054 (url "https://github.com/troglobit/watchdogd")
6055 (commit version)))
6056 (file-name (git-file-name name version))
6057 (sha256
6058 (base32
6059 "1n5xq5gxrj8b8j2g323k0jpxabjnq9piw8v2fqcyphj33kmgay23"))))
6060 (build-system gnu-build-system)
6061 (native-inputs (list autoconf automake libtool pkg-config))
6062 (inputs (list libconfuse libite libuev))
6063 (synopsis "Advanced system & process supervisor for Linux")
6064 (description "This package provides an advanced monitor of critical system
6065resources, supervises the heartbeat of processes, records deadline
6066transgressions, and initiates a controlled reset if needed.")
6067 (home-page "https://troglobit.com/projects/watchdogd/")
6068 (license license:isc)))
6069
6070(define-public wireless-tools
6071 (package
6072 (name "wireless-tools")
6073 (version "30.pre9")
6074 (source
6075 (origin
6076 (method url-fetch)
6077 (uri (string-append "http://www.hpl.hp.com/personal/Jean_Tourrilhes/"
6078 "Linux/wireless_tools." version ".tar.gz"))
6079 (sha256
6080 (base32 "0qscyd44jmhs4k32ggp107hlym1pcyjzihiai48xs7xzib4wbndb"))
6081 (snippet
6082 #~(begin
6083 ;; Remove the older header files that are not free software.
6084 (for-each (lambda (n)
6085 (delete-file (format #f "wireless.~a.h" n)))
6086 '(10 11 12 13 14 15 16 17 18 19 20))))))
6087 (build-system gnu-build-system)
6088 (arguments
6089 (list #:make-flags
6090 #~(list (string-append "PREFIX=" #$output)
6091 (string-append "INSTALL_MAN=" #$output "/share/man")
6092 (string-append "LDFLAGS=-Wl,-rpath=" #$output "/lib")
6093 "BUILD_STATIC=")
6094 #:phases
6095 #~(modify-phases %standard-phases
6096 (replace 'configure
6097 (lambda* (#:key target #:allow-other-keys)
6098 (when target
6099 ;; Cross-compilation: use the cross tools.
6100 (substitute* (find-files "." "Makefile")
6101 (("CC = .*$")
6102 (string-append "CC = " target "-gcc\n"))
6103 (("AR = .*$")
6104 (string-append "AR = " target "-ar\n"))
6105 (("RANLIB = .*$")
6106 (string-append "RANLIB = " target "-ranlib\n")))))))
6107 #:tests? #f))
6108 (synopsis "Tools for manipulating Linux Wireless Extensions")
6109 (description "Wireless Tools are used to manipulate the now-deprecated
6110Linux Wireless Extensions; consider using @code{iw} instead. The Wireless
6111Extension was an interface allowing you to set Wireless LAN specific
6112parameters and get the specific stats. It is deprecated in favor the nl80211
6113interface.")
6114 (home-page "https://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html")
6115 ;; wireless.21.h and wireless.22.h are distributed under lgpl2.1+, the
6116 ;; other files are distributed under gpl2.
6117 (license (list license:gpl2 license:lgpl2.1+))))
6118
6119(define-public crda
6120 (package
6121 (name "crda")
6122 (version "4.15")
6123 (source
6124 (origin
6125 (method git-fetch)
6126 (uri (git-reference
6127 (url "https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/crda.git")
6128 (commit (string-append "v" version))))
6129 (file-name (git-file-name name version))
6130 (sha256
6131 (base32 "1ajh8zx84p15y9wawh764zawniwn059iw9m32v56ajvkz9xbnkp2"))
6132 (patches (search-patches "crda-optional-gcrypt.patch"))))
6133 (build-system gnu-build-system)
6134 (arguments
6135 (list #:phases
6136 #~(modify-phases %standard-phases
6137 (delete 'configure)
6138 (add-after 'unpack 'gzip-deterministically
6139 (lambda _
6140 (substitute* "Makefile"
6141 (("gzip" command)
6142 (string-append command " --no-name")))))
6143 #$@(if (%current-target-system)
6144 #~((add-after 'unpack 'fix-pkg-config
6145 (lambda* (#:key target #:allow-other-keys)
6146 (substitute* "Makefile"
6147 (("pkg-config" command)
6148 (string-append target "-" command))))))
6149 #~())
6150 (add-before 'build 'patch-Makefile
6151 (lambda _
6152 (substitute* "Makefile"
6153 (("ldconfig") "true"))))
6154 (add-before 'build 'set-regulatory-db-file-name
6155 (lambda* (#:key native-inputs inputs #:allow-other-keys)
6156 ;; Tell CRDA where to find our database.
6157 (let ((regdb (assoc-ref (or native-inputs inputs)
6158 "wireless-regdb")))
6159 (substitute* "crda.c"
6160 (("\"/lib/crda/regulatory.bin\"")
6161 (string-append "\"" regdb
6162 "/lib/crda/regulatory.bin\"")))))))
6163 #:test-target "verify"
6164 #:make-flags
6165 #~(list
6166 (string-append "CC=" #$(cc-for-target))
6167 "V=1"
6168
6169 ;; Disable signature-checking on 'regulatory.bin'.
6170 ;; The reason is that this simplifies maintenance
6171 ;; on our side (no need to manage a distro key
6172 ;; pair), and we can guarantee integrity of
6173 ;; 'regulatory.bin' by other means anyway, such as
6174 ;; 'guix gc --verify'. See
6175 ;; <https://wireless.wiki.kernel.org/en/developers/regulatory/wireless-regdb>
6176 ;; for a discssion.
6177 "USE_OPENSSL=0"
6178
6179 (string-append "PREFIX=" #$output)
6180 (string-append "SBINDIR=" #$output "/sbin/")
6181 (string-append "UDEV_RULE_DIR="
6182 #$output "/lib/udev/rules.d")
6183 (string-append "LDFLAGS=-Wl,-rpath="
6184 #$output "/lib -L.")
6185 (string-append "REG_BIN="
6186 #$(this-package-native-input "wireless-regdb")
6187 "/lib/crda/regulatory.bin")
6188 "all_noverify")))
6189 (native-inputs (list pkg-config wireless-regdb))
6190 (inputs (list libnl))
6191 (home-page
6192 "https://wireless.wiki.kernel.org/en/developers/Regulatory/CRDA")
6193 (synopsis "@acronym{CRDA, Central Regulatory Domain Agent} for WiFi")
6194 (description
6195 "The @acronym{CRDA, Central Regulatory Domain Agent} acts as the udev
6196helper for communication between the kernel Linux and user space for regulatory
6197compliance.")
6198 (license license:copyleft-next)))
6199
6200(define-public wireless-regdb
6201 (package
6202 (name "wireless-regdb")
6203 (version "2023.05.03")
6204 (source (origin
6205 (method url-fetch)
6206 (uri (string-append
6207 "mirror://kernel.org/software/network/wireless-regdb/"
6208 "wireless-regdb-" version ".tar.xz"))
6209 (sha256
6210 (base32 "04lc9jp8zxhyqxvkhrm637sswi2xm48jw8jnp3iflnknnf5d0m7j"))
6211
6212 ;; We're building 'regulatory.bin' by ourselves.
6213 (snippet '(begin
6214 (delete-file "regulatory.bin")))))
6215 (build-system gnu-build-system)
6216 (arguments
6217 (list
6218 #:phases
6219 #~(modify-phases %standard-phases
6220 (add-after 'unpack 'gzip-determinism
6221 (lambda _
6222 (substitute* "Makefile"
6223 (("gzip") "gzip --no-name"))))
6224 (add-after 'unpack 'omit-signature
6225 (lambda _
6226 (substitute* "Makefile"
6227 ;; Signing requires a REGDB_PUBCERT and REGDB_PRIVKEY which we
6228 ;; don't provide (see below). Disable it.
6229 ((" regulatory\\.db\\.p7s") "")
6230 ;; regulatory.db is built as a dependency of regulatory.db.p7s,
6231 ;; but ‘make install’ depends only on the latter while
6232 ;; installing both (and failing). Depend on it explicitly.
6233 (("^install: " all) (string-append all "regulatory.db ")))))
6234 (delete 'configure)) ; no configure script
6235
6236 ;; The 'all' target of the makefile depends on $(REGDB_CHANGED), which
6237 ;; is computed and can be equal to 'maintainer-clean'; when that
6238 ;; happens, we can end up deleting the 'regulatory.bin' file that we
6239 ;; just built. Thus, build things sequentially.
6240 #:parallel-build? #f
6241
6242 #:tests? #f ; no tests
6243 #:make-flags
6244 #~(list (string-append "PREFIX=" #$output)
6245 (string-append "FIRMWARE_PATH=$(PREFIX)/lib/firmware")
6246
6247 ;; Leave this empty so that db2bin.py doesn't try to sign
6248 ;; ‘regulatory.bin’. This allows us to avoid managing a key
6249 ;; pair for the whole distribution.
6250 (string-append "REGDB_PRIVKEY=")
6251 ;; Don't generate a public key for the same reason. These are
6252 ;; used as Makefile targets and can't be the empty string.
6253 (string-append "REGDB_PUBCERT=/dev/null")
6254 (string-append "REGDB_PUBKEY=/dev/null"))))
6255 (native-inputs
6256 (list python-wrapper))
6257 (home-page
6258 "https://wireless.wiki.kernel.org/en/developers/regulatory/wireless-regdb")
6259 (synopsis "Wireless regulatory database")
6260 (description
6261 "This package contains the wireless regulatory database for the
6262@acronym{CRDA, Central Regulatory Database Agent}. The database contains
6263information on country-specific regulations for the wireless spectrum.")
6264 (license license:isc)))
6265
6266(define-public lm-sensors
6267 (package
6268 (name "lm-sensors")
6269 (version "3.6.2")
6270 (source
6271 (origin
6272 (method git-fetch)
6273 (uri (git-reference
6274 (url "https://github.com/hramrach/lm-sensors")
6275 (commit (string-append "V" (string-join
6276 (string-split version #\.) "-")))))
6277 (file-name (git-file-name name version))
6278 (sha256
6279 (base32 "0p2ck8p9zb1w53l37pvm6c10vi6r8bfz51nd3sdwwsfhfhgvsr0j"))
6280 (patches (search-patches "lm-sensors-hwmon-attrs.patch"))))
6281 (build-system gnu-build-system)
6282 (outputs '("lib" ; avoid perl in closure
6283 "out"))
6284 (arguments
6285 (list
6286 #:tests? #f ; no 'check' target
6287 #:make-flags
6288 #~(list (string-append "PREFIX=" #$output)
6289 (string-append "ETCDIR=" #$output:lib "/etc")
6290 (string-append "INCLUDEDIR=" #$output:lib "/include")
6291 (string-append "MANDIR=" #$output "/share/man")
6292 (string-append "LIBDIR=" #$output:lib "/lib"))
6293 #:phases
6294 #~(modify-phases %standard-phases
6295 (delete 'configure)
6296 (add-before 'build 'patch-exec-paths
6297 (lambda* (#:key inputs #:allow-other-keys)
6298 (substitute* "prog/detect/sensors-detect"
6299 (("`uname")
6300 (string-append
6301 "`" (assoc-ref inputs "coreutils") "/bin/uname"))
6302 (("(`|\")modprobe" all open-quote)
6303 (string-append
6304 open-quote #$(this-package-input "kmod") "/bin/modprobe")))
6305 (substitute* '("prog/pwm/pwmconfig" "prog/pwm/fancontrol")
6306 (("gnuplot")
6307 (search-input-file inputs "/bin/gnuplot"))
6308 (("cat ")
6309 (string-append (search-input-file inputs "/bin/cat") " "))
6310 (("e?grep " match)
6311 (string-append
6312 (search-input-file
6313 inputs (string-append "/bin/" (string-trim-right match)))
6314 " "))
6315 (("sed -e")
6316 (string-append (search-input-file inputs "/bin/sed") " -e"))
6317 (("cut -d")
6318 (string-append (search-input-file inputs "/bin/cut") " -d"))
6319 (("sleep ")
6320 (string-append (search-input-file inputs "/bin/sleep") " "))
6321 (("readlink -f")
6322 (string-append
6323 (search-input-file inputs "/bin/readlink") " -f"))))))))
6324 (inputs
6325 (list gnuplot kmod perl rrdtool))
6326 (native-inputs
6327 (list bison flex pkg-config which))
6328 (home-page "https://hwmon.wiki.kernel.org/lm_sensors")
6329 (synopsis "Utilities to read temperature/voltage/fan sensors")
6330 (description
6331 "Lm-sensors is a hardware health monitoring package for Linux. It allows
6332you to access information from temperature, voltage, and fan speed sensors.
6333It works with most newer systems.")
6334 (license license:gpl2+)))
6335
6336(define-public iucode-tool
6337 (package
6338 (name "iucode-tool")
6339 (version "2.3.1")
6340 (source (origin
6341 (method url-fetch)
6342 (uri (string-append "https://gitlab.com/iucode-tool/releases"
6343 "/raw/latest/iucode-tool_" version ".tar.xz"))
6344 (sha256
6345 (base32
6346 "159gvf6ljgg3g4vlhyy6pyr0wz11rcyhp985vc4az58d9px8xf0j"))))
6347 (build-system gnu-build-system)
6348 (home-page "https://gitlab.com/iucode-tool/iucode-tool/wikis/home")
6349 (synopsis "Manipulate Intel microcode bundles")
6350 (description
6351 "@command{iucode_tool} is a utility to work with microcode packages for
6352Intel processors. It can convert between formats, extract specific versions,
6353create a firmware image suitable for the Linux kernel, and more.")
6354 ;; cpuid.h is available for i686, x86_64, and ia64.
6355 (supported-systems '("i686-linux" "x86_64-linux"))
6356 (license license:gpl2+)))
6357
6358(define-public i2c-tools
6359 (package
6360 (name "i2c-tools")
6361 (version "4.3")
6362 (source (origin
6363 (method url-fetch)
6364 (uri (string-append
6365 "http://jdelvare.nerim.net/mirror/i2c-tools/i2c-tools-"
6366 version ".tar.xz"))
6367 (sha256
6368 (base32
6369 "1y0fphjd5ah2j886x8i175r7viq0hmx666hyca0wi4dzrm290qxk"))))
6370 (build-system gnu-build-system)
6371 (arguments
6372 `(#:tests? #f ; no 'check' target
6373 #:make-flags
6374 ,#~(list (string-append "PREFIX=" #$output)
6375 (string-append "LDFLAGS+=-Wl,-rpath=" #$output "/lib")
6376 (string-append "CC=" #$(cc-for-target)))
6377 ;; No configure script.
6378 #:phases (modify-phases %standard-phases (delete 'configure))))
6379 (inputs
6380 (list perl))
6381 (home-page "http://jdelvare.nerim.net/devel.html#i2ctools")
6382 (synopsis "I2C tools for Linux")
6383 (description
6384 "The i2c-tools package contains a heterogeneous set of I2C tools for
6385Linux: a bus probing tool, a chip dumper, register-level SMBus access helpers,
6386EEPROM decoding scripts, EEPROM programming tools, and a python module for
6387SMBus access.")
6388 (license license:gpl2+)))
6389
6390(define-public i2c-tools-3
6391 (package
6392 (inherit i2c-tools)
6393 (name "i2c-tools")
6394 (version "3.1.2")
6395 (source (origin
6396 (method url-fetch)
6397 (uri (string-append
6398 "http://jdelvare.nerim.net/mirror/i2c-tools/i2c-tools-"
6399 version ".tar.bz2"))
6400 (sha256
6401 (base32 "0hd4c1w8lnwc3j95h3vpd125170l1d4myspyrlpamqx6wbr6jpnv"))))
6402 (arguments
6403 (substitute-keyword-arguments arguments
6404 ((#:make-flags _)
6405 #~(list (string-append "prefix=" #$output)
6406 (string-append "CC=" #$(cc-for-target))))))))
6407
6408(define-public python-smbus
6409 (package
6410 (inherit i2c-tools)
6411 (name "python-smbus")
6412 (build-system pyproject-build-system)
6413 (arguments
6414 (list #:tests? #f ;; No test suite.
6415 #:phases
6416 #~(modify-phases %standard-phases
6417 (add-after 'unpack 'change-directory
6418 (lambda _ (chdir "py-smbus")))
6419 (add-after 'change-directory 'set-library-path
6420 (lambda _
6421 (substitute* "setup.py"
6422 (("-L\\.\\./lib")
6423 (string-append "-L" #$(this-package-input "i2c-tools")
6424 "/lib"))))))))
6425 (inputs (list i2c-tools))
6426 (native-inputs (list python-setuptools python-wheel))
6427 (synopsis "I2C/SMBus access for Python")
6428 (description "This package provides a Python library to access
6429@acronym{I2C, Inter-Integrated Circuit} and @acronym{SMBus, System
6430Management Bus} devices on Linux.")))
6431
6432(define-public xsensors
6433 (package
6434 (name "xsensors")
6435 (version "0.70")
6436 (source (origin
6437 (method url-fetch)
6438 (uri (string-append
6439 "http://www.linuxhardware.org/xsensors/xsensors-"
6440 version ".tar.gz"))
6441 (sha256
6442 (base32
6443 "1siplsfgvcxamyqf44h71jx6jdfmvhfm7mh0y1q8ps4zs6pj2zwh"))))
6444 (build-system gnu-build-system)
6445 (arguments
6446 `(#:phases
6447 (modify-phases %standard-phases
6448 (add-before 'configure 'enable-deprecated
6449 (lambda _
6450 (substitute* "src/Makefile.in"
6451 (("-DGDK_DISABLE_DEPRECATED") "")
6452 (("-DGTK_DISABLE_DEPRECATED") ""))))
6453 (add-before 'configure 'remove-Werror
6454 (lambda _
6455 (substitute* '("configure" "src/Makefile.in")
6456 (("-Werror") "")))))))
6457 (inputs (list (list lm-sensors "lib") gtk+-2))
6458 (native-inputs (list pkg-config))
6459 (home-page "http://www.linuxhardware.org/xsensors/")
6460 (synopsis "Hardware health information viewer")
6461 (description
6462 "Xsensors reads data from the libsensors library regarding hardware
6463health such as temperature, voltage and fan speed and displays the information
6464in a digital read-out.")
6465 (license license:gpl2+)))
6466
6467(define-public perf
6468 (package
6469 (name "perf")
6470 (version (package-version linux-libre))
6471 (source (package-source linux-libre))
6472 (build-system gnu-build-system)
6473 (arguments
6474 '(#:phases
6475 (modify-phases %standard-phases
6476 (replace 'configure
6477 (lambda* (#:key inputs #:allow-other-keys)
6478 (setenv "SHELL_PATH" (which "bash"))
6479 (chdir "tools/perf")
6480
6481 ;; In Linux 6.10.6, 'Makefile.config' overrides PKG_CONFIG_PATH
6482 ;; when looking for libtraceevent and thus fails to find it.
6483 ;; Remove that.
6484 (substitute* "Makefile.config"
6485 (("PKG_CONFIG_PATH=[[:graph:]]+")
6486 ""))
6487
6488 ;; This file hard-codes file system layouts for specific distros
6489 ;; but not for ours; address that. With this change, one can run
6490 ;; "perf report --symfs=$HOME/.guix-profile" (without
6491 ;; "/lib/debug") and 'perf' should be able to find separate debug
6492 ;; info files.
6493 (substitute* "util/dso.c"
6494 (("/usr/lib/debug")
6495 "/lib/debug")))))
6496 #:make-flags (list (string-append "prefix="
6497 (assoc-ref %outputs "out"))
6498 "CC=gcc"
6499 "WERROR=0"
6500
6501 ;; By default, 'config/Makefile' uses lib64 on
6502 ;; x86_64. Work around that.
6503 "lib=lib")
6504 #:tests? #f)) ;no tests
6505 (native-inputs
6506 (list pkg-config
6507 bison
6508 flex
6509 ;; For build scripts.
6510 python-3
6511 ;; Documentation
6512 docbook-xsl
6513 xmlto
6514 asciidoc))
6515 (inputs
6516 (list slang ;for the interactive TUI
6517 zlib
6518 ;; newt
6519 python-3 ;'perf' links against libpython
6520 elfutils
6521 libiberty ;used alongside BDF for symbol demangling
6522 libunwind ;better stack walking
6523 libtraceevent
6524 numactl)) ;for 'perf bench numa mem'
6525 (home-page "https://perf.wiki.kernel.org/")
6526 (synopsis "Linux profiling with performance counters")
6527 (description
6528 "perf is a tool suite for profiling using hardware performance counters,
6529with support in the Linux kernel. perf can instrument CPU performance
6530counters, tracepoints, kprobes, and uprobes (dynamic tracing). It is capable
6531of lightweight profiling. This package contains the user-land tools and in
6532particular the @code{perf} command.")
6533 (license (package-license linux-libre))))
6534
6535(define-public pflask
6536 (package
6537 (name "pflask")
6538 (version "0.2")
6539 (source (origin
6540 (method git-fetch)
6541 (uri (git-reference
6542 (url "https://github.com/ghedo/pflask")
6543 (commit (string-append "v" version))))
6544 (file-name (git-file-name name version))
6545 (sha256
6546 (base32
6547 "1jikjbhlxlqracnai3v9krzcgd2xwp0p4adw5n07yxc7b857damz"))))
6548 (build-system cmake-build-system)
6549 (arguments
6550 '(#:tests? #f)) ; no tests
6551 (home-page "https://ghedo.github.io/pflask/")
6552 (synopsis "Simple tool for creating Linux namespace containers")
6553 (description "pflask is a simple tool for creating Linux namespace
6554containers. It can be used for running a command or even booting an OS inside
6555an isolated container, created with the help of Linux namespaces. It is
6556similar in functionality to chroot, although pflask provides better isolation
6557thanks to the use of namespaces.")
6558 (license license:bsd-2)))
6559
6560(define-public singularity
6561 (package
6562 (name "singularity")
6563 (version "2.6.1")
6564 (source (origin
6565 (method url-fetch)
6566 (uri (string-append "https://github.com/singularityware/singularity/"
6567 "releases/download/" version
6568 "/singularity-" version ".tar.gz"))
6569 (sha256
6570 (base32
6571 "1whx0hqqi1326scgdxxxa1d94vn95mnq0drid6s8wdp84ni4d3gk"))
6572 (modules '((guix build utils)))
6573 (snippet
6574 '(begin
6575 ;; Do not create directories in /var.
6576 (substitute* "Makefile.in"
6577 (("\\$\\(MAKE\\) .*install-data-hook") ""))
6578
6579 ;; The original source overrides PATH so that it points to
6580 ;; /bin, /usr/local/bin, etc., which obviously doesn't work
6581 ;; on Guix System. Leave PATH unchanged so we refer to the
6582 ;; installed Coreutils, grep, etc.
6583 (substitute* "bin/singularity.in"
6584 (("^PATH=.*" all)
6585 (string-append "#" all "\n")))
6586
6587 (substitute* (find-files "libexec/cli" "\\.exec$")
6588 (("\\$SINGULARITY_libexecdir/singularity/bin/([a-z]+)-suid"
6589 _ program)
6590 (string-append "/run/privileged/bin/singularity-"
6591 program "-helper")))
6592
6593 ;; These squashfs mount options are apparently no longer
6594 ;; supported since Linux-libre 5.4.5.
6595 (substitute* "src/lib/image/squashfs/mount.c"
6596 (("\"errors=remount-ro\"")
6597 "NULL"))))))
6598 (build-system gnu-build-system)
6599 (arguments
6600 (list
6601 #:configure-flags #~(list "--localstatedir=/var")
6602 #:phases
6603 #~(modify-phases %standard-phases
6604 (add-after 'unpack 'patch-references
6605 (lambda _
6606 (substitute* "libexec/cli/build.exec.in"
6607 (("-mksquashfs") (string-append "-" (which "mksquashfs"))))
6608 (substitute* (append
6609 (find-files "libexec" "functions")
6610 (find-files "libexec/bootstrap-scripts" ".*sh$")
6611 (find-files "libexec/cli" ".*exec$"))
6612 (("\\| grep ")
6613 (string-append "| " (which "grep") " "))
6614 (("egrep ")
6615 (string-append (which "egrep") " "))
6616 ((" sed ")
6617 (string-append " " (which "sed") " ")))))
6618 (add-after 'install 'set-PATH
6619 (lambda _
6620 ;; Have the 'singularity' and 'run-singularity' self-sufficient.
6621 ;; But don't override PATH, so that other tools like zcat and
6622 ;; tar can still be found if they are available.
6623 (let ((coreutils #$(this-package-input "coreutils")))
6624 (wrap-program (string-append #$output "/bin/singularity")
6625 `("PATH" prefix (,(string-append coreutils "/bin"))))
6626 (substitute* (string-append #$output "/bin/run-singularity")
6627 (("/usr/bin/env singularity")
6628 (string-append (which "env") " "
6629 #$output "/bin/singularity")))))))))
6630 (inputs
6631 (list bash-minimal
6632 coreutils
6633 libarchive
6634 python-wrapper
6635 squashfs-tools
6636 zlib))
6637 (home-page "https://singularity.lbl.gov/")
6638 (synopsis "Container platform")
6639 (description "Singularity is a container platform supporting a number of
6640container image formats. It can build SquashFS container images or import
6641existing Docker images. Singularity requires kernel support for container
6642isolation or root privileges.")
6643 (license license:bsd-3)))
6644
6645(define-public python-spython
6646 (package
6647 (name "python-spython")
6648 (version "0.3.13")
6649 (source
6650 (origin
6651 (method url-fetch)
6652 (uri (pypi-uri "spython" version))
6653 (sha256
6654 (base32 "0kly851k6mj7xzcybciav5d0pq5q04pzg7c5a1g712bqbxkha4ck"))))
6655 (build-system pyproject-build-system)
6656 (arguments
6657 (list
6658 #:phases
6659 #~(modify-phases %standard-phases
6660 ;; Configure absolute path to singularity.
6661 (add-after 'unpack 'configure
6662 (lambda* (#:key inputs #:allow-other-keys)
6663 (let ((singularity (search-input-file inputs "bin/singularity")))
6664 (substitute* "spython/utils/terminal.py"
6665 (("software=\"singularity\"")
6666 (string-append "software=\"" singularity "\"")))
6667 (substitute* (list "spython/utils/terminal.py"
6668 "spython/main/help.py"
6669 "spython/main/base/command.py")
6670 (("\\[\"singularity\"")
6671 (string-append "[\"" singularity "\"")))
6672 (substitute* "spython/main/execute.py"
6673 (("shutil.which\\(\"singularity\"\\)")
6674 (string-append "shutil.which(\"" singularity "\")"))))))
6675 ;; Skip tests that require network access.
6676 (add-before 'check 'skip-tests
6677 (lambda _
6678 (delete-file "spython/tests/test_client.py"))))))
6679 (inputs
6680 (list singularity))
6681 (native-inputs
6682 (list python-pytest python-setuptools python-wheel))
6683 (home-page "https://github.com/singularityhub/singularity-cli")
6684 (synopsis "Singularity Python client")
6685 (description "@code{python-spython} is a Python library to interact with
6686Singularity containers.")
6687 (license license:mpl2.0)))
6688
6689(define-public libnvme
6690 (package
6691 (name "libnvme")
6692 (version "1.5")
6693 (source (origin
6694 (method git-fetch)
6695 (uri (git-reference
6696 (url "https://github.com/linux-nvme/libnvme.git")
6697 (commit (string-append "v" version))))
6698 (sha256
6699 (base32 "1wq8bw60l090z2kb717wyzk5wz1jrcn31ykdaa7k9pz9w79v0v67"))
6700 (file-name (git-file-name name version))))
6701 (build-system meson-build-system)
6702 (outputs (list "out" "doc")) ; docs are 80% of all output
6703 (arguments
6704 (list
6705 #:configure-flags
6706 #~(let ((doc (string-append #$output:doc "/share/doc/" #$name)))
6707 (list (string-append "-Dhtmldir=" doc "/html")
6708 (string-append "-Drstdir=" doc "/rst")
6709 "-Ddocs-build=true" "-Ddocs=all"))))
6710 (native-inputs (list pkg-config perl python python-sphinx))
6711 ;; libnvme.pc, libnvme-mi.pc lists these in Requires.private.
6712 (propagated-inputs (list dbus json-c openssl))
6713 (home-page "https://github.com/linux-nvme/libnvme")
6714 (synopsis "C Library for NVM Express on Linux")
6715 (description "libnvme provides type definitions for NVMe specification
6716structures, enumerations, and bit fields, helper functions to construct,
6717dispatch, and decode commands and payloads, and utilities to connect, scan,
6718and manage nvme devices on a Linux system.")
6719 (license license:lgpl2.1+)))
6720
6721(define-public nvme-cli
6722 (package
6723 (name "nvme-cli")
6724 (version "2.5")
6725 (home-page "https://github.com/linux-nvme/nvme-cli")
6726 (source (origin
6727 (method git-fetch)
6728 (uri (git-reference
6729 (url home-page)
6730 (commit (string-append "v" version))))
6731 (sha256
6732 (base32 "1jv1xir6gm86yyk5846qqkcjhc1bq103zyxf794fznyinh4nhlbg"))
6733 (file-name (git-file-name name version))))
6734 (build-system meson-build-system)
6735 (outputs (list "out" "doc")) ; docs make up ~70% of total size
6736 (arguments
6737 (list
6738 #:configure-flags #~(list (format #f "-Dhtmldir=~a/share/doc/~a/html"
6739 #$output:doc #$name)
6740 "-Ddocs=all")))
6741 (native-inputs (list pkg-config))
6742 (inputs (list libnvme json-c zlib))
6743 (synopsis "NVM-Express user space tooling for Linux")
6744 (description "Nvme-cli is a utility to provide standards compliant tooling
6745for NVM-Express drives. It was made specifically for Linux as it relies on the
6746IOCTLs defined by the mainline kernel driver.")
6747 (license license:gpl2+)))
6748
6749(define-public rfkill
6750 (package
6751 (name "rfkill")
6752 (version "0.5")
6753 (source (origin
6754 (method url-fetch)
6755 (uri (string-append "mirror://kernel.org/software/network/"
6756 name "/" name "-" version ".tar.xz"))
6757 (sha256
6758 (base32
6759 "0snqj5h0y991lszbigbyyqb8swj0hxajc1vfqg2scfay44231bp0"))))
6760 (build-system gnu-build-system)
6761 (arguments
6762 `(#:make-flags (list "CC=gcc"
6763 (string-append "PREFIX=" %output))
6764 #:phases (modify-phases %standard-phases
6765 (delete 'configure))
6766 #:tests? #f))
6767 (home-page "https://wireless.wiki.kernel.org/en/users/Documentation/rfkill")
6768 (synopsis "Tool for enabling and disabling wireless devices")
6769 (description
6770 "rfkill is a simple tool for accessing the rfkill device interface,
6771which is used to enable and disable wireless networking devices, typically
6772WLAN, Bluetooth and mobile broadband.")
6773 (license (license:non-copyleft "file://COPYING"
6774 "See COPYING in the distribution."))
6775 ;; rfkill is part of util-linux as of 2.31.
6776 (properties `((superseded . ,util-linux)))))
6777
6778(define-public acpi
6779 (package
6780 (name "acpi")
6781 (version "1.7")
6782 (source (origin
6783 (method url-fetch)
6784 (uri (string-append "mirror://sourceforge/acpiclient/acpiclient/"
6785 version "/" name "-" version ".tar.gz"))
6786 (sha256
6787 (base32
6788 "01ahldvf0gc29dmbd5zi4rrnrw2i1ajnf30sx2vyaski3jv099fp"))))
6789 (build-system gnu-build-system)
6790 (home-page "http://acpiclient.sourceforge.net")
6791 (synopsis "Display information on ACPI devices")
6792 (description "@code{acpi} attempts to replicate the functionality of the
6793\"old\" @code{apm} command on ACPI systems, including battery and thermal
6794information. It does not support ACPI suspending, only displays information
6795about ACPI devices.")
6796 (license license:gpl2+)))
6797
6798(define-public acpid
6799 (package
6800 (name "acpid")
6801 (version "2.0.34")
6802 (source (origin
6803 (method url-fetch)
6804 (uri (string-append "mirror://sourceforge/acpid2/acpid-"
6805 version ".tar.xz"))
6806 (sha256
6807 (base32
6808 "0cxkdbd087kj9ikprvvjpk0ixzqbipf2rmj6qyp7r15wzj65q29d"))))
6809 (build-system gnu-build-system)
6810 (home-page "https://sourceforge.net/projects/acpid2/")
6811 (synopsis "Daemon for delivering ACPI events to user-space programs")
6812 (description
6813 "acpid is designed to notify user-space programs of Advanced
6814Configuration and Power Interface (ACPI) events. acpid should be started
6815during the system boot, and will run as a background process. When an ACPI
6816event is received from the kernel, acpid will examine the list of rules
6817specified in /etc/acpi/events and execute the rules that match the event.")
6818 (license license:gpl2+)))
6819
6820(define-public sysfsutils
6821 (package
6822 (name "sysfsutils")
6823 (version "2.1.0")
6824 (source
6825 (origin
6826 (method url-fetch)
6827 (uri
6828 (string-append
6829 "mirror://sourceforge/linux-diag/sysfsutils/" version "/sysfsutils-"
6830 version ".tar.gz"))
6831 (sha256
6832 (base32 "12i0ip11xbfcjzxz4r10cvz7mbzgq1hfcdn97w6zz7sm3wndwrg8"))))
6833 (build-system gnu-build-system)
6834 (home-page "https://linux-diag.sourceforge.net/Sysfsutils.html")
6835 (synopsis "System utilities based on Linux sysfs")
6836 (description
6837 "These are a set of utilities built upon sysfs, a virtual file system in
6838Linux kernel versions 2.5+ that exposes a system's device tree. The package
6839also contains the libsysfs library.")
6840 ;; The library is under lgpl2.1+ (all files say "or any later version").
6841 ;; The rest is mostly gpl2, with a few files indicating gpl2+.
6842 (license (list license:gpl2 license:gpl2+ license:lgpl2.1+))))
6843
6844(define-public cpufrequtils
6845 (let ((commit "a2f0c39d5f21596bb9f5223e895c0ff210b265d0")
6846 (revision "1"))
6847 (package
6848 (name "cpufrequtils")
6849 (version (git-version "008" revision commit))
6850 (source
6851 (origin
6852 (method git-fetch)
6853 (uri
6854 (git-reference
6855 (url "https://git.kernel.org/pub/scm/linux/kernel/git/brodo/cpufrequtils.git")
6856 (commit commit)))
6857 (file-name (git-file-name name version))
6858 (sha256
6859 (base32 "01n2hp6v89cilqqvqvlcprphyhnljsjclh4h1zf3b1l7ypz29lbp"))))
6860 (build-system gnu-build-system)
6861 (arguments
6862 (list
6863 #:tests? #f ;no test suite
6864 #:make-flags
6865 #~(let ((out #$output))
6866 (list "PROC=false" ;obsoleted by sysfs in Linux 2.6(!)
6867 (string-append "CC=" #$(cc-for-target))
6868 (string-append "LDFLAGS=-Wl,-rpath=" out "/lib")
6869 "INSTALL=install"
6870 (string-append "bindir=" out "/bin")
6871 (string-append "sbindir=" out "/sbin")
6872 (string-append "mandir=" out "/share/man")
6873 (string-append "includedir=" out "/include")
6874 (string-append "libdir=" out "/lib")
6875 (string-append "localedir=" out "/share/locale")
6876 (string-append "docdir=" out "/share/doc/" #$name)))
6877 #:phases
6878 #~(modify-phases %standard-phases
6879 (delete 'configure)))) ;no configure script
6880 (native-inputs (list gettext-minimal))
6881 (home-page
6882 "http://ftp.be.debian.org/pub/linux/utils/kernel/cpufreq/cpufrequtils.html")
6883 (synopsis "Utilities to get and set CPU frequency on Linux")
6884 (description
6885 "The cpufrequtils suite contains utilities to retrieve CPU frequency
6886information, and set the CPU frequency if supported, using the cpufreq
6887capabilities of the Linux kernel.")
6888 (license license:gpl2))))
6889
6890(define-public libite
6891 (package
6892 (name "libite")
6893 (version "2.5.2")
6894 (source
6895 (origin
6896 (method git-fetch)
6897 (uri (git-reference
6898 (url "https://github.com/troglobit/libite")
6899 (commit (string-append "v" version))))
6900 (file-name (git-file-name name version))
6901 (sha256
6902 (base32 "0i27ppb557kdc1hm7nf0f5r7sxvqma31pr57h79whl6qcp28gy4a"))))
6903 (build-system gnu-build-system)
6904 (arguments
6905 `(#:configure-flags
6906 (list "--disable-static")
6907 #:phases
6908 (modify-phases %standard-phases
6909 (add-after 'unpack 'fix-tests
6910 (lambda* (#:key inputs #:allow-other-keys)
6911 ;; replace paths to the executables
6912 (substitute* "test/which.c"
6913 (("/usr/bin/which")
6914 (search-input-file inputs "/bin/which"))
6915 (("ls\"")
6916 (string-append
6917 (search-input-file inputs "/bin/ls") "\"")))
6918 ;; create pidfile in /tmp instead of /var
6919 (substitute* "test/pidfile.c" (("/var/tmp") "/tmp")))))))
6920 (native-inputs (list autoconf automake libtool which))
6921 (synopsis "Library providing missing pieces in GNU libc")
6922 (description "This package provides many of the missing pieces in GNU
6923libc. Most notably the string functions: strlcpy(3), strlcat(3) and the *BSD
6924sys/queue.h and sys/tree.h API's.")
6925 (home-page "https://troglobit.com/projects/libite/")
6926 (license license:expat)))
6927
6928(define-public libuev
6929 (package
6930 (name "libuev")
6931 (version "2.4.0")
6932 (source
6933 (origin
6934 (method git-fetch)
6935 (uri (git-reference
6936 (url "https://github.com/troglobit/libuev")
6937 (commit (string-append "v" version))))
6938 (file-name (git-file-name name version))
6939 (sha256
6940 (base32
6941 "0ih82lxfdcq179kknzdl5c8vi1l0n5j7yh68y8f6kwsrm457paf7"))))
6942 (build-system gnu-build-system)
6943 (native-inputs (list autoconf automake libtool))
6944 (synopsis "Lightweight event loop library for epoll family APIs")
6945 (description "This package provides small event loop that wraps the
6946epoll family of APIs.")
6947 (home-page "https://troglobit.com/projects/libuev/")
6948 (license license:expat)))
6949
6950(define-public libraw1394
6951 (package
6952 (name "libraw1394")
6953 (version "2.1.2")
6954 (source (origin
6955 (method url-fetch)
6956 (uri (string-append
6957 "mirror://kernel.org/linux/libs/ieee1394/"
6958 name "-" version ".tar.xz"))
6959 (sha256
6960 (base32
6961 "0pm5b415j1qdzyw38wdv8h7ff4yx20831z1727mpsb6jc6bwdk03"))))
6962 (build-system gnu-build-system)
6963 (home-page "https://ieee1394.wiki.kernel.org/index.php/Main_Page")
6964 (synopsis "Interface library for the Linux IEEE1394 drivers")
6965 (description
6966 "Libraw1394 is the only supported interface to the kernel side raw1394 of
6967the Linux IEEE-1394 subsystem, which provides direct access to the connected
69681394 buses to user space. Through libraw1394/raw1394, applications can directly
6969send to and receive from other nodes without requiring a kernel driver for the
6970protocol in question.")
6971 (license license:lgpl2.1+)))
6972
6973(define-public libavc1394
6974 (package
6975 (name "libavc1394")
6976 (version "0.5.4")
6977 (source (origin
6978 (method url-fetch)
6979 (uri (string-append "mirror://sourceforge/libavc1394/libavc1394/"
6980 name "-" version ".tar.gz"))
6981 (sha256
6982 (base32
6983 "0lsv46jdqvdx5hx92v0z2cz3yh6212pz9gk0k3513sbaa04zzcbw"))))
6984 (build-system gnu-build-system)
6985 (native-inputs
6986 (list pkg-config))
6987 (propagated-inputs
6988 (list libraw1394)) ; required by libavc1394.pc
6989 (home-page "https://sourceforge.net/projects/libavc1394/")
6990 (synopsis "AV/C protocol library for IEEE 1394")
6991 (description
6992 "Libavc1394 is a programming interface to the AV/C specification from
6993the 1394 Trade Association. AV/C stands for Audio/Video Control.")
6994 (license license:lgpl2.1+)))
6995
6996(define-public libiec61883
6997 (package
6998 (name "libiec61883")
6999 (version "1.2.0")
7000 (source (origin
7001 (method url-fetch)
7002 (uri (string-append
7003 "mirror://kernel.org/linux/libs/ieee1394/"
7004 name "-" version ".tar.xz"))
7005 (sha256
7006 (base32
7007 "17ph458zya2l8dr2xwqnzy195qd9swrir31g78qkgb3g4xz2rq6i"))))
7008 (build-system gnu-build-system)
7009 (native-inputs
7010 (list pkg-config))
7011 (propagated-inputs
7012 (list libraw1394)) ; required by libiec61883.pc
7013 (home-page "https://ieee1394.wiki.kernel.org/index.php/Main_Page")
7014 (synopsis "Isochronous streaming media library for IEEE 1394")
7015 (description
7016 "The libiec61883 library provides a higher level API for streaming DV,
7017MPEG-2 and audio over Linux IEEE 1394.")
7018 (license license:lgpl2.1+)))
7019
7020(define-public mdadm
7021 (package
7022 (name "mdadm")
7023 (version "4.2")
7024 (source (origin
7025 (method url-fetch)
7026 (uri (string-append
7027 "mirror://kernel.org/linux/utils/raid/mdadm/mdadm-"
7028 version ".tar.xz"))
7029 (sha256
7030 (base32
7031 "07ghmibmbnkdy91ng87zdllzicm299l20dhs9m5bfjw6f1b22726"))))
7032 (build-system gnu-build-system)
7033 (arguments
7034 (list #:make-flags
7035 #~(list (string-append "CC=" #$(cc-for-target))
7036 "INSTALL=install"
7037 "CHECK_RUN_DIR=0"
7038 ;; TODO: tell it where to find 'sendmail'
7039 ;; (string-append "MAILCMD=" <???> "/sbin/sendmail")
7040 (string-append "BINDIR=" #$output "/sbin")
7041 (string-append "MANDIR=" #$output "/share/man")
7042 (string-append "UDEVDIR=" #$output "/lib/udev"))
7043 #:phases
7044 #~(modify-phases %standard-phases
7045 (add-before 'build 'patch-program-paths
7046 (lambda* (#:key native-inputs inputs #:allow-other-keys)
7047 (let ((coreutils (assoc-ref (or native-inputs inputs)
7048 "coreutils")))
7049 (substitute* "udev-md-raid-arrays.rules"
7050 (("/usr/bin/(readlink|basename)" all program)
7051 (string-append coreutils "/bin/" program))))))
7052 (add-before 'build 'remove-W-error
7053 (lambda _
7054 ;; We cannot build with -Werror on i686 due to a
7055 ;; 'sign-compare' warning in util.c.
7056 (substitute* "Makefile"
7057 (("-Werror") ""))))
7058 (delete 'configure))
7059 ;; Tests must be run as root.
7060 #:tests? #f))
7061 (inputs
7062 (list eudev))
7063 (supported-systems (remove target-hurd? %supported-systems))
7064 (home-page "http://neil.brown.name/blog/mdadm")
7065 (synopsis "Tool for managing Linux Software RAID arrays")
7066 (description
7067 "mdadm is a tool for managing Linux Software RAID arrays. It can create,
7068assemble, report on, and monitor arrays. It can also move spares between raid
7069arrays when needed.")
7070 (license license:gpl2+)))
7071
7072(define-public mdadm-static
7073 (package
7074 (inherit mdadm)
7075 (name "mdadm-static")
7076 (arguments
7077 (substitute-keyword-arguments arguments
7078 ((#:make-flags flags)
7079 #~(cons* "LDFLAGS = -static"
7080 "CXFLAGS = -DNO_LIBUDEV"
7081 #$flags))
7082 ((#:phases phases)
7083 #~(modify-phases #$phases
7084 (add-after 'install 'remove-cruft
7085 (lambda* (#:key outputs #:allow-other-keys)
7086 (let* ((out (assoc-ref outputs "out"))
7087 (precious? (lambda (file)
7088 (member file '("." ".." "sbin"))))
7089 (directories (scandir out (negate precious?))))
7090 (with-directory-excursion out
7091 (for-each delete-file-recursively directories)
7092 (remove-store-references "sbin/mdadm")
7093 (delete-file "sbin/mdmon")))))))
7094 ((#:modules modules %default-gnu-modules)
7095 `((ice-9 ftw) ,@modules))
7096 ((#:strip-flags _ '())
7097 ''("--strip-all")) ;strip a few extra KiB
7098 ((#:allowed-references _ '("out"))
7099 '("out")))) ;refer only self
7100 (synopsis "Statically-linked 'mdadm' command for use in an initrd")))
7101
7102(define-public multipath-tools
7103 (package
7104 (name "multipath-tools")
7105 (version "0.11.0")
7106 (home-page "https://github.com/opensvc/multipath-tools")
7107 (source (origin
7108 (method git-fetch)
7109 (uri (git-reference (url home-page) (commit version)))
7110 (file-name (git-file-name name version))
7111 (sha256
7112 (base32
7113 "1yl2cd4xgw2l5xzx5dbdf7awhrvfbjsrspli9i6bmxc5j4jkvazr"))
7114 (modules '((guix build utils)))
7115 (snippet
7116 '(begin
7117 ;; Drop bundled valgrind headers.
7118 (delete-file-recursively "third-party")
7119 (substitute* '("multipathd/main.c"
7120 "libmpathutil/debug.c")
7121 (("#include \"../third-party/")
7122 "#include \""))))))
7123 (build-system gnu-build-system)
7124 (arguments
7125 (list
7126 #:test-target "test"
7127 #:make-flags #~(list (string-append "CC=" #$(cc-for-target))
7128 (string-append "prefix=" #$output)
7129 ;; Install Udev rules below this directory, relative
7130 ;; to the prefix.
7131 (string-append "systemd_prefix=" #$output))
7132 #:phases
7133 #~(modify-phases %standard-phases
7134 (add-after 'unpack 'patch-source
7135 (lambda* (#:key inputs #:allow-other-keys)
7136 (let ((libdevmapper.h
7137 (search-input-file inputs "include/libdevmapper.h"))
7138 (libudev.h
7139 (search-input-file inputs "include/libudev.h")))
7140 (substitute* "Makefile.inc"
7141 (("/bin/echo") "echo")
7142 (("\\$\\(prefix\\)/usr") "$(prefix)")
7143 (("configdir.*:= \\$\\(prefix\\)/etc/multipath/conf.d")
7144 "configdir := /etc/multipath/conf.d")
7145 ;; Do not save timestamp to avoid gzip "timestamp
7146 ;; out-of-range" warnings.
7147 (("gzip -9") "gzip -9n"))
7148 (substitute* '("kpartx/Makefile" "libmultipath/Makefile")
7149 (("/usr/include/libdevmapper.h") libdevmapper.h)
7150 (("/usr/include/libudev.h") libudev.h)))))
7151 (add-after 'unpack 'skip-failing-tests
7152 (lambda _
7153 ;; This test and the module's setup() test an arbitrary block
7154 ;; device node name, but the build environment has none.
7155 (substitute* "tests/devt.c"
7156 (("return get_one_devt.*") "return 0;\n")
7157 (("cmocka_unit_test\\(test_devt2devname_devt_good\\),") ""))
7158 ;; The above triggers -Werror=unused-function. Ignore it.
7159 (substitute* "tests/Makefile"
7160 (("CFLAGS \\+= " match)
7161 (string-append match "-Wno-error=unused-function ")))))
7162 (delete 'configure) ;no configure script
7163 (add-before 'build 'no-fortify-3
7164 (lambda _
7165 ;; NOTE: The check made seems to wrongly assume the
7166 ;; FORTIFY_SOURCE=3 is valid. However, when compiling, warnings
7167 ;; are emitted from glibc, resulting in failed build. Fix this
7168 ;; by forcing the usage of FORTIFY_SOURCE=2.
7169 (substitute* "create-config.mk"
7170 (("FORTIFY_SOURCE=3")
7171 "FORTIFY_SOURCE=2"))))
7172 (add-before 'build 'set-LDFLAGS
7173 (lambda _
7174 ;; Note: this cannot be passed as a make flag because that will
7175 ;; override the build system LDFLAGS.
7176 (setenv "LDFLAGS"
7177 (string-append "-Wl,-rpath=" #$output "/lib")))))))
7178
7179 (native-inputs
7180 (list perl pkg-config valgrind/pinned
7181 ;; For tests.
7182 cmocka))
7183 (inputs
7184 (list json-c
7185 libaio
7186 liburcu
7187 lvm2
7188 readline
7189 eudev
7190 ;; For libmount.
7191 `(,util-linux "lib")))
7192 (synopsis "Access block devices through multiple paths")
7193 (description
7194 "This package provides the following binaries to drive the
7195Linux Device Mapper multipathing driver:
7196@enumerate
7197@item @command{multipath} - Device mapper target autoconfig.
7198@item @command{multipathd} - Multipath daemon.
7199@item @command{mpathpersist} - Manages SCSI persistent reservations on
7200@code{dm} multipath devices.
7201@item @command{kpartx} - Create device maps from partition tables.
7202@end enumerate")
7203 (license (list license:gpl2+ ;main distribution
7204 license:lgpl2.0+)))) ;libmpathcmd/mpath_cmd.h
7205
7206(define-public libaio
7207 (package
7208 (name "libaio")
7209 (version "0.3.113")
7210 (source (origin
7211 (method url-fetch)
7212 (uri (list
7213 (string-append "https://releases.pagure.org/libaio/"
7214 name "-" version ".tar.gz")))
7215 (sha256
7216 (base32
7217 "02r0g2vfv6kfljplm3ga93w4xw13q2wixbn9hwi7ahqdzp2x2i1c"))
7218 (patches (search-patches "libaio-32bit-test.patch"))))
7219 (build-system gnu-build-system)
7220 (arguments
7221 (list #:make-flags
7222 #~(list (string-append "prefix=" #$output)
7223 (string-append "CC=" #$(cc-for-target)))
7224 #:test-target "partcheck" ; need root for a full 'check'
7225 #:phases
7226 #~(modify-phases %standard-phases
7227 (add-after 'unpack 'disable-problematic-tests
7228 (lambda _
7229 (with-directory-excursion "harness/cases"
7230 ;; The 21.t test fails with "Expected 4096, got
7231 ;; 18446744073709551605" (see:
7232 ;; https://pagure.io/libaio/issue/26).
7233 (rename-file "21.t" "21.t.disabled"))))
7234 (delete 'configure) ; no configure script
7235 #$@(if (target-riscv64?)
7236 #~((add-after 'unpack 'patch-test
7237 (lambda* (#:key build-inputs #:allow-other-keys)
7238 (invoke "patch" "-p1" "-i"
7239 #$(local-file
7240 (search-patch
7241 "libaio-riscv-test5.patch"))))))
7242 #~()))))
7243 (native-inputs
7244 (if (target-riscv64?)
7245 (list (search-patch "libaio-riscv-test5.patch")
7246 patch)
7247 '()))
7248 (home-page "https://pagure.io/libaio")
7249 (synopsis "Linux-native asynchronous I/O access library")
7250 (description
7251 "This library enables userspace to use Linux kernel asynchronous I/O
7252system calls, important for the performance of databases and other advanced
7253applications.")
7254 (license license:lgpl2.1+)))
7255
7256(define-public blktrace
7257 ;; Take a newer commit to get the latest patches.
7258 (let ((commit "b9ea6e507e8849f01d06aa48c0c59c5cee4820be")
7259 (revision "1"))
7260 (package
7261 (name "blktrace")
7262 (version (git-version "1.3.0" revision commit))
7263 (home-page
7264 "https://git.kernel.org/pub/scm/linux/kernel/git/axboe/blktrace.git")
7265 (source (origin
7266 (method git-fetch)
7267 (uri (git-reference
7268 (url home-page)
7269 (commit commit)))
7270 (sha256
7271 (base32 "0a4830mlqckbhchar1xcn2w4f24bzb75bigdig5wpm2axl0zc8cq"))
7272 (file-name (git-file-name name version))))
7273 (build-system gnu-build-system)
7274 (arguments
7275 (list
7276 #:make-flags
7277 #~(list (string-append "CC=" #$(cc-for-target))
7278 (string-append "prefix=" #$output))
7279 #:tests? #f ; no tests
7280 #:phases
7281 #~(modify-phases %standard-phases
7282 (delete 'configure) ; no configure script
7283 (add-after 'unpack 'fix-gnuplot-path
7284 (lambda* (#:key inputs #:allow-other-keys)
7285 (substitute* "btt/bno_plot.py"
7286 (("gnuplot %s")
7287 (string-append
7288 (search-input-file inputs "/bin/gnuplot" ) " %s"))))))))
7289 (inputs
7290 (list libaio
7291 gnuplot
7292 python-wrapper)) ; for 'bno_plot.py'
7293 (synopsis "Block layer IO tracing mechanism")
7294 (description "Blktrace is a block layer IO tracing mechanism which provides
7295detailed information about request queue operations to user space. It extracts
7296event traces from the kernel (via the relaying through the debug file system).")
7297 (license license:gpl2))))
7298
7299(define-public sbc
7300 (package
7301 (name "sbc")
7302 (version "1.5")
7303 (source (origin
7304 (method url-fetch)
7305 (uri (string-append "mirror://kernel.org/linux/bluetooth/sbc-"
7306 version ".tar.xz"))
7307 (patches (search-patches "sbc-fix-build-non-x86.patch"))
7308 (sha256
7309 (base32
7310 "1liig5856crb331dps18mp0s13zbkv7yh007zqhq97m94fcddfhc"))))
7311 (build-system gnu-build-system)
7312 (inputs
7313 (list libsndfile))
7314 (native-inputs
7315 (list pkg-config))
7316 (home-page "https://www.kernel.org/pub/linux/bluetooth/")
7317 (synopsis "Bluetooth subband audio codec")
7318 (description
7319 "The SBC is a digital audio encoder and decoder used to transfer data to
7320Bluetooth audio output devices like headphones or loudspeakers.")
7321 (license license:gpl2+)))
7322
7323(define-public bluez
7324 (package
7325 (name "bluez")
7326 (version "5.79")
7327 (source (origin
7328 (method url-fetch)
7329 (uri (string-append
7330 "mirror://kernel.org/linux/bluetooth/bluez-"
7331 version ".tar.xz"))
7332 (sha256
7333 (base32
7334 "12pal1m4xlr8k7kxb6isv5lbaca2wc5zcgy0907wfwcz78qaar21"))))
7335 (build-system gnu-build-system)
7336 (arguments
7337 (list
7338 #:configure-flags
7339 #~(list "--sysconfdir=/etc"
7340 "--localstatedir=/var"
7341 "--enable-library"
7342 "--enable-wiimote"
7343 "--disable-systemd"
7344 ;; TODO: is this needed? Not installed by default since 5.55.
7345 "--enable-hid2hci"
7346 ;; Install dbus/udev files to the correct location.
7347 (string-append "--with-dbusconfdir=" #$output "/etc")
7348 (string-append "--with-udevdir=" #$output "/lib/udev"))
7349 #:phases
7350 #~(modify-phases %standard-phases
7351 ;; Test unit/test-gatt fails unpredictably. Seems to be a timing
7352 ;; issue (discussion on upstream mailing list:
7353 ;; https://marc.info/?t=149578476300002&r=1&w=2)
7354 (add-before 'check 'skip-wonky-test
7355 (lambda _
7356 (substitute* "unit/test-gatt.c"
7357 (("tester_init\\(&argc, &argv\\);") "return 77;"))))
7358 (replace 'install
7359 (lambda* (#:key make-flags #:allow-other-keys #:rest args)
7360 ;; Override the sysconfdir and localstatedir locations only for
7361 ;; the installation phase. Otherwise, the installation fails when
7362 ;; it tries to write to /etc/bluetooth and /var.
7363 (define make-flags*
7364 (append make-flags (list (string-append "sysconfdir="
7365 #$output "/etc")
7366 (string-append "localstatedir="
7367 #$output "/var"))))
7368 (apply (assoc-ref %standard-phases 'install)
7369 (append args (list #:make-flags make-flags*)))))
7370 (add-after 'install 'post-install
7371 (lambda* (#:key inputs outputs #:allow-other-keys)
7372 (let* ((servicedir (string-append #$output
7373 "/share/dbus-1/services"))
7374 (service "obexd/src/org.bluez.obex.service")
7375 (rule (string-append
7376 #$output "/lib/udev/rules.d/97-hid2hci.rules")))
7377 ;; Install the obex dbus service file.
7378 (substitute* service
7379 (("/bin/false")
7380 (string-append #$output "/libexec/bluetooth/obexd")))
7381 (install-file service servicedir)
7382 ;; Fix paths in the udev rule.
7383 (substitute* rule
7384 (("hid2hci --method")
7385 (string-append #$output "/lib/udev/hid2hci --method"))
7386 (("/sbin/udevadm")
7387 (search-input-file inputs "/bin/udevadm")))))))))
7388 (native-inputs
7389 (list gettext-minimal
7390 pkg-config
7391 python
7392 python-docutils
7393 python-pygments))
7394 (inputs
7395 (list glib dbus eudev libical readline))
7396 (home-page "https://www.bluez.org/")
7397 (synopsis "Linux Bluetooth protocol stack")
7398 (description
7399 "BlueZ provides support for the core Bluetooth layers and protocols. It
7400is flexible, efficient and uses a modular implementation.")
7401 (license license:gpl2+)))
7402
7403(define-public fuse-exfat
7404 (package
7405 (name "fuse-exfat")
7406 (version "1.4.0")
7407 (source (origin
7408 (method url-fetch)
7409 (uri (string-append
7410 "https://github.com/relan/exfat/releases/download/v"
7411 version "/" name "-" version ".tar.gz"))
7412 (sha256
7413 (base32
7414 "07h0ngnydfy8n8h9ni3jn8zlmcj4pzqa0nk0hk0i4yhfbv2yvkx1"))))
7415 (build-system gnu-build-system)
7416 (native-inputs
7417 (list pkg-config))
7418 (inputs
7419 (list fuse-2))
7420 (home-page "https://github.com/relan/exfat")
7421 (synopsis "Mount exFAT file systems")
7422 (description
7423 "This package provides a FUSE-based file system that provides read and
7424write access to exFAT devices.")
7425 (license license:gpl2+)))
7426
7427(define-public fuseiso
7428 (package
7429 (name "fuseiso")
7430 (version "20070708")
7431 (source (origin
7432 (method url-fetch)
7433 (uri (string-append "mirror://sourceforge/fuseiso/fuseiso/"
7434 version "/fuseiso-" version ".tar.bz2"))
7435 (sha256
7436 (base32
7437 "127xql52dcdhmh7s5m9xc6q39jdlj3zhbjar1j821kb6gl3jw94b"))))
7438 (build-system gnu-build-system)
7439 (native-inputs
7440 (list pkg-config))
7441 (inputs
7442 (list fuse-2 glib zlib))
7443 (home-page "https://sourceforge.net/projects/fuseiso/")
7444 (synopsis "Mount ISO file system images")
7445 (description
7446 "FuseISO is a FUSE module to mount ISO file system images (.iso, .nrg,
7447.bin, .mdf and .img files). It supports plain ISO9660 Level 1 and 2, Rock
7448Ridge, Joliet, and zisofs.")
7449 (license license:gpl2)))
7450
7451(define-public gpm
7452 (package
7453 (name "gpm")
7454 (version "1.20.7")
7455 (source (origin
7456 (method url-fetch)
7457 (uri (string-append
7458 "https://www.nico.schottelius.org/software/gpm/archives/"
7459 "gpm-" version ".tar.bz2"))
7460 (patches (search-patches "gpm-glibc-2.26.patch"))
7461 (sha256
7462 (base32
7463 "13d426a8h403ckpc8zyf7s2p5rql0lqbg2bv0454x0pvgbfbf4gh"))
7464 (modules '((guix build utils)))
7465 (snippet
7466 '(begin
7467 ;; Take a patch from upstream to fix building with -fno-common,
7468 ;; which is default in GCC 10:
7469 ;; https://github.com/telmich/gpm/pull/37
7470 (substitute* "src/headers/daemon.h"
7471 (("^time_t[[:blank:]]+last_selection_time;")
7472 "extern time_t last_selection_time;"))))))
7473 (build-system gnu-build-system)
7474 (arguments
7475 '(#:phases (modify-phases %standard-phases
7476 (replace 'bootstrap
7477 (lambda _
7478 ;; The tarball was not generated with 'make dist' so we
7479 ;; need to bootstrap things ourselves.
7480 (substitute* "autogen.sh"
7481 (("/bin/sh") (which "sh")))
7482 (invoke "./autogen.sh")
7483 (patch-makefile-SHELL "Makefile.include.in")
7484 #t)))
7485
7486 ;; Make sure programs find libgpm.so.
7487 #:configure-flags (list (string-append "LDFLAGS=-Wl,-rpath="
7488 (assoc-ref %outputs "out")
7489 "/lib"))))
7490 (native-inputs
7491 (list texinfo
7492 bison
7493 flex
7494 autoconf
7495 automake
7496 libtool))
7497 (home-page "https://www.nico.schottelius.org/software/gpm/")
7498 (synopsis "Mouse support for the Linux console")
7499 (description
7500 "The GPM (general-purpose mouse) daemon is a mouse server for
7501applications running on the Linux console. It allows users to select items
7502and copy/paste text in the console and in xterm.")
7503 (license license:gpl2+)))
7504
7505(define-public gamemode
7506 (package
7507 (name "gamemode")
7508 (version "1.8.2")
7509 (source (origin
7510 (method git-fetch)
7511 (uri (git-reference
7512 (url "https://github.com/FeralInteractive/gamemode")
7513 (commit version)))
7514 (file-name (git-file-name name version))
7515 (sha256
7516 (base32 "14i3y385jzpr30lxk38z84rq76sy4cz0pwm54rm62f4mnk0xwjjp"))))
7517 (build-system meson-build-system)
7518 (arguments
7519 (list
7520 #:configure-flags
7521 #~(list
7522 ;; Don't build sample programs.
7523 "-Dwith-examples=false"
7524 ;; Build gamemoderun and other utilities.
7525 "-Dwith-util=true"
7526 ;; Use elogind instead of systemd for sd-bus.
7527 "-Dwith-sd-bus-provider=elogind"
7528 ;; Install PAM limits.d config to the package prefix; a Guix
7529 ;; service can then install it to /etc/security/limits.d/.
7530 (string-append "-Dwith-pam-limits-dir=" #$output
7531 "/etc/security/limits.d")
7532 ;; Guix does not use systemd.
7533 "-Dwith-systemd-user-unit=false"
7534 "-Dwith-systemd-group=false")
7535 #:phases
7536 #~(modify-phases %standard-phases
7537 (add-after 'unpack 'patch-references
7538 (lambda _
7539 (substitute* '("lib/gamemode_client.h"
7540 "data/gamemoderun")
7541 (("libgamemode(auto)?\\.so\\.0" lib)
7542 (string-append #$output "/lib/" lib))))))))
7543 (native-inputs
7544 (list pkg-config))
7545 (inputs
7546 (list
7547 dbus
7548 elogind
7549 libinih))
7550 (synopsis "Optimise Linux system performance on demand")
7551 (description "GameMode is a daemon and library for Linux that allows games to
7552request a set of optimisations be temporarily applied to the host OS and/or a
7553game process. GameMode was designed primarily as a stop-gap solution to problems
7554with the Intel and AMD CPU powersave or ondemand governors, but is now host to a
7555range of optimisation features and configurations, including CPU governor, I/O
7556priority, process niceness, kernel scheduler, screensaver inhibiting, GPU
7557performance mode, and custom scripts.")
7558 (home-page "https://github.com/FeralInteractive/gamemode")
7559 (license license:bsd-3)))
7560
7561(define-public btrfs-progs
7562 (package
7563 (name "btrfs-progs")
7564 (version "7.0")
7565 (source (origin
7566 (method url-fetch)
7567 (uri (string-append "mirror://kernel.org/linux/kernel/"
7568 "people/kdave/btrfs-progs/" "btrfs-progs-v"
7569 version ".tar.xz"))
7570 (sha256
7571 (base32
7572 "16cs5n1hm06ppkylkd9p7v13wdc0sb7y85xll0kj7mxwdj3xd1n2"))))
7573 (build-system gnu-build-system)
7574 (outputs '("out" "static")) ;static versions of the binaries in "out"
7575 (arguments
7576 (list
7577 #:configure-flags
7578 #~(list
7579 ;; Without --disable-documentation, it complains about missing
7580 ;; python-sphinx on systems where this package isn't available
7581 ;; (because it requires Rust).
7582 #$@(if (member (%current-system)
7583 (package-transitive-supported-systems
7584 python-sphinx))
7585 '()
7586 '("--disable-documentation"))
7587 ;; The ‘Python support’ was never actually installed by previous
7588 ;; versions of this package, but did prevent cross-compilation.
7589 "--disable-python")
7590 #:phases #~(modify-phases %standard-phases
7591 (add-after 'unpack 'patch-makefile
7592 (lambda* (#:key outputs #:allow-other-keys)
7593 (substitute* "Makefile"
7594 (("\\$\\(DESTDIR\\)\\$\\(udevruledir\\)")
7595 (string-append (assoc-ref outputs "out")
7596 "/lib/udev/rules.d")))))
7597 (add-after 'build 'build-static
7598 (lambda _
7599 (invoke "make" "static")))
7600 (add-after 'install 'install-bash-completion
7601 (lambda* (#:key outputs #:allow-other-keys)
7602 (let* ((out (assoc-ref outputs "out"))
7603 (bashcomp (string-append out
7604 "/etc/bash_completion.d")))
7605 (mkdir-p bashcomp)
7606 (copy-file "btrfs-completion"
7607 (string-append bashcomp "/btrfs")))))
7608 (add-after 'install 'install-static
7609 (let ((staticbin (string-append (assoc-ref %outputs
7610 "static")
7611 "/bin")))
7612 (lambda _
7613 (invoke "make"
7614 (string-append "bindir=" staticbin)
7615 "install-static")))))
7616 #:tests? #f ;XXX: require the 'btrfs' kernel module.
7617 #:test-target "test"
7618 #:parallel-tests? #f)) ;tests fail when run in parallel
7619 (inputs (list e2fsprogs ;for btrfs-convert
7620 eudev
7621 lzo
7622 `(,util-linux "lib") ;for libblkid and libuuid
7623 `(,util-linux "static") ;ditto
7624 zlib
7625 `(,zlib "static")
7626 `(,zstd "lib")
7627 `(,zstd "static")))
7628 (native-inputs
7629 (append
7630 ;; For building documentation. Since python-sphinx requires Rust, add
7631 ;; it conditionally depending on such support.
7632 (if (supported-package? python-sphinx)
7633 (list python-wrapper python-sphinx python-sphinx-rtd-theme)
7634 '())
7635 (list pkg-config
7636 acl ;for tests
7637 lvm2 ;for dmsetup
7638 grep ;need Perl regexp support
7639 libaio
7640 liburing
7641 util-linux ;for fallocate
7642 which)))
7643 (home-page "https://btrfs.wiki.kernel.org/index.php/Main_Page")
7644 (synopsis "Create and manage btrfs copy-on-write file systems")
7645 (description
7646 "Btrfs is a @acronym{CoW, copy-on-write} file system for Linux
7647aimed at implementing advanced features while focusing on fault tolerance,
7648repair and easy administration.")
7649 ;; GPL2+: crc32.c, radix-tree.c, raid6.c, rbtree.c.
7650 ;; GPL2: Everything else.
7651 (license (list license:gpl2 license:gpl2+))))
7652
7653(define-public btrfs-progs/static
7654 (package
7655 (name "btrfs-progs-static")
7656 (version (package-version btrfs-progs))
7657 (source #f)
7658 (build-system trivial-build-system)
7659 (inputs
7660 `(("btrfs-progs:static" ,btrfs-progs "static")))
7661 (arguments
7662 `(#:modules ((guix build utils))
7663 #:builder
7664 (begin
7665 (use-modules (guix build utils)
7666 (ice-9 ftw)
7667 (srfi srfi-26))
7668
7669 (let* ((btrfs (assoc-ref %build-inputs "btrfs-progs:static"))
7670 (out (assoc-ref %outputs "out"))
7671 (source (string-append btrfs "/bin/btrfs.static"))
7672 (target (string-append out "/bin/btrfs")))
7673 (mkdir-p (dirname target))
7674 (copy-file source target)
7675 (remove-store-references target)
7676 (chmod target #o555)
7677 #t))))
7678 (home-page (package-home-page btrfs-progs))
7679 (synopsis "Statically-linked btrfs command from btrfs-progs")
7680 (description "This package provides the statically-linked @command{btrfs}
7681from the btrfs-progs package. It is meant to be used in initrds.")
7682 (license (package-license btrfs-progs))))
7683
7684(define-public cramfs-tools
7685 (package
7686 (name "cramfs-tools")
7687 (home-page "https://github.com/npitre/cramfs-tools")
7688 (version "2.1")
7689 (source (origin
7690 (method git-fetch)
7691 (uri (git-reference
7692 (url home-page)
7693 (commit (string-append "v" version))))
7694 (sha256
7695 (base32 "183rfqqyzx52q0vxicdgf0p984idh3rqkvzfb93gjvyzfhc15c0p"))
7696 (file-name (git-file-name name version))))
7697 (build-system gnu-build-system)
7698 (arguments
7699 '(#:tests? #f ; No tests.
7700 #:phases
7701 (modify-phases %standard-phases
7702 (delete 'configure)
7703 (replace 'install
7704 (lambda* (#:key outputs #:allow-other-keys)
7705 (let ((out (assoc-ref outputs "out")))
7706 (install-file "mkcramfs" (string-append out "/sbin"))
7707 (install-file "cramfsck" (string-append out "/sbin")))
7708 #t)))))
7709 (inputs
7710 (list zlib))
7711 (synopsis "Tools to manage Cramfs file systems")
7712 (description "Cramfs is a Linux file system designed to be simple, small,
7713and to compress things well. It is used on a number of embedded systems and
7714small devices. This version has additional features such as uncompressed
7715blocks and random block placement.")
7716 (license license:gpl2+)))
7717
7718(define-public compsize
7719 (let ((commit "d79eacf77abe3b799387bb8a4e07a18f1f1031e8")
7720 (revision "0"))
7721 (package
7722 (name "compsize")
7723 (version (git-version "1.5" revision commit))
7724 (home-page "https://github.com/kilobyte/compsize")
7725 (source (origin
7726 (method git-fetch)
7727 (uri (git-reference
7728 (url home-page)
7729 (commit commit)))
7730 (sha256
7731 (base32 "02fvgy12m50rg1snp555a1kc3cm01g2imb81cih7ikhkbjbca0d7"))
7732 (file-name (git-file-name name version))
7733 (patches
7734 (search-patches "compsize-fix-btrfs-progs-compatibility.patch"))))
7735 (build-system gnu-build-system)
7736 (inputs
7737 (list btrfs-progs))
7738 (arguments
7739 `(#:tests? #f ; No tests.
7740 #:make-flags
7741 (list (string-append "CC=" ,(cc-for-target)))
7742 #:phases
7743 (modify-phases %standard-phases
7744 (delete 'configure)
7745 (replace 'install
7746 (lambda* (#:key outputs #:allow-other-keys)
7747 (let ((out (assoc-ref outputs "out")))
7748 (install-file "compsize" (string-append out "/bin"))
7749 (install-file "compsize.8" (string-append out "/share/man/man8"))))))))
7750 (synopsis "Find compression type/ratio on Btrfs files")
7751 (description "@command{compsize} takes a list of files (given as
7752arguments) on a Btrfs file system and measures used compression types and
7753effective compression ratio, producing a report.
7754
7755A directory has no extents but has a (recursive) list of files. A non-regular
7756file is silently ignored.
7757
7758As it makes no sense to talk about compression ratio of a partial extent,
7759every referenced extent is counted whole, exactly once -- no matter if you use
7760only a few bytes of a 1GB extent or reflink it a thousand times. Thus, the
7761uncompressed size will not match the number given by @command{tar} or
7762@command{du}. On the other hand, the space used should be accurate (although
7763obviously it can be shared with files outside our set).")
7764 (license license:gpl2+))))
7765
7766(define-public f2fs-tools
7767 (package
7768 (name "f2fs-tools")
7769 (version "1.16.0")
7770 (source (origin
7771 (method git-fetch)
7772 (uri (git-reference
7773 (url "https://git.kernel.org/pub/scm/linux/kernel\
7774/git/jaegeuk/f2fs-tools.git")
7775 (commit (string-append "v" version))))
7776 (file-name (git-file-name name version))
7777 (sha256
7778 (base32
7779 "0832ix3jnmfagx53wr6clc3q4ay7cbashfj7jirk01gyzwbvblfc"))))
7780 (build-system gnu-build-system)
7781 (native-inputs
7782 (list autoconf automake libtool pkg-config))
7783 (inputs
7784 (list `(,util-linux "lib"))) ;for libuuid
7785 (home-page "https://f2fs.wiki.kernel.org/")
7786 (synopsis "Userland tools for f2fs")
7787 (description
7788 "F2FS, the Flash-Friendly File System, is a modern file system
7789designed to be fast and durable on flash devices such as solid-state
7790disks and SD cards. This package provides the userland utilities.")
7791 ;; The formatting utility, libf2fs and include/f2fs_fs.h is dual
7792 ;; GPL2/LGPL2.1, everything else is GPL2 only. See 'COPYING'.
7793 (license (list license:gpl2 license:lgpl2.1))))
7794
7795(define-public f2fs-tools-1.7
7796 (package
7797 (inherit f2fs-tools)
7798 (name "f2fs-tools")
7799 (version "1.7.0")
7800 (source (origin
7801 (method git-fetch)
7802 (uri (git-reference
7803 (url (git-reference-url
7804 (origin-uri (package-source f2fs-tools))))
7805 (commit (string-append "v" version))))
7806 (file-name (git-file-name name version))
7807 (sha256
7808 (base32
7809 "0wpzklw8smnngng0dm25jdmi7v5zfhpz02dksyxpz0a7kzzvnqqm"))))
7810 (inputs
7811 (list `(,util-linux "lib") libselinux))
7812 (arguments
7813 '(#:configure-flags '("CFLAGS=-fcommon")
7814 #:phases
7815 (modify-phases %standard-phases
7816 (add-after 'install 'install-headers
7817 (lambda* (#:key outputs #:allow-other-keys)
7818 (let* ((out (assoc-ref outputs "out"))
7819 (out-include (string-append out "/include")))
7820 (install-file "include/f2fs_fs.h" out-include)
7821 (install-file "mkfs/f2fs_format_utils.h" out-include)))))))))
7822
7823(define-public f2fs-tools/static
7824 (static-package
7825 (package
7826 (inherit f2fs-tools)
7827 (name "f2fs-tools-static")
7828 (arguments
7829 `(#:configure-flags
7830 (let ((libuuid-static (assoc-ref %build-inputs "libuuid:static"))
7831 (libuuid (assoc-ref %build-inputs "libuuid")))
7832 (list
7833 (string-append "libuuid_CFLAGS=-I" libuuid "/include/uuid")
7834 (string-append "libuuid_LIBS=-L" libuuid-static "/lib -luuid")
7835 (string-append "libblkid_CFLAGS=-I" libuuid "/include/uuid "
7836 "-I" libuuid "/include/blkid")
7837 (string-append "libblkid_LIBS=-L" libuuid-static "/lib -lblkid")))
7838 #:disallowed-references (,(this-package-input "libuuid"))
7839 #:make-flags '("LDFLAGS=-all-static")
7840 #:phases
7841 (modify-phases %standard-phases ; TODO: f2fs phases.
7842 (add-after 'install 'remove-store-references
7843 (lambda* (#:key outputs #:allow-other-keys)
7844 ;; Work around bug in our util-linux.
7845 ;; <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=41019>.
7846 (remove-store-references (string-append (assoc-ref outputs "out")
7847 "/sbin/mkfs.f2fs"))
7848 #t)))))
7849 (inputs
7850 `(("libuuid:static" ,util-linux "static")
7851 ("libuuid" ,util-linux "lib")))))) ; for include files
7852
7853(define-public f2fs-fsck/static
7854 (package
7855 (name "f2fs-fsck-static")
7856 (version (package-version f2fs-tools/static))
7857 (source #f)
7858 (build-system trivial-build-system)
7859 (arguments
7860 `(#:modules ((guix build utils))
7861 #:builder
7862 (begin
7863 (use-modules (guix build utils)
7864 (ice-9 ftw)
7865 (srfi srfi-26))
7866 (let* ((f2fs-tools (assoc-ref %build-inputs "f2fs-tools-static"))
7867 (fsck "fsck.f2fs")
7868 (out (assoc-ref %outputs "out"))
7869 (sbin (string-append out "/sbin")))
7870 (mkdir-p sbin)
7871 (with-directory-excursion sbin
7872 (install-file (string-append f2fs-tools "/sbin/" fsck)
7873 ".")
7874 (remove-store-references fsck)
7875 (chmod fsck #o555))
7876 #t))))
7877 (inputs
7878 (list f2fs-tools/static))
7879 (home-page (package-home-page f2fs-tools/static))
7880 (synopsis "Statically-linked fsck.f2fs command from f2fs-tools")
7881 (description "This package provides statically-linked fsck.f2fs command taken
7882from the f2fs-tools package. It is meant to be used in initrds.")
7883 (license (package-license f2fs-tools/static))))
7884
7885(define-public freefall
7886 (package
7887 (name "freefall")
7888 (version (package-version linux-libre))
7889 (source (package-source linux-libre))
7890 (build-system gnu-build-system)
7891 (arguments
7892 '(#:phases (modify-phases %standard-phases
7893 (add-after 'unpack 'enter-subdirectory
7894 (lambda _
7895 (chdir "tools/laptop/freefall")
7896 #t))
7897 (delete 'configure)
7898 (add-before 'build 'increase-timeout
7899 (lambda _
7900 ;; The default of 2 seconds is too low: it assumes an
7901 ;; open lid and AC power without actually checking.
7902 (substitute* "freefall.c"
7903 (("alarm\\(2\\)") "alarm(5)"))
7904 #t)))
7905 #:make-flags (list (string-append "PREFIX="
7906 (assoc-ref %outputs "out"))
7907 "CC=gcc")
7908 #:tests? #f)) ;no tests
7909 (home-page (package-home-page linux-libre))
7910 (synopsis "Free-fall protection for spinning laptop hard drives")
7911 (description
7912 "Prevents shock damage to the internal spinning hard drive(s) of some
7913HP and Dell laptops. When sudden movement is detected, all input/output
7914operations on the drive are suspended and its heads are parked on the ramp,
7915where they are less likely to cause damage to the spinning disc. Requires a
7916drive that supports the ATA/ATAPI-7 IDLE IMMEDIATE command with unload
7917feature, and a laptop with an accelerometer. It has no effect on SSDs.")
7918 (license license:gpl2)))
7919
7920
7921(define-public nbfc-linux
7922 (let ((version "0.1.7")
7923 (commit "4c2b75e4a875459e86a9892319889ff945e9cadf")
7924 (revision "0"))
7925 (package
7926 (name "nbfc-linux")
7927 (version (git-version version revision commit))
7928 (source (origin
7929 (method git-fetch)
7930 (uri (git-reference
7931 (url "https://github.com/nbfc-linux/nbfc-linux")
7932 (commit commit)))
7933 (file-name (git-file-name name version))
7934 (sha256
7935 (base32
7936 "0mmyfaigrh3fd5v11a8p38km4m02qzsfx8yh72g0z405bzhqn5jk"))))
7937 (build-system gnu-build-system)
7938 (arguments
7939 `(#:make-flags (list (string-append "CC="
7940 ,(cc-for-target))
7941 (string-append "PREFIX="
7942 (assoc-ref %outputs "out")))
7943 #:tests? #f
7944 #:phases (modify-phases %standard-phases
7945 (delete 'configure))))
7946 (native-inputs (list pkg-config))
7947 (propagated-inputs (list python dmidecode))
7948 (synopsis "NoteBook FanControl ported to Linux")
7949 (description
7950 "This package provides a C port of NoteBook FanControl (NBFC), a fan
7951control service for notebooks. It provides the same utilities with the same
7952interfaces as the original NBFC, although the implementation differs.")
7953 (home-page "https://github.com/nbfc-linux/nbfc-linux")
7954 (license license:gpl3+))))
7955
7956(define-public thinkfan
7957 (package
7958 (name "thinkfan")
7959 (version "2.0.0")
7960 (source
7961 (origin
7962 (method git-fetch)
7963 (uri (git-reference
7964 (url "https://github.com/vmatare/thinkfan")
7965 (commit version)))
7966 (file-name (git-file-name name version))
7967 (sha256
7968 (base32 "1jdjqdbv0m7yf9g4rxs7nq1ldh2b81a7qx4vcf9lzw7jwlydd822"))))
7969 (build-system cmake-build-system)
7970 (arguments
7971 (list
7972 #:modules '((guix build cmake-build-system)
7973 (guix build utils)
7974 (srfi srfi-26))
7975 #:tests? #f ; no test target
7976 #:configure-flags
7977 ;; Enable reading temperatures from hard disks via S.M.A.R.T.
7978 ;; Upstream ‘defaults to OFF because libatasmart seems to be horribly
7979 ;; inefficient’.
7980 #~(list "-DUSE_ATASMART:BOOL=ON")
7981 #:phases
7982 #~(modify-phases %standard-phases
7983 (add-after 'unpack 'create-init-scripts
7984 ;; CMakeLists.txt relies on build-time symptoms of OpenRC and
7985 ;; systemd to patch and install their service files. Fake their
7986 ;; presence rather than duplicating the build system below. Leave
7987 ;; things like ‘/bin/kill’ because they're not worth a dependency.
7988 ;; The sysvinit needs manual patching, but since upstream doesn't
7989 ;; even provide the option to install it: don't.
7990 (lambda _
7991 (substitute* "CMakeLists.txt"
7992 (("pkg_check_modules\\((OPENRC|SYSTEMD) .*" _ package)
7993 (format #f "option(~a_FOUND \"Faked\" ON)\n" package))
7994 ;; That was easy! Now we just need to fix the destinations.
7995 (("/etc" directory)
7996 (string-append #$output directory))))))))
7997 (native-inputs
7998 (list pkg-config))
7999 (inputs
8000 `(("libatasmart" ,libatasmart)
8001 ("lm-sensors" ,lm-sensors "lib")
8002 ("yaml-cpp" ,yaml-cpp)))
8003 (home-page "https://github.com/vmatare/thinkfan")
8004 (synopsis "Simple fan control program")
8005 (description
8006 "Thinkfan is a simple fan control program. It reads temperatures,
8007checks them against configured limits and switches to appropriate (also
8008pre-configured) fan level. It requires a working @code{thinkpad_acpi} or any
8009other @code{hwmon} driver that enables temperature reading and fan control
8010from userspace.")
8011 (license license:gpl3+)))
8012
8013(define-public tpacpi-bat
8014 (package
8015 (name "tpacpi-bat")
8016 (version "3.2")
8017 (source
8018 (origin
8019 (method git-fetch)
8020 (uri (git-reference
8021 (url "https://github.com/teleshoes/tpacpi-bat")
8022 (commit (string-append "v" version))))
8023 (file-name (git-file-name name version))
8024 (sha256
8025 (base32 "0nd8s2bqbhl0sjpflphb4l9ix71p7kvnbvkq4dg9a1v0sxafyygm"))))
8026 (build-system gnu-build-system)
8027 (arguments
8028 `(#:tests? #f ; no test target
8029 #:phases
8030 (modify-phases %standard-phases
8031 (add-after 'unpack 'refer-to-inputs
8032 (lambda* (#:key inputs #:allow-other-keys)
8033 (substitute* "tpacpi-bat"
8034 (("cat ")
8035 (string-append (search-input-file inputs "bin/cat") " "))
8036 ;; tpacpi-bat modprobes the acpi_call kernel module if it's not
8037 ;; loaded. That's the administrator's prerogative; disable it.
8038 (("system \"(modprobe .*)\"" _ match)
8039 (format #f "die \"Please run ‘~a’ first.\\n\"" match)))))
8040 (delete 'configure) ; nothing to configure
8041 (delete 'build) ; nothing to build
8042 (replace 'install
8043 (lambda* (#:key outputs #:allow-other-keys)
8044 (let* ((out (assoc-ref outputs "out"))
8045 (bin (string-append out "/bin"))
8046 (doc (string-append out "/share/doc/" ,name "-" ,version)))
8047 (install-file "tpacpi-bat" bin)
8048
8049 ;; There's no man page. Install other forms of documentation.
8050 (for-each (lambda (file)
8051 (let ((target (string-append doc "/" file)))
8052 (mkdir-p (dirname target))
8053 (copy-recursively file target)))
8054 (list "battery_asl" "examples" "README.md"))))))))
8055 (inputs
8056 (list coreutils-minimal
8057 perl))
8058 (home-page "https://github.com/teleshoes/tpacpi-bat")
8059 (synopsis "ThinkPad battery charge controller")
8060 (description
8061 "Tpacpi-bat is a command-line interface to control battery charging on
8062@uref{https://github.com/teleshoes/tpacpi-bat/wiki/Supported-Hardware, Lenovo
8063ThinkPad models released after 2011}, starting with the xx20 series. It can
8064query and set the thresholds at which one or both batteries will start and stop
8065charging, inhibit charging batteries for a set period of time, or force them to
8066discharge when they otherwise would not.
8067
8068This tool merely exposes ACPI calls provided by the @code{acpi_call} Linux
8069kernel module provided by the @code{acpi-call-linux-module} package, which must
8070be installed and loaded separately. Only the original vendor firmware is
8071supported.")
8072 (license license:gpl3+)))
8073
8074(define-public tmon
8075 (package
8076 (name "tmon")
8077 ;; Tmon's ‘VERSION = 1.0’ hasn't been touched since 2013; the code has.
8078 (version (package-version linux-libre))
8079 (source (package-source linux-libre))
8080 (build-system gnu-build-system)
8081 (arguments
8082 (list
8083 #:tests? #f ; no test suite
8084 #:make-flags
8085 #~(list (string-append "CC=" #$(cc-for-target))
8086 (string-append "INSTALL_ROOT=" #$output)
8087 "BINDIR=bin")
8088 #:phases
8089 #~(modify-phases %standard-phases
8090 (add-after 'unpack 'enter-subdirectory
8091 (lambda _
8092 (chdir "tools/thermal/tmon")))
8093 (add-after 'install 'install-man-page
8094 (lambda _
8095 (let ((man8 (string-append #$output "/share/man/man8")))
8096 (install-file "tmon.8" man8))))
8097 (delete 'configure)))) ; no configure script
8098 (inputs
8099 (list ncurses))
8100 (home-page (package-home-page linux-libre))
8101 (synopsis "Monitor and test the Linux thermal subsystem in real time")
8102 (description
8103 "Tmon is a tool to interact with the complex thermal subsystem of the
8104kernel Linux. It helps visualize thermal relationships and real-time thermal
8105data, tune and test cooling devices and sensors, and collect thermal data for
8106further analysis.
8107
8108As computers become smaller and more thermally constrained, more sensors are
8109added and new cooling capabilities introduced. Thermal relationships can change
8110dynamically. Their complexity grows exponentially among cooling devices, zones,
8111sensors, and trip points.
8112
8113Linux exposes this relationship through @file{/sys/class/thermal} with a matrix
8114of symbolic links, trip point bindings, and device instances. To traverse it
8115by hand is no trivial task: @command{tmon} aims to make it understandable.")
8116 (license (list license:gpl2 ; the man page
8117 license:gpl2+)))) ; the actual rest
8118
8119(define-public turbostat
8120 (package
8121 (name "turbostat")
8122 ;; XXX turbostat reports a version like ‘20.09.30’ but using it here would
8123 ;; make it harder to benefit from ‘free’ linux-libre package updates.
8124 (version (package-version linux-libre))
8125 (source (package-source linux-libre))
8126 (build-system gnu-build-system)
8127 (arguments
8128 (list
8129 #:tests? #f ;no test suite
8130 #:make-flags
8131 #~(list (string-append "CC=" #$(cc-for-target))
8132 (string-append "PREFIX=" #$output))
8133 #:phases
8134 #~(modify-phases %standard-phases
8135 (add-after 'unpack 'enter-subdirectory
8136 (lambda _
8137 (chdir "tools/power/x86/turbostat")))
8138 (delete 'configure)))) ;no configure script
8139 (inputs
8140 (list libcap))
8141 (supported-systems '("i686-linux" "x86_64-linux"))
8142 (home-page (package-home-page linux-libre))
8143 (synopsis "Report x86 processor frequency and idle statistics")
8144 (description
8145 "Turbostat reports x86 processor topology, frequency, idle power state
8146statistics, temperature, and power consumption. Some information is unavailable
8147on older processors.
8148
8149It can be used to identify machines that are inefficient in terms of power usage
8150or idle time, report the rate of @acronym{SMI, system management interrupt}s
8151occurring on the system, or verify the effects of power management tuning.
8152
8153@command{turbostat} reads hardware counters but doesn't write to them, so it
8154won't interfere with the OS or other running processes---including multiple
8155invocations of itself.")
8156 (license license:gpl2)))
8157
8158(define-public ntfs-3g
8159 (package
8160 (name "ntfs-3g")
8161 (version "2022.10.3")
8162 (source (origin
8163 (method git-fetch)
8164 (uri
8165 (git-reference
8166 (url "https://github.com/tuxera/ntfs-3g")
8167 (commit version)))
8168 (file-name (git-file-name name version))
8169 (sha256
8170 (base32
8171 "02cmw0b2r6j5rk733ljlyrjibv997ck8f9lwrs93kpr6d6q57qcy"))
8172 (patches
8173 (search-patches "ntfs-3g-autoconf-sbin-helpers.patch"
8174 "ntfs-3g-consistent-sbindir-usage.patch"))))
8175 (build-system gnu-build-system)
8176 (inputs (list util-linux ; libuuid
8177 kmod
8178 fuse-2))
8179 (native-inputs (list pkg-config autoconf automake libtool
8180 libgcrypt)) ; for m4 macros
8181 (arguments
8182 (list
8183 #:configure-flags
8184 #~(list "--disable-static"
8185 "--disable-ldconfig" ;not necessary
8186 "--exec-prefix=${prefix}"
8187 "--with-fuse=external" ;use our own FUSE
8188 "--enable-mount-helper"
8189 (string-append "--with-modprobe-helper="
8190 #$(this-package-input "kmod") "/bin/modprobe")
8191 "--enable-posix-acls"
8192 "--enable-xattr-mappings")
8193 #:phases
8194 #~(modify-phases %standard-phases
8195 ;; If users install ntfs-3g, they probably want to make it the
8196 ;; default driver as well, so we opt for sensible defaults and link
8197 ;; mount.ntfs to mount.ntfs-3g. (libmount tries to run mount.ntfs to
8198 ;; mount NTFS file systems.)
8199 (add-after 'install 'install-link
8200 (lambda* (#:key outputs #:allow-other-keys)
8201 (let* ((out (assoc-ref outputs "out"))
8202 (sbin (string-append out "/sbin")))
8203 (symlink "mount.ntfs-3g"
8204 (string-append sbin "/mount.ntfs"))))))))
8205 (home-page "https://www.tuxera.com/community/open-source-ntfs-3g/")
8206 (synopsis "Read-write access to NTFS file systems")
8207 (description
8208 "NTFS-3G provides read-write access to NTFS file systems, which are
8209commonly found on Microsoft Windows. It is implemented as a FUSE file system.
8210The package provides additional NTFS tools.")
8211 (license license:gpl2+)))
8212
8213(define-public ntfs-3g/static
8214 (static-package
8215 (package
8216 (inherit ntfs-3g)
8217 (name "ntfs-3g-static")
8218 (arguments
8219 (substitute-keyword-arguments arguments
8220 ((#:configure-flags flags)
8221 #~(cons* "--enable-really-static"
8222 ;; The FUSE driver isn't currently used by our initrd.
8223 "--disable-ntfs-3g"
8224 #$flags))
8225 ((#:phases phases)
8226 #~(modify-phases #$phases
8227 (add-after 'unpack 'make-really-static-really-static
8228 (lambda _
8229 (substitute* "ntfsprogs/Makefile.am"
8230 ((" -static") " -all-static"))))
8231 (delete 'install-link))))))))
8232
8233(define-public ntfsfix/static
8234 (package
8235 (name "ntfsfix-static")
8236 (version (package-version ntfs-3g/static))
8237 (source #f)
8238 (build-system trivial-build-system)
8239 (arguments
8240 (list
8241 #:modules `((guix build utils))
8242 #:builder
8243 #~(begin
8244 (use-modules (guix build utils))
8245 (let ((bin (string-append #$output "/bin")))
8246 (install-file (search-input-file %build-inputs "/bin/ntfsfix") bin)
8247 (with-directory-excursion bin
8248 (remove-store-references "ntfsfix"))))))
8249 (inputs (list ntfs-3g/static))
8250 (home-page (package-home-page ntfs-3g/static))
8251 (synopsis "Statically linked @command{ntfsfix} from ntfs-3g")
8252 (description
8253 "This package provides a statically linked @command{ntfsfix} taken
8254from the ntfs-3g package. It is meant to be used in initrds.")
8255 (license (package-license ntfs-3g/static))))
8256
8257(define-public rdma-core
8258 (package
8259 (name "rdma-core")
8260 (version "62.0")
8261 (source (origin
8262 (method url-fetch)
8263 (uri (string-append "https://github.com/linux-rdma/rdma-core"
8264 "/releases/download/v" version "/rdma-core-"
8265 version ".tar.gz"))
8266 (sha256
8267 (base32
8268 "1802afy4q80zl7qkxlyq71ll5fsksva43f8xfd6vlqj1c47dc2n0"))))
8269 (build-system cmake-build-system)
8270 (arguments
8271 `(#:tests? #f ;no tests
8272
8273 ;; Upstream uses the "ninja" build system and encourage distros
8274 ;; to do the same for consistency.
8275 #:generator "Ninja"
8276 #:configure-flags
8277 (list (string-append "-DRST2MAN_EXECUTABLE="
8278 (search-input-file
8279 %build-inputs "/bin/rst2man.py")))))
8280 (native-inputs
8281 (list pkg-config python-wrapper python-docutils-0.19)) ;for 'rst2man'
8282 (inputs
8283 (list libnl eudev))
8284 (home-page "https://github.com/linux-rdma/rdma-core")
8285 (synopsis "Utilities and libraries for working with RDMA devices")
8286 (description
8287 "This package provides userspace components for the InfiniBand
8288subsystem of the Linux kernel. Specifically it contains userspace
8289libraries for the following device nodes:
8290
8291@enumerate
8292@item @file{/dev/infiniband/uverbsX} (@code{libibverbs})
8293@item @file{/dev/infiniband/rdma_cm} (@code{librdmacm})
8294@item @file{/dev/infiniband/umadX} (@code{libibumad})
8295@end enumerate
8296
8297The following service daemons are also provided:
8298@enumerate
8299@item @code{srp_daemon} (for the @code{ib_srp} kernel module)
8300@item @code{iwpmd} (for iWARP kernel providers)
8301@item @code{ibacm} (for InfiniBand communication management assistant)
8302@end enumerate")
8303 ;; All library code is dual licensed under GPL2 and a custom MIT
8304 ;; variant. The package also includes some components covered by
8305 ;; other licenses. Consult COPYING.md for full details.
8306 (license
8307 (list license:gpl2
8308 (license:x11-style "See COPYING.BSD_MIT in the distribution")
8309 license:bsd-2 ; Files referring to COPYING.BSD_FB
8310 license:cc0 ; most files in ccan/
8311 license:bsd-3)))) ; providers/hfi1verbs are dual GPL2/BSD-3
8312
8313(define-public perftest
8314 (package
8315 (name "perftest")
8316 (version "4.5-0.20")
8317 (home-page "https://github.com/linux-rdma/perftest")
8318 (source (origin
8319 (method git-fetch)
8320 (uri (git-reference (url home-page)
8321 (commit (string-append "v" version))))
8322 (file-name (git-file-name name version))
8323 (sha256
8324 (base32
8325 "1hrpzmkz1kq4jwpy6b5fl8073iy7dllcq2hfzdw6waaf5920vd64"))))
8326 (build-system gnu-build-system)
8327 (native-inputs
8328 (list autoconf automake libtool))
8329 (inputs (list pciutils rdma-core))
8330 (synopsis "Open Fabrics Enterprise Distribution (OFED) Performance Tests")
8331 (description "This is a collection of tests written over uverbs intended
8332for use as a performance micro-benchmark. The tests may be used for hardware
8333or software tuning as well as for functional testing.
8334
8335The collection contains a set of bandwidth and latency benchmark such as:
8336@enumerate
8337@item Send - @code{ib_send_bw} and @code{ib_send_lat}
8338@item RDMA Read - @code{ib_read_bw} and @code{ib_read_lat}
8339@item RDMA Write - @code{ib_write_bw} and @code{ib_wriet_lat}
8340@item RDMA Atomic - @code{ib_atomic_bw} and @code{ib_atomic_lat}
8341@item Native Ethernet (when working with MOFED2) - @code{raw_ethernet_bw}, @code{raw_ethernet_lat}
8342@end enumerate")
8343 (license license:gpl2)))
8344
8345(define-public rng-tools
8346 (package
8347 (name "rng-tools")
8348 (home-page "https://github.com/nhorman/rng-tools")
8349 (version "6.17")
8350 (source (origin
8351 (method git-fetch)
8352 (uri (git-reference (url home-page)
8353 (commit (string-append "v" version))))
8354 (file-name (git-file-name name version))
8355 (sha256
8356 (base32
8357 "0vvqi9ha4jbk4086x2q98p4ip3z56sfdpyckdyknsd36zhp6z8n2"))
8358 (patches
8359 (search-patches "rng-tools-revert-build-randstat.patch"))
8360 (patch-flags '("-p0"))))
8361 (build-system gnu-build-system)
8362 (arguments
8363 (list
8364 ;; Disable support for various hardware entropy sources as they need
8365 ;; dependencies that are not yet in Guix, and would significantly
8366 ;; increase closure size.
8367 #:configure-flags #~(list "--without-nistbeacon"
8368 "--without-pkcs11"
8369 "--without-rtlsdr"
8370 "--without-qrypt")
8371 #:phases
8372 #~(modify-phases %standard-phases
8373 (add-before 'check 'disable-failing-test
8374 (lambda _
8375 (substitute* "tests/Makefile"
8376 ;; This test requires a hwrng, rdrand, or tpm device.
8377 ;; Worse, it appears to fail if that isn't sufficiently random.
8378 (("\\brngtestjitter\\.sh\\b") " ")))))))
8379 (native-inputs
8380 (list autoconf automake pkg-config))
8381 (inputs
8382 (list libcap sysfsutils openssl))
8383 (synopsis "Random number generator daemon")
8384 (description
8385 "Monitor a hardware random number generator, and supply entropy
8386from that to the system kernel's @file{/dev/random} machinery.")
8387 ;; The source package is offered under the GPL2+, but the files
8388 ;; 'rngd_rdrand.c' and 'rdrand_asm.S' are only available under the GPL2.
8389 (license (list license:gpl2 license:gpl2+))))
8390
8391(define-public cpupower
8392 (package
8393 (name "cpupower")
8394 (version (package-version linux-libre))
8395 (source (package-source linux-libre))
8396 (build-system gnu-build-system)
8397 (arguments
8398 (list #:make-flags
8399 #~(list "CC=gcc"
8400 (string-append "DESTDIR=" #$output)
8401 (string-append "LDFLAGS=-Wl,-rpath=" #$output "/lib")
8402 "docdir=/share/doc/cpupower" ;drop default ‘packages/’
8403 "confdir=$(docdir)/examples"
8404 ;; The Makefile recommends the following changes.
8405 "DEBUG=false"
8406 "[email protected]")
8407 #:tests? #f ; no tests
8408 #:phases
8409 #~(modify-phases %standard-phases
8410 (add-after 'unpack 'enter-subdirectory
8411 (lambda _
8412 (chdir "tools/power/cpupower")))
8413 (delete 'configure) ; no configure script
8414 (add-before 'build 'fix-makefiles
8415 (lambda _
8416 (substitute* "Makefile"
8417 (("/usr/") "/")
8418 (("/bin/(install)" _ command) command))
8419 (substitute* "bench/Makefile"
8420 (("\\$\\(CC\\) -o") "$(CC) $(LDFLAGS) -o")))))))
8421 (native-inputs (list gettext-minimal
8422 which)) ;to find gettext
8423 (inputs (list pciutils))
8424 (home-page (package-home-page linux-libre))
8425 (synopsis "CPU frequency and voltage scaling tools for Linux")
8426 (description
8427 "cpupower is a set of user-space tools that use the cpufreq feature of the
8428Linux kernel to retrieve and control processor features related to power saving,
8429such as frequency and voltage scaling.")
8430 (license license:gpl2)))
8431
8432(define-public x86-energy-perf-policy
8433 (package
8434 (name "x86-energy-perf-policy")
8435 (version (package-version linux-libre))
8436 (source (package-source linux-libre))
8437 (build-system gnu-build-system)
8438 (arguments
8439 '(#:tests? #f
8440 #:phases
8441 (modify-phases %standard-phases
8442 (add-after 'unpack 'enter-subdirectory
8443 (lambda _
8444 (chdir "tools/power/x86/x86_energy_perf_policy")
8445 #t))
8446 (delete 'configure)
8447 (add-before 'build 'fix-makefile
8448 (lambda _
8449 (substitute* "Makefile" (("/usr") ""))
8450 #t)))
8451 #:make-flags
8452 (let ((out (assoc-ref %outputs "out")))
8453 (list (string-append "DESTDIR=" out)
8454 (string-append "LDFLAGS=-Wl,-rpath=" out "/lib")))))
8455 (supported-systems '("i686-linux" "x86_64-linux"))
8456 (home-page (package-home-page linux-libre))
8457 (synopsis "Display and update Intel-CPU energy-performance policy")
8458 (description
8459 "@command{x86_energy_perf_policy} displays and updates energy-performance
8460policy settings specific to Intel Architecture Processors. Settings are
8461accessed via Model Specific Register (MSR) updates, no matter if the Linux
8462cpufreq sub-system is enabled or not.")
8463 (license license:gpl2)))
8464
8465(define-public haveged
8466 (package
8467 (name "haveged")
8468 (version "1.9.19")
8469 (source
8470 (origin
8471 (method git-fetch)
8472 (uri (git-reference
8473 (url "https://github.com/jirka-h/haveged")
8474 (commit (string-append "v" version))))
8475 (file-name (git-file-name name version))
8476 (sha256
8477 (base32 "1qka68dlfz9z3gjfvfwvh60l2121c1yx0z264jqsf2vjp5f0xbmn"))))
8478 (build-system gnu-build-system)
8479 (arguments
8480 `(#:configure-flags
8481 (list "--disable-static")))
8482 (home-page "https://www.issihosts.com/haveged")
8483 (synopsis "Entropy source for the Linux random number generator")
8484 (description
8485 "haveged generates an unpredictable stream of random numbers for use by
8486Linux's @file{/dev/random} and @file{/dev/urandom} devices. The kernel's
8487standard mechanisms for filling the entropy pool may not be sufficient for
8488systems with high needs or limited user interaction, such as headless servers.
8489
8490@command{haveged} runs as a privileged daemon, harvesting randomness from the
8491indirect effects of hardware events on hidden processor state using the
8492@acronym{HAVEGE, HArdware Volatile Entropy Gathering and Expansion} algorithm.
8493It tunes itself to its environment and provides the same built-in test suite
8494for the output stream as used on certified hardware security devices.
8495
8496The quality of the randomness produced by this algorithm has not been proven.
8497It is recommended to run it together with another entropy source like rngd, and
8498not as a replacement for it.")
8499 (license (list (license:non-copyleft "file://nist/mconf.h")
8500 (license:non-copyleft "file://nist/packtest.c")
8501 license:public-domain ; nist/dfft.c
8502 license:gpl3+)))) ; everything else
8503
8504(define-public hotspot
8505 (package
8506 (name "hotspot")
8507 (version "1.6.0")
8508 (source (origin
8509 (method git-fetch)
8510 (uri (git-reference
8511 (url "https://github.com/KDAB/hotspot")
8512 (commit version)
8513 ;; Include the bundled perfparser and PrefixTickLabels
8514 ;; libraries, which are to be used in source form.
8515 (recursive? #t)))
8516 (file-name (git-file-name name version))
8517 (sha256
8518 (base32
8519 "065pcibr4m2ixjlq9nf45g22f73zsxabll361bjjnmkfv6xhz1r4"))))
8520 (build-system qt-build-system)
8521 (arguments
8522 (list
8523 ;; As mentioned in the option help text, the KAuth helper cannot be
8524 ;; installed to a custom prefix and the build fails with "file cannot
8525 ;; create directory: /polkit-1/actions. Maybe need administrative"
8526 ;; (see: <https://bugs.kde.org/show_bug.cgi?id=363678>).
8527 #:configure-flags #~(list "-DINSTALL_KAUTH_HELPER=OFF"
8528 "-DQT6_BUILD=ON")
8529 #:qtbase qtbase
8530 ;; The 'tst_models' and 'tst_callgraphgenerator' fail, with
8531 ;; the later seemingly requiring sudo or access to the kernel
8532 ;; trace points.
8533 #:test-exclude
8534 (string-append
8535 "("
8536 (string-join
8537 ;; The 'tst_models' expected output doesn't exactly
8538 ;; match.
8539 '("tst_models"
8540 ;; The 'tst_callgraphgenerator' perf invocation
8541 ;; fails when run in the build container.
8542 "tst_callgraphgenerator"
8543 ;; The 'tst_perfparser' test requires sudo/access
8544 ;; to the kernel scheduler trace points.
8545 "tst_perfparser")
8546 "|")
8547 ")")
8548 #:phases
8549 #~(modify-phases %standard-phases
8550 (add-after 'unpack 'patch-perfparser
8551 ;; XXX: This phase is copied from qt-creator: keep them in sync!
8552 (lambda* (#:key inputs #:allow-other-keys)
8553 ;; perfparser attempts to dynamically load the demangle
8554 ;; libraries; use their absolute file name to avoid having to
8555 ;; set LD_LIBRARY_PATH.
8556 (let ((librustc_demangle.so
8557 (with-exception-handler (lambda (ex)
8558 (if (search-error? ex)
8559 #f
8560 (raise-exception ex)))
8561 (lambda ()
8562 (search-input-file inputs "lib/librustc_demangle.so"))
8563 #:unwind? #t)))
8564 (substitute* "3rdparty/perfparser/app/demangler.cpp"
8565 (("loadDemangleLib\\(QStringLiteral\\(\"rustc_demangle\")"
8566 all)
8567 (if librustc_demangle.so
8568 (format #f "loadDemangleLib(QStringLiteral(~s)"
8569 librustc_demangle.so)
8570 all)) ;no rustc_demangle; leave unchanged
8571 (("loadDemangleLib\\(QStringLiteral\\(\"d_demangle\")")
8572 (format #f "loadDemangleLib(QStringLiteral(~s)"
8573 (search-input-file inputs
8574 "lib/libd_demangle.so")))))))
8575 (add-after 'unpack 'path-paths
8576 (lambda* (#:key inputs #:allow-other-keys)
8577 (substitute* "src/perfoutputwidgetkonsole.cpp"
8578 (("\"tail\"")
8579 (format #f "~s" (search-input-file inputs "bin/tail"))))
8580 (substitute* "src/perfrecord.cpp"
8581 (("\"perf( )?\"" _ space)
8582 (string-append "\"" (search-input-file inputs "bin/perf")
8583 (or space "") "\""))))))))
8584 (native-inputs
8585 (list extra-cmake-modules
8586 vulkan-headers))
8587 (inputs
8588 (append
8589 (list coreutils-minimal
8590 d-demangler
8591 elfutils
8592 karchive
8593 kconfig
8594 kcoreaddons
8595 kddockwidgets
8596 kgraphviewer
8597 ki18n
8598 kio
8599 kiconthemes
8600 kitemmodels
8601 kitemviews
8602 knotifications
8603 kparts
8604 ksyntaxhighlighting
8605 kwindowsystem
8606 libxkbcommon
8607 perf
8608 qtdeclarative
8609 qtsvg
8610 solid
8611 threadweaver
8612 `(,zstd "lib"))
8613 (if (supported-package? rust-rustc-demangle-capi-0.1)
8614 (list rust-rustc-demangle-capi-0.1)
8615 '())))
8616 (home-page "https://github.com/KDAB/hotspot")
8617 (synopsis "Performance analysis GUI for Linux perf")
8618 (description "Hotspot is a standalone GUI for performance data analysis.
8619It aims to be similar to KCachegrind, but for data collected with
8620@command{perf}, a profiler for use with the kernel Linux. Its main feature is
8621graphically visualizing a @file{perf.data} file.")
8622 (license (list license:gpl2+ license:gpl3+)))) ;dual licensed
8623
8624(define-public ecryptfs-utils
8625 (package
8626 (name "ecryptfs-utils")
8627 (version "111")
8628 (source
8629 (origin
8630 (method url-fetch)
8631 (uri (string-append "https://launchpad.net/ecryptfs/trunk/"
8632 version "/+download/ecryptfs-utils_"
8633 version ".orig.tar.gz"))
8634 (sha256
8635 (base32
8636 "0zwq19siiwf09h7lwa7n7mgmrr8cxifp45lmwgcfr8c1gviv6b0i"))))
8637 (build-system gnu-build-system)
8638 (arguments
8639 `(#:configure-flags (list "--disable-pywrap")
8640 #:modules (,@%default-gnu-modules
8641 (ice-9 binary-ports)
8642 (rnrs bytevectors)
8643 (srfi srfi-26))
8644 #:phases
8645 (modify-phases %standard-phases
8646 (add-after 'patch-source-shebangs 'patch-hardcoded-paths
8647 (lambda* (#:key inputs outputs #:allow-other-keys)
8648 (let ((out (assoc-ref outputs "out"))
8649 (util-linux (assoc-ref inputs "util-linux"))
8650 (cryptsetup (assoc-ref inputs "cryptsetup-minimal"))
8651 (linux-pam (assoc-ref inputs "linux-pam"))
8652 (lvm2 (assoc-ref inputs "lvm2")))
8653 (substitute* '("src/utils/ecryptfs-mount-private"
8654 "src/utils/ecryptfs-umount-private"
8655 "src/utils/ecryptfs-setup-private"
8656 "src/utils/ecryptfs-setup-swap"
8657 "src/utils/mount.ecryptfs.c"
8658 "src/utils/umount.ecryptfs.c"
8659 "src/pam_ecryptfs/pam_ecryptfs.c"
8660 "src/desktop/ecryptfs-mount-private.desktop.in"
8661 "src/desktop/ecryptfs-setup-private.desktop.in")
8662 (("/bin/mount")
8663 (string-append util-linux "/bin/mount"))
8664 (("/bin/umount")
8665 (string-append util-linux "/bin/umount"))
8666 (("/sbin/mount.ecryptfs_private")
8667 (string-append out "/sbin/mount.ecryptfs_private"))
8668 (("/sbin/umount.ecryptfs_private")
8669 (string-append out "/sbin/umount.ecryptfs_private"))
8670 (("/usr/bin/ecryptfs-mount-private")
8671 (string-append out "/bin/ecryptfs-mount-private"))
8672 (("/usr/bin/ecryptfs-rewrite-file")
8673 (string-append out "/bin/ecryptfs-rewrite-file"))
8674 (("/usr/bin/ecryptfs-setup-private")
8675 (string-append out "/bin/ecryptfs-setup-private"))
8676 (("/sbin/cryptsetup")
8677 (string-append cryptsetup "/sbin/cryptsetup"))
8678 (("/sbin/unix_chkpwd")
8679 (string-append linux-pam "/sbin/unix_chkpwd"))
8680 (("/sbin/dmsetup")
8681 (string-append lvm2 "/sbin/dmsetup"))))))
8682 (add-after 'install 'wrap-scripts
8683 (lambda* (#:key inputs outputs #:allow-other-keys)
8684 (let* ((out (assoc-ref outputs "out"))
8685 (bin (string-append out "/bin"))
8686 (add (map (lambda (bin)
8687 (dirname (search-input-file
8688 inputs (string-append "bin/" bin))))
8689 ;; For simplicity, we wrap all scripts the same.
8690 (list "awk" "find" "gettext" "grep" "keyctl" "ls"
8691 "lsof" "mount" "rsync" "sed" "which")))
8692 (script? (lambda (file)
8693 (call-with-input-file file
8694 (lambda (port)
8695 (bytevector=? (string->utf8 "#!")
8696 (get-bytevector-n port 2)))))))
8697 (for-each (lambda (file)
8698 (when (script? file)
8699 (wrap-program file
8700 ;; '= would be better than 'suffix but break
8701 ;; setuid binaries.
8702 `("PATH" ":" suffix (,@add
8703 ,(string-append bin))))))
8704 (find-files bin "."))))))))
8705 (native-inputs
8706 (list intltool perl ; for pod2man
8707 pkg-config))
8708 (inputs
8709 (list coreutils
8710 cryptsetup-minimal
8711 findutils
8712 gawk
8713 grep
8714 keyutils
8715 linux-pam
8716 lsof
8717 lvm2
8718 nss
8719 rsync
8720 sed
8721 util-linux
8722 which))
8723 (home-page "https://ecryptfs.org/")
8724 (synopsis "Cryptographic file system utilities")
8725 (description
8726 "eCryptfs is a POSIX-compliant stacked cryptographic file system for Linux.
8727Each file's cryptographic meta-data is stored inside the file itself, along
8728with the encrypted contents. This allows individual encrypted files to be
8729copied between hosts and still be decrypted with the proper key. eCryptfs is a
8730native Linux file system, and has been part of the Linux kernel since version
87312.6.19. This package contains the userland utilities to manage it.")
8732 ;; The files src/key_mod/ecryptfs_key_mod_{openssl,pkcs11_helper,tspi}.c
8733 ;; grant additional permission to link with OpenSSL.
8734 (license license:gpl2+)))
8735
8736(define-public module-init-tools
8737 (package
8738 (name "module-init-tools")
8739 (version "3.16")
8740 (source (origin
8741 (method url-fetch)
8742 (uri (string-append
8743 "mirror://kernel.org/linux/utils/kernel/module-init-tools/"
8744 "module-init-tools-" version ".tar.bz2"))
8745 (sha256
8746 (base32
8747 "0jxnz9ahfic79rp93l5wxcbgh4pkv85mwnjlbv1gz3jawv5cvwp1"))
8748 (patches (search-patches "module-init-tools-moduledir.patch"))))
8749 (build-system gnu-build-system)
8750 (arguments
8751 ;; FIXME: The upstream tarball lacks man pages, and building them would
8752 ;; require DocBook & co. We used to use Gentoo's pre-built man pages,
8753 ;; but they vanished. In the meantime, fake it.
8754 '(#:phases
8755 (modify-phases %standard-phases
8756 (add-before 'configure 'fake-docbook
8757 (lambda _
8758 (substitute* "Makefile.in"
8759 (("^DOCBOOKTOMAN.*$")
8760 "DOCBOOKTOMAN = true\n"))
8761 #t)))))
8762 (home-page "https://www.kernel.org/pub/linux/utils/kernel/module-init-tools/")
8763 (synopsis "Tools for loading and managing Linux kernel modules")
8764 (description
8765 "Tools for loading and managing Linux kernel modules, such as
8766@code{modprobe}, @code{insmod}, @code{lsmod}, and more.")
8767 (license license:gpl2+)))
8768
8769(define-public mce-inject
8770 (let ((revision "0") ; no git tags :-/
8771 (commit "4cbe46321b4a81365ff3aafafe63967264dbfec5"))
8772 (package
8773 (name "mce-inject")
8774 (version (git-version "0.0.0" revision commit))
8775 (source
8776 (origin
8777 (method git-fetch)
8778 (uri (git-reference
8779 (url "https://git.kernel.org/pub/scm/utils/cpu/mce/mce-inject.git")
8780 (commit commit)))
8781 (file-name (git-file-name name version))
8782 (sha256
8783 (base32 "0gjapg2hrlxp8ssrnhvc19i3r1xpcnql7xv0zjgbv09zyha08g6z"))))
8784 (build-system gnu-build-system)
8785 (arguments
8786 ;; There is no test suite. There's a test/ directory, but it just holds
8787 ;; example text files you could feed to the programme to crash something.
8788 (list #:tests? #f
8789 #:make-flags
8790 #~(list (string-append "prefix=" #$output)
8791 (string-append "CC=" #$(cc-for-target)))
8792 #:phases
8793 #~(modify-phases %standard-phases
8794 (delete 'configure) ; no configure script
8795 (add-after 'install 'install-examples
8796 (lambda* (#:key outputs #:allow-other-keys)
8797 (let* ((out (assoc-ref outputs "out"))
8798 (doc (string-append out "/share/doc/" #$name))
8799 (dir (string-append doc "/examples")))
8800 (copy-recursively "test" dir )))))))
8801 (native-inputs
8802 (list bison flex))
8803 (supported-systems (list "i686-linux" "x86_64-linux"))
8804 (home-page
8805 "https://git.kernel.org/pub/scm/utils/cpu/mce/mce-inject.git/about/")
8806 (synopsis
8807 "Inject x86 @acronym{MCEs, machine-check exceptions} into Linux")
8808 (description
8809 "This simple tool injects fake @acronym{MCEs, machine-check exceptions}
8810into a running Linux kernel, to debug or test the kernel's @acronym{EDAC, error
8811detection and correction}-handling code specific to x86 and x86_64 platforms.
8812
8813Real MCEs are internal CPU errors. Handling them correctly can be important to
8814system stability and even prevent physical damage. In contrast, simulated MCEs
8815produced by @command{mce-inject} are purely synthetic: injection happens only at
8816the software level, inside the kernel, and is not visible to the platform
8817hardware or firmware.
8818
8819A convenient feature of @command{mce-inject} is that the input language used to
8820describe MCEs is similar to the format used in Linux panic messages, with a few
8821extensions. In general, you should be able to pipe in any logged MCE panic to
8822simulate that same MCE.
8823
8824The target kernel must have the @code{CONFIG_X86_MCE_INJECT} option enabled and
8825the @code{mce-inject} module loaded if it exists.")
8826 (license license:gpl2))))
8827
8828(define-public mcelog
8829 (package
8830 (name "mcelog")
8831 (version "195")
8832 (source
8833 (origin
8834 (method git-fetch)
8835 (uri (git-reference
8836 (url "https://git.kernel.org/pub/scm/utils/cpu/mce/mcelog.git")
8837 (commit (string-append "v" version))))
8838 (file-name (git-file-name name version))
8839 (sha256
8840 (base32 "1bg2bj8flybd8kzmmaaslisc6lc1fs9nbv09im6r32dq48skx5aj"))
8841 (modules '((guix build utils)))
8842 (snippet
8843 `(begin
8844 ;; The checkout lacks a .git directory, breaking ‘git describe’.
8845 (substitute* "Makefile"
8846 (("\"unknown\"") (string-append "\"v" ,version "\"")))))))
8847 (build-system gnu-build-system)
8848 (arguments
8849 (list
8850 ;; The tests will only run as root on certain supported CPU models.
8851 #:tests? #f
8852 #:make-flags
8853 #~(list (string-append "CC=" #$(cc-for-target))
8854 (string-append "prefix=" #$output)
8855 (string-append "DOCDIR=" #$output "/share/doc/"
8856 #$name "-" #$version)
8857 "etcprefix=$(DOCDIR)/examples")
8858 #:phases
8859 #~(modify-phases %standard-phases
8860 (delete 'configure)))) ; no configure script
8861 (native-inputs
8862 (list python-wrapper)) ; to generate example mcelog.conf
8863 (supported-systems (list "i686-linux" "x86_64-linux"))
8864 (home-page "https://mcelog.org/")
8865 (synopsis "Machine check monitor for x86 Linux systems")
8866 (description
8867 "The mcelog daemon logs memory, I/O, CPU, and other hardware errors on x86
8868systems running the kernel Linux. It can also perform user-defined tasks, such
8869as bringing bad pages off-line, when configurable error thresholds are
8870exceeded.")
8871 (license license:gpl2)))
8872
8873(define-public mtd-utils
8874 (package
8875 (name "mtd-utils")
8876 (version "2.1.5")
8877 (source (origin
8878 (method url-fetch)
8879 (uri (string-append
8880 "ftp://ftp.infradead.org/pub/mtd-utils/"
8881 "mtd-utils-" version ".tar.bz2"))
8882 (sha256
8883 (base32
8884 "0ilz8hkcyvfcnqpy25kbr8fb71x9vl28wbmw56vvd68n2byjfviq"))))
8885 (arguments
8886 (list #:configure-flags
8887 (if (%current-target-system) ; When cross-compiling.
8888 #~(list)
8889 #~(list "--enable-unit-tests"))
8890
8891 #:parallel-tests? #f)) ;tests may fail when running in parallel
8892 (native-inputs
8893 (list cmocka pkg-config))
8894 (inputs
8895 (list acl ; extended attributes (xattr)
8896 lzo
8897 openssl ; optional crypto support
8898 `(,util-linux "lib")
8899 zlib
8900 `(,zstd "lib")))
8901 (build-system gnu-build-system)
8902 (synopsis "MTD Flash Storage Utilities")
8903 (description "This package provides utilities for testing, partitioning, etc
8904of flash storage.")
8905 (home-page "http://www.linux-mtd.infradead.org/")
8906 (license
8907 (list license:gpl2 ; Almost everything is gpl2 or gpl2+
8908 license:mpl1.1 ; All ftl* files
8909 license:expat)))) ; libiniparser
8910
8911(define-public libseccomp
8912 (package
8913 (name "libseccomp")
8914 (version "2.6.0")
8915 (source (origin
8916 (method git-fetch)
8917 (uri (git-reference
8918 (url "https://github.com/seccomp/libseccomp")
8919 (commit (string-append "v" version))))
8920 (file-name (git-file-name name version))
8921 (sha256
8922 (base32
8923 "189yh66aj3z3jvns739qbj504f3mcl3w44pxxizw877pbj3kal11"))))
8924 (build-system gnu-build-system)
8925 (arguments
8926 (list
8927 #:configure-flags #~(list "--disable-static")
8928 #:phases #~(modify-phases %standard-phases
8929 #$@(if (target-ppc32?)
8930 ;; This test is removed upstream. See upstream commit
8931 ;; 7db46d72f13c172b290818f624c2966bd0db5677
8932 #~((add-after 'unpack 'skip-62-sim-arch-tests
8933 (lambda _
8934 (substitute*
8935 "tests/62-sim-arch_transactions.tests"
8936 (("test type: bpf-sim-fuzz") "")
8937 (("62-sim-arch_transactions 5") "")))))
8938 #~())
8939 (add-before 'check 'skip-load-test
8940 (lambda _
8941 ;; This test does a native system call and fails when
8942 ;; run under QEMU user-mode emulation. Just skip it.
8943 (delete-file "tests/52-basic-load.tests"))))))
8944 (native-inputs
8945 (list autoconf automake gperf libtool which))
8946 (synopsis "Interface to Linux's seccomp syscall filtering mechanism")
8947 (description "The libseccomp library provides an easy to use, platform
8948independent, interface to the Linux Kernel's syscall filtering mechanism. The
8949libseccomp API is designed to abstract away the underlying BPF based syscall
8950filter language and present a more conventional function-call based filtering
8951interface that should be familiar to, and easily adopted by, application
8952developers.")
8953 (home-page "https://github.com/seccomp/libseccomp")
8954 (license license:lgpl2.1)))
8955
8956(define-public radeontop
8957 (package
8958 (name "radeontop")
8959 (version "1.4")
8960 (source
8961 (origin
8962 (method git-fetch)
8963 (uri (git-reference
8964 (url "https://github.com/clbr/radeontop")
8965 (commit (string-append "v" version))))
8966 (file-name (git-file-name name version))
8967 (sha256
8968 (base32 "0kwqddidr45s1blp0h8r8h1dd1p50l516yb6mb4s6zsc827xzgg3"))))
8969 (build-system gnu-build-system)
8970 (arguments
8971 `(#:phases (modify-phases %standard-phases
8972 ;; getver.sh uses ‘git --describe’, isn't worth an extra git
8973 ;; dependency, and doesn't even work on release(!) tarballs.
8974 (add-after 'unpack 'report-correct-version
8975 (lambda _
8976 (substitute* "getver.sh"
8977 (("ver=unknown")
8978 (string-append "ver=" ,version)))))
8979 (delete 'configure)) ; no configure script
8980 #:make-flags (list (string-append "CC=" ,(cc-for-target))
8981 (string-append "PREFIX=" %output))
8982 #:tests? #f)) ; no tests
8983 (native-inputs
8984 (list gettext-minimal pkg-config))
8985 (inputs
8986 (list libdrm libpciaccess libxcb ncurses))
8987 (home-page "https://github.com/clbr/radeontop/")
8988 (synopsis "Usage monitor for AMD Radeon graphics")
8989 (description "RadeonTop monitors resource consumption on supported AMD
8990Radeon Graphics Processing Units (GPUs), either in real time as bar graphs on
8991a terminal or saved to a file for further processing. It measures both the
8992activity of the GPU as a whole, which is also accurate during OpenCL
8993computations, as well as separate component statistics that are only meaningful
8994under OpenGL graphics workloads.")
8995 (license license:gpl3)))
8996
8997(define-public efivar
8998 (package
8999 (name "efivar")
9000 (version "39")
9001 (source (origin
9002 (method git-fetch)
9003 (uri (git-reference
9004 (url "https://github.com/rhboot/efivar")
9005 (commit version)))
9006 (file-name (git-file-name name version))
9007 (sha256
9008 (base32
9009 "1zd9dghg1z2rrsazv3d9rj7nik6kdqz42jiak65pipz7mpjn9zdk"))
9010 (patches (search-patches "efivar-fix-fprint-format.patch"))))
9011 (build-system gnu-build-system)
9012 (arguments
9013 (list
9014 ;; Tests require a UEFI system and is not detected in the chroot.
9015 #:tests? #f
9016 #:make-flags #~(list (string-append "prefix="
9017 #$output)
9018 (string-append "libdir="
9019 #$output "/lib")
9020 (string-append "CC="
9021 #$(cc-for-target))
9022 "HOSTCC=gcc"
9023 (string-append "LDFLAGS=-Wl,-rpath="
9024 #$output "/lib")
9025 ;; Strictly only needed for i686-linux/32bit
9026 "CFLAGS=-g -O2 -Wno-error=format")
9027 #:phases #~(modify-phases %standard-phases
9028 (add-after 'unpack 'build-deterministically
9029 (lambda _
9030 (substitute* "src/include/defaults.mk"
9031 ;; Don't use -march=native.
9032 (("-march=native")
9033 ""))))
9034 (delete 'configure))))
9035 (native-inputs (list mandoc pkg-config))
9036 (inputs (list popt))
9037 (home-page "https://github.com/rhboot/efivar")
9038 (synopsis "Tool and library to manipulate EFI variables")
9039 (description "This package provides a library and a command line
9040interface to the variable facility of UEFI boot firmware.")
9041 (license license:lgpl2.1+)))
9042
9043(define-public efibootmgr
9044 (package
9045 (name "efibootmgr")
9046 (version "18")
9047 (source
9048 (origin
9049 (method git-fetch)
9050 (uri (git-reference
9051 (url "https://github.com/rhboot/efibootmgr")
9052 (commit version)))
9053 (file-name (git-file-name name version))
9054 (sha256
9055 (base32 "1j19m3dngcb7jl88ib32phbh5r7c02dhhakq8jk6z7y408c111hd"))))
9056 (build-system gnu-build-system)
9057 (arguments
9058 (list
9059 #:tests? #f ;no tests
9060 #:make-flags
9061 #~(append (list (string-append "prefix=" #$output)
9062 (string-append "libdir=" #$output "/lib")
9063 ;; EFIDIR denotes a subdirectory relative to the
9064 ;; EFI System Partition where the loader will be
9065 ;; installed (known as OS_VENDOR in the code).
9066 ;; GRUB overrides this, as such it's only used if
9067 ;; nothing else is specified on the command line.
9068 "EFIDIR=gnu")
9069 #$(if (%current-target-system)
9070 #~(list
9071 (string-append "CC=" #$(cc-for-target))
9072 (string-append "PKG_CONFIG=" #$(pkg-config-for-target))
9073 (string-append "EXTRAINCDIRS="
9074 #$(this-package-input "efivar") "/include"))
9075 #~'()))
9076 #:phases #~(modify-phases %standard-phases (delete 'configure))))
9077 (native-inputs
9078 (list pkg-config))
9079 (inputs
9080 (list efivar popt))
9081 (home-page "https://github.com/rhboot/efibootmgr")
9082 (synopsis "Modify the Extensible Firmware Interface (EFI) boot manager")
9083 (description
9084 "@code{efibootmgr} is a user-space application to modify the Intel
9085Extensible Firmware Interface (EFI) Boot Manager. This application can
9086create and destroy boot entries, change the boot order, change the next
9087running boot option, and more.")
9088 (license license:gpl2+)))
9089
9090(define-public sysstat
9091 (package
9092 (name "sysstat")
9093 (version "12.7.5")
9094 (source
9095 (origin
9096 (method url-fetch)
9097 (uri (string-append "https://sysstat.github.io/sysstat-packages/"
9098 "sysstat-" version ".tar.xz"))
9099 (sha256
9100 (base32 "0ssdrm3k0fclq5b5i0aznfwdkbac9l9cf88idaq3pls9lm040rjp"))))
9101 (build-system gnu-build-system)
9102 (native-inputs (list gettext-minimal))
9103 (arguments
9104 `(#:tests? #f ; no test suite.
9105 ;; Without this flag, it tries to install the man pages with group 'root'
9106 ;; and fails because /etc/passwd lacks an entry for the root user.
9107 #:configure-flags
9108 (list "--disable-file-attr"
9109 (string-append "conf_dir=" (assoc-ref %outputs "out") "/etc"))
9110 #:phases
9111 (modify-phases %standard-phases
9112 ;; The build process tries to create '/var/lib/sa', so we skip that
9113 ;; instruction.
9114 (add-after 'build 'skip-touching-var
9115 (lambda _
9116 (substitute* "Makefile"
9117 (("mkdir -p \\$\\(DESTDIR\\)\\$\\(SA_DIR\\)")
9118 "")))))))
9119 (home-page "https://sysstat.github.io")
9120 (synopsis "Performance monitoring tools for Linux")
9121 (description "The sysstat utilities are a collection of performance
9122monitoring tools for Linux. These include @code{mpstat}, @code{iostat},
9123@code{tapestat}, @code{cifsiostat}, @code{pidstat}, @code{sar}, @code{sadc},
9124@code{sadf} and @code{sa}.")
9125 (license license:gpl2+)))
9126
9127(define-public acpilight
9128 (package
9129 (name "acpilight")
9130 (version "1.2")
9131 (source (origin
9132 (method git-fetch)
9133 (uri (git-reference
9134 (url "https://gitlab.com/wavexx/acpilight.git")
9135 (commit (string-append "v" version))))
9136 (file-name (git-file-name name version))
9137 (sha256
9138 (base32
9139 "1r0r3nx6x6vkpal6vci0zaa1n9dfacypldf6k8fxg7919vzxdn1w"))))
9140 (build-system gnu-build-system)
9141 (arguments
9142 (list #:tests? #f ; no tests
9143 #:make-flags
9144 #~(list (string-append "prefix=" #$output)
9145 (string-append "sysconfdir=" #$output "/lib")) ;udev rule
9146 #:phases
9147 #~(modify-phases %standard-phases
9148 (delete 'configure)
9149 (add-after 'unpack 'patch
9150 (lambda* (#:key inputs #:allow-other-keys)
9151 ;; Prevent reloading udev at build time
9152 (substitute* "Makefile"
9153 (("udevadm") "true"))
9154 (substitute* "90-backlight.rules"
9155 (("/bin")
9156 (string-append #$(this-package-input "coreutils")
9157 "/bin"))))))))
9158 (inputs (list coreutils python))
9159 (home-page "https://gitlab.com/wavexx/acpilight")
9160 (synopsis "Backward-compatibile xbacklight replacement")
9161 (description "acpilight is a backward-compatibile replacement for
9162xbacklight that uses the ACPI interface to set the display brightness. On
9163modern laptops acpilight can control both display and keyboard backlight
9164uniformly on either X11, the console or Wayland.")
9165 (license license:gpl3+)))
9166
9167(define-public light
9168 (package
9169 (name "light")
9170 (version "1.2.2")
9171 (source
9172 (origin
9173 (method git-fetch)
9174 (uri (git-reference
9175 (url "https://github.com/haikarainen/light")
9176 (commit (string-append "v" version))))
9177 (sha256
9178 (base32 "1a70zcf88ifsnwll486aicjnh48zisdf8f7vi34ihw61kdadsq9s"))
9179 (file-name (git-file-name name version))))
9180 (build-system gnu-build-system)
9181 (arguments
9182 `(#:configure-flags '("CFLAGS=-fcommon")
9183 #:phases
9184 (modify-phases %standard-phases
9185 (add-after 'unpack 'patch-udev-rules-absolute-path-bins
9186 (lambda* (#:key inputs #:allow-other-keys)
9187 (substitute* "90-backlight.rules"
9188 (("/bin/chgrp") (which "chgrp"))
9189 (("/bin/chmod") (which "chmod")))
9190 #t))
9191 (add-after 'install 'install-udev-rules
9192 (lambda* (#:key outputs #:allow-other-keys)
9193 (let ((out (assoc-ref outputs "out")))
9194 (install-file
9195 "90-backlight.rules" (string-append out "/lib/udev/rules.d"))
9196 #t))))))
9197 (native-inputs
9198 (list autoconf automake))
9199 (home-page "https://haikarainen.github.io/light/")
9200 (synopsis "GNU/Linux application to control backlights")
9201 (description
9202 "Light is a program to send commands to screen backlight controllers
9203under GNU/Linux. Features include:
9204
9205@itemize
9206@item It does not rely on X.
9207@item Light can automatically figure out the best controller to use, making
9208full use of underlying hardware.
9209@item It is possible to set a minimum brightness value, as some controllers
9210set the screen to be pitch black at a value of 0 (or higher).
9211@end itemize\n")
9212 (license license:gpl3+)))
9213
9214(define-public brightnessctl
9215 (package
9216 (name "brightnessctl")
9217 (version "0.5.1")
9218 (home-page "https://github.com/Hummer12007/brightnessctl")
9219 (source (origin
9220 (method git-fetch)
9221 (uri (git-reference (url home-page) (commit version)))
9222 (file-name (git-file-name name version))
9223 (sha256
9224 (base32
9225 "0immxc7almmpg80n3bdn834p3nrrz7bspl2syhb04s3lawa5y2lq"))
9226 (patches (search-patches "brightnessctl-elogind-support.patch"))))
9227 (build-system gnu-build-system)
9228 (arguments
9229 `(#:tests? #f ; no tests
9230 #:make-flags (list (string-append "CC=" ,(cc-for-target))
9231 (string-append "PREFIX=" %output)
9232 (string-append "UDEVDIR=" %output "/lib/udev/rules.d/")
9233 "ENABLE_SYSTEMD=1")
9234 #:phases
9235 (modify-phases %standard-phases
9236 (delete 'configure)
9237 (add-after 'unpack 'adjust-udev-rules
9238 (lambda _
9239 (substitute* "Makefile"
9240 (("INSTALL_UDEV_RULES=0") "INSTALL_UDEV_RULES=1"))
9241 (substitute* "90-brightnessctl.rules"
9242 (("/bin/") "/run/current-system/profile/bin/"))
9243 #t)))))
9244 (native-inputs
9245 (list pkg-config))
9246 (inputs
9247 (list elogind))
9248 (synopsis "Backlight and LED brightness control")
9249 (description
9250 "This program allows you read and control device brightness. Devices
9251include backlight and LEDs. It can also preserve current brightness before
9252applying the operation, such as on lid close.
9253
9254The appropriate permissions must be set on the backlight or LED control
9255interface in sysfs, which can be accomplished with the included udev rules.")
9256 (license license:expat)))
9257
9258(define-public tlp
9259 (package
9260 (name "tlp")
9261 (version "1.9.0")
9262 (source
9263 (origin
9264 (method git-fetch)
9265 (uri (git-reference
9266 (url "https://github.com/linrunner/TLP")
9267 (commit version)))
9268 (file-name (git-file-name name version))
9269 (sha256
9270 (base32 "0msskz42yy0ddq6gqak0dsl77wsym24ly3bkpymfwl9dr3wzikv8"))))
9271 (native-inputs
9272 (list shellcheck))
9273 (inputs
9274 `(("dbus" ,dbus)
9275 ("ethtool" ,ethtool)
9276 ("eudev" ,eudev)
9277 ("grep" ,grep)
9278 ("guile" ,guile-3.0) ;for wrap-script
9279 ("hdparm" ,hdparm)
9280 ("inetutils" ,inetutils)
9281 ("iw" ,iw)
9282 ("kmod" ,kmod)
9283 ("pciutils" ,pciutils)
9284 ("perl" ,perl)
9285 ("rfkill" ,rfkill)
9286 ("sed" ,sed)
9287 ("usbutils" ,usbutils)
9288 ("util-linux" ,util-linux)
9289 ("wireless-tools" ,wireless-tools)
9290 ,@(if (let ((system (or (%current-target-system)
9291 (%current-system))))
9292 (or (string-prefix? "i686-" system)
9293 (string-prefix? "x86_64-" system)))
9294 `(("x86-energy-perf-policy" ,x86-energy-perf-policy))
9295 '())))
9296 (build-system gnu-build-system)
9297 (arguments
9298 ;; XXX: The full test suite is run with "checkall" but it requires
9299 ;; "checkbashisms" and "perlcritic", not yet packaged in Guix.
9300 (list
9301 #:make-flags
9302 #~(list "TLP_CONFUSR=/etc/tlp.conf" "TLP_CONFDIR=/etc/tlp.d")
9303 #:test-target "shellcheck"
9304 #:modules '((guix build gnu-build-system)
9305 (guix build utils)
9306 (srfi srfi-1))
9307 #:phases
9308 #~(modify-phases %standard-phases
9309 (delete 'configure) ; no configure script
9310 (add-before 'build 'setenv
9311 (lambda _
9312 (setenv "TLP_WITH_SYSTEMD" "0")
9313 (setenv "TLP_NO_INIT" "1")))
9314 (add-before 'build 'fix-installation
9315 (lambda _
9316 ;; Stop the Makefile from trying to create system directories.
9317 (substitute* "Makefile"
9318 (("= /usr") (string-append "= " #$output))
9319 (("= /etc") (string-append "= " #$output "/etc"))
9320 (("install -d -m 755 \\$\\(_VAR\\)") "#"))))
9321 (add-before 'build 'fix-perl-calls
9322 ;; Shell scripts in "bat.d" and "func.d" call "perl". Fix
9323 ;; invocation without wrapping every one of them.
9324 (lambda* (#:key inputs #:allow-other-keys)
9325 (substitute* (append (find-files "bat.d" ".")
9326 (find-files "func.d" "."))
9327 (("(^|[^/])perl" _ prefix)
9328 (string-append prefix
9329 (search-input-file inputs "bin/perl"))))))
9330 (replace 'install
9331 (lambda _ (invoke "make" "install-tlp" "install-man-tlp")))
9332 (add-after 'install 'wrap
9333 (lambda* (#:key inputs outputs #:allow-other-keys)
9334 (let* ((bin (string-append (assoc-ref outputs "out") "/bin"))
9335 (sbin (string-append (assoc-ref outputs "out") "/sbin"))
9336 ;; Used to ignore symlinks which don't need wrapping
9337 (regular-file-predicate
9338 (lambda (file stat) (eq? 'regular (stat:type stat))))
9339 (bin-files (find-files bin regular-file-predicate))
9340 (sbin-files (find-files sbin regular-file-predicate)))
9341 (define (bin-directory input-name)
9342 (let ((p (assoc-ref inputs input-name)))
9343 (and p (string-append p "/bin"))))
9344 (define (sbin-directory input-name)
9345 (string-append (assoc-ref inputs input-name) "/sbin"))
9346 (for-each (lambda (program)
9347 ;; Programs rely on $0 so we use wrap-script
9348 ;; instead of wrap-program
9349 (wrap-script program
9350 `("PATH" ":" prefix
9351 ,(append
9352 (filter-map bin-directory
9353 '("bash"
9354 "coreutils"
9355 "dbus"
9356 "eudev"
9357 "grep"
9358 "inetutils"
9359 "kmod"
9360 "perl"
9361 "sed"
9362 "usbutils"
9363 "util-linux"
9364 "x86-energy-perf-policy"))
9365 (filter-map sbin-directory
9366 '("ethtool"
9367 "hdparm"
9368 "iw"
9369 "pciutils"
9370 "rfkill"
9371 "wireless-tools"))))))
9372 (append bin-files sbin-files))))))))
9373 (home-page "https://linrunner.de/en/tlp/tlp.html")
9374 (synopsis "Power management tool for Linux")
9375 (description "TLP is a power management tool for Linux. It comes with
9376a default configuration already optimized for battery life. Nevertheless,
9377TLP is customizable to fulfil system requirements. TLP settings are applied
9378every time the power supply source is changed.")
9379 ;; 'COPYING' is a custom version that says that one file is GPLv3+ and the
9380 ;; rest is GPLv2+.
9381 (license (list license:gpl2+ license:gpl3+))))
9382
9383(define-public tlpui
9384 (package
9385 (name "tlpui")
9386 (version "1.9.0")
9387 (source
9388 (origin
9389 (method git-fetch)
9390 (uri (git-reference
9391 (url "https://github.com/d4nj1/TLPUI")
9392 (commit (string-append "tlpui-" version))))
9393 (file-name (git-file-name name version))
9394 (sha256
9395 (base32 "00rkq389zs525s7ckjj6cm34s25rsrgz47p28pp43ld35i538g9w"))))
9396 (build-system pyproject-build-system)
9397 (arguments
9398 (list
9399 #:phases
9400 #~(modify-phases %standard-phases
9401 (add-after 'unpack 'set-absolute-locations
9402 (lambda* (#:key inputs #:allow-other-keys)
9403 (let ((defaults.conf
9404 (search-input-file inputs "/share/tlp/defaults.conf"))
9405 (lspci (search-input-file inputs "/bin/lspci"))
9406 (lsusb (search-input-file inputs "/bin/lsusb"))
9407 (tlp-stat (search-input-file inputs "/bin/tlp-stat")))
9408 (with-directory-excursion "tlpui"
9409 (substitute* '("file.py" "settingshelper.py" "statui.py")
9410 (("\"tlp-stat\"")
9411 (string-append "'" tlp-stat "'"))
9412 (("/usr/share/tlp/defaults.conf")
9413 defaults.conf))
9414 (substitute* "ui_config_objects/gtkusblist.py"
9415 (("\"lsusb\"")
9416 (string-append "'" lsusb "'")))
9417 (substitute* "ui_config_objects/gtkpcilist.py"
9418 (("\"lspci\"")
9419 (string-append "'" lspci "'")))
9420 ;; Settings check if various tlp executables, lspci and
9421 ;; usbutils are available. Skip this phase since we know
9422 ;; for sure they are (and it avoids patching each location).
9423 (substitute* "settingshelper.py"
9424 (("(command_exists = ).*" _ lead)
9425 (string-append lead "True\n")))))))
9426 (add-after 'install 'install-desktop-file
9427 (lambda _
9428 (let ((dir (string-append #$output "/share/applications")))
9429 (install-file "tlpui.desktop" dir))))
9430 (add-after 'wrap 'wrap-gi-python
9431 (lambda _
9432 (let ((gi-typelib-path (getenv "GI_TYPELIB_PATH")))
9433 (wrap-program (string-append #$output "/bin/tlpui")
9434 `("GI_TYPELIB_PATH" ":" prefix (,gi-typelib-path)))))))))
9435 (native-inputs
9436 (list `(,glib "bin")
9437 gobject-introspection
9438 python-poetry-core
9439 python-pytest
9440 python-pyyaml))
9441 (inputs
9442 (list gtk+
9443 pciutils
9444 python-pygobject
9445 tlp
9446 usbutils))
9447 (propagated-inputs (list (librsvg-for-system)))
9448 (home-page "https://github.com/d4nj1/TLPUI")
9449 (synopsis "User interface for TLP written in Python")
9450 (description
9451 "The Python scripts in this project generate a GTK-UI to change
9452TLP configuration files easily. It aims to protect users from setting
9453bad configuration and to deliver a basic overview of all the valid
9454configuration values.")
9455 (license license:gpl2+)))
9456
9457(define-public lshw
9458 (package
9459 (name "lshw")
9460 (version "B.02.19.2")
9461 (source (origin
9462 (method url-fetch)
9463 (uri (string-append "https://www.ezix.org/software/"
9464 "files/lshw-" version
9465 ".tar.gz"))
9466 (sha256
9467 (base32
9468 "100gm1c6gb2hkfws22h0xhvv7nz38p49lxd1csikj8qlhyn4gcwv"))))
9469 (build-system gnu-build-system)
9470 (arguments
9471 `(#:phases (modify-phases %standard-phases (delete 'configure))
9472 #:tests? #f ; no tests
9473 #:make-flags
9474 (list (string-append "PREFIX=" (assoc-ref %outputs "out")))))
9475 (synopsis "List hardware information")
9476 (description
9477 "@command{lshw} (Hardware Lister) is a small tool to provide
9478detailed information on the hardware configuration of the machine.
9479It can report exact memory configuration, firmware version, mainboard
9480configuration, CPU version and speed, cache configuration, bus speed,
9481and more on DMI-capable x86 or EFI (IA-64) systems and on some PowerPC
9482machines (PowerMac G4 is known to work).")
9483 (home-page "https://www.ezix.org/project/wiki/HardwareLiSter")
9484 (license license:gpl2+)))
9485
9486(define-public libmnl
9487 (package
9488 (name "libmnl")
9489 (version "1.0.5")
9490 (source
9491 (origin
9492 (method url-fetch)
9493 (uri (string-append "mirror://netfilter.org/libmnl/"
9494 "libmnl-" version ".tar.bz2"))
9495 (sha256
9496 (base32
9497 "09851ns07399rbz0y8slrlmnw3fn1nakr8d37pxjn5gkks8rnjr7"))))
9498 (build-system gnu-build-system)
9499 (home-page "https://www.netfilter.org/projects/libmnl/")
9500 (synopsis "Netlink utility library")
9501 (description "Libmnl is a minimalistic user-space library oriented to
9502Netlink developers. There are a lot of common tasks in parsing, validating,
9503constructing of both the Netlink header and TLVs that are repetitive and easy to
9504get wrong. This library aims to provide simple helpers that allows you to
9505re-use code and to avoid re-inventing the wheel.")
9506 (properties
9507 '((release-monitoring-url . "https://www.netfilter.org/pub/libmnl/")))
9508 (license license:lgpl2.1+)))
9509
9510(define-public libnftnl
9511 (package
9512 (name "libnftnl")
9513 (version "1.2.8")
9514 (source
9515 (origin
9516 (method url-fetch)
9517 (uri (string-append "mirror://netfilter.org/libnftnl/"
9518 "libnftnl-" version ".tar.xz"))
9519 (sha256
9520 (base32 "15ddcyp91lxjh2wfi8xicjpffhn9rpiqsa8djbkqvc69npbabzip"))))
9521 (build-system gnu-build-system)
9522 (native-inputs
9523 (list pkg-config))
9524 (inputs
9525 (list libmnl))
9526 (home-page "https://www.netfilter.org/projects/libnftnl/index.html")
9527 (synopsis "Netlink programming interface to the Linux nf_tables subsystem")
9528 (description "Libnftnl is a userspace library providing a low-level netlink
9529programming interface to the in-kernel nf_tables subsystem. The library
9530libnftnl has been previously known as libnftables. This library is currently
9531used by nftables.")
9532 (license license:gpl2+)))
9533
9534;;; The symbol libnftl/fixed should be used when libnftnl needs fixes
9535;;; (security or else) and this deprecation could be removed.
9536(define-deprecated/public-alias libnftnl/fixed libnftnl/pinned)
9537
9538;; This is used in iptables, which contributes to rust. We're pinning this
9539;; variant to avoid accidental rebuilds of rust.
9540(define-public libnftnl/pinned
9541 (package
9542 (inherit libnftnl)
9543 (version "1.2.8")
9544 (source
9545 (origin
9546 (method url-fetch)
9547 (uri (string-append "mirror://netfilter.org/libnftnl/"
9548 "libnftnl-" version ".tar.xz"))
9549 (sha256
9550 (base32 "15ddcyp91lxjh2wfi8xicjpffhn9rpiqsa8djbkqvc69npbabzip"))))
9551 (build-system gnu-build-system)
9552 (native-inputs
9553 (list pkg-config))
9554 (inputs
9555 (list libmnl))))
9556
9557(define-public nftables
9558 (package
9559 (name "nftables")
9560 (version "1.0.8")
9561 (source
9562 (origin
9563 (method url-fetch)
9564 (uri (list (string-append "mirror://netfilter.org/nftables/nftables-"
9565 version ".tar.xz")
9566 (string-append "https://www.nftables.org/projects/nftables"
9567 "/files/nftables-" version ".tar.xz")))
9568 (sha256
9569 (base32 "0l1xpwr9qfbl3bxa97v8s2lbibiz0xma9q0qi34xp0hswh6p8wwk"))))
9570 (build-system gnu-build-system)
9571 (arguments `(#:configure-flags
9572 '("--disable-static"
9573 "--with-cli=readline"
9574 "--with-json")
9575 #:phases
9576 (modify-phases %standard-phases
9577 (add-before 'configure 'autoreconf
9578 (lambda _
9579 (invoke "autoreconf" "-fi"))))))
9580 (inputs (list gmp libmnl libnftnl readline jansson))
9581 (native-inputs (list pkg-config
9582 bison
9583 flex
9584 docbook2x
9585 autoconf
9586 automake
9587 libtool))
9588 (home-page "https://www.nftables.org")
9589 (synopsis "Userspace utility for Linux packet filtering")
9590 (description "nftables is the project that aims to replace the existing
9591{ip,ip6,arp,eb}tables framework. Basically, this project provides a new packet
9592filtering framework, a new userspace utility and also a compatibility layer for
9593{ip,ip6}tables. nftables is built upon the building blocks of the Netfilter
9594infrastructure such as the existing hooks, the connection tracking system, the
9595userspace queueing component and the logging subsystem.")
9596 (license license:gpl2)))
9597
9598(define-public libnetfilter-conntrack
9599 (package
9600 (name "libnetfilter-conntrack")
9601 (version "1.0.9")
9602 (source
9603 (origin
9604 (method url-fetch)
9605 (uri (string-append "https://netfilter.org/projects/"
9606 "libnetfilter_conntrack/files/"
9607 "libnetfilter_conntrack-"
9608 version ".tar.bz2"))
9609 (sha256
9610 (base32 "1a3rnpsba64dzy97wwjrxal89wr0nf9znvag2j18nkp3kzs9vgb7"))))
9611 (build-system gnu-build-system)
9612 (native-inputs (list pkg-config))
9613 (inputs (list libnfnetlink libmnl))
9614 (synopsis "Library for kernel connection tracking state table")
9615 (description "libnetfilter_conntrack is a userspace library providing a
9616programming interface (API) to the in-kernel connection tracking state table.
9617The library libnetfilter_conntrack has been previously known as
9618libnfnetlink_conntrack and libctnetlink. This library is currently used by
9619conntrack-tools among many other applications.")
9620 (home-page "https://netfilter.org/projects/libnetfilter_conntrack/index.html")
9621 (supported-systems (filter target-linux? %supported-systems))
9622 (properties '((upstream-name . "libnetfilter_conntrack")))
9623 (license license:gpl2+)))
9624
9625(define-public libnetfilter-cttimeout
9626 (package
9627 (name "libnetfilter-cttimeout")
9628 (version "1.0.1")
9629 (source
9630 (origin
9631 (method url-fetch)
9632 (uri (string-append "https://netfilter.org/projects/"
9633 "libnetfilter_cttimeout/files/"
9634 "libnetfilter_cttimeout-" version ".tar.bz2"))
9635 (sha256
9636 (base32 "0983cpyvxyycbnzqlrzml80pph2z51r6s7sxp06ciq8468pxln8b"))))
9637 (build-system gnu-build-system)
9638 (native-inputs (list pkg-config))
9639 (inputs (list libmnl))
9640 (synopsis "Library for kernel connection tracking timeout infrastructure")
9641 (description "libnetfilter_cttimeout is the userspace library that
9642provides the programming interface to the fine-grain connection tracking
9643timeout infrastructure. With this library, you can create, update and delete
9644timeout policies that can be attached to traffic flows. This library is used
9645by conntrack-tools.")
9646 (home-page "https://netfilter.org/projects/libnetfilter_cttimeout/index.html")
9647 (supported-systems (filter target-linux? %supported-systems))
9648 (properties '((upstream-name . "libnetfilter_cttimeout")))
9649 (license license:gpl2)))
9650
9651(define-public libnetfilter-cthelper
9652 (package
9653 (name "libnetfilter-cthelper")
9654 (version "1.0.1")
9655 (source
9656 (origin
9657 (method url-fetch)
9658 (uri (string-append "https://netfilter.org/projects/"
9659 "libnetfilter_cthelper/files/"
9660 "libnetfilter_cthelper-" version ".tar.bz2"))
9661 (sha256
9662 (base32 "04n95ngil5l8m8v64dfjm1dwq0wd3kf4vw1zblsrff13hxa3s1ql"))))
9663 (build-system gnu-build-system)
9664 (native-inputs (list pkg-config))
9665 (inputs (list libmnl))
9666 (synopsis "Library for user-space connection tracking helpers")
9667 (description "libnetfilter_cthelper is a userspace library that provides a
9668programming interface to user-space connection tracking helpers.
9669@enumerate
9670@item
9671register new user-space connection tracking helpers
9672@item
9673unregister user-space connection tracking helpers
9674@item
9675list existing registered user-space connection tracking helpers
9676@end enumerate")
9677 (home-page "https://netfilter.org/projects/libnetfilter_cthelper/index.html")
9678 (supported-systems (filter target-linux? %supported-systems))
9679 (properties '((upstream-name . "libnetfilter_cthelper")))
9680 (license license:gpl2+)))
9681
9682(define-public libnetfilter-queue
9683 (package
9684 (name "libnetfilter-queue")
9685 (version "1.0.5")
9686 (source
9687 (origin
9688 (method url-fetch)
9689 (uri (string-append "https://netfilter.org/projects/"
9690 "libnetfilter_queue/files/"
9691 "libnetfilter_queue-" version ".tar.bz2"))
9692 (sha256
9693 (base32
9694 "1xdra6i4p8jkv943ygjw646qx8df27f7p5852kc06vjx608krzzr"))))
9695 (build-system gnu-build-system)
9696 (native-inputs (list pkg-config))
9697 (inputs (list libmnl libnfnetlink))
9698 (synopsis "Library for kernel netfilter infrastructure and state")
9699 (description "libnetfilter_queue is a userspace library providing an API
9700to packets that have been queued by the kernel packet filter. It is is part
9701of a system that deprecates the old ip_queue/libipq mechanism.")
9702 (home-page "https://netfilter.org/projects/libnetfilter_queue/index.html")
9703 (supported-systems (filter target-linux? %supported-systems))
9704 (properties '((upstream-name . "libnetfilter_queue")))
9705 (license license:gpl2+)))
9706
9707(define-public conntrack-tools
9708 (package
9709 (name "conntrack-tools")
9710 (version "1.4.8")
9711 (source
9712 (origin
9713 (method url-fetch)
9714 (uri (string-append "https://netfilter.org/projects/"
9715 "conntrack-tools/files/"
9716 "conntrack-tools-" version ".tar.xz"))
9717 (sha256
9718 (base32 "1mnynl5a63j25arapwvkjbm3a2cqm3aaklwfwwclhmpnqps7fxh6"))))
9719 (build-system gnu-build-system)
9720 (native-inputs (list bison flex pkg-config))
9721 (inputs (list libtirpc
9722 libnetfilter-conntrack
9723 libnetfilter-cttimeout
9724 libnetfilter-cthelper
9725 libnetfilter-queue
9726 libnfnetlink
9727 libmnl))
9728 (synopsis "Set of tools targeting the conntrack kernel subsystem")
9729 (description "The tool conntrack provides a full featured interface that
9730is intended to replace the old @file{/proc/net/ip_conntrack} interface. Using
9731conntrack, you can view and manage the in-kernel connection tracking state
9732table from userspace. On the other hand, conntrackd covers the specific
9733aspects of stateful firewalls to enable highly available scenarios, and can be
9734used as statistics collector as well.
9735
9736Since 1.2.0, the conntrack-tools includes the @command{nfct} command line
9737utility. This utility only supports the nfnetlink_cttimeout by now. In the
9738long run, we expect that it will replace conntrack by providing a syntax
9739similar to nftables.")
9740 (home-page "https://netfilter.org/projects/conntrack-tools/index.html")
9741 (supported-systems (filter target-linux? %supported-systems))
9742 (license license:gpl2+)))
9743
9744(define-public libnetfilter-acct
9745 (package
9746 (name "libnetfilter-acct")
9747 (version "1.0.3")
9748 (source
9749 (origin
9750 (method url-fetch)
9751 (uri (string-append "https://netfilter.org/projects/"
9752 "libnetfilter_acct/files/"
9753 "libnetfilter_acct-" version ".tar.bz2"))
9754 (sha256
9755 (base32
9756 "06lsjndgfjsgfjr43px2n2wk3nr7whz6r405mks3887y7vpwwl22"))))
9757 (build-system gnu-build-system)
9758 (native-inputs (list pkg-config))
9759 (inputs (list libmnl))
9760 (synopsis "Library providing interface to extended accounting infrastructure")
9761 (description "libnetfilter_acct is the userspace library providing interface
9762to extended accounting infrastructure.
9763
9764@enumerate
9765@item
9766creating accounting objects
9767@item
9768retrieving accounting objects (and atomically set to zero)
9769@item
9770deleting accounting objects
9771@end enumerate
9772For the nfnetlink_acct subsystem.")
9773 (home-page "https://netfilter.org/projects/libnetfilter_acct/index.html")
9774 (supported-systems (filter target-linux? %supported-systems))
9775 (properties '((upstream-name . "libnetfilter_acct")))
9776 (license license:lgpl2.1+)))
9777
9778(define-public nfacct
9779 (package
9780 (name "nfacct")
9781 (version "1.0.2")
9782 (source
9783 (origin
9784 (method url-fetch)
9785 (uri (string-append "https://netfilter.org/projects/" name
9786 "/files/nfacct-" version ".tar.bz2"))
9787 (sha256
9788 (base32
9789 "0sdxbxjyapbqcp2ami5jd10vz4xbbdvx39f3wfy1iqsbflc25zzc"))))
9790 (build-system gnu-build-system)
9791 (native-inputs (list pkg-config))
9792 (inputs (list libmnl libnetfilter-acct))
9793 (synopsis "Command line tool to create/retrieve/delete accounting objects")
9794 (description "nfacct is the command line tool to create/retrieve/delete
9795accounting objects
9796@enumerate
9797@item
9798listing the objects of the nfacct table in plain text/XML
9799@item
9800atomically get and reset objects of the nfacct table
9801@item
9802adding new objects to the nfacct table
9803@item
9804deleting objects from the nfacct table
9805@end enumerate")
9806 (home-page "https://netfilter.org/projects/nfacct/index.html")
9807 (supported-systems (filter target-linux? %supported-systems))
9808 (license license:gpl2+)))
9809
9810(define-public libnetfilter-log
9811 (package
9812 (name "libnetfilter-log")
9813 (version "1.0.2")
9814 (source
9815 (origin
9816 (method url-fetch)
9817 (uri (string-append "https://netfilter.org/projects/"
9818 "libnetfilter_log/files/"
9819 "libnetfilter_log-" version ".tar.bz2"))
9820 (sha256
9821 (base32
9822 "1spy9xs41v76kid5ana8n126f3mvgq6fjibbfbj4kn0larbhix73"))))
9823 (build-system gnu-build-system)
9824 (native-inputs (list pkg-config))
9825 (inputs (list libnfnetlink libmnl))
9826 (synopsis "Library providing interface to packets logged by netfilter")
9827 (description "libnetfilter_log is a userspace library providing interface to
9828packets that have been logged by the kernel packet filter. It is is part of a
9829system that deprecates the old syslog/dmesg based packet logging. This library
9830has been previously known as libnfnetlink_log.
9831
9832@enumerate
9833@item
9834receiving to-be-logged packets from the kernel nfnetlink_log subsystem
9835@end enumerate")
9836 (home-page "https://netfilter.org/projects/libnetfilter_log/index.html")
9837 (supported-systems (filter target-linux? %supported-systems))
9838 (properties '((upstream-name . "libnetfilter_log")))
9839 (license license:gpl2+)))
9840
9841(define-public ulogd
9842 (package
9843 (name "ulogd")
9844 (version "2.0.7")
9845 (source
9846 (origin
9847 (method url-fetch)
9848 (uri (string-append "https://netfilter.org/projects/" name
9849 "/files/ulogd-" version ".tar.bz2"))
9850 (sha256
9851 (base32
9852 "0ax9959c4bapq78n13bbaibcf1gwjir3ngx8l2dh45lw9m4ha2lr"))))
9853 (build-system gnu-build-system)
9854 (outputs '("out"
9855 ;; additional non-default output plugins
9856 "json" "pcap" "sqlite3" "pgsql" "mysql"))
9857 (native-inputs (list pkg-config))
9858 (inputs (list libnfnetlink
9859 libmnl
9860 libnetfilter-log
9861 libnetfilter-conntrack
9862 libnetfilter-acct
9863 sqlite
9864 libpcap
9865 jansson
9866 postgresql
9867 (list mariadb "dev")
9868 zlib
9869 openssl))
9870 (arguments
9871 (list #:configure-flags
9872 #~(list (string-append "--with-pgsql="
9873 (assoc-ref %build-inputs "postgresql"))
9874 (string-append "--with-mysql="
9875 (assoc-ref %build-inputs "mariadb")))
9876 #:phases
9877 #~(modify-phases %standard-phases
9878 (add-after 'install 'install-doc
9879 (lambda _
9880 (let ((out-etc (string-append #$output "/etc"))
9881 (ulogd.conf "ulogd.conf"))
9882 (mkdir-p out-etc)
9883 (copy-file ulogd.conf (string-append out-etc "/"
9884 ulogd.conf)))))
9885 (add-after 'install 'setup-plugin-outputs
9886 (lambda* (#:key outputs #:allow-other-keys)
9887 (with-directory-excursion
9888 (string-append #$output "/lib/ulogd/")
9889 (for-each
9890 (lambda (output-name)
9891 (let ((output-dir (string-append
9892 (assoc-ref outputs output-name)
9893 "/lib/ulogd/")))
9894 (mkdir-p output-dir)
9895 (for-each
9896 (lambda (plugin)
9897 (copy-file plugin (string-append output-dir plugin))
9898 (delete-file plugin))
9899 (find-files "."
9900 (string-append "ulogd_output_"
9901 (string-upcase output-name)
9902 ".*$")))))
9903 (list "json" "pcap" "sqlite3" "pgsql" "mysql"))))))))
9904 (synopsis "Logging daemon for netfilter and iptables")
9905 (description "ulogd is a userspace logging daemon for netfilter/iptables
9906related logging. This includes per-packet logging of security violations,
9907per-packet logging for accounting, per-flow logging and flexible user-defined
9908accounting.
9909
9910@enumerate
9911@item
9912Packet and flow-based traffic accounting
9913@item
9914Flexible user-defined traffic accounting via nfacct infrastructure
9915@item
9916SQL database back-end support: SQLite3, PostgreSQL, MySQL
9917@item
9918Text-based output formats: CSV, XML, Netfilter's LOG, Netfilter's conntrack
9919@end enumerate")
9920 (home-page "https://netfilter.org/projects/nfacct/index.html")
9921 (supported-systems (filter target-linux? %supported-systems))
9922 (license license:gpl2)))
9923
9924(define-public proot
9925 (package
9926 (name "proot")
9927 (version "5.4.0")
9928 (source
9929 (origin
9930 (method git-fetch)
9931 (uri (git-reference
9932 (url "https://github.com/proot-me/PRoot")
9933 (commit (string-append "v" version))))
9934 (file-name (git-file-name name version))
9935 (sha256
9936 (base32 "186qsg4yvisqjgf8w5jxhnlig7x341vpqwcgp8as3r59qmqkpmk7"))
9937 ;; Waiting for upstream inclusion at
9938 ;; https://github.com/proot-me/proot/pull/355
9939 (patches (search-patches "proot-add-clone3.patch"
9940 "proot-add-missing-include.patch"))))
9941 (build-system gnu-build-system)
9942 ;; Many architectures are not supported (see:
9943 ;; https://github.com/proot-me/proot/blob/master/src/arch.h#L51).
9944 (supported-systems '("x86_64-linux" "i686-linux"
9945 "armhf-linux" "aarch64-linux" "i586-gnu" "x86_64-gnu"))
9946 (arguments
9947 ;; Disable the test suite on armhf-linux, as there are too many
9948 ;; failures to keep track of (see for example:
9949 ;; https://github.com/proot-me/proot/issues/286).
9950 (list
9951 #:tests? (not (or (%current-target-system)
9952 (string-prefix? "armhf"
9953 (or (%current-system)))))
9954 #:make-flags
9955 #~'("-C" "src")
9956 #:phases
9957 #~(modify-phases %standard-phases
9958 (add-after 'unpack 'patch-sources
9959 (lambda* (#:key inputs #:allow-other-keys)
9960 (substitute* (find-files "src" "\\.[ch]$")
9961 (("\"/bin/sh\"")
9962 (format #f "~s" (search-input-file inputs "/bin/sh"))))
9963
9964 (substitute* "src/GNUmakefile"
9965 (("/bin/echo") (which "echo"))
9966 (("^VERSION = .*")
9967 (string-append "VERSION := " #$version "\n")))
9968
9969 (substitute* (find-files "test" "\\.sh$")
9970 ;; Some of the tests try to "bind-mount" /bin/true.
9971 (("-b /bin/true:")
9972 (string-append "-b " (which "true") ":"))
9973 ;; Likewise for /bin.
9974 (("-b /bin:") "-b /gnu:")
9975 ;; Others try to run /bin/sh.
9976 (("/bin/sh") (which "sh"))
9977 ;; Others assume /etc/fstab exists.
9978 (("/etc/fstab") "/etc/passwd"))
9979 (substitute* "test/GNUmakefile"
9980 (("-b /bin:") "-b /gnu:"))
9981 (substitute* "test/test-c6b77b77.mk"
9982 (("/bin/bash") (which "bash"))
9983 (("/usr/bin/test") (which "test")))
9984 (substitute* "test/test-16573e73.c"
9985 (("/bin/([a-z-]+)" _ program)
9986 (which program)))
9987 (substitute* "test/test-5467b986.sh"
9988 (("-w /usr") "-w /gnu")
9989 (("-w usr") "-w gnu")
9990 (("/usr/share") "/gnu/store")
9991 (("share") "store"))
9992 (substitute* "test/test-092c5e26.sh"
9993 (("-q echo ")
9994 "-q $(which echo) "))
9995
9996 ;; The socket tests requires networking.
9997 (for-each delete-file
9998 (find-files "test" "test-socket.*\\.sh$"))))
9999 (delete 'configure)
10000 (add-after 'build 'build-manpage
10001 (lambda _
10002 (with-directory-excursion "doc"
10003 (invoke "make" "proot/man.1" "SUFFIX=.py"))))
10004 (replace 'check
10005 (lambda* (#:key tests? #:allow-other-keys)
10006 (when tests?
10007 ;; Most of the tests expect "/bin" to be in $PATH so
10008 ;; they can run things that live in $ROOTFS/bin.
10009 (setenv "PATH" (string-append (getenv "PATH") ":/bin"))
10010 (invoke "make" "check" "-C" "test"
10011 "-j" (number->string (parallel-job-count))))))
10012 (replace 'install
10013 (lambda _
10014 ;; The 'install' rule does nearly nothing.
10015 (let ((man1 (string-append #$output "/share/man/man1")))
10016 ;; TODO: 'make install-care' (does not even
10017 ;; build currently.)
10018 (invoke "make" "-C" "src" "install"
10019 (string-append "PREFIX=" #$output))
10020 (mkdir-p man1)
10021 (copy-file "doc/proot/man.1"
10022 (string-append man1 "/proot.1"))))))))
10023 (native-inputs (list which
10024 ;; For 'mcookie', used by some of the tests.
10025 util-linux
10026 coreutils
10027 pkg-config
10028 ;; For rst2man, used to generate the manual page.
10029 python-docutils-0.19))
10030 (inputs (list libarchive talloc))
10031 (home-page "https://github.com/proot-me/PRoot")
10032 (synopsis "Unprivileged chroot, bind mount, and binfmt_misc")
10033 (description
10034 "PRoot is a user-space implementation of @code{chroot}, @code{mount --bind},
10035and @code{binfmt_misc}. This means that users don't need any privileges or
10036setup to do things like using an arbitrary directory as the new root
10037file system, making files accessible somewhere else in the file system
10038hierarchy, or executing programs built for another CPU architecture
10039transparently through QEMU user-mode. Also, developers can use PRoot as a
10040generic process instrumentation engine thanks to its extension mechanism.
10041Technically PRoot relies on @code{ptrace}, an unprivileged system-call
10042available in the kernel Linux.")
10043 (license license:gpl2+)))
10044
10045(define-public proot-static
10046 (package
10047 (inherit proot)
10048 (name "proot-static")
10049 (synopsis
10050 "Unprivileged chroot, bind mount, and binfmt_misc (statically linked)")
10051 (inputs (list talloc/static))
10052 (arguments
10053 (substitute-keyword-arguments arguments
10054 ((#:make-flags flags)
10055 #~(cons* "LDFLAGS = -ltalloc -static -static-libgcc" #$flags))
10056 ((#:phases phases)
10057 #~(modify-phases #$phases
10058 (add-after 'strip 'remove-store-references
10059 (lambda _
10060 (with-directory-excursion #$output
10061 (remove-store-references "bin/proot"))))))
10062 ((#:allowed-references _ '("out"))
10063 '("out"))))))
10064
10065(define-public cpuid
10066 (package
10067 (name "cpuid")
10068 (version "20260220")
10069 (source (origin
10070 (method url-fetch)
10071 (uri (string-append "http://www.etallen.com/cpuid/cpuid-"
10072 version ".src.tar.gz"))
10073 (sha256
10074 (base32
10075 "1ywg1fzbk153sil3n0mdrah3728j76dbjj8c24gig4g5bbbhyqp7"))))
10076 (build-system gnu-build-system)
10077 (arguments
10078 (list #:make-flags
10079 #~(list (string-append "CC=" #$(cc-for-target)))
10080 #:tests? #f ; no tests
10081 #:phases
10082 #~(modify-phases %standard-phases
10083 (delete 'configure) ; no configure script
10084 (add-before 'install 'fix-makefile
10085 (lambda* (#:key outputs #:allow-other-keys)
10086 (substitute* "Makefile"
10087 (("\\$\\(BUILDROOT\\)/usr")
10088 (assoc-ref outputs "out"))))))))
10089 (inputs (list perl))
10090 (supported-systems '("i686-linux" "x86_64-linux"))
10091 (home-page "https://www.etallen.com/cpuid.html")
10092 (synopsis "Dump x86 CPUID processor information")
10093 (description "cpuid dumps detailed information about the CPU(s) gathered
10094from the CPUID instruction, and also determines the exact model of CPU(s). It
10095supports Intel, AMD, and VIA CPUs, as well as older Transmeta, Cyrix, UMC,
10096NexGen, Rise, and SiS CPUs.")
10097 (license license:gpl2+)))
10098
10099(define-public jmtpfs
10100 (package
10101 (name "jmtpfs")
10102 (version "0.5")
10103 (source
10104 (origin
10105 (method git-fetch)
10106 (uri (git-reference
10107 (url "https://github.com/JasonFerrara/jmtpfs")
10108 (commit (string-append "v" version))))
10109 (file-name (git-file-name name version))
10110 (sha256
10111 (base32
10112 "1pm68agkhrwgrplrfrnbwdcvx5lrivdmqw8pb5gdmm3xppnryji1"))))
10113 (build-system gnu-build-system)
10114 (inputs
10115 (list file fuse-2 libmtp))
10116 (native-inputs
10117 (list pkg-config))
10118 (home-page "https://github.com/JasonFerrara/jmtpfs")
10119 (synopsis "Use a FUSE file system to access data over MTP")
10120 (description "jmtpfs uses @acronym{FUSE, File system in USEr space} to
10121provide access to data over @acronym{MTP, the Media Transfer Protocol}.
10122Unprivileged users can mount the MTP device as a file system.")
10123 (license license:gpl3)))
10124
10125(define-public procenv
10126 (package
10127 (name "procenv")
10128 (version "0.60")
10129 (source
10130 (origin
10131 (method git-fetch)
10132 (uri (git-reference
10133 (url "https://github.com/jamesodhunt/procenv")
10134 (commit version)))
10135 (file-name (git-file-name name version))
10136 (sha256
10137 (base32 "00d7q0h4qjc8lg435lq77lp2fx6ikm5piq90m81mr1dqqna1g6pz"))))
10138 (build-system gnu-build-system)
10139 (native-inputs
10140 (list pkg-config
10141 ;; For tests.
10142 check groff))
10143 (inputs
10144 (list expat libcap libselinux))
10145 (synopsis "Utility to show process environment")
10146 (description
10147 "Procenv is a command-line tool that displays as much detail about
10148itself and its environment as possible. It can be used as a test
10149tool, to understand the type of environment a process runs in, and for
10150comparing system environments.")
10151 (home-page "https://github.com/jamesodhunt/procenv/")
10152 (license license:gpl3+)))
10153
10154(define-public cassini-headers
10155 (package
10156 (name "cassini-headers")
10157 (version "14.0.0")
10158 (home-page "https://github.com/HewlettPackard/shs-cassini-headers")
10159 (source (origin
10160 (method git-fetch)
10161 (uri (git-reference
10162 (url home-page)
10163 (commit (string-append "release/shs-" version))))
10164 (file-name (git-file-name name version))
10165 (sha256
10166 (base32
10167 "074r1snc682f1b6vgswyz55n8zjf5rhqnsl31xsswih7q9q38jda"))
10168 (patches (search-patches "cassini-headers-memset.patch"))))
10169 (build-system copy-build-system)
10170 (arguments
10171 (list #:install-plan
10172 #~'(("include" "include")
10173 ("share/cassini-headers" "share/cassini-headers"))))
10174 (synopsis "Cassini network hardware definitions and headers")
10175 (description
10176 "This package provides hardware definitions and C headers for use by
10177the Linux driver and by user-space applications for the Cassini/Slingshot
10178high-speed network interconnect made by HPE (formerly Cray). User-land
10179software uses @file{cxi_prov_hw.h} from this package.")
10180 ;; As per include/cxi_prov_hw.h it is __aarch64__ or __x86_64__ only.
10181 (supported-systems '("x86_64-linux" "aarch64-linux"))
10182 (license (list license:gpl2 license:bsd-2)))) ;dual-licensed
10183
10184(define-public cxi-driver
10185 (package
10186 (name "cxi-driver")
10187 (version "14.0.0")
10188 (home-page "https://github.com/HewlettPackard/shs-cxi-driver")
10189 (source
10190 (origin
10191 (method git-fetch)
10192 (uri (git-reference
10193 (url home-page)
10194 (commit (string-append "release/shs-" version))))
10195 (file-name (git-file-name name version))
10196 (sha256
10197 (base32
10198 "07dhdm1az9hvy48iq8bn0wypwyml59yr5aqqyf1yhwrf1basry9g"))))
10199 ;; TODO: Actually build the Linux driver.
10200 (build-system copy-build-system)
10201 (arguments
10202 (list #:install-plan #~'(("include" "include"))))
10203 (propagated-inputs (list cassini-headers))
10204 (synopsis "Linux driver for the Cassini/Slingshot interconnect")
10205 (description
10206 "This is the Linux driver for the Cray/HPE Cassini 1 and 2 high-speed
10207network interconnect (aka. Slingshot), and its Ethernet driver. It includes
10208the @file{uapi/misc/cxi.h} C header file for use by user-land software.
10209
10210Currently the Linux driver itself is missing from this package.")
10211 (license license:gpl2+)))
10212
10213(define-public cxi-driver-for-libfabric-1
10214 ;; This old version defines constants such as 'CXI_MAP_IOVA_ALLOC' that
10215 ;; libfabric 1.22.0 relies on.
10216 (let ((commit "5f0ec0ead6ef3f98542a2ef5e76b89d14dd22150")
10217 (revision "0"))
10218 (package
10219 (inherit cxi-driver)
10220 (name "cxi-driver")
10221 (version (git-version "1.0.0" ;per .spec file
10222 revision commit))
10223 (home-page "https://github.com/HewlettPackard/shs-cxi-driver")
10224 (source
10225 (origin
10226 (method git-fetch)
10227 (uri (git-reference (url home-page) (commit commit)))
10228 (file-name (git-file-name name version))
10229 (sha256
10230 (base32
10231 "19cly014ihgdidrc1aki2xsbfhpc0g73v0vxcky8r27xza7rz5bg")))))))
10232
10233(define-public libcxi
10234 (package
10235 (name "libcxi")
10236 ;; Note: Do not upgrade until
10237 ;; <https://github.com/HewlettPackard/shs-libcxi/issues/18> is resolved.
10238 (version "13.0.0")
10239 (home-page "https://github.com/HewlettPackard/shs-libcxi")
10240 (source
10241 (origin
10242 (method git-fetch)
10243 (uri (git-reference (url home-page)
10244 (commit (string-append "release/shs-" version))))
10245 (file-name (git-file-name name version))
10246 (sha256
10247 (base32 "1m8mds1h8plhfn2ja9br31xaiy82ky69685cp1rznanl18inaiff"))))
10248 (build-system gnu-build-system)
10249 (arguments
10250 (list #:configure-flags
10251 #~(list "--disable-static"
10252 (string-append "--with-udevrulesdir="
10253 #$output "/lib/udev/rules.d"))
10254
10255 #:phases
10256 #~(modify-phases %standard-phases
10257 (add-before 'configure 'set-cassini-file-names
10258 (lambda* (#:key inputs #:allow-other-keys)
10259 (substitute* "utils/cxi_dump_csrs.py"
10260 (("/usr/share/cassini-headers/csr_defs.json")
10261 (search-input-file
10262 inputs
10263 "/share/cassini-headers/csr_defs.json"))))))))
10264 (native-inputs (list autoconf
10265 automake
10266 libtool
10267 pkg-config
10268 python-wrapper))
10269 (inputs (list libconfig
10270 libuv
10271 fuse-2
10272 libyaml
10273 libnl
10274 numactl
10275 eudev
10276 (list lm-sensors "lib")))
10277 (propagated-inputs (list cassini-headers cxi-driver))
10278 (synopsis "Interface to the Cassini/Slingshot high-speed interconnect")
10279 (description
10280 "Libcxi provides applications with a low-level interface to the
10281Cray/HPE Cassini high-speed @acronym{NIC, network interface controller}, also
10282known as Slingshot.")
10283
10284 ;; License is spelled out in 'cray-libcxi.spec' and in source file
10285 ;; headers.
10286 (license (list license:lgpl2.1+ license:bsd-3)))) ;dual-licensed
10287
10288(define-public libfabric
10289 (package
10290 (name "libfabric")
10291 (version "2.5.1")
10292 (source
10293 (origin
10294 (method git-fetch)
10295 (uri (git-reference
10296 (url "https://github.com/ofiwg/libfabric")
10297 (commit (string-append "v" version))))
10298 (file-name (git-file-name name version))
10299 (sha256 (base32 "15z0g1z62hv6kkiksvpxl6xv07wdmnvqhm5vnh0vq4ipr8f5vikp"))))
10300 (build-system gnu-build-system)
10301 (native-inputs
10302 (list autoconf
10303 automake
10304 libtool))
10305 (inputs
10306 (let ((if-supported ;XXX: modified from openmpi
10307 (lambda (package . extra)
10308 (if (and (not (%current-target-system))
10309 (member (%current-system)
10310 (package-transitive-supported-systems package)))
10311 (cons package extra)
10312 '()))))
10313 (append (list rdma-core libnl)
10314 (if-supported psm)
10315 (if-supported psm2)
10316 (if-supported libcxi curl json-c))))
10317 (arguments
10318 (list #:configure-flags
10319 #~(append (if #$(target-64bit?)
10320 (list "--enable-efa")
10321 '())
10322 (list #$@(if (this-package-input "libcxi")
10323 #~("--enable-cxi")
10324 #~())
10325 #$@(if (this-package-input "rocr-runtime")
10326 #~((string-append "--with-rocr="
10327 #$(this-package-input "rocr-runtime")))
10328 #~())
10329 "--enable-verbs"))
10330 #:phases
10331 #~(modify-phases %standard-phases
10332 (add-after 'install 'remove-libtool-archive
10333 (lambda _
10334 ;; 'libfabric.la' has '-ljson-c' without a corresponding
10335 ;; '-L' in 'dependency_libs', which in turn causes users
10336 ;; such as Open MPI to fail at link time due to '-ljson-c'
10337 ;; not being found, even when building a shared library.
10338 ;; So, remove the .la file.
10339 (delete-file
10340 (string-append #$output
10341 "/lib/libfabric.la")))))))
10342 (home-page "https://ofiwg.github.io/libfabric/")
10343 (synopsis "Open Fabric Interfaces")
10344 (description
10345 "OpenFabrics Interfaces (OFI) is a framework focused on exporting fabric
10346communication services to applications. OFI is best described as a collection
10347of libraries and applications used to export fabric services. The key
10348components of OFI are: application interfaces, provider libraries, kernel
10349services, daemons, and test applications.
10350
10351Libfabric is a core component of OFI. It is the library that defines and
10352exports the user-space API of OFI, and is typically the only software that
10353applications deal with directly. It works in conjunction with provider
10354libraries, which are often integrated directly into libfabric.")
10355 (license (list license:bsd-2 license:gpl2)))) ;dual
10356
10357;; Note: ROCm support is kept separate to avoid a significant increase in
10358;; closure size: <https://codeberg.org/guix/guix/issues/7225>.
10359(define-public libfabric-rocm
10360 (package/inherit libfabric
10361 (name "libfabric-rocm")
10362 (inputs (modify-inputs inputs
10363 (append rocr-runtime)))
10364 (synopsis "Open Fabric Interfaces (with ROCm support)")))
10365
10366(define-public libfabric-1 ;needed by Open MPI 4.x
10367 (package
10368 (inherit libfabric)
10369 (name "libfabric")
10370 (version "1.22.0")
10371 (source
10372 (origin
10373 (method git-fetch)
10374 (uri (git-reference
10375 (url "https://github.com/ofiwg/libfabric")
10376 (commit (string-append "v" version))))
10377 (file-name (git-file-name name version))
10378 (sha256 (base32 "1scwkfdnlg20hld03pdq83jq1q3nmvj1gravpn02pacqq18bv9xk"))))
10379 (inputs
10380 (modify-inputs inputs
10381 (append cxi-driver-for-libfabric-1)))))
10382
10383(define-public psm
10384 (package
10385 (name "psm")
10386 (version "3.3.20170428")
10387 (home-page "https://github.com/intel/psm")
10388 (source
10389 (origin
10390 (method git-fetch)
10391 (uri (git-reference (url home-page)
10392 (commit "604758e76dc31e68d1de736ccf5ddf16cb22355b")))
10393 (file-name (string-append "psm-" version ".tar.gz"))
10394 (sha256
10395 (base32 "0nsb325dmhn5ia3d2cnksqr0gdvrrx2hmvlylfgvmaqdpq76zm85"))
10396 (patches (search-patches
10397 "psm-arch.patch" ; uname -p returns "unknown" on Debian 9
10398 "psm-ldflags.patch" ; build shared lib with LDFLAGS
10399 "psm-repro.patch" ; reproducibility
10400 "psm-disable-memory-stats.patch"))
10401 (modules '((guix build utils)))
10402 (snippet
10403 ;; That file declares its own 'strlcat' as static. To avoid a
10404 ;; conflict with the function now in glibc 2.39, give it a
10405 ;; different name.
10406 #~(substitute* "ptl_ips/ips_proto_dump.c"
10407 (("strlcat")
10408 "psm_custom_strlcat")))))
10409 (build-system gnu-build-system)
10410 (outputs '("out" "debug"))
10411 (inputs `(("libuuid" ,util-linux "lib")))
10412 (arguments
10413 '(#:make-flags `("PSM_USE_SYS_UUID=1" "CC=gcc" "WERROR="
10414 ,(string-append "INSTALL_PREFIX=" %output)
10415 ,(string-append "CFLAGS=-Wall -fpic -fPIC -D_GNU_SOURCE"
10416 " -funwind-tables -O3 -g3"
10417 " -DPSM_USE_SYS_UUID"
10418 " -Wno-strict-aliasing -DNVALGRIND"
10419 " -fcommon")
10420 ,(string-append "LDFLAGS=-Wl,-rpath=" %output "/lib"))
10421 #:tests? #f
10422 #:phases (modify-phases %standard-phases
10423 (delete 'configure)
10424 (add-after 'unpack 'patch-/usr/include
10425 (lambda _
10426 (substitute* "Makefile"
10427 (("\\$\\{DESTDIR}/usr/include")
10428 (string-append %output "/include")))
10429 (substitute* "Makefile"
10430 (("/lib64") "/lib"))
10431 #t))
10432 (add-after 'unpack 'patch-sysmacros
10433 (lambda _
10434 (substitute* "ipath/ipath_proto.c"
10435 (("#include <sys/poll.h>" m)
10436 (string-append m "\n"
10437 "#include <sys/sysmacros.h>")))
10438 #t)))))
10439 (synopsis "Intel Performance Scaled Messaging (PSM) Libraries")
10440 (description
10441 "The PSM Messaging API, or PSM API, is Intel's low-level user-level
10442communications interface for the True Scale family of products. PSM users are
10443enabled with mechanisms necessary to implement higher level communications
10444interfaces in parallel environments.")
10445 ;; Only Intel-compatible processors are supported.
10446 (supported-systems '("i686-linux" "x86_64-linux"))
10447 (license (list license:bsd-2 license:gpl2)))) ;dual
10448
10449(define-public snapscreenshot
10450 (package
10451 (name "snapscreenshot")
10452 (version "1.0.14.3")
10453 (source
10454 (origin
10455 (method url-fetch)
10456 (uri (string-append "http://bisqwit.iki.fi/src/arch/"
10457 name "-" version ".tar.bz2"))
10458 (sha256
10459 (base32 "0gzvqsbf6a2sbd1mqvj1lbm57i2bm5k0cr6ncr821d1f32gw03mk"))))
10460 (build-system gnu-build-system)
10461 (arguments
10462 `(#:make-flags
10463 (let ((out (assoc-ref %outputs "out")))
10464 (list (string-append "BINDIR=" out "/bin")
10465 (string-append "MANDIR=" out "/share/man")))
10466 #:tests? #f ; no test suite
10467 #:phases
10468 (modify-phases %standard-phases
10469 (delete 'configure) ; ./configure is a snarky no-op
10470 (add-before 'install 'fix-ownership
10471 ;; Install binaries owned by ‘root’ instead of the nonexistent ‘bin’.
10472 (lambda _
10473 (substitute* "depfun.mak"
10474 ((" -o bin -g bin ") " "))
10475 #t))
10476 (add-before 'install 'create-output-directories
10477 (lambda* (#:key outputs #:allow-other-keys)
10478 (let ((out (assoc-ref outputs "out")))
10479 (mkdir-p (string-append out "/share/man/man1"))
10480 #t))))))
10481 (home-page "https://bisqwit.iki.fi/source/snapscreenshot.html")
10482 (synopsis "Take screenshots of one or more Linux text consoles")
10483 (description
10484 "snapscreenshot saves a screenshot of one or more Linux text consoles as a
10485Targa (@dfn{.tga}) image. It can be used by anyone with read access to the
10486relevant @file{/dev/vcs*} file(s).")
10487 (license license:gpl2)))
10488
10489(define-public fbcat
10490 (package
10491 (name "fbcat")
10492 (version "0.5.2")
10493 (source
10494 (origin
10495 (method url-fetch)
10496 (uri (string-append "https://github.com/jwilk/fbcat/releases/download/"
10497 version "/" name "-" version ".tar.gz"))
10498 (sha256
10499 (base32 "07q6f0xj7b4gjvn69qfn0g04yd0ch8ndzyigcz8nnrhli0cvsbh6"))))
10500 (build-system gnu-build-system)
10501 (outputs (list "out" "fbgrab"))
10502 (arguments
10503 (list
10504 #:make-flags
10505 #~(list "CC=gcc" (string-append "PREFIX=" #$output))
10506 #:tests? #f ;no tests
10507 #:phases
10508 #~(modify-phases %standard-phases
10509 (delete 'configure) ;no configure script
10510 (add-after 'build 'qualify-references
10511 (lambda* (#:key inputs #:allow-other-keys)
10512 (let ((pnmtopng (assoc-ref inputs "pnmtopng")))
10513 (substitute* "fbgrab"
10514 (("fbcat" all)
10515 (string-append #$output "/bin/" all))
10516 (("pnmtopng")
10517 (search-input-file inputs "/bin/pnmtopng"))))))
10518 (add-after 'install 'split-fbgrab-output
10519 (lambda _
10520 (for-each (lambda (file)
10521 (let ((old (string-append #$output "/" file))
10522 (new (string-append #$output:fbgrab "/" file)))
10523 (mkdir-p (dirname new))
10524 (rename-file old new)))
10525 (list "bin/fbgrab" "share/man/man1/fbgrab.1")))))))
10526 (inputs
10527 ;; The ‘fbgrab’ wrapper can use one of several PPM-to-PNG converters. We
10528 ;; choose netpbm simply because it's the smallest. It still adds ~94 MiB
10529 ;; to an otherwise tiny package, so we put ‘fbgrab’ in its own output.
10530 (list netpbm))
10531 (home-page "https://jwilk.net/software/fbcat")
10532 (synopsis "Take a screenshot of the contents of the Linux framebuffer")
10533 (description
10534 "fbcat saves the contents of the Linux framebuffer (@file{/dev/fb*}), or
10535a dump thereof. It supports a wide range of drivers and pixel formats.
10536
10537@command{fbcat} can take screenshots of virtually any application that can be
10538made to write its output to the framebuffer, including (but not limited to)
10539text-mode or graphical applications that don't use a display server.
10540
10541Also included is @command{fbgrab}, a wrapper around @command{fbcat} that
10542emulates the behaviour of Gunnar Monell's older fbgrab utility.")
10543 (license license:gpl2)))
10544
10545(define-public fbgrab
10546 (package
10547 (name "fbgrab")
10548 (version "1.5")
10549 (source (origin
10550 (method git-fetch)
10551 (uri (git-reference
10552 (url "https://github.com/GunnarMonell/fbgrab")
10553 (commit version)))
10554 (file-name (git-file-name name version))
10555 (sha256
10556 (base32
10557 "1npn7l8jg0nhjraybjl38v8635zawzmn06ql3hs3vhci1vi1r90r"))))
10558 (build-system gnu-build-system)
10559 (arguments
10560 (list #:tests? #f ;no test suite
10561 #:make-flags #~(list (string-append "CC=" #$(cc-for-target))
10562 (string-append "DESTDIR=" #$output))
10563 #:phases #~(modify-phases %standard-phases
10564 (add-after 'unpack 'strip-/usr-prefix
10565 (lambda _
10566 (substitute* "Makefile"
10567 (("/usr") ""))))
10568 (delete 'configure))))
10569 (inputs (list libpng zlib))
10570 (home-page "https://github.com/GunnarMonell/fbgrab")
10571 (synopsis "Linux framebuffer screenshot/conversion utility")
10572 (description "FBGrab is a framebuffer screenshot program that captures the
10573Linux framebuffer and converts it to a PNG image. It can also convert a
10574framebuffer dump file (copy) to a PNG image.")
10575 (license license:gpl2))) ;GPL 2.0 only (per SPDX identifier in fbgrab.c)
10576
10577(define-public libcgroup
10578 (package
10579 (name "libcgroup")
10580 (version "3.2.0")
10581 (home-page "https://github.com/libcgroup/libcgroup")
10582 (source
10583 (origin
10584 (method url-fetch)
10585 (uri (string-append
10586 "https://github.com/libcgroup/libcgroup/releases/download/v"
10587 version "/" name "-" version ".tar.gz"))
10588 (sha256
10589 (base32 "1zmxhqp8kj2n7yvj82nsy5sx07yrxj4r37w41lz5q8bpqgbc43ws"))))
10590 (build-system gnu-build-system)
10591 (arguments
10592 ;; Tests are virtualized with lxc, it is not very feasible
10593 ;; to make them executable under guix build. Also, note that
10594 ;; origin is using source tarball release which is prepared
10595 ;; after testing.
10596 (list #:tests? #f
10597 #:configure-flags
10598 #~'("--disable-systemd")))
10599 (native-inputs
10600 (list bison flex))
10601 (inputs
10602 (list linux-pam))
10603 (synopsis "Control groups management tools")
10604 (description "Control groups is Linux kernel method for process resource
10605restriction, permission handling and more. This package provides userspace
10606interface to this kernel feature.")
10607 (license license:lgpl2.1)))
10608
10609(define-public mbpfan
10610 (package
10611 (name "mbpfan")
10612 (version "2.4.0")
10613 (source
10614 (origin
10615 (method git-fetch)
10616 (uri (git-reference
10617 (url "https://github.com/dgraziotin/mbpfan")
10618 (commit (string-append "v" version))))
10619 (file-name (git-file-name name version))
10620 (sha256
10621 (base32 "146sshsjafi26n741jvi9mdbazwf74jlacxfwkky4fhbq98idlhp"))))
10622 (build-system gnu-build-system)
10623 (arguments
10624 (list #:tests? #f ; tests ask to be run as root
10625 #:make-flags
10626 #~(list (string-append "DESTDIR=" #$output)
10627 (string-append "CC=" #$(cc-for-target)))
10628 #:phases
10629 #~(modify-phases %standard-phases
10630 (add-after 'unpack 'patch-paths
10631 (lambda _
10632 (substitute* "Makefile"
10633 (("/usr") ""))))
10634 (delete 'configure)))) ; there's no configure phase
10635 (home-page "https://github.com/dgraziotin/mbpfan")
10636 (synopsis "Control fan speed on Macbooks")
10637 (description
10638 "mbpfan is a fan control daemon for Apple Macbooks. It uses input from
10639the @code{coretemp} module and sets the fan speed using the @code{applesmc}
10640module. It can be executed as a daemon or in the foreground with root
10641privileges.")
10642 (license license:gpl3+)))
10643
10644(define-public psm2
10645 (package
10646 (name "psm2")
10647 (version "12.0")
10648 (source (origin
10649 (method git-fetch)
10650 (uri (git-reference
10651 (url "https://github.com/intel/opa-psm2")
10652 ;; tag 'psm-v12.0' = commit ad5dd1b
10653 (commit (string-append "psm-v" version))))
10654 (file-name (git-file-name name version))
10655 (sha256
10656 (base32
10657 "04nar65ac11qqx41vkfs7iip8kfiah0zms7l4rmsxncpiz2iqfik"))
10658 (patches
10659 (search-patches
10660 "psm2-compile-ctor-without-avx.patch"))
10661 (modules '((guix build utils)))
10662 (snippet
10663 ;; That file declares its own 'strlcat' as static. To avoid a
10664 ;; conflict with the function now in glibc 2.39, give it a
10665 ;; different name.
10666 #~(substitute* "ptl_ips/ips_proto_dump.c"
10667 (("strlcat")
10668 "psm2_custom_strlcat")))))
10669 (build-system gnu-build-system)
10670 (arguments
10671 (list #:make-flags
10672 #~(list (string-append "LDFLAGS=-Wl,-rpath=" #$output "/lib"))
10673 #:tests? #f
10674 #:phases #~(modify-phases %standard-phases
10675 (delete 'configure)
10676 (add-after 'unpack 'patch-Makefiles
10677 (lambda _
10678 (substitute* "Makefile"
10679 (("/lib64") "/lib")
10680 (("/usr") ""))
10681 (substitute* "compat/Makefile"
10682 (("/lib64") "/lib")
10683 (("/usr") ""))))
10684 (replace 'install
10685 (lambda _
10686 (setenv "DESTDIR" #$output)
10687 (invoke "make" "install"))))))
10688 (inputs
10689 (list rdma-core numactl))
10690 (synopsis "Intel Performance Scaled Messaging 2 (PSM2) library")
10691 (description
10692 "This package is low-level user-level Intel's communications interface.
10693The PSM2 API is a high-performance vendor-specific protocol that provides a
10694low-level communications interface for the Intel Omni-Path family of
10695high-speed networking devices.")
10696 (home-page "https://github.com/intel/opa-psm2")
10697 ;; Only the x86_64 architecture is supported.
10698 (supported-systems '("x86_64-linux"))
10699 (license (list license:bsd-3 license:gpl2)))) ; dual
10700
10701(define-public libpfm4
10702 (package
10703 (name "libpfm4")
10704 (version "4.9.0")
10705 (source (origin
10706 (method url-fetch)
10707 (uri (string-append "mirror://sourceforge/perfmon2/"
10708 name "/libpfm-" version ".tar.gz"))
10709 (sha256
10710 (base32
10711 "1qp4g4n6dw42p2w5rkwzdb7ynk8h7g5vg01ybpmvxncgwa7bw3yv"))))
10712 (build-system gnu-build-system)
10713 (arguments
10714 '(#:modules ((guix build utils)
10715 (guix build gnu-build-system))
10716 #:phases (modify-phases %standard-phases
10717 (delete 'configure)
10718 (delete 'check)
10719 (replace 'build
10720 (lambda* (#:key inputs outputs #:allow-other-keys)
10721 (let* ((out (assoc-ref outputs "out")))
10722 (setenv "CC" "gcc")
10723 (setenv "CFLAGS" "-Wno-format-truncation")
10724 (invoke "make")
10725 #t)))
10726 (replace 'install
10727 (lambda* (#:key outputs #:allow-other-keys)
10728 (let* ((out (assoc-ref outputs "out")))
10729 (invoke "make"
10730 (string-append "PREFIX=" out)
10731 "install")
10732 #t))))))
10733 (synopsis "Performance event monitoring library")
10734 (description
10735 "This package provides a library called libpfm4, which is used to develop
10736monitoring tools exploiting the performance monitoring events such as those
10737provided by the Performance Monitoring Unit (PMU) of modern processors.
10738
10739Libpfm4 helps convert from an event name, expressed as a string, to the event
10740encoding that is either the raw event as documented by the hardware vendor or
10741the OS-specific encoding. In the latter case, the library is able to prepare
10742the OS-specific data structures needed by the kernel to setup the event.
10743
10744libpfm4 provides support for the @code{perf_events} interface, which was
10745introduced in Linux 2.6.31.")
10746 (home-page "https://perfmon2.sourceforge.net/")
10747 (license license:expat)))
10748
10749(define-public libnfnetlink
10750 (package
10751 (name "libnfnetlink")
10752 (version "1.0.2")
10753 (source (origin
10754 (method url-fetch)
10755 (uri (string-append
10756 "https://www.netfilter.org/projects/libnfnetlink/files/"
10757 "libnfnetlink-" version ".tar.bz2"))
10758 (sha256
10759 (base32
10760 "0xn3rcrzxr6g82kfxzs9bqn2zvl2kf2yda30drwb9vr6sk1wfr5h"))))
10761 (build-system gnu-build-system)
10762 (home-page "https://www.netfilter.org/projects/libnfnetlink/")
10763 (synopsis "Low-level netfilter netlink communication library")
10764 (description
10765 "@code{libnfnetlink} is the low-level library for netfilter related
10766kernel/userspace communication. It provides a generic messaging
10767infrastructure for in-kernel netfilter subsystems (such as nfnetlink_log,
10768nfnetlink_queue, nfnetlink_conntrack) and their respective users and/or
10769management tools in userspace.")
10770 (license license:gpl2)))
10771
10772(define-public libinih
10773 (package
10774 (name "libinih")
10775 (version "62")
10776 (source (origin
10777 (method git-fetch)
10778 (uri (git-reference
10779 (url "https://github.com/benhoyt/inih")
10780 (commit (string-append "r" version))))
10781 (file-name (git-file-name name version))
10782 (sha256
10783 (base32
10784 "0yl5057682gvk1iszjkz4hy73yv45l7wr3fwhbgyf7r7fwx0cwwf"))))
10785 (build-system meson-build-system)
10786 ;; Install static libraries for use by the initrd's xfsprogs/static.
10787 (outputs (list "out" "static"))
10788 (arguments
10789 `(#:configure-flags
10790 (list "-Ddistro_install=true"
10791 "-Ddefault_library=both")
10792 #:phases
10793 (modify-phases %standard-phases
10794 (add-after 'install 'separate-static
10795 (lambda* (#:key outputs #:allow-other-keys)
10796 (let ((out (assoc-ref outputs "out"))
10797 (static (assoc-ref outputs "static")))
10798 (with-directory-excursion out
10799 (for-each (lambda (source)
10800 (let ((target (string-append static "/" source)))
10801 (mkdir-p (dirname target))
10802 (rename-file source target)))
10803 (find-files "lib" "\\.a$")))))))))
10804 (home-page "https://github.com/benhoyt/inih")
10805 (synopsis "Simple .INI parser library for C")
10806 (description "The inih (INI Not Invented Here) library is a simple .INI file
10807parser written in C. It's only a couple of pages of code, and it was designed to
10808be small and simple, so it's good for embedded systems. It's also more or less
10809compatible with Python's ConfigParser style of .INI files, including RFC
10810822-style multi-line syntax and name: value entries.")
10811 (license license:bsd-3)))
10812
10813(define-public simpleini
10814 (package
10815 (name "simpleini")
10816 (version "4.25")
10817 (source (origin
10818 (method git-fetch)
10819 (uri (git-reference
10820 (url "https://github.com/brofield/simpleini")
10821 (commit (string-append "v" version))))
10822 (file-name (git-file-name name version))
10823 (sha256
10824 (base32
10825 "1v9s0kr5ca1gdbnlkdz7chzypy0wz95f09l0r6jnmff4qy6db56l"))))
10826 (build-system cmake-build-system)
10827 (arguments
10828 (list #:configure-flags #~(list "-DSIMPLEINI_USE_SYSTEM_GTEST=ON")))
10829 (native-inputs (list googletest))
10830 (home-page "https://github.com/brofield/simpleini")
10831 (synopsis "Simple API to read and write INI-style files")
10832 (description
10833 "SimpleIni provides a simple API to read and write INI-style
10834configuration files. It supports data files in ASCII, MBCS and Unicode.")
10835 (license license:expat)))
10836
10837(define-public xfsprogs
10838 (package
10839 (name "xfsprogs")
10840 (version "6.12.0")
10841 (source (origin
10842 (method url-fetch)
10843 (uri (string-append
10844 "mirror://kernel.org/linux/utils/fs/xfs/xfsprogs/"
10845 "xfsprogs-" version ".tar.gz"))
10846 (sha256
10847 (base32
10848 "1n46n27fxx1137kni3drrhzhp1l8ksxabcsmi8yzxbhpbnl4q293"))))
10849 (build-system gnu-build-system)
10850 (outputs (list "out" "python"))
10851 (arguments
10852 `(#:tests? #f ; kernel/user integration tests are in package "xfstests"
10853 #:configure-flags
10854 (list "--disable-static")
10855 #:make-flags
10856 (list "V=1")
10857 #:phases
10858 (modify-phases %standard-phases
10859 (add-after 'install 'separate-python-output
10860 (lambda* (#:key outputs #:allow-other-keys)
10861 (let ((out (assoc-ref outputs "out"))
10862 (python (assoc-ref outputs "python")))
10863 (for-each
10864 (lambda (script)
10865 (mkdir-p (string-append python (dirname script)))
10866 (rename-file (string-append out script)
10867 (string-append python script)))
10868 (list "/sbin/xfs_scrub_all")))))
10869 (add-after 'install 'install-headers
10870 (lambda* (#:key make-flags #:allow-other-keys)
10871 (apply invoke "make" "install-dev" make-flags))))))
10872 (native-inputs
10873 (list gettext-minimal))
10874 (inputs
10875 `(("libinih" ,libinih)
10876 ("liburcu" ,liburcu)
10877 ("libuuid" ,util-linux "lib")
10878 ("python" ,python-wrapper)))
10879 (home-page "https://xfs.wiki.kernel.org/")
10880 (synopsis "XFS file system tools")
10881 (description "This package provides commands to create and check XFS
10882file systems.")
10883 ;; The library "libhandle" and the headers in "xfslibs-dev" are
10884 ;; licensed under lgpl2.1. the other stuff is licensed under gpl2.
10885 (license (list license:gpl2 license:lgpl2.1))))
10886
10887(define-public xfsprogs-5.9
10888 (package
10889 (inherit xfsprogs)
10890 (name "xfsprogs")
10891 (version "5.9.0")
10892 (source (origin
10893 (method url-fetch)
10894 (uri (string-append
10895 "mirror://kernel.org/linux/utils/fs/xfs/xfsprogs/"
10896 "xfsprogs-" version ".tar.gz"))
10897 (sha256
10898 (base32
10899 "13xkn9jpmwp4fm9r68vhgznkmxhnv83n2b39mhy2qdaph90w2a1l"))))
10900 (arguments
10901 (substitute-keyword-arguments arguments
10902 ((#:configure-flags configure-flags '())
10903 `(cons "--enable-gettext=no"
10904 ,configure-flags))))
10905 (native-inputs
10906 (modify-inputs native-inputs
10907 (delete "gettext-minimal")))))
10908
10909(define-public xfsprogs/static
10910 (package
10911 (inherit xfsprogs)
10912 (name "xfsprogs-static")
10913 (outputs (list "out"))
10914 (arguments
10915 (substitute-keyword-arguments arguments
10916 ((#:configure-flags configure-flags '())
10917 `(append ,configure-flags
10918 (list "--enable-static")))
10919 ((#:make-flags make-flags ''())
10920 `(cons* "LLDFLAGS=-all-static" ,make-flags))
10921 ((#:phases _ ''())
10922 `(modify-phases %standard-phases
10923 (add-after 'install 'delete-useless-files
10924 (lambda* (#:key outputs #:allow-other-keys)
10925 (with-directory-excursion (assoc-ref outputs "out")
10926 (for-each delete-file-recursively
10927 (list "include" "lib")))))))))
10928 (inputs
10929 `(("libinih:static" ,libinih "static")
10930 ("util-linux:static" ,util-linux "static")
10931 ,@(remove (match-lambda
10932 ((label . _)
10933 (member label '("python"))))
10934 (package-inputs xfsprogs))))
10935 (synopsis "Statically linked XFS file system tools")))
10936
10937(define-public xfs_repair/static
10938 (package
10939 (name "xfs_repair-static")
10940 (version (package-version xfsprogs/static))
10941 (source #f)
10942 (build-system trivial-build-system)
10943 (arguments
10944 `(#:modules ((guix build utils))
10945 #:builder
10946 (begin
10947 (use-modules (guix build utils))
10948 (let* ((xfsprogs (assoc-ref %build-inputs "xfsprogs"))
10949 (out (assoc-ref %outputs "out"))
10950 (sbin (string-append out "/sbin")))
10951 (install-file (string-append xfsprogs "/sbin/xfs_repair") sbin)
10952 (with-directory-excursion sbin
10953 (remove-store-references "xfs_repair"))))))
10954 (inputs
10955 `(("xfsprogs" ,xfsprogs/static)))
10956 (home-page (package-home-page xfsprogs/static))
10957 (synopsis "Statically linked @command{xfs_repair} from xfsprogs")
10958 (description
10959 "This package provides a statically linked @command{xfs_repair} taken
10960from the xfsprogs package. It is meant to be used in initrds.")
10961 (license (package-license xfsprogs/static))))
10962
10963(define-public genext2fs
10964 (package
10965 (name "genext2fs")
10966 (version "1.5.0")
10967 (source (origin
10968 (method git-fetch)
10969 (uri (git-reference
10970 (url "https://github.com/bestouff/genext2fs")
10971 (commit "474111097321f03de9e009aa9f7d4a8948e310b2")))
10972 (file-name (git-file-name name version))
10973 (sha256
10974 (base32 "14lgvml5zz99845ja47jpf4iirjzfqv36ffzachh3hw2ggji9c7l"))))
10975 (build-system gnu-build-system)
10976 (native-inputs
10977 (list autoconf automake))
10978 (home-page "https://github.com/bestouff/genext2fs")
10979 (synopsis "Generate ext2 file system as a normal user")
10980 (description "This package provides a program to generate an ext2
10981file system as a normal (non-root) user. It does not require you to mount
10982the image file to copy files on it, nor does it require that you become
10983the superuser to make device nodes.")
10984 (license license:gpl2)))
10985
10986(define-public fakeroot
10987 (package
10988 (name "fakeroot")
10989 (version "1.38")
10990 (source
10991 (origin
10992 ;; There are no tags in the repository, so take this snapshot.
10993 (method url-fetch)
10994 (uri (string-append "https://deb.debian.org/debian/pool/main/f/"
10995 "fakeroot/fakeroot_" version ".orig.tar.gz"))
10996 (file-name (string-append name "-" version ".tar.gz"))
10997 (sha256
10998 (base32 "00p07xi1j61i4bbxymydihff8frw9bs0g0fr6rpm88q94wclcl1p"))
10999 (modules '((guix build utils)
11000 (ice-9 ftw)))
11001 (snippet
11002 `(begin
11003 ;; Delete pregenerated man page translations, but not the originals.
11004 (with-directory-excursion "doc"
11005 (for-each (lambda (language)
11006 (for-each delete-file
11007 (find-files language "\\.[0-9]$")))
11008 (scandir "."
11009 (lambda (file)
11010 (and (not (string-prefix? "." file))
11011 (eq? 'directory
11012 (stat:type (lstat file))))))))))))
11013 (build-system gnu-build-system)
11014 (arguments
11015 `(#:configure-flags
11016 (list "--disable-static")
11017 #:phases
11018 (modify-phases %standard-phases
11019 (add-after 'unpack 'patch-Makefile.am
11020 (lambda _
11021 (substitute* "Makefile.am"
11022 (("/bin/sh") (which "sh")))))
11023 (add-after 'unpack 'patch-script
11024 (lambda* (#:key inputs #:allow-other-keys)
11025 (substitute* "scripts/fakeroot.in"
11026 (("getopt")
11027 (string-append (assoc-ref inputs "util-linux")
11028 "/bin/getopt"))
11029 (("sed")
11030 (string-append (assoc-ref inputs "sed")
11031 "/bin/sed"))
11032 (("cat|cut" command)
11033 (string-append (assoc-ref inputs "coreutils")
11034 "/bin/" command)) )))
11035 (replace 'bootstrap
11036 (lambda _
11037 ;; The "preroll" script takes care of Autoconf and also
11038 ;; prepares the translated manuals.
11039 (invoke "sh" "./preroll")))
11040 (add-before 'configure 'setenv
11041 (lambda _
11042 (setenv "LIBS" "-lacl")))
11043 (add-before 'check 'prepare-check
11044 (lambda _
11045 (setenv "SHELL" (which "bash"))
11046 (setenv "VERBOSE" "1")
11047 (substitute* "test/t.touchinstall"
11048 ;; We don't have the name of the root user, so use ID=0.
11049 (("grep root") "grep \"\\<0\\>\""))
11050 (substitute* "test/tartest"
11051 ;; We don't have the name of the root group, so use ID=0.
11052 (("ROOTGROUP=root") "ROOTGROUP=0")
11053 ;; We don't have the name of the daemon user, so use IDs.
11054 (("daemon:sys") "1:3")
11055 (("daemon:") "1:"))
11056 ;; We don't have an /etc/passwd entry for "root" - use numeric IDs.
11057 (substitute* "test/compare-tar"
11058 (("tar -tvf") "tar --numeric-owner -tvf")))))))
11059 (native-inputs
11060 (list autoconf-2.71 automake gettext-minimal libtool po4a
11061 perl sharutils xz)) ; for tests
11062 (inputs
11063 (list acl libcap util-linux sed coreutils))
11064 (synopsis "Run commands in an environment with fake root privileges")
11065 (description
11066 "@command{fakeroot} runs a command in an environment where it appears to
11067have root privileges for file manipulation. This is useful for allowing users
11068to create archives (@file{tar}, @file{ar}, @file{deb}, etc.) with files in
11069them with root permissions and/or ownership.
11070
11071Without fakeroot, one would have to have root privileges to create the
11072constituent files of the archives with the correct permissions and ownership,
11073and then pack them up, or one would have to construct the archives directly,
11074without using the archiver.")
11075 (home-page "http://freshmeat.sourceforge.net/projects/fakeroot")
11076 (license license:gpl3+)))
11077
11078(define-public fakechroot
11079 ;; XXX: Build from the change submitted at
11080 ;; <https://github.com/dex4er/fakechroot/pull/85> to allow compilation
11081 ;; against glibc 2.33. Switch back to the official repository on the next
11082 ;; release.
11083 (let ((commit "e7c1f3a446e594a4d0cce5f5d499c9439ce1d5c5")
11084 (revision "0"))
11085 (package
11086 (name "fakechroot")
11087 (version (git-version "2.20.1" revision commit))
11088 (source (origin
11089 (method git-fetch)
11090 (uri (git-reference
11091 (url "https://github.com/lipnitsk/fakechroot")
11092 (commit commit)))
11093 (file-name (git-file-name name version))
11094 (sha256
11095 (base32
11096 "0gac6a6djx3nf343vd33sr5qqngz8ss3aij54zl8x9wb47pc11kb"))))
11097 (build-system gnu-build-system)
11098 (arguments
11099 ;; XXX: The tests heavily assume they run on an FHS system so for now
11100 ;; skip them.
11101 '(#:tests? #f
11102 #:configure-flags '("--disable-static")))
11103 (native-inputs (list autoconf automake libtool perl))
11104 (synopsis "Emulate @code{chroot} by overriding file system calls")
11105 (description
11106 "@command{fakechroot} runs a command in an environment were is additional
11107possibility to use @code{chroot} command without root privileges. This is
11108useful for allowing users to create own chrooted environment with possibility
11109to install another packages without need for root privileges.
11110
11111It works by providing @file{libfakechroot.so}, a shared library meant to be
11112set as @code{LD_PRELOAD} to override the C library file system functions.")
11113 (home-page "https://github.com/dex4er/fakechroot/")
11114 (license license:lgpl2.1+))))
11115
11116(define-public falcosecurity-libs
11117 (package
11118 (name "falcosecurity-libs")
11119 (version "0.20.0")
11120 (source (origin
11121 (method git-fetch)
11122 (uri (git-reference
11123 (url "https://github.com/falcosecurity/libs/")
11124 (commit version)))
11125 (file-name (git-file-name name version))
11126 (sha256
11127 (base32
11128 "041ir9wk44v7isidwl7fzxrjvs85j637wcr7xirasd8ysxa0r4qv"))
11129 (patches
11130 (search-patches
11131 "falcosecurity-libs-bpf-probes-fix.patch"
11132 "falcosecurity-libs-shared-build.patch"))))
11133 (build-system cmake-build-system)
11134 (arguments
11135 (list
11136 #:configure-flags
11137 #~(list "-DUSE_BUNDLED_DEPS=OFF"
11138 "-DBUILD_DRIVER=OFF"
11139 "-DENABLE_DKMS=OFF"
11140 "-DBUILD_LIBSCAP_MODERN_BPF=ON"
11141 "-DSCAP_FILES_SUITE_ENABLE=OFF" ;attempts to download scap files
11142 "-DBUILD_SHARED_LIBS=ON"
11143 #$(string-append "-DFALCOSECURITY_LIBS_VERSION=" version))
11144 ;; Only the libsinsp test suite is run, as the one for libscap requires
11145 ;; elevated privileges.
11146 #:modules '((guix build cmake-build-system)
11147 ((guix build gnu-build-system) #:prefix gnu:)
11148 (guix build utils))
11149 #:phases
11150 #~(modify-phases %standard-phases
11151 (add-after 'unpack 'disable-problematic-tests
11152 (lambda _
11153 (substitute* "userspace/libsinsp/test/user.ut.cpp"
11154 ;; The 'system_lookup' test assumes a root user
11155 ;; exists in the build environment.
11156 (("TEST_F\\(usergroup_manager_test, system_lookup)")
11157 "TEST_F(usergroup_manager_test, DISABLED_system_lookup)"))))
11158 (replace 'check
11159 (lambda* (#:rest args)
11160 (apply (assoc-ref gnu:%standard-phases 'check)
11161 #:test-target "run-unit-test-libsinsp" args)))
11162 (add-after 'install 'delete-src
11163 (lambda _
11164 (delete-file-recursively
11165 (string-append #$output "/src")))))))
11166 (native-inputs
11167 (list bpftool
11168 clang-18 ;avoid stack limit exceeded build error
11169 googletest
11170 pkg-config
11171 valijson)) ;header-only library
11172 (inputs
11173 (list elfutils))
11174 (propagated-inputs
11175 ;; The following inputs are in the 'Requires' field of libscap.pc,
11176 ;; libsinp.pc or libpman.pc.
11177 (list c-ares
11178 grpc
11179 jsoncpp
11180 libbpf
11181 libelf
11182 openssl
11183 protobuf
11184 uthash ;included in libscap headers
11185 zlib
11186 ;; These are in the 'Requires.private' field of libscap.pc and
11187 ;; libsinp.pc. They are required because the headers are installed
11188 ;; to a non-standard directory, and thus need to be found via the
11189 ;; 'Cflags' field, which in turn mandates that both the pkg-config
11190 ;; modules listed in the 'Requires' and 'Requires.private' be
11191 ;; available.
11192 curl
11193 re2
11194 onetbb))
11195 (home-page "https://github.com/falcosecurity/libs/")
11196 (synopsis "Falco security libraries")
11197 (description "The Falco security libraries include @code{libsinsp} and
11198@code{libscap}. @code{libscap} manages the data capture process, while
11199@code{libsinsp} is a system inspection library that enriches events from
11200@code{libscap} with machine state. @code{libsinsp} also performs events
11201filtering with rule evaluation through its internal rule engine. These
11202libraries are used by the @command{sysdig} command-line utility.")
11203 (license license:asl2.0)))
11204
11205(define-public inputattach
11206 (package
11207 (name "inputattach")
11208 (version "0.42.0")
11209 (source (origin
11210 (method git-fetch)
11211 (uri (git-reference
11212 (url "https://github.com/linuxwacom/input-wacom")
11213 (commit (string-append "input-wacom-" version))))
11214 (file-name (git-file-name name version))
11215 (sha256
11216 (base32 "04lnn7v0rm4ppbya140im5d4igcl6c1nrqpgbsr0i8wkral0nv7j"))))
11217 (build-system gnu-build-system)
11218 (arguments
11219 `(#:phases
11220 (modify-phases %standard-phases
11221 (delete 'bootstrap)
11222 (delete 'configure)
11223 (replace 'build
11224 (lambda* (#:key inputs #:allow-other-keys)
11225 (with-directory-excursion "inputattach"
11226 (invoke "gcc" "-O2" "-o" "inputattach"
11227 "inputattach.c"))))
11228 (delete 'check)
11229 (replace 'install
11230 (lambda* (#:key outputs #:allow-other-keys)
11231 (let ((target-dir (string-append
11232 (assoc-ref outputs "out")
11233 "/bin/")))
11234 (mkdir-p target-dir)
11235 (copy-file "inputattach/inputattach"
11236 (string-append target-dir
11237 "inputattach"))
11238 #t))))))
11239 (home-page "https://linuxwacom.github.io/")
11240 (synopsis "Dispatch input peripherals events to a device file")
11241 (description "inputattach dispatches input events from several device
11242types and interfaces and translates so that the X server can use them.")
11243 (license license:gpl2+)))
11244
11245(define-public keyd
11246 (package
11247 (name "keyd")
11248 (version "2.6.0")
11249 (source
11250 (origin
11251 (method git-fetch)
11252 (uri (git-reference
11253 (url "https://github.com/rvaiya/keyd")
11254 (commit (string-append "v" version))))
11255 (sha256
11256 (base32
11257 "14rgrg8d1ys1cqq46mgi34yqg9jd1q3yw1acw5r5jpwwk0da7g4p"))))
11258 (arguments
11259 (list #:tests? #f ; tests require root
11260 #:make-flags
11261 #~(list (string-append "CC=" #$(cc-for-target))
11262 "PREFIX="
11263 (string-append "DESTDIR=" #$output))
11264 #:phases
11265 '(modify-phases
11266 %standard-phases
11267 (delete 'configure)))) ; no autoconf
11268 (build-system gnu-build-system)
11269 (inputs (list linux-libre-headers))
11270 (synopsis "Key remapping daemon for Linux")
11271 (description
11272 "Keyd is a keyboard remapping utility with intuitive ini configuration
11273file format. Keyd has several features, many of which are traditionally only
11274found in custom keyboard firmware like QMK.")
11275 (home-page "https://github.com/rvaiya/keyd")
11276 (license license:expat)))
11277
11278(define-public pipewire
11279 (package
11280 (name "pipewire")
11281 (version "1.6.2")
11282 (source (origin
11283 (method git-fetch)
11284 (uri (git-reference
11285 (url "https://gitlab.freedesktop.org/pipewire/pipewire")
11286 (commit version)))
11287 (file-name (git-file-name name version))
11288 (sha256
11289 (base32
11290 "01jvq9ck8dhkbmw21jw0frgbgvzwfq1dxkvl3zynrj179kpm4v9w"))))
11291 (build-system meson-build-system)
11292 (arguments
11293 (list
11294 #:configure-flags
11295 #~(list (string-append "-Dudevrulesdir=" #$output "/lib/udev/rules.d")
11296 "-Dman=enabled"
11297 "-Drlimits-install=false"
11298 "-Dsession-managers=[]"
11299 "-Dsysconfdir=/etc"
11300 "-Dlibsystemd=disabled"
11301
11302 ;; XXX: link with -Wl,--no-as-needed so that libgcc_s.so.1 does not get dropped
11303 ;; Otherwise test_loop will fail with:
11304 ;; libgcc_s.so.1 must be installed for pthread_cancel to work
11305 "-Db_asneeded=false")))
11306 (native-inputs
11307 (list `(,glib "bin")
11308 pkg-config
11309 doxygen
11310 python
11311 python-docutils))
11312 (inputs (list alsa-lib
11313 avahi
11314 bluez
11315 dbus
11316 eudev
11317 ffmpeg
11318 gst-plugins-base
11319 gstreamer
11320 jack-2
11321 ldacbt
11322 libcamera-minimal
11323 libdrm
11324 libfdk
11325 libfreeaptx
11326 libsndfile
11327 libusb
11328 openssl ; raop sink
11329 libva
11330 pulseaudio
11331 readline ; for pw-cli
11332 sbc
11333 vulkan-headers
11334 vulkan-loader
11335 webrtc-audio-processing))
11336 (home-page "https://pipewire.org/")
11337 (synopsis "Server and user space API to deal with multimedia pipelines")
11338 (description
11339 "PipeWire is a project that aims to greatly improve handling of audio and
11340video under Linux. It aims to support the usecases currently handled by both
11341PulseAudio and Jack and at the same time provide same level of powerful handling
11342of Video input and output. It also introduces a security model that makes
11343interacting with audio and video devices from containerized applications easy,
11344with supporting Flatpak applications being the primary goal. Alongside Wayland
11345and Flatpak we expect PipeWire to provide a core building block for the future
11346of Linux application development.")
11347 (license license:lgpl2.0+)))
11348
11349(define-public pipewire-minimal
11350 ;; Used as libpipewire to reduce closure size and avoid dependency cycles.
11351 (hidden-package
11352 (package
11353 (inherit pipewire)
11354 (name "pipewire-minimal")
11355 (arguments
11356 (list
11357 #:configure-flags
11358 #~(list "-Dsession-managers=[]"
11359 "-Ddbus=disabled"
11360 "-Dflatpak=disabled"
11361 ;; XXX: Otherwise test_loop will fail with:
11362 ;; libgcc_s.so.1 must be installed for pthread_cancel to work
11363 "-Db_asneeded=false")))
11364 (native-inputs '())
11365 (inputs '()))))
11366
11367(define-public pipewire-minimal-1.4
11368 (package
11369 (inherit pipewire-minimal)
11370 (name "pipewire")
11371 (version "1.4.10")
11372 (source (origin
11373 (method git-fetch)
11374 (uri (git-reference
11375 (url "https://gitlab.freedesktop.org/pipewire/pipewire")
11376 (commit version)))
11377 (file-name (git-file-name name version))
11378 (sha256
11379 (base32
11380 "14rsdbcsyyhjh7hvbq3d84f6s0fllvq6vpg39cxcd7l8fn4zc2zw"))))))
11381
11382(define-public wireplumber
11383 (package
11384 (name "wireplumber")
11385 (version "0.5.15")
11386 (source
11387 (origin
11388 (method git-fetch)
11389 (uri (git-reference
11390 (url
11391 "https://gitlab.freedesktop.org/pipewire/wireplumber.git")
11392 (commit version)))
11393 (file-name (git-file-name name version))
11394 (sha256
11395 (base32 "1a7fzfdxipjaq0fb695jbpipnlr67yl273x1gd9mmpbnqmgnphnv"))))
11396 (build-system meson-build-system)
11397 (arguments
11398 `(#:configure-flags '("-Dsystemd=disabled"
11399 "-Dsystem-lua=true")))
11400 (native-inputs
11401 (list `(,glib "bin")
11402 pkg-config python-minimal))
11403 (inputs (list dbus elogind glib lua pipewire))
11404 (home-page "https://gitlab.freedesktop.org/pipewire/wireplumber")
11405 (synopsis "Session / policy manager implementation for PipeWire")
11406 (description "WirePlumber is a modular session / policy manager for
11407PipeWire and a GObject-based high-level library that wraps PipeWire's API,
11408providing convenience for writing the daemon's modules as well as external
11409tools for managing PipeWire.")
11410 (license license:expat)))
11411
11412(define-public wireplumber-minimal
11413 (let ((base wireplumber))
11414 (package
11415 (inherit base)
11416 (name "wireplumber-minimal")
11417 (arguments
11418 (substitute-keyword-arguments arguments
11419 ((#:configure-flags flags ''())
11420 #~(cons "-Delogind=disabled" #$flags))))
11421 (inputs
11422 (modify-inputs inputs
11423 (delete "elogind"))))))
11424
11425(define-public ell
11426 (package
11427 (name "ell")
11428 (version "0.83")
11429 (source (origin
11430 (method git-fetch)
11431 (uri (git-reference
11432 (url "https://git.kernel.org/pub/scm/libs/ell/ell.git")
11433 (commit version)))
11434 (file-name (git-file-name name version))
11435 (sha256
11436 (base32
11437 "1ywq84jgvf7f86srqwpq31w2kzdp875fx039x5g4lx486plgf526"))
11438 (modules '((guix build utils)))
11439 (snippet
11440 #~(begin
11441 (substitute* "Makefile.am"
11442 ;; requires hwdb.bin
11443 (("unit/test-hwdb.*") ""))))))
11444 (build-system gnu-build-system)
11445 (arguments
11446 ;; Tests launch dbus-daemon instances that all try to bind to
11447 ;; "/tmp/ell-test-bus". Thus, we need to run them sequentially.
11448 '(#:parallel-tests? #f))
11449 (inputs
11450 (list dbus))
11451 (native-inputs
11452 (list autoconf automake libtool pkg-config procps))
11453 (home-page "https://01.org/ell")
11454 (synopsis "Embedded Linux Library")
11455 (description "The Embedded Linux* Library (ELL) provides core, low-level
11456functionality for system daemons. It typically has no dependencies other than
11457the Linux kernel, C standard library, and libdl (for dynamic linking). While
11458ELL is designed to be efficient and compact enough for use on embedded Linux
11459platforms, it is not limited to resource-constrained systems.")
11460 (license license:lgpl2.1+)))
11461
11462(define-public kexec-tools
11463 (package
11464 (name "kexec-tools")
11465 (version "2.0.31")
11466 (source (origin
11467 (method url-fetch)
11468 (uri (string-append "mirror://kernel.org/linux/utils/kernel"
11469 "/kexec/kexec-tools-" version ".tar.xz"))
11470 (sha256
11471 (base32
11472 "0c9cj9xvcm81gcwnkvvh9vh82v59kdz5llmblc2wkqb6vh6kb3wa"))))
11473 (build-system gnu-build-system)
11474 (arguments
11475 ;; There are no automated tests.
11476 '(#:tests? #f))
11477 ;; This variant of binutils is used for the 64 bit support needed to
11478 ;; assemble the `purgatory/arch/i386/compat_x86_64.S' program on i686-linux.
11479 (native-inputs (list (make-ld-wrapper "ld-wrapper"
11480 #:binutils binutils)
11481 binutils))
11482 (home-page "https://projects.horms.net/projects/kexec/")
11483 (synopsis "Tools for booting directly into different kernels")
11484 (description "This package provides the @code{kexec} program and ancillary
11485utilities. Using @code{kexec}, it is possible to boot directly into a new
11486kernel from the context of an already-running kernel, bypassing the normal
11487system boot process.")
11488 (supported-systems (delete "riscv64-linux" %supported-systems))
11489 (license license:gpl2)))
11490
11491(define-public cachefilesd
11492 (package
11493 (name "cachefilesd")
11494 (version "0.10.10")
11495 (source (origin
11496 (method url-fetch)
11497 (uri (string-append
11498 "https://git.kernel.org/pub/scm/linux/kernel/git/dhowells"
11499 "/cachefilesd.git/snapshot/cachefilesd-"
11500 version ".tar.gz"))
11501 (sha256
11502 (base32
11503 "0g40ljjnn3wzh9gp6il21c95f977298qrrkrxfnwfl3k3asfmnbi"))))
11504 (build-system gnu-build-system)
11505 (outputs '("out"))
11506 (arguments
11507 `(#:tests? #f ; there are no tests
11508 #:make-flags
11509 (let ((prefix-dir (lambda (var dir)
11510 (string-append var "=" %output "/" dir))))
11511 (list (string-append "CC=" ,(cc-for-target))
11512 (prefix-dir "SBINDIR" "sbin/")
11513 (prefix-dir "ETCDIR" "etc/")
11514 (prefix-dir "MANDIR" "share/man/")))
11515 #:phases (modify-phases %standard-phases (delete 'configure))))
11516 (home-page "https://people.redhat.com/~dhowells/cachefs/")
11517 (synopsis "CacheFiles userspace management daemon")
11518 (description "@code{cachefilesd} is a userspace daemon that manages the
11519cache data store that is used by network file systems such as @code{AFS} and
11520@code{NFS} to cache data locally on disk. The content of the cache is
11521persistent over reboots.")
11522 (license license:gpl2+)))
11523
11524(define-public libbpf
11525 (package
11526 (name "libbpf")
11527 (version "1.5.0")
11528 (source
11529 (origin
11530 (method git-fetch)
11531 (uri (git-reference
11532 (url "https://github.com/libbpf/libbpf")
11533 (commit (string-append "v" version))))
11534 (file-name (git-file-name name version))
11535 (sha256
11536 (base32
11537 "0j7rm76g2ss09vksm4nm2g5yq7df2z5qpjr4h6kd3959sc1rvxnh"))))
11538 (build-system gnu-build-system)
11539 (arguments
11540 (list
11541 #:tests? #f ;self-tests run in QEMU
11542 #:make-flags
11543 #~(list (string-append "PREFIX=" #$output)
11544 (string-append "LIBDIR=$(PREFIX)/lib")
11545 (string-append "CC=" #$(cc-for-target)))
11546 #:phases
11547 #~(modify-phases %standard-phases
11548 (delete 'configure)
11549 (add-before 'build 'pre-build
11550 (lambda _
11551 (chdir "src")))
11552 (replace 'install
11553 (lambda* (#:key make-flags #:allow-other-keys #:rest args)
11554 (apply (assoc-ref %standard-phases 'install)
11555 (append args
11556 (list #:make-flags
11557 (append (list "install"
11558 ;; Also install the kernel
11559 ;; user API (uAPI) headers.
11560 "install_uapi_headers")
11561 make-flags)))))))))
11562 (native-inputs (list pkg-config))
11563 (propagated-inputs (list elfutils zlib)) ;in Requires.private of libbpf.pc
11564 (home-page "https://github.com/libbpf/libbpf")
11565 (synopsis "BPF CO-RE (Compile Once – Run Everywhere)")
11566 (description
11567 "Libbpf supports building BPF CO-RE-enabled applications, which, in
11568contrast to BCC, do not require the Clang/LLVM runtime or linux kernel
11569headers.")
11570 (license (list license:lgpl2.1 license:bsd-2))))
11571
11572(define-public libbpf-0.8
11573 (package
11574 (inherit libbpf)
11575 (name "libbpf")
11576 (version "0.8.1")
11577 (source
11578 (origin
11579 (method git-fetch)
11580 (uri (git-reference
11581 (url "https://github.com/libbpf/libbpf")
11582 (commit (string-append "v" version))))
11583 (file-name (git-file-name name version))
11584 (sha256
11585 (base32
11586 "1zzpkk4x3f20483dzw43b3ml03d63vvkmqf4j8y3b61b67wm59bm"))))
11587 (arguments
11588 (list
11589 #:tests? #f ;self-tests run in QEMU
11590 #:make-flags
11591 #~(list (string-append "PREFIX=" #$output)
11592 (string-append "LIBDIR=$(PREFIX)/lib")
11593 (string-append "CC=" #$(cc-for-target)))
11594 #:phases #~(modify-phases %standard-phases
11595 (delete 'configure)
11596 (add-before 'build 'pre-build
11597 (lambda _
11598 (chdir "src"))))))
11599 (native-inputs (list pkg-config))
11600 (propagated-inputs (list elfutils zlib)))) ;in Requires.private of libbpf.pc
11601
11602(define-public bcc
11603 (package
11604 (name "bcc")
11605 (version "0.30.0")
11606 (source
11607 (origin
11608 (method git-fetch)
11609 (uri (git-reference
11610 (url "https://github.com/iovisor/bcc")
11611 (commit (string-append "v" version))))
11612 (file-name (git-file-name name version))
11613 (sha256
11614 (base32
11615 "0b5la0yn6x6ll73drnrm5v5yibbrzkvl86hqivkrmnpgy8cqn0cy"))))
11616 (build-system cmake-build-system)
11617 (native-inputs
11618 (list bison
11619 flex
11620 (@ (gnu packages compression) zip)))
11621 (inputs
11622 (list bash-minimal ;for wrap-program
11623 clang-15
11624 elfutils
11625 luajit
11626 libbpf
11627 python-setuptools
11628 python-wrapper))
11629 (arguments
11630 (list
11631 ;; Tests all require root permissions and a "standard" file hierarchy.
11632 #:tests? #f
11633 #:configure-flags #~(list (string-append "-DREVISION=" #$version)
11634 "-DCMAKE_USE_LIBBPF_PACKAGE=ON")
11635 #:phases
11636 #~(modify-phases %standard-phases
11637 (add-after 'unpack 'substitute-libbc
11638 (lambda _
11639 (substitute* "src/python/bcc/libbcc.py"
11640 (("(libbcc\\.so.*)\\b" _ libbcc)
11641 (string-append #$output "/lib/" libbcc)))))
11642 (add-after 'install 'wrap-tools
11643 (lambda _
11644 (use-modules (ice-9 textual-ports))
11645 (let* ((out #$output)
11646 (lib (string-append out "/lib"))
11647 (tools (string-append out "/share/bcc/tools"))
11648 (python-executable?
11649 (lambda (filename _)
11650 (call-with-input-file filename
11651 (lambda (port)
11652 (string-contains (get-line port)
11653 "/bin/python"))))))
11654 (for-each (lambda (python-executable)
11655 (format #t "Wrapping: ~A.~%" python-executable)
11656 (wrap-program python-executable
11657 `("GUIX_PYTHONPATH" ":" prefix
11658 (,(string-append lib
11659 "/python"
11660 #$(version-major+minor
11661 (package-version python))
11662 "/site-packages")))))
11663 (find-files tools python-executable?))))))))
11664 (home-page "https://github.com/iovisor/bcc")
11665 (synopsis "Tools for BPF on Linux")
11666 (description
11667 "BCC is a toolkit for creating efficient kernel tracing and manipulation
11668programs, and includes several useful tools and examples. It makes use of
11669extended BPF (Berkeley Packet Filters), formally known as eBPF, a new feature
11670that was first added to Linux 3.15. Much of what BCC uses requires Linux 4.1
11671and above.")
11672 (license license:asl2.0)))
11673
11674(define-public bpftool
11675 (package
11676 (name "bpftool")
11677 (version (package-version linux-libre))
11678 (source (package-source linux-libre))
11679 (build-system gnu-build-system)
11680 (arguments
11681 `(#:tests? #f ;This package has no tests.
11682 #:phases (modify-phases %standard-phases
11683 (delete 'configure)
11684 (replace 'build
11685 (lambda* (#:key inputs #:allow-other-keys)
11686 (invoke "make" "-C" "tools/bpf/bpftool"
11687 ,(string-append "CC=" (cc-for-target)))))
11688 (replace 'install
11689 (lambda* (#:key outputs #:allow-other-keys)
11690 (let* ((out (assoc-ref outputs "out")))
11691 (mkdir-p (string-append out "/sbin"))
11692 (mkdir-p (string-append out
11693 "/share/bash-completion/completions"))
11694 (invoke "make"
11695 (string-append "prefix=" out)
11696 (string-append
11697 "bash_compdir=" out
11698 "/share/bash-completion/completions")
11699 "-C" "tools/bpf/bpftool"
11700 "install")))))))
11701 (inputs (list elfutils ;provides libelf
11702 libcap openssl readline zlib))
11703 (native-inputs (list bison python))
11704 ;; This tool does not have a proper web page.
11705 (home-page
11706 "https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/tree/tools/bpf/bpftool")
11707 (synopsis "Tool for inspection and manipulation of eBPF programs and maps")
11708 (description "@command{bpftool} allows for inspection and simple
11709modification of BPF objects on the system.")
11710 (license (package-license linux-libre))))
11711
11712(define-public bpftrace
11713 (package
11714 (name "bpftrace")
11715 (version "0.21.2")
11716 (source
11717 (origin
11718 (method git-fetch)
11719 (uri (git-reference
11720 (url "https://github.com/bpftrace/bpftrace")
11721 (commit (string-append "v" version))))
11722 (file-name (git-file-name name version))
11723 (sha256
11724 (base32 "0icbhf1wk523a7lcmwqa67zc6hl6h02p5mfg26cizva447kbwsgz"))))
11725 (build-system cmake-build-system)
11726 (arguments
11727 (list
11728 #:test-exclude "(runtime_tests|tools-parsing-test)"
11729 #:phases
11730 #~(modify-phases %standard-phases
11731 ;; This patch also fixes broken compilation due to improper detection
11732 ;; of bfd features. This is taken from following upstream PR:
11733 ;; https://github.com/bpftrace/bpftrace/pull/3332
11734 (add-after 'unpack 'patch-paths-and-bfd-defs
11735 (lambda _
11736 (substitute* '("cmake/FindLibBfd.cmake"
11737 "src/CMakeLists.txt")
11738 (("LIBSFRAME_FOUND")
11739 "LIBSFRAME_LIBRARIES")
11740 (("LIBZSTD_FOUND")
11741 "LIBZSTD_LIBRARIES"))
11742 (with-directory-excursion "tests"
11743 (substitute* (find-files ".")
11744 (("/bin/sh")
11745 (which "sh")))
11746 (substitute* '("child.cpp"
11747 "runtime/call"
11748 "procmon.cpp")
11749 (("/bin/ls")
11750 (which "ls"))))))
11751 (add-after 'unpack 'fix-paths
11752 (lambda* (#:key inputs outputs #:allow-other-keys)
11753 (substitute* '("tests/child.cpp")
11754 (("/bin/sleep")
11755 (search-input-file inputs "bin/sleep")))))
11756 (add-before 'check 'set-test-filter
11757 (lambda _
11758 (setenv "GTEST_FILTER"
11759 (string-join
11760 (list ; "-" disables all following tests
11761 "-ast.probe_name_uprobe"
11762 "bpftrace.add_probes_uprobe_wildcard_file"
11763 "bpftrace.add_probes_uprobe_wildcard_file_uprobe_multi"
11764 "bpftrace.add_probes_usdt_wildcard"
11765 "Parser.multiple_attach_points_kprobe"
11766 "Parser.uretprobe_offset"
11767 "semantic_analyser.builtin_functions"
11768 "semantic_analyser.call_func"
11769 "semantic_analyser.call_uaddr")
11770 ":")))))))
11771 (native-inputs (list bison coreutils dwarves flex googletest xxd))
11772 (inputs (list bcc clang-15 elfutils libbpf libiberty cereal))
11773 (home-page "https://github.com/bpftrace/bpftrace")
11774 (synopsis "High-level tracing language for Linux eBPF")
11775 (description
11776 "bpftrace is a high-level tracing language for Linux enhanced Berkeley
11777Packet Filter (eBPF) available in recent Linux kernels (4.x). bpftrace uses
11778LLVM as a backend to compile scripts to BPF-bytecode and makes use of BCC for
11779interacting with the Linux BPF system, as well as existing Linux tracing
11780capabilities: kernel dynamic tracing (kprobes), user-level dynamic
11781tracing (uprobes), and tracepoints. The bpftrace language is inspired by awk
11782and C, and predecessor tracers such as DTrace and SystemTap. bpftrace was
11783created by Alastair Robertson.")
11784 (license license:asl2.0)))
11785
11786(define-public ttyebus-linux-module
11787 (let ((revision "0")
11788 (commit "fe4332a2281cf79804ef4d8516aa848ca1c58d1f"))
11789 (package
11790 (name "ttyebus-linux-module")
11791 (version (git-version "1.5" revision commit))
11792 (source
11793 (origin
11794 (method git-fetch)
11795 (uri (git-reference
11796 (url "https://github.com/eBUS/ttyebus")
11797 (commit "fe4332a2281cf79804ef4d8516aa848ca1c58d1f")))
11798 (file-name (git-file-name name version))
11799 (sha256
11800 (base32
11801 "1i66xjs9vln5cca6wx7aiiw7jihrlsk9hjdqyczp36fvm1b1bani"))))
11802 (supported-systems '("armhf-linux" "aarch64-linux"))
11803 (build-system linux-module-build-system)
11804 (arguments
11805 `(#:tests? #f))
11806 (home-page "https://github.com/eBUS/ttyebus")
11807 (synopsis "Low-latency Raspberry Pi UART driver")
11808 (description "This package provides a Linux kernel module that will
11809provide a serial device @code{/dev/ttyebus} with almost no latency upon
11810receiving. It is dedicated to the PL011 UART of the Raspberry Pi.")
11811 (license license:gpl3+))))
11812
11813(define-public ipset
11814 (package
11815 (name "ipset")
11816 (version "7.17")
11817 (source
11818 (origin
11819 (method url-fetch)
11820 (uri (string-append "https://ipset.netfilter.org/"
11821 "ipset-" version ".tar.bz2"))
11822 (sha256
11823 (base32 "1n34mkrdha9rggd0fizjx6baqkiqqd1yfhb5ml663mlx93zwjjdy"))))
11824 (build-system gnu-build-system)
11825 (inputs
11826 (list libmnl))
11827 (native-inputs
11828 (list pkg-config))
11829 (arguments
11830 `(#:configure-flags '("--disable-static"
11831 "--with-kmod=no")))
11832 (home-page "https://ipset.netfilter.org/")
11833 (synopsis "Administration tool for IP sets")
11834 (description "IP sets are a framework inside the Linux 2.4.x and 2.6.x kernel which
11835can be administered by the ipset utility. Depending on the type,
11836currently an IP set may store IP addresses, (TCP/UDP) port numbers or
11837IP addresses with MAC addresses in a way which ensures lightning speed
11838when matching an entry against a set.
11839
11840If you want to
11841@itemize @bullet
11842@item store multiple IP addresses or port numbers and match against the entire
11843collection using a single iptables rule.
11844@item dynamically update iptables rules against IP addresses or ports without
11845performance penalty.
11846@item express complex IP address and ports based rulesets with a single
11847iptables rule and benefit from the speed of IP sets.
11848@end itemize\n
11849then IP sets may be the proper tool for you.")
11850 (license license:gpl2+)))
11851
11852(define-public liburing
11853 (package
11854 (name "liburing")
11855 (version "2.14")
11856 (source (origin
11857 (method git-fetch)
11858 (uri (git-reference
11859 (url "https://github.com/axboe/liburing")
11860 (commit (string-append "liburing-" version))))
11861 (file-name (git-file-name name version))
11862 (sha256
11863 (base32
11864 "1xsrd1x3p5aidcmvhcqqjzgw283hjzrbz26ndpwd0i09dwrvhakd"))))
11865 (build-system gnu-build-system)
11866 (arguments
11867 `(;; Tests are dependent on kernel version and features
11868 #:tests? #f
11869 #:phases
11870 (modify-phases %standard-phases
11871 (replace 'configure
11872 ;; configure fails if it is followed by SHELL, CONFIG_SHELL,
11873 ;; --enable-fast-install, and --build
11874 (lambda* (#:key outputs #:allow-other-keys)
11875 (let ((out (assoc-ref outputs "out")))
11876 (setenv "SHELL" (which "sh"))
11877 (setenv "CONFIG_SHELL" (which "sh"))
11878 (invoke "./configure" (string-append "--prefix=" out))))))))
11879 (home-page "https://github.com/axboe/liburing")
11880 (synopsis "Interface to the Linux kernel @code{io_uring} interface")
11881 (description "This is the io_uring library, liburing. liburing provides
11882helpers to setup and teardown io_uring instances, and also a simplified
11883interface for applications that don't need (or want) to deal with the full
11884kernel side implementation.")
11885 (license license:expat)))
11886
11887(define-public erofs-utils
11888 (package
11889 (name "erofs-utils")
11890 (version "1.8.10")
11891 (source
11892 (origin
11893 (method git-fetch)
11894 (uri (git-reference
11895 (url "https://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs-utils.git")
11896 (commit (string-append "v" version))))
11897 (file-name (git-file-name name version))
11898 (sha256
11899 (base32 "1qlig9q1fdjl0zn7206dbv7w5ssjg4az4hg7y3vk69ly0zbmwkil"))))
11900 (build-system gnu-build-system)
11901 (inputs
11902 (list lz4
11903 `(,util-linux "lib")
11904 zlib))
11905 (native-inputs
11906 (list autoconf automake libtool pkg-config))
11907 (home-page "https://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs-utils.git/")
11908 (synopsis "User-space tools for the EROFS file system")
11909 (description
11910 "@acronym{EROFS, The Enhanced Read-Only File System} is a compressed,
11911read-only file system optimized for resource-scarce devices. This package
11912provides user-space tools for creating EROFS file systems.")
11913 (license license:gpl2+)))
11914
11915(define-public rasdaemon
11916 (package
11917 (name "rasdaemon")
11918 (version "0.8.4")
11919 (source
11920 (origin
11921 (method git-fetch)
11922 (uri (git-reference
11923 (url "https://github.com/mchehab/rasdaemon")
11924 (commit (string-append "v" version))))
11925 (file-name (git-file-name name version))
11926 (sha256
11927 (base32 "1930g35igfdw5bzcd6diy59rm1q4yirpjgqznfqfsichnmk04kmf"))))
11928 (native-inputs (list autoconf automake libtool pkg-config))
11929 (inputs
11930 (list bash-minimal
11931 dmidecode
11932 kmod
11933 libtraceevent
11934 pciutils
11935 perl
11936 perl-dbd-sqlite
11937 sqlite))
11938 (arguments
11939 (list
11940 #:configure-flags
11941 #~(list "--enable-all"
11942 ;; Don't install unused /etc/sysconfig/rasdaemon environment file.
11943 "--with-sysconfdefdir=."
11944 "--localstatedir=/var")
11945 #:phases
11946 #~(modify-phases %standard-phases
11947 (add-after 'unpack 'rename-README
11948 (lambda _
11949 ;; Required by autoreconf
11950 (rename-file "README.md" "README")))
11951 (add-before 'configure 'munge-autotools
11952 (lambda _
11953 ;; For some reason upstream forces sysconfdir=/etc. This results
11954 ;; in EPERM during the install phase. Removing the offending
11955 ;; line lets sysconfdir correctly pick up DESTDIR.
11956 (substitute* "configure.ac"
11957 (("^test .* sysconfdir=/etc\n$") ""))))
11958 (add-after 'install 'wrap-rasdaemon
11959 (lambda* (#:key inputs #:allow-other-keys)
11960 (let ((path (map dirname
11961 (list (search-input-file inputs "/sbin/dmidecode")
11962 (search-input-file inputs "/bin/modprobe")))))
11963 (wrap-program (string-append #$output "/sbin/ras-mc-ctl")
11964 `("PATH" ":" prefix ,path)
11965 `("PERL5LIB" ":" prefix ,(string-split (getenv "PERL5LIB") #\:)))))))))
11966 (build-system gnu-build-system)
11967 (home-page "https://github.com/mchehab/rasdaemon")
11968 (synopsis "Platform Reliability, Availability, and Serviceability tools")
11969 (description
11970 "The @code{rasdaemon} daemon monitors platform @acronym{RAS, Reliability
11971Availability and Serviceability} reports from Linux kernel trace events.
11972These trace events are logged in @file{/sys/kernel/debug/tracing} and reported
11973through standard log mechanisms like syslog.")
11974 (license license:gpl2)))
11975
11976(define-public renameat2
11977 ;; This is a Gist, with no release or tags.
11978 (let ((revision "0")
11979 (commit "5c5193f20142511a5fc7069a539f4e5aba0ea470"))
11980 (package
11981 (name "renameat2")
11982 (version (git-version "0.0.0" revision commit))
11983 (source (origin
11984 (method url-fetch)
11985 (uri (string-append "https://gist.githubusercontent.com/"
11986 "eatnumber1/f97ac7dad7b1f5a9721f/raw/"
11987 commit "/renameat2.c"))
11988 (sha256
11989 (base32
11990 "07b4hsxqjm610sdkm4nxhp0gnl2s7gzlh4zdnja5ay40v4x24bb9"))))
11991 (build-system gnu-build-system)
11992 (arguments
11993 (list
11994 #:tests? #f ;no test suite
11995 #:phases #~(modify-phases %standard-phases
11996 (delete 'configure)
11997 (replace 'build
11998 (lambda _
11999 (invoke #$(cc-for-target) "renameat2.c"
12000 "-o" "renameat2")))
12001 (replace 'install
12002 (lambda _
12003 (install-file "renameat2"
12004 (string-append #$output "/bin")))))))
12005 (home-page "https://gist.github.com/eatnumber1/f97ac7dad7b1f5a9721f")
12006 (synopsis "Command to call the renameat2 Linux system call")
12007 (description "This package provides a @command{renameat2} command that
12008calls the Linux-specific @code{renameat2} system call.")
12009 (license license:expat))))
12010
12011(define-public libgpiod
12012 (package
12013 (name "libgpiod")
12014 (version "2.2.2")
12015 (source
12016 (origin
12017 (method git-fetch)
12018 (uri
12019 (git-reference
12020 (url "https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git")
12021 (commit (string-append "v" version))))
12022 (file-name (git-file-name name version))
12023 (sha256 (base32 "10yiwrw80x0057w825zxmdbd54w9lbyf49bgqk1cryqapglfzqri"))))
12024 (build-system gnu-build-system)
12025 (arguments
12026 (list #:configure-flags
12027 #~(list "--enable-tools=yes"
12028 "--enable-bindings-cxx")))
12029 (native-inputs
12030 (list automake
12031 autoconf-2.71
12032 libtool
12033 autoconf-archive
12034 pkg-config))
12035 (synopsis "Interact with the Linux GPIO character device")
12036 (description
12037 "This package provides a C library with C++ bindings and
12038command-line tools for interacting with GPIO devices that avoids the usage of
12039older system-wide @file{/sys} interface.")
12040 (home-page "https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/")
12041 (license (list license:lgpl2.1+ ;; libgpiod
12042 license:gpl2+ ;; gpio-tools
12043 license:lgpl3+)))) ;; C++ bindings
12044
12045(define-public python-libgpiod
12046 (package
12047 (name "python-libgpiod")
12048 (version "2.3.0")
12049 (source
12050 (origin
12051 (method git-fetch)
12052 (uri
12053 (git-reference
12054 (url "https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git")
12055 (commit (string-append "python-v" version))))
12056 (file-name (git-file-name name version))
12057 (sha256 (base32 "1lkd7lgpb28pqf7p6lrwl0ss7r5ryiddmdcisnz6ixy796qhr8kr"))))
12058 (build-system pyproject-build-system)
12059 (arguments
12060 (list
12061 #:tests? #f ; tests require root, see README.md
12062 #:phases
12063 #~(modify-phases %standard-phases
12064 (add-after 'unpack 'cd-to-python-bindings
12065 (lambda _
12066 (chdir "bindings/python"))))))
12067 (native-inputs
12068 (list python-setuptools
12069 python-wheel
12070 libgpiod))
12071 (synopsis "Interact with the Linux GPIO character device")
12072 (description
12073 "This package provides Python bindings for interacting with GPIO devices
12074that avoids the usage of older system-wide @file{/sys} interface.")
12075 (home-page "https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/")
12076 (license (list license:lgpl2.1+ ;; libgpiod
12077 license:gpl2+ ;; gpio-tools
12078 license:lgpl3+)))) ;; C++ bindings
12079
12080(define-public libtraceevent
12081 (package
12082 (name "libtraceevent")
12083 (version "1.9.0")
12084 (source
12085 (origin
12086 (method git-fetch)
12087 (uri (git-reference
12088 (url "https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git")
12089 (commit (string-append name "-" version))))
12090 (file-name (git-file-name name version))
12091 (sha256
12092 (base32 "10fklw4znjhm8mlg6hwlipdyk7v3053lnrc5bpqifnsc8gwqbaz0"))))
12093 (build-system meson-build-system)
12094 (arguments
12095 (list
12096 #:configure-flags
12097 #~(list "-Ddoc=false")))
12098 (home-page "https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/")
12099 (synopsis "Linux kernel trace event library")
12100 (description
12101 "This library parses raw Linux kernel trace event formats.")
12102 (license (list license:gpl2
12103 license:lgpl2.1))))
12104
12105(define-public libtracefs
12106 (package
12107 (name "libtracefs")
12108 (version "1.8.3")
12109 (source
12110 (origin
12111 (method git-fetch)
12112 (uri (git-reference
12113 (url "https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git")
12114 (commit (string-append name "-" version))))
12115 (file-name (git-file-name name version))
12116 (sha256
12117 (base32 "1bc4mwf488nlja64zawjznvb6640vchjb25xa02v53x6qfb1mpmq"))))
12118 (build-system meson-build-system)
12119 (arguments
12120 (list
12121 #:configure-flags
12122 #~(list "-Ddoc=false")))
12123 (native-inputs
12124 (list bison
12125 flex
12126 pkg-config))
12127 (inputs (list libtraceevent))
12128 (home-page "https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git/")
12129 (synopsis "Linux kernel trace file system library")
12130 (description
12131 "This library provides APIs to access the Linux kernel's trace file
12132system.")
12133 (license (list license:gpl2
12134 license:lgpl2.1))))
12135
12136(define-public libtree
12137 (package
12138 (name "libtree")
12139 (version "3.1.1")
12140 (source
12141 (origin
12142 (method git-fetch)
12143 (uri (git-reference
12144 (url "https://github.com/haampie/libtree")
12145 (commit (string-append "v" version))))
12146 (file-name (git-file-name name version))
12147 (patches (search-patches "libtree-fix-check-non-x86.patch"))
12148 (sha256
12149 (base32 "1jbc60cslzcfxk9jwva51ncr1zl1nz0fkgfjdckgv81is11nswmb"))))
12150 (arguments
12151 (list #:make-flags
12152 ;; NOTE: Official documentation recommends to build libtree with
12153 ;; "-static" flag.
12154 #~(list (string-append "CC=" #$(cc-for-target))
12155 (string-append "PREFIX=" #$output))
12156 #:phases
12157 #~(modify-phases %standard-phases
12158 (add-after 'unpack 'fix-tests
12159 ;; XXX: '08_nodeflib' fails as 'libtree' returns a non-zero
12160 ;; code in one of the tests.
12161 ;;
12162 ;; See <https://github.com/haampie/libtree/issues/80>).
12163 (lambda _
12164 (substitute* "tests/08_nodeflib/Makefile"
12165 (("! ../../libtree -vvv exe_b")
12166 "../../libtree -vvv exe_b"))))
12167 (delete 'configure))))
12168 (build-system gnu-build-system)
12169 (home-page "https://github.com/haampie/libtree")
12170 (synopsis "Show output of @command{ldd} as a tree")
12171 (description
12172 "This tool turns @command{ldd} into a tree and explains how shared
12173libraries are found or why they cannot be located.")
12174 (license license:expat)))
12175
12176(define-public touchegg
12177 (package
12178 (name "touchegg")
12179 (version "2.0.18")
12180 (source
12181 (origin
12182 (method git-fetch)
12183 (uri (git-reference
12184 (url "https://github.com/JoseExposito/touchegg")
12185 (commit version)))
12186 (file-name (git-file-name name version))
12187 (sha256
12188 (base32 "0m8zgihij14b8dxrxxvpl8sdsx49mjlnxnm0fhgfxscy7n07kcpc"))))
12189 (build-system cmake-build-system)
12190 (arguments
12191 `(#:tests? #f ; No tests exist
12192 #:configure-flags
12193 (list "-DUSE_SYSTEMD=OFF"))) ; No systemd
12194 (native-inputs
12195 (list
12196 pkg-config))
12197 (inputs
12198 (list
12199 cairo
12200 gtk+
12201 libgudev
12202 libinput
12203 libxrandr
12204 libxtst
12205 pugixml))
12206 (home-page "https://github.com/JoseExposito/touchegg")
12207 (synopsis "Multitouch gesture recognizer")
12208 (description
12209 "Touchégg is an application that runs in the background and transform the
12210gestures you make on your touchpad or touchscreen into visible actions in your
12211desktop.")
12212 (license license:gpl3+)))
12213
12214(define-public evtest
12215 (package
12216 (name "evtest")
12217 (version "1.36")
12218 (source (origin
12219 (method git-fetch)
12220 (uri (git-reference
12221 (url "https://gitlab.freedesktop.org/libevdev/evtest")
12222 (commit (string-append "evtest-" version))))
12223 (file-name (git-file-name name version))
12224 (sha256
12225 (base32
12226 "0mwjvz0fwwcwm4fpw0m4x8bcxpnzjkiy7fpb438vf4i5g5q0dc1k"))))
12227 (build-system gnu-build-system)
12228 (arguments
12229 (list #:tests? #f ;No tests exist
12230 #:make-flags #~(list (string-append "CC="
12231 #$(cc-for-target))
12232 (string-append "PREFIX="
12233 #$output))
12234 #:phases #~(modify-phases %standard-phases
12235 (add-after 'unpack 'generate-doc
12236 (lambda _
12237 (invoke "asciidoc" "-d" "manpage"
12238 "-b" "docbook"
12239 "-o" "evtest.1.xml"
12240 "evtest.txt")
12241 (invoke "xsltproc" "--nonet"
12242 (string-append
12243 #$(this-package-native-input "docbook-xsl")
12244 "/xml/xsl/docbook-xsl-"
12245 #$(package-version
12246 (this-package-native-input "docbook-xsl"))
12247 "/manpages/docbook.xsl")
12248 "evtest.1.xml")))
12249 (replace 'bootstrap
12250 (lambda _
12251 (setenv "CONFIG_SHELL" (which "sh"))
12252 (invoke "autoreconf" "-fi"))))))
12253 (native-inputs (list autoconf
12254 automake
12255 bash-minimal
12256 xmlto
12257 docbook-xsl
12258 libxslt
12259 asciidoc))
12260 (home-page "https://gitlab.freedesktop.org/libevdev/evtest")
12261 (synopsis "Kernel evdev device information and monitor")
12262 (description
12263 "@code{evtest} is a tool to print @code{evdev} kernel events. It reads
12264directly from the kernel device and prints a device description and the events
12265with the value and the symbolic name.")
12266 (license license:gpl2+)))
12267
12268(define-public tp-smapi-module
12269 (package
12270 (name "tp-smapi-module")
12271 (version "0.44")
12272 (source (origin
12273 (method git-fetch)
12274 (uri (git-reference
12275 (url "https://github.com/linux-thinkpad/tp_smapi")
12276 (commit (string-append "tp-smapi/" version))))
12277 (file-name (git-file-name name version))
12278 (sha256
12279 (base32
12280 "0kzbks07bh5jbi1n311zp9cbp1xxyzi7nys8wq1k0k5ig81h9w6k"))))
12281 (build-system linux-module-build-system)
12282 (arguments
12283 `(#:tests? #f)) ;there are none.
12284 (home-page "https://github.com/linux-thinkpad/tp_smapi")
12285 (synopsis
12286 "Linux Kernel module exposing features of ThinkPad hardware")
12287 (description
12288 "This package provides a Linux Kernel module that controls
12289battery charging of specific ThinkPad laptops. It also includes an improved
12290version of the HDAPS driver. The underlying hardware interfaces are
12291@acronym{SMAPI, System Management Application Program Interface} and direct
12292access to the embedded controller.")
12293 (license license:gpl2+)))
12294
12295(define-public modprobed-db
12296 (package
12297 (name "modprobed-db")
12298 (version "2.48")
12299 (source (origin
12300 (method git-fetch)
12301 (uri (git-reference
12302 (url "https://github.com/graysky2/modprobed-db")
12303 (commit (string-append "v" version))))
12304 (file-name (git-file-name name version))
12305 (sha256
12306 (base32
12307 "0jscinga32jjvy3vwl4s1pyd5fjgqhmmk010k665nhil302hzjdc"))))
12308 (build-system gnu-build-system)
12309 (arguments
12310 (list #:tests? #f ;no tests
12311 #:make-flags
12312 #~(list (string-append "PREFIX=" #$output)
12313 "INITDIR_SYSTEMD=no-thanks")
12314 #:phases
12315 #~(modify-phases %standard-phases
12316 (delete 'configure)
12317 (add-after 'install 'fix-path
12318 (lambda* (#:key inputs #:allow-other-keys)
12319 (substitute* (string-append #$output "/bin/modprobed-db")
12320 (("/usr") #$output)
12321 (((string-append "(" (string-join (list "awk"
12322 "cp"
12323 "cut"
12324 "getent"
12325 "grep"
12326 "logname"
12327 "md5sum"
12328 "mkdir"
12329 "mv"
12330 "sed"
12331 "sort"
12332 "uniq"
12333 "wc")
12334 "|") ")") m)
12335 (search-input-file inputs (string-append "/bin/" m)))
12336 (("modprobe ")
12337 (string-append
12338 (search-input-file inputs "/bin/modprobe") " "))))))))
12339 (inputs (list coreutils kmod gawk glibc grep sed))
12340 (home-page "https://wiki.archlinux.org/title/Modprobed-db")
12341 (synopsis "Keep track of Linux modules that have been probed")
12342 (description
12343 "Modprobed-db is a useful utility for users wishing to build a minimal
12344kernel via a @code{make localmodconfig}. In a nutshell, this @command{make}
12345target creates a config based on the current config and a list of modules you
12346define (that @command{modprobed-db} keeps for you). It then disables any
12347module option that is not needed thus not building extraneous modules. This
12348results in a system-specific, streamlined kernel package and footprint as well
12349as reduced compilation times.
12350
12351Modprobed-db simply logs every module ever probed on the target system to a
12352text-based database (@file{$XDG_CONFIG_HOME/modprobed-db}), which can be read
12353directly by @code{make localmodconfig} as described above.")
12354 (license license:expat)))
12355
12356(define-public kernel-hardening-checker
12357 (package
12358 (name "kernel-hardening-checker")
12359 (version "0.6.17.1")
12360 (source (origin
12361 (method git-fetch)
12362 (uri (git-reference
12363 (url "https://github.com/a13xp0p0v/kernel-hardening-checker")
12364 (commit (string-append "v" version))))
12365 (file-name (git-file-name name version))
12366 (sha256
12367 (base32
12368 "04r9bbayhs1ik84908q148k9djawy69zarxw0vc31dfbf64mni62"))))
12369 (build-system pyproject-build-system)
12370 (arguments
12371 (list #:tests? #f)) ;no active tests, runtime only, see GitHub Actions
12372 (native-inputs
12373 (list python-setuptools))
12374 (home-page "https://github.com/a13xp0p0v/kernel-hardening-checker")
12375 (synopsis
12376 "Tool for checking the security hardening options of the Linux kernel")
12377 (description
12378 "@code{kernel-hardening-checker} is a tool for checking the security
12379hardening options of the Linux kernel. Provided preferences are based on
12380suggestions from various sources, including:
12381
12382@itemize
12383@item KSPP recommended settings
12384@item CLIP OS kernel configuration
12385@item Last public grsecurity patch (options which they disable)
12386@item SECURITY_LOCKDOWN_LSM patchset
12387@item Direct feedback from the Linux kernel maintainers
12388@end itemize\n
12389This tool supports checking Kconfig options and kernel cmdline parameters.")
12390 (license license:gpl3)))
12391
12392(define-deprecated-package kconfig-hardened-check
12393 kernel-hardening-checker)
12394
12395(define-public firejail
12396 (package
12397 (name "firejail")
12398 (version "0.9.78")
12399 (source (origin
12400 (method git-fetch)
12401 (uri (git-reference
12402 (url "https://github.com/netblue30/firejail")
12403 (commit version)))
12404 (file-name (git-file-name name version))
12405 (sha256
12406 (base32
12407 "18bsnwyg7aidm74qckrp437gr0zy9bpq1b1wr6mfnj61v74fwwxs"))))
12408 (arguments
12409 (list #:phases
12410 #~(modify-phases %standard-phases
12411 (replace 'check
12412 (lambda* (#:key tests? #:allow-other-keys)
12413 (when tests?
12414 (with-directory-excursion "test"
12415 (invoke "make"))))))))
12416 (build-system gnu-build-system)
12417 (inputs
12418 (list apparmor xdg-dbus-proxy))
12419 (synopsis "Linux namespaces sandbox program")
12420 (description
12421 "Firejail is a SUID sandbox program that reduces the risk of security
12422breaches by restricting the running environment of untrusted applications
12423using Linux namespaces, seccomp-bpf and Linux capabilities. The software
12424includes sandbox profiles for a number of common Linux programs. Firejail
12425should be added to the list of setuid programs in the system configuration to
12426work properly.")
12427 (home-page "https://github.com/netblue30/firejail")
12428 (supported-systems
12429 (filter (cut string-suffix? "-linux" <>) %supported-systems))
12430 (license license:gpl2+)))
12431
12432(define-public firejail-disable-sandbox-check
12433 (package/inherit
12434 firejail
12435 (name "firejail-disable-sandbox-check")
12436 (arguments
12437 (substitute-keyword-arguments arguments
12438 ((#:configure-flags flags #~'())
12439 #~(append #$flags
12440 (list "--disable-sandbox-check")))))
12441 (description
12442 (string-append (package-description firejail)
12443 " Builded with @code{--disable-sandbox-check}, which is
12444 only intended for development."))))
12445
12446(define-public edac-utils
12447 (package
12448 (name "edac-utils")
12449 (version "0.18")
12450 (source (origin
12451 (method git-fetch)
12452 (uri (git-reference
12453 (url "https://github.com/grondo/edac-utils.git")
12454 (commit version)))
12455 (file-name (string-append name "-" version "-checkout"))
12456 (sha256
12457 (base32
12458 "04j686m58wsnyy5di7rz0sw9jahlm4ziwxjmgs31pjb87vzw3xgp"))))
12459 (build-system gnu-build-system)
12460 (native-inputs
12461 (list perl))
12462 (inputs
12463 (list sysfsutils))
12464 (synopsis "Memory error detection and correction userspace helpers")
12465 (description "This package provides userspace helpers for memory
12466error detection and correction (EDAC).")
12467 (home-page "https://github.com/grondo/edac-utils")
12468 (license license:gpl2+)))
12469
12470(define-public spectre-meltdown-checker
12471 (package
12472 (name "spectre-meltdown-checker")
12473 (version "0.46")
12474 (source (origin
12475 (method git-fetch)
12476 (uri (git-reference
12477 (url "https://github.com/speed47/spectre-meltdown-checker")
12478 (commit (string-append "v" version))))
12479 (file-name (git-file-name name version))
12480 (patches
12481 (search-patches
12482 "spectre-meltdown-checker-externalize-fwdb.patch"))
12483 ;; Remove builtin firmware database.
12484 (modules '((guix build utils)))
12485 (snippet '(substitute* "spectre-meltdown-checker.sh"
12486 (("^# [AI],.*") "")))
12487 (sha256
12488 (base32
12489 "0j42p6dayb7k87kf8sqimxlaswis3qh0569a15zccyknv9vf129k"))))
12490 (build-system copy-build-system)
12491 (arguments
12492 (list
12493 #:install-plan
12494 #~'(("spectre-meltdown-checker.sh" "bin/spectre-meltdown-checker"))
12495 #:phases
12496 #~(modify-phases %standard-phases
12497 (add-after 'unpack 'fixpath
12498 (lambda* (#:key inputs #:allow-other-keys)
12499 (define* (find-command inputs cmd #:optional (bin "bin"))
12500 (search-input-file inputs (string-append bin "/" cmd)))
12501 (substitute* "spectre-meltdown-checker.sh"
12502 ;; ${opt_arch_prefix}CMD
12503 (("\\$\\{opt_arch_prefix\\}\\<(nm|objdump|readelf|strings)\\>"
12504 all cmd)
12505 (find-command inputs cmd))
12506
12507 ;; Commands safe to substitute directly.
12508 (("\\<(awk|(base|dir)name|bunzip2|g(un)?zip|lz4)\\>" all cmd)
12509 (find-command inputs cmd))
12510 (("\\<(lzop|mktemp|modprobe|pgrep|rmmod|umount)\\>" all cmd)
12511 (find-command inputs cmd))
12512 (("\\<(unlzma|unxz|unzstd|uuencode)\\>" all cmd)
12513 (find-command inputs cmd))
12514
12515 ;; Commands which should only be substituted based on their
12516 ;; surroundings: First up, dd.
12517 (("\\<(dd)\\> if=" all cmd)
12518 (string-append
12519 (find-command inputs cmd)
12520 " if="))
12521
12522 ;; Another special case: sysctl is in sbin.
12523 (("(if |\\$\\( *)\\<(sysctl)\\>" all pre cmd)
12524 (string-append pre (find-command inputs cmd "sbin")))
12525
12526 ;; Meow
12527 (("cat (<<EOF|\"\\$)" all what)
12528 (string-append (find-command inputs "cat") " " what))
12529 (("'cat'")
12530 (string-append "'" (find-command inputs "cat") "'"))
12531 (("\"cat\"")
12532 (string-append "\"" (find-command inputs "cat") "\""))
12533
12534 ;; ${COMMAND} -
12535 ;; ${COMMAND} ^
12536 (("\\<(base64|cut|grep|head|id|mount)\\> ([-^])" all cmd suffix)
12537 (string-append (find-command inputs cmd) " " suffix))
12538 (("\\<(od|perl|rm|uname|xargs)\\> ([-^])" all cmd suffix)
12539 (string-append (find-command inputs cmd) " " suffix))
12540
12541 ;; ${COMMAND} |
12542 (("\\<(dmesg)\\> \\|" all cmd)
12543 (string-append (find-command inputs cmd) " |"))
12544 ;; | ${COMMAND}
12545 (("\\| \\<(grep|sed|sort|stat|tr)\\>" all cmd)
12546 (string-append "| " (find-command inputs cmd)))
12547
12548 ;; Command in sub-shell, i.e. $($COMMAND ...)
12549 (("\\$\\( *(\\<cat|find|grep|mount|nproc|stat|tr\\>)"
12550 all cmd)
12551 (string-append "$(" (find-command inputs cmd)))
12552
12553 ;; command -v
12554 (("command -v \"*\\<(base64|nproc|perl|printf)\\>\"*" all cmd)
12555 (string-append "command -v " (find-command inputs cmd)))))))))
12556 (inputs (list kmod lz4 lzop perl procps sharutils util-linux zstd))
12557 (home-page "https://github.com/speed47/spectre-meltdown-checker")
12558 (synopsis "CPU vulnerability / mitigation checker")
12559 (description
12560 "This package provides a shell script to assess your system's resilience
12561against the several transient execution CVEs that were published since early
125622018, and gives guidance as to how to mitigate them.")
12563 (license license:gpl3)))
12564
12565(define-public csmith
12566 (package
12567 (name "csmith")
12568 (version "2.3.0")
12569 (source (origin
12570 (method git-fetch)
12571 (uri (git-reference
12572 (url "https://github.com/csmith-project/csmith")
12573 (commit (string-append "csmith-" version))))
12574 (file-name (git-file-name name version))
12575 (sha256
12576 (base32
12577 "0nhrsnv6cny14xz68qb1h30fbwc05adkisk51p3x63mydm60ddl3"))))
12578 (build-system gnu-build-system)
12579 (native-inputs
12580 (list autoconf automake libtool m4 perl))
12581 (arguments
12582 (list
12583 #:tests? #f ;no test suite
12584 ;; Do not install headers under 'include/csmith-VERSION' but in
12585 ;; 'include/csmith'.
12586 #:phases
12587 `(modify-phases %standard-phases
12588 (add-after 'unpack 'patch-includedir
12589 (lambda _
12590 (substitute* "runtime/Makefile.am"
12591 (("\\$\\(includedir\\)/\\$\\(PACKAGE\\)-\\$\\(VERSION\\)")
12592 "$(includedir)/$(PACKAGE)"))))
12593 (add-before 'bootstrap 'force-bootstrap
12594 (lambda _
12595 (delete-file "configure"))))))
12596 (home-page "https://github.com/csmith-project/csmith")
12597 (synopsis "Random generator of C programs")
12598 (description "The primary purpose of Csmith is to find compiler bugs with
12599random programs using differential testing.")
12600 (license license:bsd-4)))
12601
12602(define-public ipvsadm
12603 (package
12604 (name "ipvsadm")
12605 (version "1.31")
12606 (source
12607 (origin
12608 (method url-fetch)
12609 (uri (string-append "https://kernel.org/pub/linux/utils/kernel"
12610 "/ipvsadm/ipvsadm-" version ".tar.xz"))
12611 (sha256
12612 (base32 "1nyzpv1hx75k9lh0vfxfhc0p2fpqaqb38xpvs8sn88m1nljmw2hs"))))
12613 (build-system gnu-build-system)
12614 (native-inputs (list linux-libre-headers pkg-config which))
12615 (inputs (list libnl popt))
12616 (arguments
12617 (list #:tests? #f
12618 #:parallel-build? #f ;build fails randomly with '-j'
12619 #:make-flags
12620 #~(list (string-join
12621 (list "CFLAGS="
12622 (string-append "-I"
12623 #$(this-package-input "libnl")
12624 "/include/libnl3")
12625 (string-append "-L" #$(this-package-input "libnl")
12626 "/lib")
12627 "-fPIC")
12628 " ")
12629 (string-append "CC=" #$(cc-for-target))
12630 (string-append "SBIN=" #$output "/sbin")
12631 (string-append "INIT=" #$output "/etc/init.d")
12632 (string-append "MANDIR=" #$output "/share/man"))
12633 #:phases #~(modify-phases %standard-phases
12634 (delete 'configure))))
12635 (home-page "http://www.linuxvirtualserver.org/software/ipvs.html")
12636 (synopsis "IP virtual server administration utility")
12637 (description "@code{ipvsadm(8)} is used to set up, maintain or inspect the
12638virtual server table in the Linux kernel. The Linux Virtual Server can be used
12639to build scalable network services based on a cluster of two or more nodes.")
12640 (license license:gpl2+)))
12641
12642(define-public ryzenadj
12643 (package
12644 (name "ryzenadj")
12645 (version "0.17.0")
12646 (source
12647 (origin
12648 (method git-fetch)
12649 (uri (git-reference
12650 (url "https://github.com/flygoat/ryzenadj")
12651 (commit (string-append "v" version))))
12652 (file-name (git-file-name name version))
12653 (sha256
12654 (base32 "0dpznl4h1f5syq5464a0h9grqlvlp0qmjxr59nq3gp363gr5vjfv"))
12655 (modules '((guix build utils)))
12656 (snippet
12657 '(begin
12658 (delete-file-recursively "win32")))))
12659 (build-system cmake-build-system)
12660 (inputs (list pciutils))
12661 (arguments
12662 (list
12663 #:tests? #f ;No test suite
12664 #:build-type "Release"))
12665 (home-page "https://github.com/flygoat/ryzenadj")
12666 (synopsis "Power management tool for AMD Ryzen APUs")
12667 (description
12668 "@command{ryzenadj} is an utility to adjust power management settings for
12669AMD Ryzen mobile processors. You will need to ensure it can access /dev/mem,
12670for instance by using the \"iomem=relaxed\" kernel argument.")
12671 (license license:lgpl3)))
12672
12673(define-public ryzen-smu
12674 (package
12675 (name "ryzen-smu")
12676 (version "0.1.5")
12677 (source (origin
12678 (method git-fetch)
12679 (uri (git-reference
12680 (url "https://gitlab.com/leogx9r/ryzen_smu.git")
12681 (commit (string-append "v" version))))
12682 (file-name (git-file-name name version))
12683 (sha256
12684 (base32
12685 "010la2a8zp7rljlg5ssc9ragzva4ca05gvzlicjagl508659d2wz"))))
12686 (build-system linux-module-build-system)
12687 (arguments
12688 `(#:tests? #f)) ; no tests
12689 (synopsis "System Management Unit driver for AMD Ryzen processors")
12690 (description "This package provides a way to access the
12691System Management Unit for certain AMD Ryzen processors.
12692This includes access to the System Management Network.")
12693 (home-page "https://gitlab.com/leogx9r/ryzen_smu")
12694 (license license:gpl2)))
12695
12696(define-public hid-wiimote-plus
12697 (package
12698 (name "hid-wiimote-plus")
12699 (version "1.0.0")
12700 (source
12701 (origin
12702 (method git-fetch)
12703 (uri (git-reference
12704 (url "https://github.com/dkosmari/hid-wiimote-plus")
12705 (commit (string-append "v" version))))
12706 (file-name (git-file-name name version))
12707 (sha256
12708 (base32 "0vly8z9876yiaxx77ca9lbf9hfv5xichkkxxczjhbs2qwr819k1k"))))
12709 (build-system linux-module-build-system)
12710 (arguments
12711 (list #:tests? #f)) ; No tests.
12712 (synopsis "WiiMote HID kernel module")
12713 (description "This package provides a WiiMote driver that follows the
12714Linux input convention. Specifically, that allows you to use the D-pad
12715as a gamepad.")
12716 (home-page "https://github.com/dkosmari/hid-wiimote-plus")
12717 (license license:gpl2+)))
12718
12719(define-public python-evemu
12720 (package
12721 (name "python-evemu")
12722 (version "2.7.0")
12723 (source (origin
12724 (method git-fetch)
12725 (uri (git-reference
12726 (url "https://gitlab.freedesktop.org/libevdev/evemu")
12727 (commit (string-append "v" version))))
12728 (file-name (git-file-name name version))
12729 (sha256
12730 (base32
12731 "1sxf6v2wnajj9srlkfjfymjmmp4dlq73gzjcjmaw015a3c0xl029"))))
12732 (build-system gnu-build-system)
12733 (arguments
12734 (list #:tests? #f ; would open device files
12735 #:phases
12736 #~(modify-phases %standard-phases
12737 (add-after 'unpack 'patch
12738 (lambda* (#:key inputs #:allow-other-keys)
12739 (substitute* "python/evemu/base.py"
12740 (("\"libevdev.so\"")
12741 (string-append "\"" (assoc-ref inputs "libevdev")
12742 "/lib/libevdev.so\""))))))))
12743 (native-inputs
12744 (list asciidoc autoconf automake libtool docbook-xsl pkg-config
12745 python-wrapper xmlto))
12746 (inputs
12747 (list libevdev))
12748 (synopsis "Record and replay input device events")
12749 (description "This package provides a way to record and replay device
12750descriptions and events, making it possible to emulate input devices
12751through the Linux kernel's input system. Emulated devices are for most
12752practical purposes indistinguishable from real devices.
12753
12754It provides a command line program and also a Python library.")
12755 (home-page "https://www.freedesktop.org/wiki/Evemu/")
12756 (license license:gpl3)))
12757
12758(define-public dualsensectl
12759 (package
12760 (name "dualsensectl")
12761 (version "0.7")
12762 (source (origin
12763 (method git-fetch)
12764 (uri (git-reference
12765 (url "https://github.com/nowrep/dualsensectl.git")
12766 (commit (string-append "v" version))))
12767 (file-name (git-file-name name version))
12768 (sha256
12769 (base32
12770 "05snsp5r3hc2yc1nf0w4aam1my4h0lkxnmy7k4glxvasd9jwahzw"))))
12771 (build-system meson-build-system)
12772 (native-inputs
12773 (list pkg-config))
12774 (inputs
12775 (list eudev dbus hidapi))
12776 (synopsis "Linux tool for controlling PS5 DualSense controller")
12777 (description "This package provides a Linux tool for controlling a PS5
12778DualSense controller. It has to be already connected via USB or connected
12779via Bluetooth.")
12780 (home-page "https://github.com/nowrep/dualsensectl")
12781 (license license:gpl2)))