projects/guix·blob ruby-team · refs

12868 lines · 552.8 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-2026 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 © 2025 Dariqq <[email protected]>
90;;; Copyright © 2026 Justin Veilleux <[email protected]>
91;;; Copyright © 2026 Simen Endsjø <[email protected]>
92;;;
93;;; This file is part of GNU Guix.
94;;;
95;;; GNU Guix is free software; you can redistribute it and/or modify it
96;;; under the terms of the GNU General Public License as published by
97;;; the Free Software Foundation; either version 3 of the License, or (at
98;;; your option) any later version.
99;;;
100;;; GNU Guix is distributed in the hope that it will be useful, but
101;;; WITHOUT ANY WARRANTY; without even the implied warranty of
102;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
103;;; GNU General Public License for more details.
104;;;
105;;; You should have received a copy of the GNU General Public License
106;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
107
108(define-module (gnu packages linux)
109 #:use-module (gnu packages acl)
110 #:use-module (gnu packages admin)
111 #:use-module (gnu packages algebra)
112 #:use-module (gnu packages apparmor)
113 #:use-module (gnu packages audio)
114 #:use-module (gnu packages autotools)
115 #:use-module (gnu packages backup)
116 #:use-module (gnu packages base)
117 #:use-module (gnu packages bash)
118 #:use-module (gnu packages bison)
119 #:use-module (gnu packages boost)
120 #:use-module (gnu packages calendar)
121 #:use-module (gnu packages check)
122 #:use-module (gnu packages compression)
123 #:use-module (gnu packages cpio)
124 #:use-module (gnu packages cpp)
125 #:use-module (gnu packages crypto)
126 #:use-module (gnu packages cryptsetup)
127 #:use-module (gnu packages curl)
128 #:use-module (gnu packages databases)
129 #:use-module (gnu packages datastructures)
130 #:use-module (gnu packages dbm)
131 #:use-module (gnu packages disk)
132 #:use-module (gnu packages dlang)
133 #:use-module (gnu packages dns)
134 #:use-module (gnu packages docbook)
135 #:use-module (gnu packages documentation)
136 #:use-module (gnu packages elf)
137 #:use-module (gnu packages file)
138 #:use-module (gnu packages compiler-tools)
139 #:use-module (gnu packages fontutils)
140 #:use-module (gnu packages freedesktop)
141 #:use-module (gnu packages gawk)
142 #:use-module (gnu packages gcc)
143 #:use-module (gnu packages gettext)
144 #:use-module (gnu packages glib)
145 #:use-module (gnu packages gnome)
146 #:use-module (gnu packages gnupg)
147 #:use-module (gnu packages golang)
148 #:use-module (gnu packages golang-xyz)
149 #:use-module (gnu packages gperf)
150 #:use-module (gnu packages graphviz)
151 #:use-module (gnu packages groff)
152 #:use-module (gnu packages gstreamer)
153 #:use-module (gnu packages gtk)
154 #:use-module (gnu packages guile)
155 #:use-module (gnu packages haskell-apps)
156 #:use-module (gnu packages haskell-xyz)
157 #:use-module (gnu packages image)
158 #:use-module (gnu packages kde-frameworks)
159 #:use-module (gnu packages kde-graphics)
160 #:use-module (gnu packages libedit)
161 #:use-module (gnu packages libevent)
162 #:use-module (gnu packages libunwind)
163 #:use-module (gnu packages libusb)
164 #:use-module (gnu packages llvm)
165 #:use-module (gnu packages lsof)
166 #:use-module (gnu packages lua)
167 #:use-module (gnu packages m4)
168 #:use-module (gnu packages man)
169 #:use-module (gnu packages maths)
170 #:use-module (gnu packages multiprecision)
171 #:use-module (gnu packages ncurses)
172 #:use-module (gnu packages netpbm)
173 #:use-module (gnu packages networking)
174 #:use-module (gnu packages nss)
175 #:use-module (gnu packages onc-rpc)
176 #:use-module (gnu packages oneapi)
177 #:use-module (gnu packages patchutils)
178 #:use-module (gnu packages pciutils)
179 #:use-module (gnu packages perl)
180 #:use-module (gnu packages photo)
181 #:use-module (gnu packages pkg-config)
182 #:use-module (gnu packages polkit)
183 #:use-module (gnu packages popt)
184 #:use-module (gnu packages protobuf)
185 #:use-module (gnu packages pulseaudio)
186 #:use-module (gnu packages python)
187 #:use-module (gnu packages python-build)
188 #:use-module (gnu packages python-xyz)
189 #:use-module (gnu packages qt)
190 #:use-module (gnu packages readline)
191 #:use-module (gnu packages regex)
192 #:use-module (gnu packages rocm)
193 #:use-module (gnu packages rpc)
194 #:use-module (gnu packages rrdtool)
195 #:use-module (gnu packages rsync)
196 #:use-module (gnu packages rust-sources)
197 #:use-module (gnu packages samba)
198 #:use-module (gnu packages sdl)
199 #:use-module (gnu packages selinux)
200 #:use-module (gnu packages serialization)
201 #:use-module (gnu packages slang)
202 #:use-module (gnu packages sphinx)
203 #:use-module (gnu packages sqlite)
204 #:use-module (gnu packages swig)
205 #:use-module (gnu packages texinfo)
206 #:use-module (gnu packages textutils)
207 #:use-module (gnu packages tls)
208 #:use-module (gnu packages valgrind)
209 #:use-module (gnu packages video)
210 #:use-module (gnu packages vim)
211 #:use-module (gnu packages vulkan)
212 #:use-module (gnu packages web)
213 #:use-module (gnu packages xdisorg)
214 #:use-module (gnu packages xiph)
215 #:use-module (gnu packages xml)
216 #:use-module (gnu packages xorg)
217 #:use-module (gnu packages)
218 #:use-module (guix build-system cmake)
219 #:use-module (guix build-system copy)
220 #:use-module (guix build-system gnu)
221 #:use-module (guix build-system go)
222 #:use-module (guix build-system linux-module)
223 #:use-module (guix build-system meson)
224 #:use-module (guix build-system pyproject)
225 #:use-module (guix build-system qt)
226 #:use-module (guix build-system trivial)
227 #:use-module (guix deprecation) ;for libcap/next
228 #:use-module (guix download)
229 #:use-module (guix gexp)
230 #:use-module (guix git-download)
231 #:use-module ((guix licenses) #:prefix license:)
232 #:use-module (guix monads)
233 #:use-module (guix packages)
234 #:use-module (guix platform)
235 #:use-module (guix store)
236 #:use-module (guix utils)
237 #:use-module (ice-9 match)
238 #:use-module (ice-9 regex)
239 #:use-module (srfi srfi-1)
240 #:use-module (srfi srfi-2)
241 #:use-module (srfi srfi-26)
242 #:export (customize-linux
243 make-defconfig))
244
245
246
247;;;
248;;; Linux kernel customization functions.
249;;;
250
251(define* (customize-linux #:key name
252 (linux linux-libre)
253 source
254 defconfig
255 modconfig
256 (configs "")
257 extra-version)
258 "Make a customized Linux package NAME derived from the LINUX package.
259
260If NAME is not given, then it defaults to the same name as the LINUX package.
261
262Unless SOURCE is given the source of LINUX is used.
263
264A DEFCONFIG file to be used can be given as an origin, as a file-like object
265(file-append, local-file etc.), or as a string with the name of a defconfig file
266available in the Linux sources. If DEFCONFIG is not given, then a defconfig
267file will be saved from the LINUX package configuration.
268
269MODCONFIG is an origin or file-like object used for make localmodconfig to
270disable unlisted modules. For instance, this can come from using modprobed-db
271periodically on a running machine to find all loaded modules.
272
273Additional CONFIGS will be used to modify the given or saved defconfig, which
274will finally be used to build Linux.
275
276CONFIGS can be a list of strings, with one configuration per line. The usual
277defconfig syntax has to be used, but there is a special extension to ease the
278removal of configurations. Comment lines are supported as well.
279
280Here is an example:
281
282 '(;; This string defines the version tail in 'uname -r'.
283 \"CONFIG_LOCALVERSION=\\\"-handcrafted\\\"
284 ;; This '# CONFIG_... is not set' syntax has to match exactly!
285 \"# CONFIG_BOOT_CONFIG is not set\"
286 \"CONFIG_NFS_SWAP=y\"
287 ;; This is a multiline configuration:
288 \"CONFIG_E1000=y
289# This is a comment, below follows an extension to unset a configuration:
290CONFIG_CMDLINE_EXTEND\")
291
292A string of configurations instead of a list of configuration strings is also
293possible.
294
295EXTRA-VERSION can be a string overwriting the EXTRAVERSION setting of the LINUX
296package, after being prepended by a hyphen. It will be visible in the output
297of 'uname -r' behind the Linux version numbers."
298 (package
299 (inherit linux)
300 (name (or name (package-name linux)))
301 (source (or source (package-source linux)))
302 (arguments
303 (substitute-keyword-arguments
304 (package-arguments linux)
305 ((#:imported-modules imported-modules %default-gnu-imported-modules)
306 `((guix build kconfig) ,@imported-modules))
307 ((#:modules modules)
308 `((guix build kconfig) ,@modules))
309 ((#:phases phases)
310 #~(modify-phases #$phases
311 (replace 'configure
312 (lambda* (#:key inputs #:allow-other-keys #:rest arguments)
313 (setenv "EXTRAVERSION"
314 #$(and extra-version
315 (not (string-null? extra-version))
316 (string-append "-" extra-version)))
317 (let* ((configs (string-append "arch/" #$(linux-srcarch)
318 "/configs/"))
319 (guix_defconfig (string-append configs
320 "guix_defconfig")))
321 #$(cond
322 ((not defconfig)
323 #~(begin
324 ;; Call the original 'configure phase.
325 (apply (assoc-ref #$phases 'configure) arguments)
326 ;; Save a defconfig file.
327 (invoke "make" "savedefconfig")
328 ;; Move the saved defconfig to the proper location.
329 (rename-file "defconfig"
330 guix_defconfig)))
331 ((string? defconfig)
332 ;; Use another existing defconfig from the Linux sources.
333 #~(rename-file (string-append configs #$defconfig)
334 guix_defconfig))
335 (else
336 ;; Copy the defconfig input to the proper location.
337 #~(copy-file #$defconfig guix_defconfig)))
338 (chmod guix_defconfig #o644)
339 (modify-defconfig guix_defconfig '#$configs)
340 (invoke "make" "guix_defconfig")
341 (verify-config ".config" guix_defconfig)
342 ;; Minimize module building if provided e.g. a modprobed-db
343 ;; database.
344 (if #$modconfig
345 (invoke "make" (string-append "LSMOD=" #$modconfig)
346 "localmodconfig")))))))))))
347
348(define (make-defconfig uri sha256-as-base32)
349 (origin (method url-fetch)
350 (uri uri)
351 (sha256 (base32 sha256-as-base32))))
352
353(define (linux-srcarch)
354 "Return the linux SRCARCH name, which is set in the toplevel Makefile of
355Linux and denotes the architecture-specific directory name below arch/ in its
356source code. Some few architectures share a common folder. It resembles the
357definition of SRCARCH based on ARCH in the Makefile and may be used to place a
358defconfig file in the proper path."
359 (let ((linux-arch (platform-linux-architecture
360 (lookup-platform-by-target-or-system
361 (or (%current-target-system)
362 (%current-system))))))
363 (match linux-arch
364 ("i386" "x86")
365 ("x86_64" "x86")
366 ("sparc32" "sparc")
367 ("sparc64" "sparc")
368 ("sh64" "sh")
369 (_ linux-arch))))
370
371(define-public (system->defconfig system)
372 "Some systems (notably powerpc-linux) require a special target for kernel
373defconfig. Return the appropriate Make target if applicable, otherwise return
374\"defconfig\"."
375 (cond ((string-prefix? "powerpc-" system) "pmac32_defconfig")
376 ((string-prefix? "powerpc64-" system) "ppc64_defconfig")
377 ((string-prefix? "powerpc64le-" system) "ppc64_defconfig")
378 (else "defconfig")))
379
380
381;;;
382;;; Kernel source code deblobbing.
383;;;
384
385(define (linux-libre-deblob-scripts version gnu-revision
386 deblob-hash
387 deblob-check-hash)
388 (list (version-major+minor version)
389 (origin
390 (method url-fetch)
391 (uri (string-append "https://linux-libre.fsfla.org"
392 "/pub/linux-libre/releases/" version "-" gnu-revision "/"
393 "deblob-" (version-major+minor version)))
394 (file-name (string-append "linux-libre-deblob-"
395 version "-" gnu-revision))
396 (sha256 deblob-hash))
397 (origin
398 (method url-fetch)
399 (uri (string-append "https://linux-libre.fsfla.org"
400 "/pub/linux-libre/releases/" version "-" gnu-revision "/"
401 "deblob-check"))
402 (file-name (string-append "linux-libre-deblob-check-" version "-" gnu-revision))
403 (sha256 deblob-check-hash))))
404
405;; XXXX: Workaround 'snippet' limitations
406(define computed-origin-method (@@ (guix packages) computed-origin-method))
407
408(define (make-linux-libre-source version
409 upstream-source
410 deblob-scripts)
411 "Return a 'computed' origin that generates a Linux-libre tarball from the
412corresponding UPSTREAM-SOURCE (an origin), using the given DEBLOB-SCRIPTS."
413 (match deblob-scripts
414 ((deblob-version (? origin? deblob) (? origin? deblob-check))
415 (unless (string=? deblob-version (version-major+minor version))
416 ;; The deblob script cannot be expected to work properly on a
417 ;; different version (major+minor) of Linux, even if no errors
418 ;; are signaled during execution.
419 (error "deblob major+minor version mismatch"))
420 (define unchecked-source
421 (make-linux-source
422 version upstream-source
423 (delay
424 (with-imported-modules '((guix build utils))
425 #~(begin
426 (use-modules (guix build utils))
427
428 (mkdir "/tmp/bin")
429 (set-path-environment-variable
430 "PATH" '("bin")
431 (list "/tmp"
432 #+(canonical-package bash)
433 #+(canonical-package coreutils)
434 #+(canonical-package diffutils)
435 #+(canonical-package findutils)
436 #+(canonical-package patch)
437 #+(canonical-package xz)
438 #+(canonical-package sed)
439 #+(canonical-package grep)
440 #+(canonical-package bzip2)
441 #+(canonical-package gzip)
442 #+(canonical-package tar)
443 #+(canonical-package gawk)
444 #+python-wrapper))
445
446 (with-directory-excursion "/tmp/bin"
447 (copy-file #+deblob "deblob")
448 (chmod "deblob" #o755)
449 (substitute* "deblob"
450 (("/bin/sh") (which "sh")))
451
452 (copy-file #+deblob-check "deblob-check")
453 (chmod "deblob-check" #o755)
454 (substitute* "deblob-check"
455 (("/bin/sh") (which "sh"))
456 (("/bin/sed") (which "sed"))
457 (("/usr/bin/python") (which "python"))))
458
459 (format #t "Running deblob script...~%")
460 (invoke "/tmp/bin/deblob"))))))
461 (origin
462 (method computed-origin-method)
463 (file-name (string-append "linux-" version "-guix.tar.xz"))
464 (sha256 #f)
465 (uri
466 (delay
467 (with-imported-modules '((guix build utils))
468 #~(begin
469 (use-modules (guix build utils))
470
471 (mkdir "/tmp/bin")
472 (set-path-environment-variable
473 "PATH" '("bin")
474 (list "/tmp"
475 #+(canonical-package bash)
476 #+(canonical-package coreutils)
477 #+(canonical-package diffutils)
478 #+(canonical-package findutils)
479 #+(canonical-package patch)
480 #+(canonical-package xz)
481 #+(canonical-package sed)
482 #+(canonical-package grep)
483 #+(canonical-package bzip2)
484 #+(canonical-package gzip)
485 #+(canonical-package tar)
486 #+(canonical-package gawk)
487 #+python-wrapper))
488
489 (with-directory-excursion "/tmp/bin"
490 (copy-file #+deblob-check "deblob-check")
491 (chmod "deblob-check" #o755)
492 (substitute* "deblob-check"
493 (("/bin/sh") (which "sh"))
494 (("/bin/sed") (which "sed"))
495 (("/usr/bin/python") (which "python"))))
496
497 (copy-file #$unchecked-source #$output)
498
499 (format #t "~%Scanning the generated tarball for blobs...~%")
500 (invoke "/tmp/bin/deblob-check" "--use-awk" "--list-blobs"
501 #$output)))))))))
502
503(define (make-linux-source version upstream-source transformation)
504 "Return a 'computed' origin that generates a modified Linux tarball from the
505corresponding UPSTREAM-SOURCE (an origin), using the given TRANSFORMATION (a
506GEXP)."
507 (origin
508 (method computed-origin-method)
509 (file-name (string-append "linux-" version "-guix.tar.xz"))
510 (sha256 #f)
511 (uri
512 (delay
513 (with-imported-modules '((guix build utils))
514 ;; NOTE: it's very important not to introduce local symbols inside
515 ;; the gexp as they will shadow symbols used in TRANSFORMATION.
516 (let ((dir (string-append "linux-" version))
517 (cp (file-append (canonical-package coreutils) "/bin/cp"))
518 (tar (file-append (canonical-package tar) "/bin/tar"))
519 (change-mode (file-append (canonical-package coreutils) "/bin/chmod")))
520 #~(begin
521 (use-modules (guix build utils)
522 (srfi srfi-1)
523 (ice-9 match)
524 (ice-9 ftw))
525
526 ;; Required for tar gz decompression.
527 (setenv "PATH" #+(file-append (canonical-package xz) "/bin"))
528
529 (if (file-is-directory? #+upstream-source)
530 (begin
531 (format #t "Copying upstream Linux source...~%")
532 (copy-recursively #+upstream-source #$dir)
533 (for-each (cut make-file-writable <>)
534 (find-files #$dir)))
535 (begin
536 (format #t "Unpacking upstream Linux tarball...~%")
537 (invoke #+tar "xf" #$upstream-source)
538 (match (scandir "."
539 (lambda (name)
540 (and (not (member name '("." "..")))
541 (file-is-directory? name))))
542 ((unpacked-dir)
543 (unless (string=? #$dir unpacked-dir)
544 (rename-file unpacked-dir #$dir)))
545 (dirs
546 (error "multiple directories found" dirs)))))
547
548 (with-directory-excursion #$dir
549 #$(if (promise? transformation)
550 (force transformation)
551 transformation))
552
553 (format #t "~%Packing new Linux tarball...~%")
554 (invoke #+tar "cvfa" #$output
555 ;; Avoid non-determinism in the archive.
556 "--mtime=@0"
557 "--owner=root:0"
558 "--group=root:0"
559 "--sort=name"
560 "--hard-dereference"
561 #$dir))))))))
562
563
564;;;
565;;; Kernel sources.
566;;;
567
568(define (linux-libre-urls version gnu-revision)
569 "Return a list of URLs for Linux-Libre VERSION."
570 (list (string-append
571 "https://linux-libre.fsfla.org/pub/linux-libre/releases/"
572 version "-" gnu-revision "/linux-libre-" version "-" gnu-revision ".tar.xz")
573
574 ;; XXX: Work around <http://bugs.gnu.org/14851>.
575 (string-append
576 "ftp://alpha.gnu.org/gnu/guix/mirror/linux-libre-"
577 version "-" gnu-revision ".tar.xz")
578
579 ;; Maybe this URL will become valid eventually.
580 (string-append
581 "mirror://gnu/linux-libre/" version "-" gnu-revision "/linux-libre-"
582 version "-" gnu-revision ".tar.xz")))
583
584(define (%upstream-linux-source version hash)
585 (origin
586 (method url-fetch)
587 (uri (string-append "mirror://kernel.org"
588 "/linux/kernel/v" (version-major version) ".x/"
589 "linux-" version ".tar.xz"))
590 (sha256 hash)))
591
592;; The current "mainline" kernel.
593
594(define-public linux-libre-7.2-version "7.2")
595(define-public linux-libre-7.2-gnu-revision "gnu")
596(define deblob-scripts-7.2
597 (linux-libre-deblob-scripts
598 linux-libre-7.2-version
599 linux-libre-7.2-gnu-revision
600 (base32 "109qy4m3mcc19c1p3b87amzkmmq39jgkr70q3zyxpml41fcc8m23")
601 (base32 "173ixshdiwbka7hzaxjmfxc44bjjjhigig8appbwd2ml4hmliaww")))
602(define-public linux-libre-7.2-pristine-source
603 (let ((version linux-libre-7.2-version)
604 (hash (base32 "1cq2jj1g06gav6xvbxfb1l5jlp43b52ffjvg08ckix8d9k8z7zpr")))
605 (make-linux-libre-source version
606 (%upstream-linux-source version hash)
607 deblob-scripts-7.2)))
608
609;; The current "stable" kernels. That is, the most recently released major
610;; versions that are still supported upstream.
611
612(define-public linux-libre-7.1-version "7.1.10")
613(define-public linux-libre-7.1-gnu-revision "gnu")
614(define deblob-scripts-7.1
615 (linux-libre-deblob-scripts
616 linux-libre-7.1-version
617 linux-libre-7.1-gnu-revision
618 (base32 "0a14ymlj6ahfd5ch78hk9nx47ihglndq1h9hi9a4r9di469s5f8v")
619 (base32 "0ab66phhdwhhhvhywiylhlsmqvw8ny4xyi7ap7xzzkqc7im8w1j9")))
620(define-public linux-libre-7.1-pristine-source
621 (let ((version linux-libre-7.1-version)
622 (hash (base32 "16crmblk96nwjzpbb22fpcj0r4ky63f1njvliv4vxwq2g9lz9lk7")))
623 (make-linux-libre-source version
624 (%upstream-linux-source version hash)
625 deblob-scripts-7.1)))
626
627;; The "longterm" kernels — the older releases with long-term upstream support.
628;; Here are the support timelines:
629;; <https://www.kernel.org/category/releases.html>
630
631(define-public linux-libre-6.18-version "6.18.46")
632(define-public linux-libre-6.18-gnu-revision "gnu")
633(define deblob-scripts-6.18
634 (linux-libre-deblob-scripts
635 linux-libre-6.18-version
636 linux-libre-6.18-gnu-revision
637 (base32 "1x5szxc5d20jq8j5wzqqwk4jagc1q9kdhi2xvry7zbwy6cxskw52")
638 (base32 "0yk2c643d2gykwbl3cibgwr9aaqrfg9m3q9xgha98yy4vzcyqbhr")))
639(define-public linux-libre-6.18-pristine-source
640 (let ((version linux-libre-6.18-version)
641 (hash (base32 "186c850qncfvwqnvmllzkiqj6xfrh6h4nh65d4lwq0lbh29lpm7m")))
642 (make-linux-libre-source version
643 (%upstream-linux-source version hash)
644 deblob-scripts-6.18)))
645
646(define-public linux-libre-6.12-version "6.12.105")
647(define-public linux-libre-6.12-gnu-revision "gnu")
648(define deblob-scripts-6.12
649 (linux-libre-deblob-scripts
650 linux-libre-6.12-version
651 linux-libre-6.12-gnu-revision
652 (base32 "168aykyvyyp34549hqhlprl0n052q8wdb2y3vyxqw40wpf2vw3ln")
653 (base32 "1x48hpmvajz7v5wn1vdd7l5r14mq4ngzh5npz3pj81z4f1g61i0a")))
654(define-public linux-libre-6.12-pristine-source
655 (let ((version linux-libre-6.12-version)
656 (hash (base32 "0ggni16ill7acfxsmwr96q2zfcia1v19sif32csv2acm24g80dpb")))
657 (make-linux-libre-source version
658 (%upstream-linux-source version hash)
659 deblob-scripts-6.12)))
660
661(define-public linux-libre-6.6-version "6.6.153")
662(define-public linux-libre-6.6-gnu-revision "gnu")
663(define deblob-scripts-6.6
664 (linux-libre-deblob-scripts
665 linux-libre-6.6-version
666 linux-libre-6.6-gnu-revision
667 (base32 "0y3lawljby2rl0mb0yjdyaasci4pl935y8xa0dnmbzff23knkxlw")
668 (base32 "1h0qybxvk1f2vvbajivxcyqha49zfh1as5053ww36klllyml3cpn")))
669(define-public linux-libre-6.6-pristine-source
670 (let ((version linux-libre-6.6-version)
671 (hash (base32 "0mwmr68vz1a296gkizwywvrjr8i86wg3crk777p0sli3i437gg1r")))
672 (make-linux-libre-source version
673 (%upstream-linux-source version hash)
674 deblob-scripts-6.6)))
675
676(define-public linux-libre-6.1-version "6.1.184")
677(define-public linux-libre-6.1-gnu-revision "gnu")
678(define deblob-scripts-6.1
679 (linux-libre-deblob-scripts
680 linux-libre-6.1-version
681 linux-libre-6.1-gnu-revision
682 (base32 "10gcbkd5jxfspa712kvb3qmsjgsapd9cz47pmpfk03bbfzf8ydlv")
683 (base32 "1w5pfws6l39dpc3lzazs1n6r4m96f6rdf6vb2scy5fhmrd933ldc")))
684(define-public linux-libre-6.1-pristine-source
685 (let ((version linux-libre-6.1-version)
686 (hash (base32 "1facdyxlvcmfkiman0jzq6nvjs81h51arzmyl1pqam30bc47c2cn")))
687 (make-linux-libre-source version
688 (%upstream-linux-source version hash)
689 deblob-scripts-6.1)))
690
691(define-public linux-libre-5.15-version "5.15.217")
692(define-public linux-libre-5.15-gnu-revision "gnu")
693(define deblob-scripts-5.15
694 (linux-libre-deblob-scripts
695 linux-libre-5.15-version
696 linux-libre-5.15-gnu-revision
697 (base32 "0b2gd83ihxlq490gpgq930misc6jrckw4rzl7fvwd0qzczqjvff5")
698 (base32 "1s6km2r2mad0wpf7nqn4rqsykw1lm386l1yskmil24239fbva1f1")))
699(define-public linux-libre-5.15-pristine-source
700 (let ((version linux-libre-5.15-version)
701 (hash (base32 "1rd5ffv9j3d5g2iygapjgkmqpsqfq69xyig3jifmmr5x9wsgs873")))
702 (make-linux-libre-source version
703 (%upstream-linux-source version hash)
704 deblob-scripts-5.15)))
705
706(define %boot-logo-patch
707 ;; Linux-Libre boot logo featuring Freedo and a gnu.
708 (origin
709 (method url-fetch)
710 (uri (string-append "http://www.fsfla.org/svn/fsfla/software/linux-libre/"
711 "lemote/gnewsense/branches/3.16/100gnu+freedo.patch"))
712 (sha256
713 (base32
714 "1hk9swxxc80bmn2zd2qr5ccrjrk28xkypwhl4z0qx4hbivj7qm06"))))
715
716(define %linux-libre-arm-export-__sync_icache_dcache-patch
717 (origin
718 (method url-fetch)
719 (uri (string-append
720 "https://salsa.debian.org/kernel-team/linux"
721 "/raw/34a7d9011fcfcfa38b68282fd2b1a8797e6834f0"
722 "/debian/patches/bugfix/arm/"
723 "arm-mm-export-__sync_icache_dcache-for-xen-privcmd.patch"))
724 (file-name "linux-libre-arm-export-__sync_icache_dcache.patch")
725 (sha256
726 (base32 "1ifnfhpakzffn4b8n7x7w5cps9mzjxlkcfz9zqak2vaw8nzvl39f"))))
727
728(define (source-with-patches source patches)
729 (origin
730 (inherit source)
731 (patches (append (origin-patches source)
732 patches))))
733
734(define-public linux-libre-7.2-source
735 (source-with-patches linux-libre-7.2-pristine-source
736 (append
737 (list %linux-libre-arm-export-__sync_icache_dcache-patch)
738 (search-patches "linux-shmem-hurd-xattr.patch"
739 "linux-libre-fix-arm64-bin-sh.patch"))))
740
741(define-public linux-libre-7.1-source
742 (source-with-patches linux-libre-7.1-pristine-source
743 (append
744 (list %linux-libre-arm-export-__sync_icache_dcache-patch)
745 (search-patches "linux-shmem-hurd-xattr.patch"
746 "linux-libre-fix-arm64-bin-sh.patch"))))
747
748(define-public linux-libre-6.18-source
749 (source-with-patches linux-libre-6.18-pristine-source
750 (list %boot-logo-patch
751 %linux-libre-arm-export-__sync_icache_dcache-patch)))
752
753(define-public linux-libre-6.12-source
754 (source-with-patches linux-libre-6.12-pristine-source
755 (list %boot-logo-patch
756 %linux-libre-arm-export-__sync_icache_dcache-patch)))
757
758(define-public linux-libre-6.6-source
759 (source-with-patches linux-libre-6.6-pristine-source
760 (list %boot-logo-patch
761 %linux-libre-arm-export-__sync_icache_dcache-patch)))
762
763(define-public linux-libre-6.1-source
764 (source-with-patches linux-libre-6.1-pristine-source
765 (append
766 (list %boot-logo-patch
767 %linux-libre-arm-export-__sync_icache_dcache-patch)
768 (search-patches
769 "linux-libre-infodocs-target.patch"))))
770
771(define-public linux-libre-5.15-source
772 (source-with-patches linux-libre-5.15-pristine-source
773 (list %boot-logo-patch
774 %linux-libre-arm-export-__sync_icache_dcache-patch)))
775
776
777;; Debian sources.
778
779(define (linux-debian-patches version hash)
780 (package
781 (name "linux-debian-patches")
782 (version version)
783 (source (origin
784 (method git-fetch)
785 (uri (git-reference
786 (url "https://salsa.debian.org/kernel-team/linux.git")
787 (commit (string-append "debian/" version))))
788 (file-name (git-file-name name version))
789 (sha256 hash)))
790 (build-system copy-build-system)
791 (arguments
792 (list
793 #:install-plan
794 ''(("debian/patches" "")
795 ("debian/config" ""))))
796 (home-page "Debian patches")
797 (synopsis "Debian patches")
798 (description "Debian patches")
799 (license license:gpl2)))
800
801(define-public linux-debian-6.12-version "6.12.105")
802(define debian-patches-6.12
803 (linux-debian-patches
804 (string-append linux-debian-6.12-version "-1")
805 (base32 "1nz6p83y4ak6l1hw8l6hsp0j61nvlfw0xrvsq54kza9rd5a89gq5")))
806(define-public linux-debian-6.12-pristine-source
807 (let ((version linux-debian-6.12-version)
808 (hash (base32 "0ggni16ill7acfxsmwr96q2zfcia1v19sif32csv2acm24g80dpb")))
809 (make-linux-source
810 version (%upstream-linux-source version hash)
811 (delay
812 #~(begin
813 (format #t "Patching kernel...~%")
814 (setenv "QUILT_PATCHES" #$(file-append debian-patches-6.12
815 "/patches"))
816 (invoke #$(file-append quilt "/bin/quilt") "push" "-a"))))))
817
818(define-public linux-debian-6.12-source
819 (source-with-patches linux-debian-6.12-pristine-source
820 (search-patches "linux-shmem-hurd-xattr.patch")))
821
822
823;;;
824;;; Kernel headers.
825;;;
826
827(define %linux-libre-timeout-properties
828 ;; Package properties for 'linux-libre' and 'linux-libre-headers' packages.
829 `((timeout . ,(* 8 3600)) ;deblob takes >5h on AArch64
830 (max-silent-time . ,(* 3 3600)))) ;don't time out on blob scan
831
832(define (make-linux-libre-headers version gnu-revision hash-string)
833 (make-linux-libre-headers* version gnu-revision
834 (origin
835 (method url-fetch)
836 (uri (linux-libre-urls version gnu-revision))
837 (sha256 (base32 hash-string)))))
838
839(define (make-linux-libre-headers* version gnu-revision source)
840 (package
841 (name "linux-libre-headers")
842 (version version)
843 (source source)
844 (build-system gnu-build-system)
845 (native-inputs `(("perl" ,perl)
846 ,@(if (version>=? version "4.16")
847 `(("flex" ,flex)
848 ("bison" ,bison))
849 '())))
850 (arguments
851 `(#:modules ((guix build gnu-build-system)
852 (guix build utils)
853 (srfi srfi-1)
854 (ice-9 match))
855 #:phases
856 (modify-phases %standard-phases
857 (delete 'configure)
858 (replace 'build
859 (lambda _
860 (let ((arch ,(platform-linux-architecture
861 (lookup-platform-by-target-or-system
862 (or (%current-target-system)
863 (%current-system)))))
864 (defconfig ,(system->defconfig
865 (or (%current-target-system)
866 (%current-system))))
867 (make-target ,(if (version>=? version "5.3")
868 "headers"
869 "headers_check")))
870 (setenv "ARCH" arch)
871 (format #t "`ARCH' set to `~a'~%" (getenv "ARCH"))
872 (invoke "make" defconfig)
873 (invoke "make" "mrproper" make-target))))
874 (replace 'install
875 (lambda* (#:key outputs #:allow-other-keys)
876 (let ((out (assoc-ref outputs "out")))
877
878 ;; Mimic the quiet_cmd_headers_install target to avoid a
879 ;; dependency on rsync.
880 (for-each (lambda (file)
881 (let ((destination (string-append
882 out "/include/"
883 ;; Drop the 'usr/include' prefix.
884 (match (string-split file #\/)
885 ((_ _ path ...)
886 (string-join path "/"))))))
887 (format #t "`~a' -> `~a'~%" file destination)
888 (install-file file (dirname destination))))
889 (find-files "usr/include" "\\.h$"))
890
891 (mkdir (string-append out "/include/config"))
892 (call-with-output-file
893 (string-append out
894 "/include/config/kernel.release")
895 (lambda (p)
896 (format p "~a-default~%" ,version)))))))
897 #:allowed-references ()
898 #:tests? #f))
899 (supported-systems (remove target-hurd? %supported-systems))
900 (properties %linux-libre-timeout-properties)
901 (home-page "https://www.gnu.org/software/linux-libre/")
902 (synopsis "GNU Linux-Libre kernel headers")
903 (description "Headers of the Linux-Libre kernel.")
904 (license license:gpl2)))
905
906(define-public linux-libre-headers-7.2
907 (make-linux-libre-headers* linux-libre-7.2-version
908 linux-libre-7.2-gnu-revision
909 linux-libre-7.2-source))
910
911(define-public linux-libre-headers-7.1
912 (make-linux-libre-headers* linux-libre-7.1-version
913 linux-libre-7.1-gnu-revision
914 linux-libre-7.1-source))
915
916(define-public linux-libre-headers-6.18
917 (make-linux-libre-headers* linux-libre-6.18-version
918 linux-libre-6.18-gnu-revision
919 linux-libre-6.18-source))
920
921(define-public linux-libre-headers-6.12
922 (make-linux-libre-headers* linux-libre-6.12-version
923 linux-libre-6.12-gnu-revision
924 linux-libre-6.12-source))
925
926(define-public linux-libre-headers-6.6
927 (make-linux-libre-headers* linux-libre-6.6-version
928 linux-libre-6.6-gnu-revision
929 linux-libre-6.6-source))
930
931(define-public linux-libre-headers-6.1
932 (make-linux-libre-headers* linux-libre-6.1-version
933 linux-libre-6.1-gnu-revision
934 linux-libre-6.1-source))
935
936(define-public linux-libre-headers-5.15
937 (make-linux-libre-headers* linux-libre-5.15-version
938 linux-libre-5.15-gnu-revision
939 linux-libre-5.15-source))
940
941;; The following package is used in the early bootstrap, and thus must be kept
942;; stable and with minimal build requirements.
943(define-public linux-libre-headers-6.12.17
944 (make-linux-libre-headers "6.12.17" "gnu"
945 "1j3iyivh8h9abryjqksf4k51wgwnwqy2l3zsc019bm84xmka38xm"))
946
947(define-public linux-libre-headers linux-libre-headers-6.12.17)
948;; linux-libre-headers-latest points to the latest headers package
949;; and should be used as a dependency for packages that depend on
950;; the headers.
951(define-public linux-libre-headers-latest linux-libre-headers-7.1)
952
953
954;;;
955;;; Kernel configurations.
956;;;
957
958(define* (kernel-config arch #:key variant)
959 "Return a file-like object of the Linux-Libre build configuration file for
960ARCH and optionally VARIANT, or #f if there is no such configuration."
961 (let* ((name (string-append (if variant (string-append variant "-") "")
962 (if (string=? "i386" arch) "i686" arch) ".conf"))
963 (file (string-append "linux-libre/" name))
964 (config (search-auxiliary-file file)))
965 (and config (local-file config))))
966
967(define (default-extra-linux-options version)
968 `(;; Make the kernel config available at /proc/config.gz
969 ("CONFIG_IKCONFIG" . #t)
970 ("CONFIG_IKCONFIG_PROC" . #t)
971 ;; Debugging options.
972 ("CONFIG_DEBUG_INFO" . #t) ;required by BTF
973 ,@(if (version>=? version "5.1")
974 '(("CONFIG_DEBUG_INFO_BTF" . #t))
975 '())
976 ,@(if (version>=? version "5.12")
977 '(("CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT" . #t))
978 '())
979 ("CONFIG_DEBUG_INFO_REDUCED" . #f) ;incompatible with BTF
980 ;; Tracing and related options.
981 ,@(if (version>=? version "5.1")
982 '(("CONFIG_BPF_JIT" . #t)
983 ("CONFIG_BPF_JIT_ALWAYS_ON" . #t)
984 ("CONFIG_BPF_SYSCALL" . #t))
985 '())
986 ,@(if (version>=? version "5.13")
987 '(("CONFIG_BPF_UNPRIV_DEFAULT_OFF" . #t))
988 '())
989 ("CONFIG_NET_CLS_BPF" . m) ;classify packets based on BPF filters
990 ("CONFIG_NET_ACT_BPF" . m) ;to execute BPF code on packets
991 ;; Compress kernel modules via Zstd.
992 ,(if (version>=? version "5.13")
993 '("CONFIG_MODULE_COMPRESS_ZSTD" . #t)
994 '("CONFIG_MODULE_COMPRESS_GZIP" . #t))
995 ;; Some very mild hardening.
996 ("CONFIG_SECURITY_DMESG_RESTRICT" . #t)
997 ;; All kernels should have NAMESPACES options enabled
998 ("CONFIG_NAMESPACES" . #t)
999 ("CONFIG_UTS_NS" . #t)
1000 ("CONFIG_IPC_NS" . #t)
1001 ("CONFIG_USER_NS" . #t)
1002 ("CONFIG_PID_NS" . #t)
1003 ("CONFIG_NET_NS" . #t)
1004 ;; Various options needed for elogind service:
1005 ;; https://issues.guix.gnu.org/43078
1006 ("CONFIG_CGROUP_FREEZER" . #t)
1007 ("CONFIG_BLK_CGROUP" . #t)
1008 ("CONFIG_CGROUP_WRITEBACK" . #t)
1009 ("CONFIG_CGROUP_SCHED" . #t)
1010 ("CONFIG_CGROUP_PIDS" . #t)
1011 ("CONFIG_CGROUP_FREEZER" . #t)
1012 ("CONFIG_CGROUP_DEVICE" . #t)
1013 ("CONFIG_CGROUP_CPUACCT" . #t)
1014 ("CONFIG_CGROUP_PERF" . #t)
1015 ("CONFIG_SOCK_CGROUP_DATA" . #t)
1016 ("CONFIG_BLK_CGROUP_IOCOST" . #t)
1017 ("CONFIG_CGROUP_NET_PRIO" . #t)
1018 ("CONFIG_CGROUP_NET_CLASSID" . #t)
1019 ("CONFIG_MEMCG" . #t)
1020 ("CONFIG_MEMCG_SWAP" . #t)
1021 ("CONFIG_MEMCG_KMEM" . #t)
1022 ("CONFIG_CPUSETS" . #t)
1023 ("CONFIG_PROC_PID_CPUSET" . #t)
1024 ;; Allow disk encryption by default
1025 ("CONFIG_DM_CRYPT" . m)
1026 ;; Allow fscrypt filesystem encryption by default
1027 ("CONFIG_FS_ENCRYPTION" . #t)
1028 ;; Support zram on all kernel configs
1029 ("CONFIG_ZSWAP" . #t)
1030 ("CONFIG_ZSMALLOC" . #t)
1031 ("CONFIG_ZRAM" . m)
1032 ;; Accessibility support.
1033 ("CONFIG_ACCESSIBILITY" . #t)
1034 ("CONFIG_A11Y_BRAILLE_CONSOLE" . #t)
1035 ("CONFIG_SPEAKUP" . m)
1036 ("CONFIG_SPEAKUP_SYNTH_SOFT" . m)
1037 ;; Modules required for initrd:
1038 ("CONFIG_NET_9P" . m)
1039 ("CONFIG_NET_9P_VIRTIO" . m)
1040 ("CONFIG_VIRTIO_BLK" . m)
1041 ("CONFIG_VIRTIO_NET" . m)
1042 ("CONFIG_VIRTIO_PCI" . m)
1043 ("CONFIG_VIRTIO_BALLOON" . m)
1044 ("CONFIG_VIRTIO_MMIO" . m)
1045 ("CONFIG_FUSE_FS" . m)
1046 ("CONFIG_CIFS" . m)
1047 ("CONFIG_9P_FS" . m)
1048 ;; Enable DMABUF used by wayland, pipewire and libcamera
1049 ;; https://codeberg.org/guix/guix/issues/5995
1050 ("CONFIG_UDMABUF" . #t)
1051 ("CONFIG_DMABUF_MOVE_NOTIFY" . #t)
1052 ("CONFIG_DMABUF_HEAPS" . #t)
1053 ("CONFIG_DMABUF_HEAPS_SYSTEM" . #t)
1054 ("CONFIG_DMABUF_HEAPS_CMA" . #t)
1055 ,@(if (version>=? version "6.17")
1056 '(("CONFIG_DMABUF_HEAPS_CMA_LEGACY" . #t))
1057 '())
1058 ;; Enable sched_ext support for userspace schedulers
1059 ;; Note: Depends on BPF tracing
1060 ;; https://docs.kernel.org/scheduler/sched-ext.html
1061 ,@(if (version>=? version "6.12")
1062 '(("CONFIG_SCHED_CLASS_EXT" . #t))
1063 '())
1064 ;; Disable the EFI pstore storage backend to avoid causing
1065 ;; unrecoverable failures on some EFI systems:
1066 ;; https://lists.gnu.org/archive/html/help-guix/2025-01/msg00173.html
1067 ("CONFIG_EFI_VARS_PSTORE_DEFAULT_DISABLE" . #t)
1068 ;; Provide modules for wireguard and netfilter support
1069 ("CONFIG_WIREGUARD" . m)
1070 ("CONFIG_IP_NF_FILTER" . m)
1071 ("CONFIG_NETFILTER_XT_MATCH_ADDRTYPE" . m)))
1072
1073(define (config->string options)
1074 (string-join (map (match-lambda
1075 ((option . 'm)
1076 (string-append option "=m"))
1077 ((option . #t)
1078 (string-append option "=y"))
1079 ((option . #f)
1080 (string-append option "=n"))
1081 ((option . string)
1082 (string-append option "=\"" string "\"")))
1083 options)
1084 "\n"))
1085
1086
1087;;;
1088;;; Kernel package utilities.
1089;;;
1090
1091(define (apply-infodoc-patch? version)
1092 ;; Versions older than 5.10 have different enough build scripts that the
1093 ;; infodocs patch doesn't apply.
1094 (and (version>=? version "5.10")
1095 (not (version>=? version "6.2")))) ;patch applied upstream
1096
1097(define* (make-linux* version source supported-systems produced-modules
1098 #:key
1099 (extra-version #f)
1100 ;; A function that takes an arch and a variant.
1101 ;; See kernel-config for an example.
1102 (configuration-file #f)
1103 (defconfig "defconfig")
1104 (extra-options (default-extra-linux-options version)))
1105 "Create a Linux package from VERSION using SOURCE for SUPPORTED-SYSTEMS.
1106
1107Produced modules will use package-properties to convey which modules the given
1108configuration produced either by CONFIGURATION-FILE or DEFCONFIG will yield.
1109This allows 'operating-system' records to infer their 'intrd-modules' value
1110from their 'kernel' field package.
1111
1112EXTRA-VERSION will control the emitted package name as well as the
1113EXTRAVERSION value of the kernel build.
1114
1115CONFIGURATION-FILE is a file-like object which will be used as the
1116configuration file to use for building the kernel. If used the DEFCONFIG
1117argument will be ignored.
1118
1119DEFCONFIG can either be a string, which will control the make target that
1120generates the configuration file used for building the kernel, or a GEXP which
1121should produce the '.config' file that will be used for building the kernel.
1122
1123EXTRA-OPTIONS will be appended to the configuration file provided by
1124CONFIGURATION-FILE or generated by DEFCONFIG. It must be an alist where each element has the form:
1125(KERNEL-OPTION . VALUE)
1126
1127KERNEL-OPTION must be a string and VALUE can be '#t', '#f' or 'm' for
1128instructing that the configuration option should build a kernel module."
1129 (package
1130 (name (if extra-version
1131 (string-append "linux-" extra-version)
1132 "linux"))
1133 (version version)
1134 (source source)
1135 (supported-systems supported-systems)
1136 (build-system gnu-build-system)
1137 (arguments
1138 (list
1139 #:modules '((guix build gnu-build-system)
1140 (guix build utils)
1141 (srfi srfi-1)
1142 (srfi srfi-26)
1143 (ice-9 ftw)
1144 (ice-9 match))
1145 #:tests? #f
1146 #:phases
1147 #~(modify-phases %standard-phases
1148 (add-after 'unpack 'patch-/bin/pwd
1149 (lambda _
1150 (substitute* (find-files
1151 "." "^Makefile(\\.include)?$")
1152 (("/bin/pwd") "pwd"))))
1153 (add-before 'configure 'set-environment
1154 (lambda* (#:key target #:allow-other-keys)
1155 ;; Avoid introducing timestamps.
1156 (setenv "KCONFIG_NOTIMESTAMP" "1")
1157 (setenv "KBUILD_BUILD_TIMESTAMP" (getenv "SOURCE_DATE_EPOCH"))
1158
1159 ;; Other variables useful for reproducibility.
1160 (setenv "KBUILD_BUILD_VERSION" "1")
1161 (setenv "KBUILD_BUILD_USER" "guix")
1162 (setenv "KBUILD_BUILD_HOST" "guix")
1163
1164 ;; Set ARCH and CROSS_COMPILE.
1165 (let ((arch #$(platform-linux-architecture
1166 (lookup-platform-by-target-or-system
1167 (or (%current-target-system)
1168 (%current-system))))))
1169 (setenv "ARCH" arch)
1170 (format #t "`ARCH' set to `~a'~%" (getenv "ARCH"))
1171 (when target
1172 (setenv "CROSS_COMPILE" (string-append target "-"))
1173 (format #t "`CROSS_COMPILE' set to `~a'~%"
1174 (getenv "CROSS_COMPILE"))))
1175
1176 ;; Allow EXTRAVERSION to be set via the environment.
1177 (substitute* "Makefile"
1178 (("^ *EXTRAVERSION[[:blank:]]*=")
1179 "EXTRAVERSION ?="))
1180 (setenv "EXTRAVERSION"
1181 #$(and extra-version
1182 (string-append "-" extra-version)))
1183 ;; Use the maximum compression available for Zstd-compressed
1184 ;; modules.
1185 (setenv "ZSTD_CLEVEL" "19")))
1186 (replace 'configure
1187 (lambda _
1188 (let ((config
1189 #$(match (let ((arch (platform-linux-architecture
1190 (lookup-platform-by-target-or-system
1191 (or (%current-target-system)
1192 (%current-system))))))
1193 (and configuration-file arch
1194 (configuration-file
1195 arch
1196 #:variant (version-major+minor version))))
1197 (#f ;no config for this platform
1198 #f)
1199 ((? file-like? config)
1200 config))))
1201 ;; Use a custom kernel configuration file or a default
1202 ;; configuration file.
1203 (if config
1204 (begin
1205 (copy-file config ".config")
1206 (chmod ".config" #o666))
1207 #$(cond
1208 ((string? defconfig)
1209 #~(invoke "make" #$defconfig))
1210 ((promise? defconfig)
1211 (force defconfig))
1212 (else
1213 defconfig)))
1214 ;; Appending works even when the option wasn't in the file.
1215 ;; The last one prevails if duplicated.
1216 (let ((port (open-file ".config" "a"))
1217 (extra-configuration #$(config->string extra-options)))
1218 (display extra-configuration port)
1219 (close-port port))
1220 (invoke "make" "oldconfig"))))
1221 (replace 'install
1222 (lambda* (#:key make-flags parallel-build? #:allow-other-keys)
1223 (let ((moddir (string-append #$output "/lib/modules"))
1224 (dtbdir (string-append #$output "/lib/dtbs"))
1225 (make-flags
1226 (append make-flags
1227 (list "-j"
1228 (if parallel-build?
1229 (number->string (parallel-job-count))
1230 "1")))))
1231 ;; Install kernel image, kernel configuration and link map.
1232 (for-each (lambda (file) (install-file file #$output))
1233 (find-files "." "^(\\.config|bzImage|zImage|Image\
1234|vmlinuz|System\\.map|Module\\.symvers)$"))
1235 ;; Install device tree files
1236 (unless (null? (find-files "." "\\.dtb$"))
1237 (mkdir-p dtbdir)
1238 (apply invoke "make"
1239 (string-append "INSTALL_DTBS_PATH=" dtbdir)
1240 "dtbs_install" make-flags))
1241 ;; Install kernel modules
1242 (mkdir-p moddir)
1243 (apply invoke "make"
1244 ;; Disable depmod because the Guix system's module
1245 ;; directory is an union of potentially multiple
1246 ;; packages. It is not possible to use depmod to
1247 ;; usefully calculate a dependency graph while building
1248 ;; only one of them.
1249 "DEPMOD=true"
1250 (string-append "MODULE_DIR=" moddir)
1251 (string-append "INSTALL_PATH=" #$output)
1252 (string-append "INSTALL_MOD_PATH=" #$output)
1253 "INSTALL_MOD_STRIP=1"
1254 "modules_install" make-flags)
1255 (let* ((versions (filter (lambda (name)
1256 (not (string-prefix? "." name)))
1257 (scandir moddir)))
1258 (version (match versions
1259 ((x) x))))
1260 ;; There are symlinks to the build and source directory.
1261 ;; Both will point to target /tmp/guix-build* and thus not
1262 ;; be useful in a profile. Delete the symlinks.
1263 (false-if-file-not-found
1264 (delete-file
1265 (string-append moddir "/" version "/build")))
1266 (false-if-file-not-found
1267 (delete-file
1268 (string-append moddir "/" version "/source"))))))))))
1269 (native-inputs
1270 (list perl
1271 bc
1272 openssl
1273 elfutils ;needed to enable CONFIG_STACK_VALIDATION
1274 flex
1275 bison
1276 util-linux ;needed for hexdump
1277 ;; These are needed to compile the GCC plugins.
1278 gmp
1279 mpfr
1280 mpc
1281 ;; These are needed when building with the CONFIG_DEBUG_INFO_BTF
1282 ;; support.
1283 dwarves ;for pahole
1284 python-wrapper
1285 zlib
1286 ;; For Zstd compression of kernel modules.
1287 zstd))
1288 (home-page #f)
1289 (synopsis #f)
1290 (description #f)
1291 (license #f)
1292 (properties
1293 `((base-initrd-modules . ,produced-modules)))))
1294
1295(define* (make-linux-libre version gnu-revision hash-string supported-systems
1296 #:key
1297 (extra-version #f)
1298 ;; A function that takes an arch and a variant, and
1299 ;; return a file-like object. See kernel-config
1300 ;; for an example.
1301 (configuration-file #f)
1302 (defconfig "defconfig")
1303 (extra-options (default-extra-linux-options version))
1304 (patches
1305 `(,%boot-logo-patch
1306 ,@(if (apply-infodoc-patch? version)
1307 (list (search-patch
1308 "linux-libre-infodocs-target.patch"))
1309 '()))))
1310 (make-linux-libre* version gnu-revision
1311 (origin
1312 (method url-fetch)
1313 (uri (linux-libre-urls version gnu-revision))
1314 (sha256 (base32 hash-string))
1315 (patches patches))
1316 supported-systems
1317 #:extra-version extra-version
1318 #:configuration-file configuration-file
1319 #:defconfig defconfig
1320 #:extra-options extra-options))
1321
1322(define virtio-modules
1323 ;; Modules for Linux para-virtualized devices, for use in QEMU guests.
1324 '("virtio_pci" "virtio_balloon" "virtio_blk" "virtio_net"
1325 "virtio_console" "virtio-rng" "virtio_mmio" "virtio_scsi"))
1326
1327(define default-linux-libre-initrd-modules
1328 ;; Default set of modules that need to be available in the initrd when
1329 ;; booting Linux-libre.
1330 (let* ((generic `("ahci" ;for SATA controllers
1331 "nvme" ;for NVMe controllers
1332 "usb-storage" "uas" ;for the installation image etc.
1333 "usbhid" "hid-generic" ;keyboards during early boot
1334 "mmc_block" ;for MMC block device driver
1335 "dm-crypt" "xts" "serpent_generic" "wp512" ;for encrypted root partitions
1336 "nls_iso8859-1" ;for `mkfs.fat`, et.al
1337 ,@virtio-modules))
1338 (_86 (cons*
1339 "hid-apple"
1340 "pata_acpi" "pata_atiixp" ;for ATA controllers
1341 "isci"
1342 generic))
1343 (others (cons*
1344 "hid-apple"
1345 generic)))
1346 `(("x86_64-linux" . ,_86)
1347 ("i686-linux" . ,_86)
1348 ("armhf-linux" . ,others)
1349 ("aarch64-linux" . ,others)
1350 ("mips64el-linux" . ,others)
1351 ("powerpc-linux" . ,others)
1352 ("powerpc64le-linux" . ,others)
1353 ("riscv64-linux" . ,generic))))
1354
1355(define* (make-linux-libre* version gnu-revision source supported-systems
1356 #:key
1357 (extra-version #f)
1358 ;; A function that takes an arch and a variant.
1359 ;; See kernel-config for an example.
1360 (configuration-file #f)
1361 (defconfig "defconfig")
1362 (extra-options (default-extra-linux-options version)))
1363 (let ((linux (make-linux* version source supported-systems
1364 default-linux-libre-initrd-modules
1365 #:extra-version extra-version
1366 #:configuration-file configuration-file
1367 #:defconfig defconfig
1368 #:extra-options extra-options)))
1369 (package
1370 (inherit linux)
1371 (name (if extra-version
1372 (string-append "linux-libre-" extra-version)
1373 "linux-libre"))
1374 (home-page "https://www.gnu.org/software/linux-libre/")
1375 (synopsis "100% free redistribution of a cleaned Linux kernel")
1376 (description "GNU Linux-Libre is a free (as in freedom) variant of the
1377Linux kernel. It has been modified to remove all non-free binary blobs.")
1378 (license license:gpl2)
1379 (properties (append %linux-libre-timeout-properties
1380 (package-properties linux))))))
1381
1382(define default-linux-debian-initrd-modules
1383 ;; Default set of modules that need to be available in the initrd when
1384 ;; booting Linux-debian.
1385 (let* ((generic `("ext4" "crc32c_generic" ; Compiled as a module by 'CONFIG_EXT4_FS=m'.
1386 "usb-storage" "uas" ;for the installation image etc.
1387 "usbhid" "hid-generic" ;keyboards during early boot
1388 "dm-crypt" "xts" "serpent_generic" "wp512" ;for encrypted root partitions
1389 "nls_iso8859-1" ;for `mkfs.fat`, et.al
1390 ,@virtio-modules))
1391 (others (cons*
1392 "hid-apple"
1393 generic)))
1394 `(("x86_64-linux" . ,others)
1395 ("i686-linux" . ,others)
1396 ("armhf-linux" . ,others)
1397 ("aarch64-linux" . ,others)
1398 ("mips64el-linux" . ,others)
1399 ("powerpc-linux" . ,others)
1400 ("powerpc64le-linux" . ,others)
1401 ("riscv64-linux" . ,generic))))
1402
1403(define* (make-linux-debian* version source supported-systems
1404 #:key
1405 (extra-version #f)
1406 ;; A function that takes an arch and a variant.
1407 ;; See kernel-config for an example.
1408 (configuration-file #f)
1409 (defconfig "defconfig")
1410 (extra-options (append
1411 ;; Required for enabling CIRRUS
1412 '(("CONFIG_PCI" . #t)
1413 ("CONFIG_DRM" . #t)
1414 ;; Required for QEMU virt
1415 ;; support.
1416 ("CONFIG_DRM_CIRRUS_QEMU" . m)
1417 ("CONFIG_DRM_VIRTIO_GPU" . m)
1418 ("CONFIG_DRM_BOCHS" . m))
1419 (default-extra-linux-options version))))
1420 (package
1421 (inherit (make-linux* version source supported-systems
1422 default-linux-debian-initrd-modules
1423 #:extra-version extra-version
1424 #:configuration-file configuration-file
1425 #:defconfig defconfig
1426 #:extra-options extra-options))
1427 (name (if extra-version
1428 (string-append "linux-debian-" extra-version)
1429 "linux-debian"))
1430 (home-page "https://www.debian.org")
1431 (synopsis "Debian's free redistribution of a cleaned Linux kernel")
1432 (description "Linux-Debian is a free (as in freedom) variant of the
1433Linux kernel. It has been modified to remove all non-free binary blobs
1434following the @uref{https://www.debian.org/social_contract#guidelines,
1435DFSDG}.")
1436 (license license:gpl2)))
1437
1438
1439;;;
1440;;; Generic kernel packages.
1441;;;
1442
1443(define-public linux-debian-6.12
1444 (make-linux-debian* linux-debian-6.12-version
1445 linux-debian-6.12-source
1446 '("x86_64-linux" "armhf-linux" "aarch64-linux"
1447 "powerpc64le-linux" "riscv64-linux")
1448 #:defconfig
1449 ;; XXX: this snippet merges the different configuration
1450 ;; files provided by Debian to construct a Debian
1451 ;; configuration for the given architecture. The
1452 ;; complete Debian configuration is composed by a
1453 ;; generic configuration 'config/config', an
1454 ;; architecture specific one ('armhf', 'arm64',
1455 ;; 'riscv64', 'amd64') that follows debian architecture
1456 ;; naming and sometimes an additionaly configuration
1457 ;; following the pattern 'kernelarch-xxx'.
1458 (delay
1459 #~(let* ((arch->debian-arch
1460 (lambda (arch)
1461 ;; Case comparison is done with 'eqv?'
1462 ;; which doesn't work with strings.
1463 (case (string->symbol arch)
1464 ((arm) '("kernelarch-arm" "armhf"))
1465 ((arm64) '("arm64"))
1466 ((powerpc) '("kernelarch-powerpc" "ppc64el"))
1467 ((riscv) '("riscv64"))
1468 ((x86_64) '("kernelarch-x86" "amd64"))
1469 (else '()))))
1470 (arch-confs (arch->debian-arch (getenv "ARCH"))))
1471 (apply invoke "scripts/kconfig/merge_config.sh"
1472 #$(file-append debian-patches-6.12
1473 "/config/config")
1474 (map (lambda (arch-conf)
1475 (string-append #$debian-patches-6.12
1476 "/config/"
1477 arch-conf
1478 "/config"))
1479 arch-confs))
1480 (invoke #$(file-append gnu-make "/bin/make")
1481 "olddefconfig")))))
1482
1483(define-public linux-debian linux-debian-6.12)
1484
1485(define-public linux-libre-7.2
1486 (make-linux-libre* linux-libre-7.2-version
1487 linux-libre-7.2-gnu-revision
1488 linux-libre-7.2-source
1489 '("x86_64-linux" "i686-linux" "armhf-linux"
1490 "aarch64-linux" "powerpc64le-linux" "riscv64-linux")
1491 #:configuration-file kernel-config))
1492
1493(define-public linux-libre-7.1
1494 (make-linux-libre* linux-libre-7.1-version
1495 linux-libre-7.1-gnu-revision
1496 linux-libre-7.1-source
1497 '("x86_64-linux" "i686-linux" "armhf-linux"
1498 "aarch64-linux" "powerpc64le-linux" "riscv64-linux")
1499 #:configuration-file kernel-config))
1500
1501(define-public linux-libre-version linux-libre-7.1-version)
1502(define-public linux-libre-gnu-revision linux-libre-7.1-gnu-revision)
1503(define-public linux-libre-pristine-source linux-libre-7.1-pristine-source)
1504(define-public linux-libre-source linux-libre-7.1-source)
1505(define-public linux-libre linux-libre-7.1)
1506
1507(define-public linux-libre-6.18
1508 (make-linux-libre* linux-libre-6.18-version
1509 linux-libre-6.18-gnu-revision
1510 linux-libre-6.18-source
1511 '("x86_64-linux" "i686-linux" "armhf-linux"
1512 "aarch64-linux" "powerpc64le-linux" "riscv64-linux")
1513 #:configuration-file kernel-config))
1514
1515(define-public linux-libre-6.12
1516 (make-linux-libre* linux-libre-6.12-version
1517 linux-libre-6.12-gnu-revision
1518 linux-libre-6.12-source
1519 '("x86_64-linux" "i686-linux" "armhf-linux"
1520 "aarch64-linux" "powerpc64le-linux" "riscv64-linux")
1521 #:configuration-file kernel-config))
1522
1523(define-public linux-libre-6.6
1524 (make-linux-libre* linux-libre-6.6-version
1525 linux-libre-6.6-gnu-revision
1526 linux-libre-6.6-source
1527 '("x86_64-linux" "i686-linux" "armhf-linux"
1528 "aarch64-linux" "powerpc64le-linux" "riscv64-linux")
1529 #:configuration-file kernel-config))
1530
1531(define-public linux-libre-6.1
1532 (make-linux-libre* linux-libre-6.1-version
1533 linux-libre-6.1-gnu-revision
1534 linux-libre-6.1-source
1535 '("x86_64-linux" "i686-linux" "armhf-linux"
1536 "aarch64-linux" "powerpc64le-linux" "riscv64-linux")
1537 #:configuration-file kernel-config))
1538
1539;; Linux-Libre-LTS points to the *newest* released long-term support version of
1540;; Linux-Libre.
1541;; Reference: <https://www.kernel.org/category/releases.html>
1542
1543(define-public linux-libre-lts-version linux-libre-6.18-version)
1544(define-public linux-libre-lts-gnu-revision linux-libre-6.18-gnu-revision)
1545(define-public linux-libre-lts-pristine-source linux-libre-6.18-pristine-source)
1546(define-public linux-libre-lts-source linux-libre-6.18-source)
1547(define-public linux-libre-lts linux-libre-6.18)
1548
1549
1550;;;
1551;;; Specialized kernel variants.
1552;;;
1553
1554(define-public %dummy-linux-kernel-for-container
1555 (hidden-package
1556 (package
1557 (name "linux-dummy")
1558 (version "0.0.0")
1559 (source #f)
1560 (build-system copy-build-system)
1561 (arguments
1562 (list #:phases
1563 #~(modify-phases %standard-phases
1564 (delete 'unpack)
1565 (replace 'install
1566 (lambda _
1567 (mkdir-p #$output))))))
1568 (home-page "")
1569 (synopsis "Dummy Linux kernel for @command{guix system container}")
1570 (description "")
1571 (license #f))))
1572
1573(define-public linux-libre-arm-generic
1574 (make-linux-libre* linux-libre-version
1575 linux-libre-gnu-revision
1576 linux-libre-source
1577 '("armhf-linux")
1578 #:defconfig "multi_v7_defconfig"
1579 #:extra-version "arm-generic"
1580 #:extra-options
1581 (append
1582 `(;; needed to fix the RTC on rockchip platforms
1583 ("CONFIG_RTC_DRV_RK808" . #t))
1584 (default-extra-linux-options linux-libre-version))))
1585
1586(define-public linux-libre-arm-omap2plus
1587 (make-linux-libre* linux-libre-version
1588 linux-libre-gnu-revision
1589 linux-libre-source
1590 '("armhf-linux")
1591 #:defconfig "omap2plus_defconfig"
1592 #:extra-version "arm-omap2plus"))
1593
1594(define pinebook-extra-modules
1595 `(;; Pinebook display, battery, charger and usb
1596 ("CONFIG_DRM_ANALOGIX_ANX6345" . m)
1597 ("CONFIG_CHARGER_AXP20X" . m)
1598 ("CONFIG_INPUT_AXP20X_PEK" . m)
1599 ("CONFIG_CHARGER_AXP20X" . m)
1600 ("CONFIG_BATTERY_AXP20X" . m)
1601 ("CONFIG_PINCTRL_AXP209" . m)
1602 ("CONFIG_AXP20X_POWER" . m)
1603 ("CONFIG_AXP20X_ADC" . m)
1604 ;; Pinebook PRO battery and sound support
1605 ("CONFIG_BATTERY_CW2015" . m)
1606 ("CONFIG_CHARGER_GPIO" . m)
1607 ("CONFIG_SND_SOC_ES8316" . m)))
1608
1609(define arm64-generic-extra-modules
1610 (append
1611 pinebook-extra-modules
1612 `(;; Provide support for ath9k wireless
1613 ("CONFIG_ATH9K_HTC" . m)
1614 ;; Support Orange Pi R1 Plus LTS ethernet PHY.
1615 ("CONFIG_MOTORCOMM_PHY" . m)
1616 ;; needed to fix the RTC on rockchip platforms
1617 ("CONFIG_RTC_DRV_RK808" . #t))))
1618
1619(define-public linux-libre-arm64-generic
1620 (make-linux-libre* linux-libre-version
1621 linux-libre-gnu-revision
1622 linux-libre-source
1623 '("aarch64-linux")
1624 #:defconfig "defconfig"
1625 #:extra-version "arm64-generic"
1626 #:extra-options
1627 (append
1628 arm64-generic-extra-modules
1629 (default-extra-linux-options linux-libre-version))))
1630
1631(define-public linux-libre-lts-arm64-generic
1632 (if (string=? linux-libre-lts-version linux-libre-version)
1633
1634 ;; Make it a strict alias so that the user interface does not see two
1635 ;; packages with the exact same name and version.
1636 linux-libre-arm64-generic
1637
1638 (make-linux-libre* linux-libre-lts-version
1639 linux-libre-lts-gnu-revision
1640 linux-libre-lts-source
1641 '("aarch64-linux")
1642 #:defconfig "defconfig"
1643 #:extra-version "arm64-generic"
1644 #:extra-options
1645 (append
1646 arm64-generic-extra-modules
1647 (default-extra-linux-options linux-libre-lts-version)))))
1648
1649(define-public linux-libre-arm64-honeycomb
1650 ;; Kernel for use on the HoneyComb LX2 boards:
1651 ;; <https://shop.solid-run.com/product/SRCFTXE000IV13/>.
1652 (make-linux-libre* linux-libre-lts-version
1653 linux-libre-lts-gnu-revision
1654 linux-libre-lts-source
1655 '("aarch64-linux")
1656 #:extra-version "arm64-honeycomb"
1657 #:extra-options
1658 ;; See
1659 ;; https://github.com/SolidRun/lx2160a_build/blob/master/configs/linux/lx2k_additions.config
1660 (append
1661 `(("CONFIG_GPIO_SYSFS" . #true)
1662 ("CONFIG_GPIO_MPC8XXX" . #true)
1663 ("CONFIG_NET_PKTGEN" . #true)
1664 ("CONFIG_USB_SERIAL" . #true)
1665 ("CONFIG_USB_SERIAL_CONSOLE" . #true)
1666 ("CONFIG_USB_SERIAL_GENERIC" . #true)
1667 ("CONFIG_USB_SERIAL_SIMPLE" . #true)
1668 ("CONFIG_USB_SERIAL_FTDI_SIO" . #true)
1669 ("CONFIG_USB_ACM" . #true)
1670 ("CONFIG_USB_NET_DRIVERS" . #true)
1671 ("CONFIG_USB_USBNET" . #true)
1672 ("CONFIG_USB_NET_CDCETHER" . #true)
1673 ("CONFIG_USB_NET_CDC_NCM" . #true)
1674 ("CONFIG_USB_NET_NET1080" . #true)
1675 ("CONFIG_USB_NET_CDC_SUBSET_ENABLE" . #true)
1676 ("CONFIG_USB_NET_CDC_SUBSET" . #true)
1677 ("CONFIG_USB_ARMLINUX" . #true)
1678 ("CONFIG_BLK_DEV_NVME" . #true)
1679 ("CONFIG_NVMEM_BCM_OCOTP" . #true)
1680 ("CONFIG_DRM_AMDGPU" . #true)
1681 ("CONFIG_DRM_AMDGPU_SI" . #true)
1682 ("CONFIG_DRM_AMDGPU_CIK" . #true)
1683 ("CONFIG_DRM_AMDGPU_USERPTR" . #true)
1684 ("CONFIG_DRM_AMD_DC" . #true)
1685 ("CONFIG_CHASH" . #true)
1686 ("CONFIG_PMBUS" . #true)
1687 ("CONFIG_SENSORS_PMBUS" . #true)
1688 ("CONFIG_REGULATOR" . #true)
1689 ("CONFIG_REGULATOR_FIXED_VOLTAGE" . #true)
1690 ("CONFIG_REGULATOR_PWM" . #true)
1691 ("CONFIG_SENSORS_AMC6821" . #true)
1692 ("CONFIG_SENSORS_LM90" . #true)
1693 ("CONFIG_SENSORS_LTC2978" . #true)
1694 ("CONFIG_SENSORS_LTC2978_REGULATOR" . #true)
1695 ("CONFIG_TMPFS" . #true)
1696 ("CONFIG_TMPFS_POSIX_ACL" . #true)
1697 ("CONFIG_TMPFS_XATTR" . #true)
1698 ;;("CONFIG_BLK_DEV_RAM_SIZE" . 524288)
1699 ("CONFIG_POWER_RESET_GPIO" . #true)
1700 ("CONFIG_CRYPTO_USER_API_HASH" . #true)
1701 ("CONFIG_CRYPTO_USER_API_SKCIPHER" . #true)
1702 ("CONFIG_CRYPTO_USER_API_RNG" . #true)
1703 ("CONFIG_CRYPTO_USER_API_AEAD" . #true)
1704
1705 ;; Fixes https://codeberg.org/guix/guix/issues/101
1706 ("CONFIG_KEY_DH_OPERATIONS" . #true)
1707
1708 ;; restool support
1709 ("CONFIG_FSL_MC_UAPI_SUPPORT" . #t)
1710 ("CONFIG_FSL_MC_BUS" . #t)
1711 ("CONFIG_VFIO_FSL_MC" . #t)
1712 ("CONFIG_FSL_MC_DPIO" . #t)
1713 ("CONFIG_ARM_GIC_V3_ITS_FSL_MC" . #t)
1714
1715 ;; vsockets support
1716 ;; TODO This seems to be enabled by default on other
1717 ;; architectures?
1718 ("CONFIG_VSOCKETS" . m)
1719 ("CONFIG_VSOCKETS_DIAG" . m)
1720 ("CONFIG_VSOCKETS_LOOPBACK" . m)
1721 ("CONFIG_VMWARE_VMCI_VSOCKETS" . m)
1722 ("CONFIG_VIRTIO_VSOCKETS" . m)
1723 ("CONFIG_VIRTIO_VSOCKETS_COMMON" . m)
1724 ("CONFIG_HYPERV_VSOCKETS" . m)
1725 ("CONFIG_VHOST_IOTLB" . m)
1726 ("CONFIG_VHOST_RING" . m)
1727 ("CONFIG_VHOST_TASK" . #true)
1728 ("CONFIG_VHOST" . m)
1729 ("CONFIG_VHOST_MENU" . #true)
1730 ("CONFIG_VHOST_NET" . m)
1731 ("CONFIG_VHOST_SCSI" . m)
1732 ("CONFIG_VHOST_VSOCK" . m)
1733 ("CONFIG_VHOST_VDPA" . m))
1734 (default-extra-linux-options linux-libre-lts-version))))
1735
1736(define-public reform-debian-packages-for-7.1
1737 (package
1738 (name "reform-debian-packages")
1739 (version "2023-07-10-688-gc3e9ed6") ;from git describe
1740 (source
1741 (origin
1742 (method git-fetch)
1743 (uri (git-reference
1744 (url "https://source.mnt.re/reform/reform-debian-packages.git")
1745 (commit "c3e9ed6f2dc3b18221dcbfe251d5724f6be83d09")))
1746 (file-name (git-file-name name version))
1747 (sha256
1748 (base32 "138a9jz882mia71gvvhhhhza1kb9vwp1xrmh6r9aj16qqfbzhspj"))))
1749 (build-system copy-build-system)
1750 (arguments
1751 (list
1752 #:install-plan
1753 #~'(("linux/patches7.1/" "/patches7.1")
1754 ("linux/" "/dts/amlogic"
1755 #:include-regexp ("meson.*\\.dts$"))
1756 ("linux/" "/dts/freescale"
1757 #:include-regexp ("imx8.*\\.dts$"))
1758 ("linux/" "/dts/freescale"
1759 #:include-regexp ("fsl.*\\.dts$"))
1760 ("linux/" "/dts/rockchip"
1761 #:include-regexp ("rk3588.*\\.dts$"))
1762 ("linux/" "/dts/qcom"
1763 #:include-regexp ("qcs.*\\.dts$"))
1764 ("linux/" "/dts/qcom"
1765 #:include-regexp ("qcs.*\\.dtsi$"))
1766 ("linux/config" "config"))))
1767 (home-page "https://source.mnt.re/reform/reform-debian-packages")
1768 (synopsis
1769 "Linux kernel patches and device-trees used for MNT Reform systems")
1770 (description
1771 "Linux kernel patches and device-trees used for the MNT Reform systems")
1772 (license (list
1773 (license:fsf-free "file://filter-output"
1774 "https://www.gnu.org/prep/maintain/html_node/License-Notices-for-Other-Files.html")
1775 license:bsd-2
1776 license:expat
1777 license:gpl2
1778 license:gpl2+
1779 license:gpl3
1780 license:x11))))
1781
1782(define-public reform-debian-packages-for-6.18
1783 (package
1784 (name "reform-debian-packages")
1785 (version "2023-07-10-525-g7e8a95c") ;from git describe
1786 (source
1787 (origin
1788 (method git-fetch)
1789 (uri (git-reference
1790 (url "https://source.mnt.re/reform/reform-debian-packages.git")
1791 (commit "7e8a95c7babd9e1f4b307b6d146e0846c65fc9b8")))
1792 (file-name (git-file-name name version))
1793 (sha256
1794 (base32 "0g7lm7bfsjn6y77i1gk6wgpmghd36s3axqdqr1ahl9vhzw03cx0g"))))
1795 (build-system copy-build-system)
1796 (arguments
1797 (list
1798 #:install-plan
1799 #~'(("linux/patches6.18/" "/patches6.18")
1800 ("linux/" "/dts/amlogic"
1801 #:include-regexp ("meson.*\\.dts$"))
1802 ("linux/" "/dts/freescale"
1803 #:include-regexp ("imx8.*\\.dts$"))
1804 ("linux/" "/dts/freescale"
1805 #:include-regexp ("fsl.*\\.dts$"))
1806 ("linux/" "/dts/rockchip"
1807 #:include-regexp ("rk3588.*\\.dts$"))
1808 ("linux/config" "config"))))
1809 (home-page "https://source.mnt.re/reform/reform-debian-packages")
1810 (synopsis
1811 "Linux kernel patches and device-trees used for MNT Reform systems")
1812 (description
1813 "Linux kernel patches and device-trees used for the MNT Reform systems")
1814 (license (list
1815 (license:fsf-free "file://filter-output"
1816 "https://www.gnu.org/prep/maintain/html_node/License-Notices-for-Other-Files.html")
1817 license:bsd-2
1818 license:expat
1819 license:gpl2
1820 license:gpl2+
1821 license:gpl3
1822 license:x11))))
1823
1824(define-public reform-debian-packages-for-6.12
1825 (package
1826 (name "reform-debian-packages")
1827 (version "2023-07-10-320-gaf0a461") ;from git describe
1828 (source
1829 (origin
1830 (method git-fetch)
1831 (uri (git-reference
1832 (url "https://source.mnt.re/reform/reform-debian-packages.git")
1833 (commit "af0a461d38e13481323f061d9ff6827d1d13873b")))
1834 (file-name (git-file-name name version))
1835 (sha256
1836 (base32 "1cylprld2ri3mprj5cgwla1l8qv9iqqvcra7h64yarzs49zaa16m"))))
1837 (build-system copy-build-system)
1838 (arguments
1839 (list
1840 #:install-plan
1841 #~'(("linux/patches6.12/" "/patches6.12")
1842 ("linux/" "/dts/amlogic"
1843 #:include-regexp ("meson.*\\.dts$"))
1844 ("linux/" "/dts/freescale"
1845 #:include-regexp ("imx8.*\\.dts$"))
1846 ("linux/" "/dts/freescale"
1847 #:include-regexp ("fsl.*\\.dts$"))
1848 ("linux/" "/dts/rockchip"
1849 #:include-regexp ("rk3588.*\\.dts$"))
1850 ("linux/config" "config"))))
1851 (home-page "https://source.mnt.re/reform/reform-debian-packages")
1852 (synopsis
1853 "Linux kernel patches and device-trees used for MNT Reform systems")
1854 (description
1855 "Linux kernel patches and device-trees used for the MNT Reform systems")
1856 (license (list
1857 (license:fsf-free "file://filter-output"
1858 "https://www.gnu.org/prep/maintain/html_node/License-Notices-for-Other-Files.html")
1859 license:bsd-2
1860 license:expat
1861 license:gpl2
1862 license:gpl2+
1863 license:gpl3
1864 license:x11))))
1865
1866(define (mnt-reform-kernel-options version)
1867 `(("CONFIG_DRM_LVDS_CODEC" . m)
1868 ("CONFIG_DRM_CDNS_MHDP8546" . m)
1869 ("CONFIG_DRM_CDNS_HDMI_CEC" . m)
1870 ("CONFIG_DRM_IMX_CDNS_MHDP" . m)
1871 ("CONFIG_DRM_IMX_DCSS" . m)
1872 ("CONFIG_PHY_FSL_IMX8MQ_HDPTX" . m)
1873 ("CONFIG_DRM_PANEL_LVDS" . m)
1874 ("CONFIG_I2C_IMX_LPI2C" . m)
1875 ("CONFIG_I2C_MUX_REG" . m)
1876 ("CONFIG_INTERCONNECT_IMX" . #true)
1877 ("CONFIG_INTERCONNECT_IMX8MQ" . #true)
1878 ("CONFIG_MFD_WM8994" . m)
1879 ("CONFIG_MUX_GPIO" . m)
1880 ("CONFIG_MUX_MMIO" . m)
1881 ("CONFIG_RTC_DRV_PCF8523" . m)
1882 ("CONFIG_USB_EHCI_FSL" . m)
1883 ("CONFIG_NO_HZ_IDLE" . #true)
1884 ("CONFIG_SND_SOC_FSL_MICFIL" . m)
1885 ("CONFIG_SND_IMX_SOC" . m)
1886 ("CONFIG_SND_SOC_FSL_ASOC_CARD" . m)
1887 ("CONFIG_SND_SOC_IMX_AUDMIX" . m)
1888 ("CONFIG_SND_SOC_IMX_HDMI" . m)
1889 ("CONFIG_INPUT_JOYSTICK" . #true)
1890 ("CONFIG_JOYSTICK_XPAD" . m)
1891 ("CONFIG_JOYSTICK_XPAD_FF" . #true)
1892 ("CONFIG_JOYSTICK_XPAD_LEDS" . #true)
1893 ("CONFIG_INTERCONNECT_IMX8MP" . #true)
1894 ("CONFIG_SND_SOC_FSL_ASRC" . #true)
1895 ("CONFIG_DRM_IMX_LCDIF" . #true)
1896 ("CONFIG_DRM_IMX8MP_DW_HDMI_BRIDGE" . #true)
1897 ("CONFIG_DRM_IMX8MP_HDMI_PVI" . #true)
1898 ("CONFIG_IMX8MM_THERMAL" . #true)
1899 ("CONFIG_IMX2_WDT" . #true)
1900 ("CONFIG_DRM_SAMSUNG_DSIM" . #true)
1901 ("CONFIG_PHY_FSL_SAMSUNG_HDMI_PHY" . #true)
1902 ("CONFIG_DRM" . m)
1903 ("CONFIG_DRM_PANEL_MNT_POCKET_REFORM" . m)
1904 ("CONFIG_IMX8M_BLK_CTRL" . #true)
1905 ("CONFIG_IMX_GPCV2_PM_DOMAINS" . #true)
1906 ("CONFIG_DRM_DISPLAY_CONNECTOR" . #true)
1907 ("CONFIG_DRM_FSL_LDB" . #true)
1908 ("CONFIG_BACKLIGHT_CLASS_DEVICE" . #true)
1909 ("CONFIG_BACKLIGHT_PWM" . #true)
1910 ("CONFIG_BACKLIGHT_GPIO" . #true)
1911 ("CONFIG_BACKLIGHT_LED" . #true)
1912 ("CONFIG_CPU_FREQ_GOV_PERFORMANCE" . #true)
1913 ("CONFIG_CPU_FREQ_GOV_POWERSAVE" . #true)
1914 ("CONFIG_CPU_FREQ_GOV_USERSPACE" . #true)
1915 ("CONFIG_CPU_FREQ_GOV_ONDEMAND" . #true)
1916 ("CONFIG_CPU_FREQ_GOV_CONSERVATIVE" . #true)
1917 ("CONFIG_CPU_FREQ_GOV_SCHEDUTIL" . #true)
1918 ("CONFIG_ARM_IMX_CPUFREQ_DT" . #true)
1919 ("CONFIG_ARM_IMX_BUS_DEVFREQ" . #true)
1920 ("CONFIG_IMX_IRQSTEER" . #true)
1921 ("CONFIG_PCI_MESON" . #true)
1922 ("CONFIG_DWMAC_MESON" . #true)
1923 ("CONFIG_MDIO_BUS_MUX_MESON_G12A" . m)
1924 ("CONFIG_GPIO_ROCKCHIP" . #true)
1925 ("CONFIG_PL330_DMA" . #true)
1926 ("CONFIG_I2C_MESON" . #true)
1927 ("CONFIG_PWM_MESON" . #true)
1928 ("CONFIG_USB_DWC3_MESON_G12A" . #true)
1929 ("CONFIG_MMC_MESON_GX" . #true)
1930 ("CONFIG_MMC_MESON_MX_SDIO" . #true)
1931 ("CONFIG_MESON_DDR_PMU" . #true)
1932 ("CONFIG_RTW88_8822CS" . m)
1933 ("CONFIG_PWM_FSL_FTM" . #true)
1934 ("CONFIG_FSL_RCPM" . #true)
1935 ("CONFIG_VIDEO_DW100" . m)
1936 ("CONFIG_IMX_AIPSTZ" . m)
1937 ("CONFIG_IMX_DSP" . m)
1938 ("CONFIG_IMX_REMOTEPROC" . m)
1939 ("CONFIG_IMX_DSP_REMOTEPROC" . m)
1940 ("CONFIG_ARM_ROCKCHIP_CPUFREQ" . m)
1941 ("CONFIG_DRM_PANTHOR" . m)
1942 ("CONFIG_NVMEM_ROCKCHIP_OTP" . #true)
1943 ("CONFIG_PHY_ROCKCHIP_SAMSUNG_HDPTX" . m)
1944 ("CONFIG_PHY_ROCKCHIP_USBDP" . m)
1945 ("CONFIG_ROCKCHIP_REGULATOR_COUPLER" . #true)
1946 ("CONFIG_SPI_ROCKCHIP" . #true)
1947 ("CONFIG_SPI_ROCKCHIP_SFC" . m)
1948 ("CONFIG_ARM_SCMI_CPUFREQ" . m)
1949 ("CONFIG_PHY_ROCKCHIP_SAMSUNG_DCPHY" . #true)
1950 ("CONFIG_VIDEO_ROCKCHIP_VDEC2" . m)
1951 ("CONFIG_ROCKCHIP_DW_HDMI_QP" . #true)
1952 ;; Fixes https://codeberg.org/guix/guix/issues/101
1953 ("CONFIG_CRYPTO_USER_API_HASH" . #true)
1954 ("CONFIG_CRYPTO_USER_API_SKCIPHER" . #true)
1955 ("CONFIG_CRYPTO_USER_API_RNG" . #true)
1956 ("CONFIG_CRYPTO_USER_API_AEAD" . #true)
1957 ("CONFIG_KEY_DH_OPERATIONS" . #true)
1958 ;; nftables support
1959 ("CONFIG_NF_TABLES" . m)
1960 ("CONFIG_NF_TABLES_INET" . #true)
1961 ("CONFIG_NF_TABLES_NETDEV" . #true)
1962 ("CONFIG_NF_TABLES_IPV4" . #true)
1963 ("CONFIG_NF_TABLES_ARP" . #true)
1964 ("CONFIG_NF_TABLES_IPV6" . #true)
1965 ("CONFIG_NF_TABLES_BRIDGE" . m)
1966 ("CONFIG_NFT_NUMGEN" . m)
1967 ("CONFIG_NFT_CT" . m)
1968 ("CONFIG_NFT_FLOW_OFFLOAD" . m)
1969 ("CONFIG_NFT_CONNLIMIT" . m)
1970 ("CONFIG_NFT_LOG" . m)
1971 ("CONFIG_NFT_LIMIT" . m)
1972 ("CONFIG_NFT_MASQ" . m)
1973 ("CONFIG_NFT_REDIR" . m)
1974 ("CONFIG_NFT_NAT" . m)
1975 ("CONFIG_NFT_TUNNEL" . m)
1976 ("CONFIG_NFT_QUEUE" . m)
1977 ("CONFIG_NFT_QUOTA" . m)
1978 ("CONFIG_NFT_REJECT" . m)
1979 ("CONFIG_NFT_REJECT_INET" . m)
1980 ("CONFIG_NFT_COMPAT" . m)
1981 ("CONFIG_NFT_HASH" . m)
1982 ("CONFIG_NFT_FIB" . m)
1983 ("CONFIG_NFT_FIB_INET" . m)
1984 ("CONFIG_NFT_XFRM" . m)
1985 ("CONFIG_NFT_SOCKET" . m)
1986 ("CONFIG_NFT_OSF" . m)
1987 ("CONFIG_NFT_TPROXY" . m)
1988 ("CONFIG_NFT_SYNPROXY" . m)
1989 ("CONFIG_NFT_DUP_NETDEV" . m)
1990 ("CONFIG_NFT_FWD_NETDEV" . m)
1991 ("CONFIG_NFT_FIB_NETDEV" . m)
1992 ("CONFIG_NFT_REJECT_NETDEV" . m)
1993 ("CONFIG_NFT_REJECT_IPV4" . m)
1994 ("CONFIG_NFT_DUP_IPV4" . m)
1995 ("CONFIG_NFT_FIB_IPV4" . m)
1996 ("CONFIG_NFT_COMPAT_ARP" . m)
1997 ("CONFIG_NFT_REJECT_IPV6" . m)
1998 ("CONFIG_NFT_DUP_IPV6" . m)
1999 ("CONFIG_NFT_FIB_IPV6" . m)
2000 ("CONFIG_NFT_BRIDGE_META" . m)
2001 ("CONFIG_NFT_BRIDGE_REJECT" . m)
2002 ;; Provides support for FBCON options
2003 ("CONFIG_FRAMEBUFFER_CONSOLE_ROTATION" . #true)
2004 ("CONFIG_HIDRAW" . #true)
2005 ("CONFIG_FONT_SUPPORT" . #true)
2006 ("CONFIG_FONTS" . #true)
2007 ("CONFIG_FONT_8x8" . #true)
2008 ("CONFIG_FONT_8x16" . #true)
2009 ("CONFIG_FONT_TER10x18" . #true)
2010 ("CONFIG_FONT_TER16x32" . #true)
2011 ;; Provide support for USB tethering
2012 ("CONFIG_USB_NET_CDC_EEM" . m)
2013 ("CONFIG_USB_NET_RNDIS_HOST" . m)
2014 ("CONFIG_USB_WDM" . m)
2015 ("CONFIG_USB_GADGET" . m)
2016 ("CONFIG_USB_ETH" . m)
2017 ("CONFIG_USB_ETH_RNDIS" . m)
2018 ("CONFIG_USB_ETH_EEM" . m)
2019 ("CONFIG_USB_G_NCM" . m)
2020 ;; Provide support for ath9k wireless
2021 ("CONFIG_ATH9K" . m)
2022 ("CONFIG_ATH9K_HTC" . m)
2023 ;; vsockets support
2024 ("CONFIG_VSOCKETS" . m)
2025 ("CONFIG_VSOCKETS_DIAG" . m)
2026 ("CONFIG_VSOCKETS_LOOPBACK" . m)
2027 ("CONFIG_VMWARE_VMCI_VSOCKETS" . m)
2028 ("CONFIG_VIRTIO_VSOCKETS" . m)
2029 ("CONFIG_VIRTIO_VSOCKETS_COMMON" . m)
2030 ("CONFIG_HYPERV_VSOCKETS" . m)
2031 ,@(if (version>=? version "6.18")
2032 '(("CONFIG_ROCKCHIP_DW_MIPI_DSI2" . #true))
2033 ;; 6.12 or older gets this instead:
2034 '(("CONFIG_ROCKCHIP_INNO_HDMI" . #true)
2035 ("CONFIG_ROCKCHIP_LVDS" . #true)
2036 ("CONFIG_ROCKCHIP_DW_MIPI_DSI" . #true)))
2037 ,@(if (version>=? version "7.1")
2038 '( ;; QCOM cpu module
2039 ("CONFIG_INTERCONNECT_QCOM_SM8550" . #true)
2040 ("CONFIG_PINCTRL_SM8550" . #true)
2041 ("CONFIG_PINCTRL_SM8550_LPASS_LPI" . #true)
2042 ("CONFIG_SM_CAMCC_8550" . #true)
2043 ("CONFIG_SM_GCC_8550" . #true)
2044 ("CONFIG_SM_GPUCC_8550" . #true)
2045 ("CONFIG_SM_TCSRCC_8550" . #true)
2046 ("CONFIG_SM_VIDEOCC_8550" . #true)
2047 ("CONFIG_SM_DISPCC_8550" . #true)
2048 ("CONFIG_USB_QCOM_EUD" . #true)
2049 ("CONFIG_SPMI_PMIC_CLKDIV" . #true)
2050 ("CONFIG_INTERCONNECT_QCOM_SM8750" . #true)
2051 ("CONFIG_PINCTRL_SM8750" . #true)
2052 ("CONFIG_SM_TCSRCC_8750" . #true)
2053 ("CONFIG_REGULATOR_QCOM_REFGEN" . m)
2054 ("CONFIG_MNTRE_SC" . m))
2055 '())))
2056
2057(define-public linux-libre-arm64-mnt-reform-7.1
2058 ;; Kernel for use on the MNT/Reform systems
2059 ;; https://mntre.com/reform.html
2060 (let ((base (make-linux-libre* linux-libre-7.1-version
2061 linux-libre-7.1-gnu-revision
2062 linux-libre-7.1-source
2063 '("aarch64-linux")
2064 #:extra-version "arm64-mnt-reform"
2065 #:extra-options
2066 ;; https://source.mnt.re/reform/reform-debian-packages/-/blob/main/linux/config
2067 (append (mnt-reform-kernel-options
2068 linux-libre-7.1-version)
2069 (default-extra-linux-options
2070 linux-libre-7.1-version)))))
2071 (package
2072 (inherit base)
2073 (inputs (list reform-debian-packages-for-7.1))
2074 (synopsis (string-append (package-synopsis base)
2075 " for MNT/Reform systems"))
2076 (description (string-append (package-description base)
2077 " Configuration options and patches have been applied for use with MNT/Reform systems."))
2078 (arguments
2079 (substitute-keyword-arguments (package-arguments base)
2080 ((#:phases phases)
2081 #~(modify-phases #$phases
2082 (add-after 'unpack 'apply-reform-patches
2083 (lambda* (#:key inputs #:allow-other-keys)
2084 (for-each (lambda (patch)
2085 (invoke "patch" "-p1" "-i"
2086 (search-input-file inputs
2087 (string-append
2088 "patches7.1/" patch))))
2089 (list
2090 "imx8mp-mnt-pocket-reform/2ghz/0001-imx8mp-2ghz-clk.patch"
2091 "imx8mp-mnt-pocket-reform/2ghz/0002-imx8mp-2ghz-opp.patch"
2092 "imx8mp-mnt-pocket-reform/mmc-sdio/0001-sdhci-add-no-sd-uhs-sdr104-devicetree-property.patch"
2093 "imx8mp-mnt-pocket-reform/mmc-sdio/0002-During-the-card-init-the-host-side-sometimes-may-nee.patch"
2094 "imx8mp-mnt-pocket-reform/mmc-sdio/0003-USDHC-IP-has-one-limitation-the-tuning-circuit-can-t.patch"
2095 "imx8mp-mnt-pocket-reform/pocket-panel/0001-v5-add-multi-display-panel-driver.patch"
2096 "imx8mp-mnt-reform2/0001-sn65dsi86-use-hs-clock-of-samsung-dsim-host-directly.patch"
2097 "imx8mp-mnt-reform2/0002-lcdif-dont-exceed-desired-pixel-clock.patch"
2098 "imx8mq-mnt-reform2/0001-imx8mq-mnt-reform2.dts-multiple-fixes-for-display-wi.patch"
2099 "imx8mq-mnt-reform2/0001-nwl-dsi-fixup-mode-only-for-LCDIF-input-not-DCSS.patch"
2100 "imx8mq-mnt-reform2/0002-Revert-drm-bridge-nwl-dsi-Use-vsync-hsync-polarity-f.patch"
2101 "imx8mq-mnt-reform2/0003-lcdif-fix-pcie-interference.patch"
2102 "imx8mq-mnt-reform2/0004-mnt4002-imx-gpcv2-wake-smccc.patch.patch"
2103 "imx8mq-mnt-reform2/0005-pci-imx6-add-support-for-internal-refclk-imx8mq.patch"
2104 "imx8mq-mnt-reform2/0006-imx8mq-import-HDMI-driver-and-make-DCSS-compatible-w.patch"
2105 "ls1028a-mnt-reform2/0000-dtsi-add-hdptx.patch"
2106 "meson-g12b-bananapi-cm4-mnt-pocket-reform/0001-a311d-viu-fifo-lines-config.patch"
2107 "meson-g12b-bananapi-cm4-mnt-pocket-reform/0002-a311d-viu-fifo-lines-config-header.patch"
2108 "meson-g12b-bananapi-cm4-mnt-pocket-reform/0003-tlv320aic31xx-add-1228800hz-support.patch"
2109 "meson-g12b-bananapi-cm4-mnt-reform2/0001-Revert-drm-bridge-synopsys-dw-mipi-dsi-enable-EoTp-b.patch"
2110 "meson-g12b-bananapi-cm4-mnt-reform2/0001-meson-g12b-bananapi-cm4-mnt-reform2.dts-fix-audio-an.patch"
2111 "meson-g12b-bananapi-cm4-mnt-reform2/0011-dw-mipi-dsi-phy-stop-wait-time.patch"
2112 "meson-g12b-bananapi-cm4-mnt-reform2/0012-innolux-n125hce-gn1-timing-tweaks.patch"
2113 "meson-g12b-bananapi-cm4-mnt-reform2/0013-meson-viu-hold-fifo-lines.patch"
2114 "meson-g12b-bananapi-cm4-mnt-reform2/0014-meson-venc-sync.patch.patch"
2115 "meson-g12b-bananapi-cm4-mnt-reform2/0015-meson-dw-mipi-dsi-sync-invert.patch"
2116 "meson-g12b-bananapi-cm4-mnt-reform2/0016-sn65dsi86-burst-mode-support.patch"
2117 "meson-g12b-bananapi-cm4-mnt-reform2/0018-sn65dsi86-never-turn-off.patch"
2118 "meson-g12b-bananapi-cm4-mnt-reform2/0020-LOCAL-ALSA-Assign-internal-PCM-chmap-ELD-IEC958-kctl.patch"
2119 "meson-g12b-bananapi-cm4-mnt-reform2/0021-HACK-of-partial-revert-of-fdt.c-changes.patch"
2120 "meson-g12b-bananapi-cm4-mnt-reform2/0022-add-bt-and-eth-resets.patch"
2121 "meson-g12b-bananapi-cm4-mnt-reform2/0023-sdio-pullups.patch"
2122 "meson-g12b-bananapi-cm4-mnt-reform2/0024-sdio-improve-wifi-speed.patch"
2123 "meson-g12b-bananapi-cm4-mnt-reform2/0030-WORKAROUND-meson-plane-disable-afbc-32x8.patch"
2124 "qcom-mnt-reform2/3001-casey-aux-bridge-defer.patch"
2125 "qcom-mnt-reform2/3003-casey-lpass-sc7280-audio-hacks.patch"
2126 "qcom-mnt-reform2/4000-qcom-pci-d3cold.patch"
2127 "qcom-mnt-reform2/4001-qcom-pci-d3cold-2.patch"
2128 "qcom-mnt-reform2/4002-qcom-pci-get-ltssm.patch"
2129 "qcom-mnt-reform2/4003-qcom-pci-power-down-phy-via-parf.patch"
2130 "qcom-mnt-reform2/4004-qcom-pci-add-d3cold.patch"
2131 "qcom-mnt-reform2/5000-tlv320aic31xx-mclk-fallback.patch"
2132 "qcom-mnt-reform2/5010-asoc_qcom_qdsp6_q6prm_add_the_missing_mclk_clock_ids.patch"
2133 "qcom-mnt-reform2/5011-sc8280xp-add-support-for-I2S-clocks.patch"
2134 "rk3588-mnt-reform2/0024-math.h-add-DIV_ROUND_UP_NO_OVERFLOW.patch"
2135 "rk3588-mnt-reform2/0025-clk-divider-Fix-divisor-masking-on-64-bit-platforms.patch"
2136 "rk3588-mnt-reform2/0026-clk-composite-replace-open-coded-abs_diff.patch"
2137 "rk3588-mnt-reform2/0029-PCI-dw-rockchip-Restore-vpcie3v3-regulator-handle.patch"
2138 "rk3588-mnt-reform2/0030-mfd-rk8xx-Fix-shutdown-handler.patch"
2139 "rk3588-mnt-reform2/0031-dt-bindings-display-vop2-Add-VP-clock-resets.patch"
2140 "rk3588-mnt-reform2/0032-drm-rockchip-vop2-Add-clock-resets-support.patch"
2141 "rk3588-mnt-reform2/0033-arm64-dts-rockchip-Add-VOP-clock-resets-for-rk3588s.patch"
2142 "rk3588-mnt-reform2/0035-drm-rockchip-vop2-Add-core-reset-support.patch"
2143 "rk3588-mnt-reform2/0062-PCI-dw-rockchip-Move-devm_phy_get-out-of-phy_init.patch"
2144 "rk3588-mnt-reform2/0063-PCI-dw-rockchip-Add-helper-function-for-enhanced-LTS.patch"
2145 "rk3588-mnt-reform2/0064-PCI-dw-rockchip-Add-helper-function-for-controller-m.patch"
2146 "rk3588-mnt-reform2/0065-PCI-dw-rockchip-Add-helper-function-for-DDL-indicato.patch"
2147 "rk3588-mnt-reform2/0066-PCI-dw-rockchip-Add-pme_turn_off-support.patch"
2148 "rk3588-mnt-reform2/0067-PCI-dw-rockchip-Add-system-PM-support.patch"
2149 "rk3588-mnt-reform2/0078-PCI-dw-rockchip-Fix-LTSSM-set-functions.patch"
2150 "rk3588-mnt-reform2/0079-RFC-PCI-dw-rockchip-port-some-suspend-code-from-vend.patch"
2151 "rk3588-mnt-reform2/0089-DEBUG-phy-rockchip-samsung-hdptx-Add-verbose-logging.patch"
2152 "rk3588-mnt-reform2/0092-drm-rockchip-dw_hdmi_qp-Restrict-HPD-event-to-the-af.patch"
2153 "rk3588-mnt-reform2/0094-drm-bridge-connector-Use-cached-connector-status-in-.patch"
2154 "rk3588-mnt-reform2/0095-drm-bridge-Add-detect_ctx-hook-and-drm_bridge_detect.patch"
2155 "rk3588-mnt-reform2/0096-drm-bridge-connector-Switch-to-.detect_ctx-for-conne.patch"
2156 "rk3588-mnt-reform2/0097-drm-bridge-dw-hdmi-qp-Add-HDMI-2.0-SCDC-scrambling-a.patch"
2157 "rk3588-mnt-reform2/0108-dt-bindings-phy-rockchip-usbdp-add-improved-ports-sc.patch"
2158 "rk3588-mnt-reform2/2001-drm-bridge-dw-hdmi-qp-Return-0-in-audio-prepare-when.patch"
2159 "rk3588-mnt-reform2/2003-drm-bridge-synopsys-Do-not-warn-about-audio-params-c.patch"
2160 "rk3588-mnt-reform2/5200-drm-rockchip-Set-dma-mask-to-64-bit.patch"
2161 "rk3588-mnt-reform2/6000-loosen-mnt-reform2-edp-panel-timing.patch"
2162 "rk3588-mnt-reform2/7000-mnt-analogix-dp-changes-for-usb-c-alt-mode.patch"
2163 "sc/1000-mnt-sc-driver.patch"))))
2164 (add-after 'apply-reform-patches 'copy-reform-dts-files
2165 (lambda* (#:key inputs #:allow-other-keys)
2166 (for-each (lambda (dts)
2167 (copy-file (search-input-file inputs
2168 (string-append
2169 "/dts/" dts))
2170 (string-append "arch/arm64/boot/dts/"
2171 dts)))
2172 (list
2173 "amlogic/meson-g12b-bananapi-cm4-mnt-pocket-reform.dts"
2174 "freescale/fsl-ls1028a-mnt-reform2.dts"
2175 "freescale/imx8mp-mnt-pocket-reform.dts"
2176 "freescale/imx8mp-mnt-reform2.dts"
2177 "freescale/imx8mq-mnt-reform2-hdmi.dts"
2178 "rockchip/rk3588-mnt-station.dts"
2179 "rockchip/rk3588-mnt-pocket-reform.dts"
2180 "rockchip/rk3588-mnt-reform-next.dts"
2181 "rockchip/rk3588-mnt-reform2.dts"
2182 "rockchip/rk3588-mnt-reform2-dsi.dts"
2183 "qcom/qcs6490-mnt-quasar.dtsi"
2184 "qcom/qcs6490-mnt-reform2.dts"
2185 "qcom/qcs6490-mnt-pocket-reform.dts"
2186 "qcom/qcs6490-mnt-reform-next.dts"
2187 "qcom/qcs8550-mnt-reform2.dts"
2188 "qcom/qcs8550-mnt-pocket-reform.dts"
2189 "qcom/qcs8550-mnt-reform-next.dts"))))
2190 (add-after 'apply-reform-patches 'adjust-makefiles-with-new-dtb
2191 (lambda _
2192 (substitute* "arch/arm64/boot/dts/amlogic/Makefile"
2193 (("meson-g12b-bananapi-cm4-mnt-reform2.dtb")
2194 "meson-g12b-bananapi-cm4-mnt-reform2.dtb
2195dtb-$(CONFIG_ARCH_MESON) += meson-g12b-bananapi-cm4-mnt-pocket-reform.dtb"))
2196 (substitute* "arch/arm64/boot/dts/freescale/Makefile"
2197 (("fsl-ls1028a-rdb.dtb")
2198 "fsl-ls1028a-rdb.dtb
2199dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-ls1028a-mnt-reform2.dtb"))
2200 (substitute* "arch/arm64/boot/dts/freescale/Makefile"
2201 (("imx8mq-mnt-reform2.dtb")
2202 "imx8mq-mnt-reform2.dtb
2203dtb-$(CONFIG_ARCH_MXC) += imx8mp-mnt-reform2.dtb
2204dtb-$(CONFIG_ARCH_MXC) += imx8mp-mnt-pocket-reform.dtb
2205dtb-$(CONFIG_ARCH_MXC) += imx8mq-mnt-reform2-hdmi.dtb"))
2206 (substitute* "arch/arm64/boot/dts/rockchip/Makefile"
2207 (("rk3588-mnt-reform2.dtb")
2208 "rk3588-mnt-reform2.dtb
2209dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-mnt-station.dts
2210dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-mnt-reform2-dsi.dtb
2211dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-mnt-reform-next.dtb
2212dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-mnt-pocket-reform.dtb"))
2213 (substitute* "arch/arm64/boot/dts/qcom/Makefile"
2214 (("= qcs6490-rb3gen2-vision-mezzanine.dtb")
2215 "= qcs6490-rb3gen2-vision-mezzanine.dtb
2216dtb-$(CONFIG_ARCH_QCOM) += qcs6490-mnt-reform2.dtb
2217dtb-$(CONFIG_ARCH_QCOM) += qcs6490-mnt-pocket-reform.dtb
2218dtb-$(CONFIG_ARCH_QCOM) += qcs6490-mnt-reform-next.dtb")
2219 (("qcs8550-aim300-aiot.dtb")
2220 "qcs8550-aim300-aiot.dtb
2221dtb-$(CONFIG_ARCH_QCOM) += qcs8550-mnt-reform2.dtb
2222dtb-$(CONFIG_ARCH_QCOM) += qcs8550-mnt-pocket-reform.dtb
2223dtb-$(CONFIG_ARCH_QCOM) += qcs8550-mnt-reform-next.dtb")))))))))))
2224
2225(define-public linux-libre-arm64-mnt-reform linux-libre-arm64-mnt-reform-7.1)
2226
2227(define-public linux-libre-arm64-mnt-reform-6.18
2228 ;; Kernel for use on the MNT/Reform systems
2229 ;; https://mntre.com/reform.html
2230 (let ((base (make-linux-libre* linux-libre-6.18-version
2231 linux-libre-6.18-gnu-revision
2232 linux-libre-6.18-source
2233 '("aarch64-linux")
2234 #:extra-version "arm64-mnt-reform"
2235 #:extra-options
2236 ;; https://source.mnt.re/reform/reform-debian-packages/-/blob/main/linux/config
2237 (append (mnt-reform-kernel-options
2238 linux-libre-6.18-version)
2239 (default-extra-linux-options
2240 linux-libre-6.18-version)))))
2241 (package
2242 (inherit base)
2243 (inputs (list reform-debian-packages-for-6.18))
2244 (synopsis (string-append (package-synopsis base)
2245 " for MNT/Reform systems"))
2246 (description (string-append (package-description base)
2247 " Configuration options and patches have been applied for use with MNT/Reform systems."))
2248 (arguments
2249 (substitute-keyword-arguments arguments
2250 ((#:phases phases)
2251 #~(modify-phases #$phases
2252 (add-after 'unpack 'apply-reform-patches
2253 (lambda* (#:key inputs #:allow-other-keys)
2254 (for-each (lambda (patch)
2255 (invoke "patch" "-p1" "-i"
2256 (search-input-file inputs
2257 (string-append
2258 "patches6.18/" patch))))
2259 (list
2260 "imx8mp-mnt-pocket-reform/2ghz/0001-imx8mp-2ghz-clk.patch"
2261 "imx8mp-mnt-pocket-reform/2ghz/0002-imx8mp-2ghz-opp.patch"
2262 "imx8mp-mnt-pocket-reform/audio/0000-revert-crashy-audiomix-pm-support.patch"
2263 "imx8mp-mnt-pocket-reform/mmc-sdio/0001-sdhci-add-no-sd-uhs-sdr104-devicetree-property.patch"
2264 "imx8mp-mnt-pocket-reform/mmc-sdio/0002-During-the-card-init-the-host-side-sometimes-may-nee.patch"
2265 "imx8mp-mnt-pocket-reform/mmc-sdio/0003-USDHC-IP-has-one-limitation-the-tuning-circuit-can-t.patch"
2266 "imx8mp-mnt-pocket-reform/pocket-panel/0001-v5-add-multi-display-panel-driver.patch"
2267 "imx8mp-mnt-pocket-reform/pocket-panel/0002-pocket-panel-fix-sleep-add-orientation.patch"
2268 "imx8mp-mnt-reform2/0001-sn65dsi86-use-hs-clock-of-samsung-dsim-host-directly.patch"
2269 "imx8mp-mnt-reform2/0002-lcdif-dont-exceed-desired-pixel-clock.patch"
2270 "imx8mq-mnt-reform2/0001-imx8mq-mnt-reform2.dts-multiple-fixes-for-display-wi.patch"
2271 "imx8mq-mnt-reform2/0001-nwl-dsi-fixup-mode-only-for-LCDIF-input-not-DCSS.patch"
2272 "imx8mq-mnt-reform2/0002-Revert-drm-bridge-nwl-dsi-Use-vsync-hsync-polarity-f.patch"
2273 "imx8mq-mnt-reform2/0003-lcdif-fix-pcie-interference.patch"
2274 "imx8mq-mnt-reform2/0004-mnt4002-imx-gpcv2-wake-smccc.patch.patch"
2275 "imx8mq-mnt-reform2/0005-pci-imx6-add-support-for-internal-refclk-imx8mq.patch"
2276 "imx8mq-mnt-reform2/0006-imx8mq-import-HDMI-driver-and-make-DCSS-compatible-w.patch"
2277 "ls1028a-mnt-reform2/0000-dtsi-add-hdptx.patch"
2278 "meson-g12b-bananapi-cm4-mnt-pocket-reform/0001-a311d-viu-fifo-lines-config.patch"
2279 "meson-g12b-bananapi-cm4-mnt-pocket-reform/0002-a311d-viu-fifo-lines-config-header.patch"
2280 "meson-g12b-bananapi-cm4-mnt-pocket-reform/0003-tlv320aic31xx-add-1228800hz-support.patch"
2281 "meson-g12b-bananapi-cm4-mnt-reform2/0001-meson-g12b-bananapi-cm4-mnt-reform2.dts-fix-audio-an.patch"
2282 "meson-g12b-bananapi-cm4-mnt-reform2/0001-Revert-drm-bridge-synopsys-dw-mipi-dsi-enable-EoTp-b.patch"
2283 "meson-g12b-bananapi-cm4-mnt-reform2/0011-dw-mipi-dsi-phy-stop-wait-time.patch"
2284 "meson-g12b-bananapi-cm4-mnt-reform2/0012-innolux-n125hce-gn1-timing-tweaks.patch"
2285 "meson-g12b-bananapi-cm4-mnt-reform2/0013-meson-viu-hold-fifo-lines.patch"
2286 "meson-g12b-bananapi-cm4-mnt-reform2/0014-meson-venc-sync.patch.patch"
2287 "meson-g12b-bananapi-cm4-mnt-reform2/0015-meson-dw-mipi-dsi-sync-invert.patch"
2288 "meson-g12b-bananapi-cm4-mnt-reform2/0016-sn65dsi86-burst-mode-support.patch"
2289 "meson-g12b-bananapi-cm4-mnt-reform2/0018-sn65dsi86-never-turn-off.patch"
2290 "meson-g12b-bananapi-cm4-mnt-reform2/0020-LOCAL-ALSA-Assign-internal-PCM-chmap-ELD-IEC958-kctl.patch"
2291 "meson-g12b-bananapi-cm4-mnt-reform2/0021-HACK-of-partial-revert-of-fdt.c-changes.patch"
2292 "meson-g12b-bananapi-cm4-mnt-reform2/0022-add-bt-and-eth-resets.patch"
2293 "meson-g12b-bananapi-cm4-mnt-reform2/0023-sdio-pullups.patch"
2294 "meson-g12b-bananapi-cm4-mnt-reform2/0024-sdio-improve-wifi-speed.patch"
2295 "meson-g12b-bananapi-cm4-mnt-reform2/0030-WORKAROUND-meson-plane-disable-afbc-32x8.patch"
2296 "rk3588-mnt-reform2/0001-MERGED-drm-bridge-Pass-down-connector-to-drm-bridge-.patch"
2297 "rk3588-mnt-reform2/0024-math.h-add-DIV_ROUND_UP_NO_OVERFLOW.patch"
2298 "rk3588-mnt-reform2/0025-clk-divider-Fix-divisor-masking-on-64-bit-platforms.patch"
2299 "rk3588-mnt-reform2/0026-clk-composite-replace-open-coded-abs_diff.patch"
2300 "rk3588-mnt-reform2/0030-mfd-rk8xx-Fix-shutdown-handler.patch"
2301 "rk3588-mnt-reform2/0031-dt-bindings-display-vop2-Add-VP-clock-resets.patch"
2302 "rk3588-mnt-reform2/0032-drm-rockchip-vop2-Add-clock-resets-support.patch"
2303 "rk3588-mnt-reform2/0033-arm64-dts-rockchip-Add-VOP-clock-resets-for-rk3588s.patch"
2304 "rk3588-mnt-reform2/0035-drm-rockchip-vop2-Add-core-reset-support.patch"
2305 "rk3588-mnt-reform2/0046-arm64-defconfig-Enable-Rockchip-RK3588-DisplayPort-C.patch"
2306 "rk3588-mnt-reform2/0055-phy-rockchip-usbdp-move-orientation-handling-further.patch"
2307 "rk3588-mnt-reform2/0056-phy-rockchip-usbdp-reset-USB3-and-reinit-on-orientat.patch"
2308 ;; "rk3588-mnt-reform2/0060-PCI-dw-rockchip-Rename-rockchip_pcie_get_ltssm-funct.patch"
2309 ;; "rk3588-mnt-reform2/0061-PCI-dw-rockchip-Support-get_ltssm-operation.patch"
2310 ;; "rk3588-mnt-reform2/0062-PCI-dw-rockchip-Move-devm_phy_get-out-of-phy_init.patch"
2311 ;; "rk3588-mnt-reform2/0063-PCI-dw-rockchip-Add-helper-function-for-enhanced-LTS.patch"
2312 ;; "rk3588-mnt-reform2/0064-PCI-dw-rockchip-Add-helper-function-for-controller-m.patch"
2313 ;; "rk3588-mnt-reform2/0065-PCI-dw-rockchip-Add-helper-function-for-DDL-indicato.patch"
2314 ;; "rk3588-mnt-reform2/0066-PCI-dw-rockchip-Add-pme_turn_off-support.patch"
2315 ;; "rk3588-mnt-reform2/0067-PCI-dw-rockchip-Add-system-PM-support.patch"
2316 "rk3588-mnt-reform2/0068-drm-bridge-dw-hdmi-qp-Add-CEC-support.patch"
2317 "rk3588-mnt-reform2/0069-drm-bridge-dw-hdmi-qp-Fixup-timer-base-setup.patch"
2318 "rk3588-mnt-reform2/0070-drm-rockchip-dw_hdmi_qp-Improve-error-handling-with-.patch"
2319 "rk3588-mnt-reform2/0071-drm-rockchip-dw_hdmi_qp-Provide-CEC-IRQ-in-dw_hdmi_q.patch"
2320 "rk3588-mnt-reform2/0072-drm-rockchip-dw_hdmi_qp-Provide-ref-clock-rate-in-dw.patch"
2321 "rk3588-mnt-reform2/0073-arm64-defconfig-Enable-DW-HDMI-QP-CEC-support.patch"
2322 "rk3588-mnt-reform2/0075-phy-hdmi-Add-HDMI-2.1-FRL-configuration-options.patch"
2323 "rk3588-mnt-reform2/0079-phy-rockchip-samsung-hdptx-Use-usleep_range-instead-.patch"
2324 "rk3588-mnt-reform2/0080-phy-rockchip-samsung-hdptx-Fix-coding-style-alignmen.patch"
2325 "rk3588-mnt-reform2/0081-phy-rockchip-samsung-hdptx-Consistently-use-rk_-hdpt.patch"
2326 "rk3588-mnt-reform2/0082-phy-rockchip-samsung-hdptx-Enable-lane-output-in-com.patch"
2327 "rk3588-mnt-reform2/0083-phy-rockchip-samsung-hdptx-Cleanup-_cmn_init_seq-lis.patch"
2328 "rk3588-mnt-reform2/0084-phy-rockchip-samsung-hdptx-Compute-clk-rate-from-PLL.patch"
2329 "rk3588-mnt-reform2/0085-phy-rockchip-samsung-hdptx-Drop-hw_rate-driver-data.patch"
2330 "rk3588-mnt-reform2/0086-phy-rockchip-samsung-hdptx-Switch-to-driver-specific.patch"
2331 "rk3588-mnt-reform2/0087-phy-rockchip-samsung-hdptx-Extend-rk_hdptx_phy_verif.patch"
2332 "rk3588-mnt-reform2/0088-phy-rockchip-samsung-hdptx-Add-HDMI-2.1-FRL-support.patch"
2333 "rk3588-mnt-reform2/0089-drm-rockchip-vop2-Check-bpc-before-switching-DCLK-so.patch"
2334 "rk3588-mnt-reform2/0090-drm-bridge-dw-hdmi-qp-Handle-platform-supported-form.patch"
2335 "rk3588-mnt-reform2/0091-drm-rockchip-dw_hdmi_qp-Switch-to-phy_configure.patch"
2336 "rk3588-mnt-reform2/0092-drm-rockchip-dw_hdmi_qp-Use-bit-macros-for-RK3576-re.patch"
2337 "rk3588-mnt-reform2/0093-drm-rockchip-dw_hdmi_qp-Add-high-color-depth-support.patch"
2338 "rk3588-mnt-reform2/0094-DEBUG-phy-rockchip-samsung-hdptx-Add-verbose-logging.patch"
2339 "rk3588-mnt-reform2/0095-WIP-SCRAMB-drm-bridge-Add-detect_ctx-hook.patch"
2340 "rk3588-mnt-reform2/0096-WIP-SCRAMB-drm-bridge-connector-Switch-from-detect-t.patch"
2341 "rk3588-mnt-reform2/0097-WIP-SCRAMB-drm-bridge-dw-hdmi-qp-Add-high-TMDS-clock.patch"
2342 "rk3588-mnt-reform2/0098-WIP-YUV420-drm-rockchip-vop2-Add-YUV420-output-forma.patch"
2343 "rk3588-mnt-reform2/0099-WIP-YUV420-drm-rockchip-dw_hdmi_qp-Add-YUV420-output.patch"
2344 "rk3588-mnt-reform2/0100-WIP-FRL-dt-bindings-display-rockchip-Add-tmds-enable.patch"
2345 "rk3588-mnt-reform2/0101-WIP-FRL-drm-rockchip-dw_hdmi_qp-Fixup-usage-of-enabl.patch"
2346 "rk3588-mnt-reform2/0103-WIP-FRL-arm64-dts-rockchip-Assign-ACLK_VOP-to-750-MH.patch"
2347 "rk3588-mnt-reform2/0104-WIP-FRL-drm-connector-hdmi-Handle-FRL-in-hdmi_clock_.patch"
2348 "rk3588-mnt-reform2/0105-WIP-FRL-drm-bridge-dw-hdmi-qp-Add-HDMI-2.1-FRL-suppo.patch"
2349 "rk3588-mnt-reform2/0106-WIP-FRL-drm-rockchip-dw_hdmi_qp-Add-HDMI-2.1-FRL-sup.patch"
2350 "rk3588-mnt-reform2/0107-WIP-FRL-drm-rockchip-vop2-Add-HDMI-2.1-FRL-support.patch"
2351 "rk3588-mnt-reform2/0108-dt-bindings-phy-rockchip-usbdp-add-improved-ports-sc.patch"
2352 "rk3588-mnt-reform2/0114-media-dt-bindings-video-interfaces-add-defines-for-s.patch"
2353 "rk3588-mnt-reform2/2001-drm-bridge-dw-hdmi-qp-Return-0-in-audio-prepare-when.patch"
2354 "rk3588-mnt-reform2/2003-drm-bridge-synopsys-Do-not-warn-about-audio-params-c.patch"
2355 "rk3588-mnt-reform2/5200-drm-rockchip-Set-dma-mask-to-64-bit.patch"
2356 "rk3588-mnt-reform2/7001-PCI-dw-rockchip-Disable-root-port-BARs.patch"))))
2357 (add-after 'apply-reform-patches 'copy-reform-dts-files
2358 (lambda* (#:key inputs #:allow-other-keys)
2359 (for-each (lambda (dts)
2360 (copy-file (search-input-file inputs
2361 (string-append
2362 "/dts/" dts))
2363 (string-append "arch/arm64/boot/dts/"
2364 dts)))
2365 (list
2366 "amlogic/meson-g12b-bananapi-cm4-mnt-pocket-reform.dts"
2367 "freescale/fsl-ls1028a-mnt-reform2.dts"
2368 "freescale/imx8mp-mnt-pocket-reform.dts"
2369 "freescale/imx8mp-mnt-reform2.dts"
2370 "freescale/imx8mq-mnt-reform2-hdmi.dts"
2371 "rockchip/rk3588-mnt-desktop-reform.dts"
2372 "rockchip/rk3588-mnt-pocket-reform.dts"
2373 "rockchip/rk3588-mnt-reform-next.dts"
2374 "rockchip/rk3588-mnt-reform2.dts"
2375 "rockchip/rk3588-mnt-reform2-dsi.dts"
2376 ))))
2377 (add-after 'apply-reform-patches 'adjust-makefiles-with-new-dtb
2378 (lambda _
2379 (substitute* "arch/arm64/boot/dts/amlogic/Makefile"
2380 (("meson-g12b-bananapi-cm4-mnt-reform2.dtb")
2381 "meson-g12b-bananapi-cm4-mnt-reform2.dtb
2382dtb-$(CONFIG_ARCH_MESON) += meson-g12b-bananapi-cm4-mnt-pocket-reform.dtb"))
2383 (substitute* "arch/arm64/boot/dts/freescale/Makefile"
2384 (("fsl-ls1028a-rdb.dtb")
2385 "fsl-ls1028a-rdb.dtb
2386dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-ls1028a-mnt-reform2.dtb"))
2387 (substitute* "arch/arm64/boot/dts/freescale/Makefile"
2388 (("imx8mq-mnt-reform2.dtb")
2389 "imx8mq-mnt-reform2.dtb
2390dtb-$(CONFIG_ARCH_MXC) += imx8mp-mnt-reform2.dtb
2391dtb-$(CONFIG_ARCH_MXC) += imx8mp-mnt-pocket-reform.dtb
2392dtb-$(CONFIG_ARCH_MXC) += imx8mq-mnt-reform2-hdmi.dtb"))
2393 (substitute* "arch/arm64/boot/dts/rockchip/Makefile"
2394 (("rk3588-mnt-reform2.dtb")
2395 "rk3588-mnt-reform2.dtb
2396dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-mnt-desktop-reform.dtb
2397dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-mnt-reform2-dsi.dtb
2398dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-mnt-reform-next.dtb
2399dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-mnt-pocket-reform.dtb")))))))))))
2400
2401(define-public linux-libre-arm64-mnt-reform-6.12
2402 ;; Kernel for use on the MNT/Reform systems
2403 ;; https://mntre.com/reform.html
2404 (let ((base (make-linux-libre* linux-libre-6.12-version
2405 linux-libre-6.12-gnu-revision
2406 (source-with-patches linux-libre-6.12-source
2407 ;; Revert upstream patches
2408 ;; that conflict with
2409 ;; MNT/Reform patches
2410 (search-patches
2411 "linux-libre-arm64-mnt-reform-revert-vop2-display-modes.patch"
2412 "linux-libre-arm64-mnt-reform-revert-phy-rockchip-samsung.patch"
2413 "linux-libre-arm64-mnt-reform-revert-rk-samsung-hdptx.patch"))
2414 '("aarch64-linux")
2415 #:extra-version "arm64-mnt-reform"
2416 #:extra-options
2417 ;; https://source.mnt.re/reform/reform-debian-packages/-/blob/main/linux/config
2418 (append (mnt-reform-kernel-options
2419 linux-libre-6.12-version)
2420 (default-extra-linux-options
2421 linux-libre-6.12-version)))))
2422 (package
2423 (inherit base)
2424 (inputs (list reform-debian-packages-for-6.12))
2425 (synopsis (string-append (package-synopsis base)
2426 " for MNT/Reform systems"))
2427 (description (string-append (package-description base)
2428 " Configuration options and patches have been applied for use with MNT/Reform systems."))
2429 (arguments
2430 (substitute-keyword-arguments arguments
2431 ((#:phases phases)
2432 #~(modify-phases #$phases
2433 (add-after 'unpack 'apply-reform-patches
2434 (lambda* (#:key inputs #:allow-other-keys)
2435 (for-each (lambda (patch)
2436 (invoke "patch" "-p1" "-i"
2437 (search-input-file inputs
2438 (string-append
2439 "patches6.12/" patch))))
2440 (list
2441 "imx8mp-mnt-pocket-reform/2ghz/0001-imx8mp-2ghz-clk.patch"
2442 "imx8mp-mnt-pocket-reform/2ghz/0002-imx8mp-2ghz-opp.patch"
2443 "imx8mp-mnt-pocket-reform/audio/0000-revert-crashy-audiomix-pm-support.patch"
2444 "imx8mp-mnt-pocket-reform/mmc-sdio/0001-sdhci-add-no-sd-uhs-sdr104-devicetree-property.patch"
2445 "imx8mp-mnt-pocket-reform/mmc-sdio/0002-During-the-card-init-the-host-side-sometimes-may-nee.patch"
2446 "imx8mp-mnt-pocket-reform/mmc-sdio/0003-USDHC-IP-has-one-limitation-the-tuning-circuit-can-t.patch"
2447 "imx8mp-mnt-pocket-reform/pocket-panel/0001-v5-add-multi-display-panel-driver.patch"
2448 "imx8mp-mnt-reform2/0001-sn65dsi86-use-hs-clock-of-samsung-dsim-host-directly.patch"
2449 "imx8mp-mnt-reform2/0002-lcdif-dont-exceed-desired-pixel-clock.patch"
2450 "imx8mq-mnt-reform2/0001-nwl-dsi-fixup-mode-only-for-LCDIF-input-not-DCSS.patch"
2451 "imx8mq-mnt-reform2/0002-pci-imx6-add-support-for-internal-refclk-imx8mq.patch"
2452 "imx8mq-mnt-reform2/0003-lcdif-fix-pcie-interference.patch"
2453 "imx8mq-mnt-reform2/0004-mnt4002-imx-gpcv2-wake-smccc.patch.patch"
2454 ;; Does not apply, needs further investigation
2455 ;; "imx8mq-mnt-reform2/v19_20241126_sandor_yu_initial_support_cadence_mhdp8501_hdmi_dp_for_i_mx8mq.mbx"
2456 "ls1028a-mnt-reform2/0000-dtsi-add-hdptx.patch"
2457 "meson-g12b-bananapi-cm4-mnt-pocket-reform/0001-a311d-viu-fifo-lines-config.patch"
2458 "meson-g12b-bananapi-cm4-mnt-pocket-reform/0002-a311d-viu-fifo-lines-config-header.patch"
2459 "meson-g12b-bananapi-cm4-mnt-pocket-reform/0003-tlv320aic31xx-add-1228800hz-support.patch"
2460 "meson-g12b-bananapi-cm4-mnt-reform2/0001-Revert-drm-bridge-synopsys-dw-mipi-dsi-enable-EoTp-b.patch"
2461 "meson-g12b-bananapi-cm4-mnt-reform2/0011-dw-mipi-dsi-phy-stop-wait-time.patch"
2462 "meson-g12b-bananapi-cm4-mnt-reform2/0012-innolux-n125hce-gn1-timing-tweaks.patch"
2463 "meson-g12b-bananapi-cm4-mnt-reform2/0013-meson-viu-hold-fifo-lines.patch"
2464 "meson-g12b-bananapi-cm4-mnt-reform2/0014-meson-venc-sync.patch.patch"
2465 "meson-g12b-bananapi-cm4-mnt-reform2/0015-meson-dw-mipi-dsi-sync-invert.patch"
2466 "meson-g12b-bananapi-cm4-mnt-reform2/0016-sn65dsi86-burst-mode-support.patch"
2467 "meson-g12b-bananapi-cm4-mnt-reform2/0018-sn65dsi86-never-turn-off.patch"
2468 "meson-g12b-bananapi-cm4-mnt-reform2/0020-LOCAL-ALSA-Assign-internal-PCM-chmap-ELD-IEC958-kctl.patch"
2469 "meson-g12b-bananapi-cm4-mnt-reform2/0021-HACK-of-partial-revert-of-fdt.c-changes.patch"
2470 "meson-g12b-bananapi-cm4-mnt-reform2/0022-add-bt-and-eth-resets.patch"
2471 "meson-g12b-bananapi-cm4-mnt-reform2/0023-sdio-pullups.patch"
2472 "meson-g12b-bananapi-cm4-mnt-reform2/0024-sdio-improve-wifi-speed.patch"
2473 "rk3588-mnt-reform2/0001-regulator-Add-of_regulator_get_optional-for-pure-DT-.patch"
2474 "rk3588-mnt-reform2/0001-scripts-package-builddeb-allow-hooks-also-in-usr-sha.patch"
2475 "rk3588-mnt-reform2/0002-regulator-Add-devres-version-of-of_regulator_get_opt.patch"
2476 "rk3588-mnt-reform2/0004-arm64-dts-rockchip-rk3588-rock5b-add-USB-C-support.patch"
2477 "rk3588-mnt-reform2/0005-math.h-add-DIV_ROUND_UP_NO_OVERFLOW.patch"
2478 "rk3588-mnt-reform2/0006-clk-divider-Fix-divisor-masking-on-64-bit-platforms.patch"
2479 "rk3588-mnt-reform2/0007-clk-composite-replace-open-coded-abs_diff.patch"
2480 "rk3588-mnt-reform2/0008-clk-rockchip-support-clocks-registered-late.patch"
2481 "rk3588-mnt-reform2/0009-clk-rockchip-rk3588-register-GATE_LINK-later.patch"
2482 "rk3588-mnt-reform2/0010-clk-rockchip-expose-rockchip_clk_set_lookup.patch"
2483 "rk3588-mnt-reform2/0011-clk-rockchip-implement-linked-gate-clock-support.patch"
2484 "rk3588-mnt-reform2/0012-clk-rockchip-rk3588-drop-RK3588_LINKED_CLK.patch"
2485 "rk3588-mnt-reform2/0013-arm64-dts-rockchip-rk3588-evb1-add-bluetooth-rfkill.patch"
2486 "rk3588-mnt-reform2/0014-arm64-dts-rockchip-rk3588-evb1-improve-PCIe-ethernet.patch"
2487 "rk3588-mnt-reform2/0015-arm64-dts-rockchip-Slow-down-EMMC-a-bit-to-keep-IO-s.patch"
2488 "rk3588-mnt-reform2/0016-vop2-Add-clock-resets-support.patch"
2489 "rk3588-mnt-reform2/0017-arm64-dts-rockchip-Add-VOP-clock-resets-for-rk3588s.patch"
2490 "rk3588-mnt-reform2/0018-dt-bindings-display-vop2-Add-VP-clock-resets.patch"
2491 "rk3588-mnt-reform2/0019-media-v4l2-ctrls-core-Set-frame_mbs_only_flag-by-def.patch"
2492 "rk3588-mnt-reform2/0020-media-rockchip-Move-H264-CABAC-table-to-header-file.patch"
2493 "rk3588-mnt-reform2/0021-media-rockchip-Introduce-the-rkvdec2-driver.patch"
2494 "rk3588-mnt-reform2/0022-media-dt-bindings-rockchip-Document-RK3588-Video-Dec.patch"
2495 "rk3588-mnt-reform2/0023-arm64-dts-rockchip-Add-rkvdec2-Video-Decoder-on-rk35.patch"
2496 "rk3588-mnt-reform2/0024-arm64-defconfig-enable-Rockchip-RK3588-video-decoder.patch"
2497 "rk3588-mnt-reform2/0025-mfd-rk8xx-Fix-shutdown-handler.patch"
2498 "rk3588-mnt-reform2/0026-WIP-phy-phy-rockchip-samsung-hdptx-Add-FRL-EARC-supp.patch"
2499 "rk3588-mnt-reform2/0027-TESTING-phy-phy-rockchip-samsung-hdptx-Add-verbose-l.patch"
2500 "rk3588-mnt-reform2/0028-WIP-dt-bindings-display-rockchip-drm-Add-optional-cl.patch"
2501 "rk3588-mnt-reform2/0029-WIP-drm-rockchip-vop2-Improve-display-modes-handling.patch"
2502 "rk3588-mnt-reform2/0030-arm64-dts-rockchip-Add-HDMI0-bridge-to-rk3588.patch"
2503 "rk3588-mnt-reform2/0031-arm64-dts-rockchip-Enable-HDMI0-on-rock-5b.patch"
2504 "rk3588-mnt-reform2/0032-arm64-dts-rockchip-Enable-HDMI0-on-rk3588-evb1.patch"
2505 "rk3588-mnt-reform2/0033-WIP-arm64-dts-rockchip-Enable-HDMI0-PHY-clk-provider.patch"
2506 "rk3588-mnt-reform2/0034-WIP-arm64-dts-rockchip-Make-use-of-HDMI0-PHY-PLL-on-.patch"
2507 "rk3588-mnt-reform2/0035-WIP-arm64-dts-rockchip-Make-use-of-HDMI0-PHY-PLL-on-.patch"
2508 "rk3588-mnt-reform2/0036-dt-bindings-display-bridge-Add-schema-for-Synopsys-D.patch"
2509 "rk3588-mnt-reform2/0037-dt-bindings-display-rockchip-Add-schema-for-RK3588-H.patch"
2510 "rk3588-mnt-reform2/0038-drm-bridge-synopsys-Add-DW-HDMI-QP-TX-controller-dri.patch"
2511 "rk3588-mnt-reform2/0039-drm-rockchip-Add-basic-RK3588-HDMI-output-support.patch"
2512 "rk3588-mnt-reform2/0040-arm64-defconfig-Enable-Rockchip-extensions-for-Synop.patch"
2513 "rk3588-mnt-reform2/0041-MAINTAINERS-Add-entry-for-Synopsys-DesignWare-HDMI-R.patch"
2514 "rk3588-mnt-reform2/0042-dt-bindings-media-Document-bindings-for-HDMI-RX-Cont.patch"
2515 "rk3588-mnt-reform2/0043-arm64-dts-rockchip-Add-device-tree-support-for-HDMI-.patch"
2516 "rk3588-mnt-reform2/0044-media-platform-synopsys-Add-support-for-HDMI-input-d.patch"
2517 "rk3588-mnt-reform2/0045-arm64-defconfig-Enable-Synopsys-HDMI-receiver.patch"
2518 "rk3588-mnt-reform2/0046-arm64-dts-rockchip-Enable-HDMI-receiver-on-rock-5b.patch"
2519 "rk3588-mnt-reform2/0047-arm64-dts-rockchip-Enable-HDMI-receiver-on-RK3588-EV.patch"
2520 "rk3588-mnt-reform2/0048-arm64-defconfig-Enable-default-EDID-for-Synopsys-HDM.patch"
2521 "rk3588-mnt-reform2/0049-regulator-Add-devm_-of_regulator_get.patch"
2522 "rk3588-mnt-reform2/0050-pmdomain-rockchip-cleanup-mutex-handling-in-rockchip.patch"
2523 "rk3588-mnt-reform2/0051-pmdomain-rockchip-forward-rockchip_do_pmu_set_power_.patch"
2524 "rk3588-mnt-reform2/0052-pmdomain-rockchip-reduce-indentation-in-rockchip_pd_.patch"
2525 "rk3588-mnt-reform2/0053-dt-bindings-power-rockchip-add-regulator-support.patch"
2526 "rk3588-mnt-reform2/0054-pmdomain-rockchip-add-regulator-support.patch"
2527 "rk3588-mnt-reform2/0055-arm64-dts-rockchip-Add-GPU-power-domain-regulator-de.patch"
2528 "rk3588-mnt-reform2/0056-dt-bindings-net-wireless-brcm4329-fmac-add-pci14e4-4.patch"
2529 "rk3588-mnt-reform2/0057-dt-bindings-net-wireless-brcm4329-fmac-add-clock-des.patch"
2530 "rk3588-mnt-reform2/0058-wifi-brcmfmac-Add-optional-lpo-clock-enable-support.patch"
2531 ;; does not apply cleanly due to DEBLOBBING
2532 ;; "rk3588-mnt-reform2/0059-wifi-brcmfmac-add-flag-for-random-seed-during-firmwa.patch"
2533 "rk3588-mnt-reform2/0060-arm64-dts-rockchip-rk3588-evb1-add-WLAN-controller.patch"
2534 "rk3588-mnt-reform2/0061-arm64-dts-rockchip-add-and-enable-gpu-node-for-Radxa.patch"
2535 "rk3588-mnt-reform2/0062-arm64-dts-rockchip-Enable-HDMI0-on-rock-5a.patch"
2536 "rk3588-mnt-reform2/0100-rk3588-dtsi-add-hdmi1-controller.patch"
2537 "rk3588-mnt-reform2/0102-drm-panthor-Actually-suspend-IRQs-in-the-unplug-path.patch"
2538 "rk3588-mnt-reform2/3001-display-rockchip-add-schema-for-rk3588-hdmi-tx.patch"
2539 "rk3588-mnt-reform2/4000-mnt-rk3588-dual-hdmi-qp-rockchip.patch"
2540 "rk3588-mnt-reform2/4001-mnt-rk3588-dual-hdmi-vop2-pll.patch"
2541 "rk3588-mnt-reform2/5001-rk3588-dsi2-driver.patch"
2542 "rk3588-mnt-reform2/5002-rk3588-dsi-dts-nodes.patch"
2543 "rk3588-mnt-reform2/5100-modernize-hdmi1-in-dtsi.patch"
2544 "rk3588-mnt-reform2/5110-hdptx-crash-workaround.patch"
2545 "rk3588-mnt-reform2/5200-drm-rockchip-Set-dma-mask-to-64-bit.patch"))))
2546 (add-after 'apply-reform-patches 'copy-reform-dts-files
2547 (lambda* (#:key inputs #:allow-other-keys)
2548 (for-each (lambda (dts)
2549 (copy-file (search-input-file inputs
2550 (string-append
2551 "/dts/" dts))
2552 (string-append "arch/arm64/boot/dts/"
2553 dts)))
2554 (list
2555 "amlogic/meson-g12b-bananapi-cm4-mnt-pocket-reform.dts"
2556 "amlogic/meson-g12b-bananapi-cm4-mnt-reform2.dts"
2557 "freescale/fsl-ls1028a-mnt-reform2.dts"
2558 "freescale/imx8mp-mnt-pocket-reform.dts"
2559 "freescale/imx8mp-mnt-reform2.dts"
2560 "freescale/imx8mq-mnt-reform2-hdmi.dts"
2561 "freescale/imx8mq-mnt-reform2.dts"
2562 "rockchip/rk3588-mnt-pocket-reform.dts"
2563 "rockchip/rk3588-mnt-reform-next.dts"
2564 "rockchip/rk3588-mnt-reform2.dts"))))
2565 (add-after 'apply-reform-patches 'adjust-makefiles-with-new-dtb
2566 (lambda _
2567 (substitute* "arch/arm64/boot/dts/amlogic/Makefile"
2568 (("meson-g12b-bananapi-cm4-mnt-reform2.dtb")
2569 "meson-g12b-bananapi-cm4-mnt-reform2.dtb
2570dtb-$(CONFIG_ARCH_MESON) += meson-g12b-bananapi-cm4-mnt-pocket-reform.dtb"))
2571 (substitute* "arch/arm64/boot/dts/freescale/Makefile"
2572 (("fsl-ls1028a-rdb.dtb")
2573 "fsl-ls1028a-rdb.dtb
2574dtb-$(CONFIG_ARCH_LAYERSCAPE) += fsl-ls1028a-mnt-reform2.dtb"))
2575 (substitute* "arch/arm64/boot/dts/freescale/Makefile"
2576 (("imx8mq-mnt-reform2.dtb")
2577 "imx8mq-mnt-reform2.dtb
2578dtb-$(CONFIG_ARCH_MXC) += imx8mp-mnt-reform2.dtb
2579dtb-$(CONFIG_ARCH_MXC) += imx8mp-mnt-pocket-reform.dtb
2580dtb-$(CONFIG_ARCH_MXC) += imx8mq-mnt-reform2-hdmi.dtb"))
2581 (substitute* "arch/arm64/boot/dts/rockchip/Makefile"
2582 (("rk3588-rock-5b.dtb")
2583 "rk3588-rock-5b.dtb
2584dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-mnt-reform2.dtb
2585dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-mnt-reform-next.dtb
2586dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-mnt-pocket-reform.dtb")))))))))))
2587
2588(define-public linux-libre-riscv64-generic
2589 (make-linux-libre* linux-libre-version
2590 linux-libre-gnu-revision
2591 linux-libre-source
2592 '("riscv64-linux")
2593 #:extra-version "riscv64-generic"
2594 #:extra-options
2595 (append
2596 ;; required `guix system vm'
2597 `(("CONFIG_USB_HID" . m)
2598 ("CONFIG_HID_GEMBIRD" . m)
2599 ("CONFIG_AHCI_DWC" . m)
2600 ("CONFIG_SATA_AHCI" . m)
2601 ("CONFIG_CRYPTO_SERPENT" . m)
2602 ("CONFIG_CRYPTO_WP512" . m)
2603 ("CONFIG_USB_UAS" . m)
2604 ("CONFIG_USB_STORAGE" . m)
2605 ("CONFIG_HID_GENERIC" . m)
2606 ("CONFIG_DRM_CIRRUS_QEMU" . m)
2607 ("CONFIG_HW_RANDOM_VIRTIO" . m)
2608 ("CONFIG_VIRTIO_CONSOLE" . m)
2609 ("CONFIG_CRYPTO_XTS" . m))
2610 (default-extra-linux-options linux-libre-version))))
2611
2612(define-public linux-libre-mips64el-fuloong2e
2613 (make-linux-libre* linux-libre-version
2614 linux-libre-gnu-revision
2615 linux-libre-source
2616 '("mips64el-linux")
2617 #:defconfig "fuloong2e_defconfig"
2618 #:extra-version "mips64el-fuloong2e"
2619 #:extra-options
2620 (append
2621 `(("CONFIG_OVERLAY_FS" . m))
2622 (default-extra-linux-options linux-libre-version))))
2623
2624
2625;;;
2626;;; Linux kernel modules.
2627;;;
2628
2629(define-public acpi-call-linux-module
2630 (package
2631 (name "acpi-call-linux-module")
2632 (version "1.2.2")
2633 (source
2634 (origin
2635 (method git-fetch)
2636 (uri (git-reference
2637 (url "https://github.com/nix-community/acpi_call")
2638 (commit (string-append "v" version))))
2639 (file-name (git-file-name name version))
2640 (sha256
2641 (base32 "09ljx0jl987753r2kjqj5kxms95bijw0xn14kf82ryn38ck5c8cf"))))
2642 (build-system linux-module-build-system)
2643 (arguments
2644 (list #:tests? #f ; no tests
2645 #:phases
2646 #~(modify-phases %standard-phases
2647 (add-before 'install 'patch-shebangs-harder
2648 ;; The (only) shebangs in examples/ don't justify a reference.
2649 ;; However, do substitute a slightly more portable one.
2650 (lambda _
2651 (substitute* (find-files "examples" ".")
2652 (("^(#! *)/[^ ]*/" _ shebang)
2653 (string-append shebang "/usr/bin/env ")))))
2654 (add-after 'install 'install-documentation
2655 (lambda _
2656 (let* ((doc (string-append #$output "/share/doc/"
2657 #$name "-" #$version)))
2658 (for-each (lambda (file)
2659 (let ((target (string-append doc "/" file)))
2660 (mkdir-p (dirname target))
2661 (copy-recursively file target)))
2662 (list "README.md" "examples"))))))))
2663 (home-page "https://github.com/nix-community/acpi_call")
2664 (synopsis "Linux kernel module to perform ACPI method calls")
2665 (description
2666 "This simple Linux kernel module allows calls from user space to any
2667@acronym{ACPI, Advanced Configuration and Power Interface} method provided by
2668your computer's firmware, by writing to @file{/proc/acpi/call}. You can pass
2669any number of parameters of types @code{ACPI_INTEGER}, @code{ACPI_STRING},
2670and @code{ACPI_BUFFER}.
2671
2672It grants direct and undocumented access to your hardware that may cause damage
2673and should be used with caution, especially on untested models.")
2674 (license license:gpl3+))) ; see README.md (no licence headers)
2675
2676(define-public corefreq
2677 (package
2678 (name "corefreq")
2679 (version "2.1.2")
2680 (source
2681 (origin
2682 (method git-fetch)
2683 (uri (git-reference
2684 (url "https://github.com/cyring/CoreFreq")
2685 (commit version)))
2686 (file-name (git-file-name name version))
2687 (sha256
2688 (base32 "0kkb82205g4vkh5rh1bd3w97b83miqvb3xf557sf7pp1gz9i0acw"))))
2689 ;; The upstream Makefile is now such a proprietary mess that standard builds
2690 ;; as performed by our linux-module-build-system are more or less impossible
2691 ;; without heavy patching. However, we still keep it as the main build
2692 ;; system because lifting out LINUX-MODULE-BUILDER would be even messier.
2693 (build-system linux-module-build-system)
2694 (outputs (list "out" "linux-module"))
2695 (arguments
2696 (list #:imported-modules `((guix build gnu-build-system)
2697 ,@%linux-module-build-system-modules)
2698 #:modules `((guix build linux-module-build-system)
2699 ((guix build gnu-build-system) #:prefix gnu:)
2700 (guix build utils))
2701 #:make-flags
2702 #~(list (string-append "CC=" #$(cc-for-target))
2703 "OPTIM_LVL=3"
2704 (string-append "PREFIX=" #$output))
2705 #:tests? #f ;no test suite
2706 #:source-directory "../build" ;must contain modules.order
2707 #:phases
2708 #~(modify-phases %standard-phases
2709 (add-after 'unpack 'patch-Makefile
2710 (lambda* (#:key inputs #:allow-other-keys)
2711 (let ((dir (search-input-directory
2712 inputs "lib/modules/build")))
2713 (substitute* "Makefile"
2714 (("^(KERNELREL \\?= ).*" _ =)
2715 (string-append = (dirname dir) "\n"))
2716 (("^(KERNELDIR \\?= ).*" _ =)
2717 (string-append = dir "\n"))
2718 (("^([[:space:]]+)(.* modules_install.*)"
2719 _ indent command)
2720 (string-append indent "echo skipping " command))))))
2721 (add-before 'build 'prepare
2722 (lambda* (#:key source-directory #:allow-other-keys)
2723 ;; Lazily fix another mismatch between what the kernel module
2724 ;; build system expects and what this package provides.
2725 (symlink "source/build" source-directory)))
2726 (replace 'build (assoc-ref gnu:%standard-phases 'build))
2727 (add-before 'install 'resolve-symlink
2728 ;; The build system silently fails to install from a symlink.
2729 (lambda _
2730 (delete-file "../build")
2731 (copy-recursively "build" "../build")))
2732 (add-before 'install 'create-output
2733 (lambda _
2734 ;; Avoid installing the corefreq binary as …/bin.
2735 (mkdir-p (string-append #$output "/bin"))))
2736 (add-after 'install 'gnu:install
2737 (assoc-ref gnu:%standard-phases 'install))
2738 (add-after 'install 'separate-module
2739 (lambda* (#:key outputs #:allow-other-keys)
2740 ;; Adding INSTALL_MOD_PATH= to #:make-flags would still create an
2741 ;; empty <out>/lib/modules directory, so just do it all by hand.
2742 (let* ((output (assoc-ref outputs "out"))
2743 (module (assoc-ref outputs "linux-module")))
2744 (mkdir-p module)
2745 (rename-file (string-append output "/lib")
2746 (string-append module "/lib")))))
2747 (add-after 'install 'install-README
2748 ;; There is no proper documentation. Provide something.
2749 (lambda* (#:key outputs #:allow-other-keys)
2750 (let* ((out (assoc-ref outputs "out"))
2751 (doc (string-append out "/share/doc/"
2752 #$name "-" #$version)))
2753 (install-file "README.md" doc)))))))
2754 (home-page "https://github.com/cyring/CoreFreq")
2755 (synopsis
2756 "Measure performance data & tweak low-level settings on x86-64 CPUs")
2757 (description
2758 "CoreFreq is a CPU monitor that reports low-level processor settings and
2759performance data with notably high precision by using a loadable Linux kernel
2760module. Unlike most similar tools, it can be used to modify some settings if
2761supported by the hardware and at your own risk. It's designed for 64-bit x86
2762Intel processors (Atom, Core2, Nehalem, SandyBridge, and newer) and compatible
2763architectures like AMD@tie{}Zen and Hygon@tie{}Dhyana.
2764
2765Supported processor features include:
2766@enumerate
2767@item time spent in C-states, including C1/C3 Auto- and UnDemotion;
2768@item core temperatures, voltage, and tweaking thermal limits;
2769@item core frequencies, ratios, and base clock rate;
2770@item enabling, disabling, and testing SpeedStep (EIST), Turbo Boost, and
2771Hyper-Threading or SMT;
2772@item enabling or disabling data cache prefetching;
2773@item kernel assembly code to keep as near as possible readings of performance
2774counters such as the @acronym{TSC, Time Stamp Counter}, @acronym{UCC, Unhalted
2775Core Cycles}, and @acronym{URC, Unhalted Reference Cycles};
2776@item the number of instructions per cycle or second (IPS, IPC, and CPI);
2777@item memory controller geometry and RAM timings;
2778@item running processes' CPU affinity.
2779@end enumerate
2780
2781This package provides the @command{corefreqd} data collection daemon, the
2782@command{corefreq-cli} client to visualise and control it in real time, and the
2783@code{corefreqk} kernel module in its own separate output. Read the included
2784@file{README.md} before loading it.")
2785 (supported-systems (list "x86_64-linux"))
2786 (license license:gpl2)))
2787
2788(define-public tuxedo-keyboard
2789 (package
2790 (name "tuxedo-keyboard")
2791 (version "4.22.2")
2792 (source
2793 (origin
2794 (method git-fetch)
2795 (uri (git-reference
2796 (url "https://gitlab.com/tuxedocomputers/development/packages/tuxedo-drivers.git")
2797 (commit (string-append "v" version))))
2798 (file-name (git-file-name name version))
2799 (sha256
2800 (base32 "0akjyz8nhhpcr4y4xmhghd4253mndzhhi5qggr2z315vpxfr7rl4"))))
2801 (build-system linux-module-build-system)
2802 (arguments
2803 (list #:tests? #f)) ; no test suite
2804 ;; This package fails to build on aarch64, and the manufacturer only sells
2805 ;; machines based on Intel-compatible processors. For more information, see
2806 ;; <https://codeberg.org/guix/guix/pulls/1795>.
2807 (supported-systems '("i686-linux" "x86_64-linux"))
2808 (home-page "https://gitlab.com/tuxedocomputers/development/packages/tuxedo-drivers")
2809 (synopsis "Linux kernel modules to control keyboard on most Tuxedo computers")
2810 (description
2811 "This package provides the @code{tuxedo_keyboard}, @code{tuxedo_io},
2812@code{clevo_wmi} @acronym{WMI, Windows Management Engine} and the
2813@code{clevo_acpi} @acronym{ACPI, Advanced Configuration and Power Interface}
2814kernel modules to control the keyboard on most Tuxedo computers. The @code{tuxedo_io}
2815module is also needed for the @code{tuxedo-control-center} (short tcc) package.")
2816 (license license:gpl2+)))
2817
2818(define-public evdi
2819 (package
2820 (name "evdi")
2821 (version "1.14.15") ;inherited by libevdi
2822 (source
2823 (origin
2824 (method git-fetch)
2825 (uri (git-reference
2826 (url "https://github.com/DisplayLink/evdi")
2827 (commit (string-append "v" version))))
2828 (file-name (git-file-name name version))
2829 (sha256
2830 (base32 "065mfwmb4nw71s0f0ax9si8xpbr1sah1bhxvq1k81yicvi83wsxn"))))
2831 (build-system linux-module-build-system)
2832 (arguments
2833 (list #:tests? #f ;no test suite
2834 #:phases #~(modify-phases %standard-phases
2835 (add-after 'unpack 'chdir
2836 (lambda _
2837 (chdir "module")))
2838 ;; Looks like the value is only there to detect RHEL
2839 ;; derivatives, so we can safely delete the include.
2840 (add-after 'unpack 'embed-/etc/os-release
2841 (lambda _
2842 (substitute* "module/Makefile"
2843 (("include /etc/os-release") "")))))))
2844 (home-page "https://github.com/DisplayLink/evdi")
2845 (synopsis
2846 "@acronym{EVDI, Extensible Virtual Display Interface} Linux kernel module")
2847 (description
2848 "The @acronym{EVDI, Extensible Virtual Display Interface} is a Linux kernel
2849module that enables management of multiple screens, allowing user-space programs
2850to take control over what happens with the image. It is essentially a virtual
2851display for which applications using the @code{libevdi} library can add, remove,
2852and receive screen updates.
2853
2854The EVDI driver uses the standard Linux @acronym{DRM, Direct Rendering Manager}.
2855Its displays can be controlled by standard tools such as @command{xrandr} and
2856display settings applets in graphical environments.")
2857 (license license:gpl2)))
2858
2859(define-public libevdi
2860 (package
2861 (inherit evdi)
2862 (name "libevdi")
2863 (build-system gnu-build-system)
2864 (arguments
2865 (list #:tests? #f ;no test suite
2866 #:make-flags
2867 #~(list (string-append "CC=" #$(cc-for-target)))
2868 #:phases #~(modify-phases %standard-phases
2869 (delete 'configure)
2870 (add-after 'unpack 'chdir
2871 (lambda _
2872 (chdir "library")))
2873 (replace 'install
2874 (lambda* _
2875 (let* ((lib (string-append #$output "/lib")))
2876 (mkdir-p lib)
2877 (install-file "libevdi.so" lib)))))))
2878 (inputs (list libdrm))
2879 (native-inputs (list pkg-config))
2880 (synopsis
2881 "@acronym{EVDI, Extensible Virtual Display Interface} user-space library")
2882 (description
2883 "Libevdi is a library that gives applications easy access to
2884@acronym{EVDI, Extensible Virtual Display Interface} devices provided by the
2885@code{evdi} driver package.")
2886 (license license:lgpl2.1)))
2887
2888(define-public ec
2889 (package
2890 (name "ec")
2891 (version (package-version linux-libre))
2892 (source (package-source linux-libre))
2893 (build-system gnu-build-system)
2894 (arguments
2895 (list #:make-flags #~(list (string-append "sbindir="
2896 #$output "/sbin")
2897 "INSTALL=install" "STRIPCMD=true")
2898 #:phases #~(modify-phases %standard-phases
2899 (add-after 'unpack 'enter-subdirectory
2900 (lambda _
2901 (chdir "tools/power/acpi/tools/ec")))
2902 (delete 'configure)) ;no configure script
2903 #:tests? #f)) ;no tests
2904 (home-page (package-home-page linux-libre))
2905 (synopsis
2906 "Utility for reading or writing @acronym{EC, Embedded Controller} registers")
2907 (description
2908 "This utility can read or write specific registers or all the available
2909registers of the @acronym{EC, Embedded Controller} supported by the
2910@code{ec_sys} Linux driver.")
2911 (license license:gpl2)))
2912
2913(define-public bbswitch-module
2914 ;; Use "develop" branch since stable release does not build on Linux >= 5.6.
2915 ;; See https://github.com/Bumblebee-Project/bbswitch/issues/205.
2916 (let ((commit "19f60204596a6463b162fc7ca11f4946f5c20cea"))
2917 (package
2918 (name "bbswitch-module")
2919 (version (git-version "0.8" "2" commit))
2920 (source (origin
2921 (method git-fetch)
2922 (uri (git-reference
2923 ;; Use fork until
2924 ;; https://github.com/Bumblebee-Project/bbswitch/pull/219
2925 ;; is merged.
2926 (url "https://github.com/madchic/bbswitch")
2927 (commit commit)))
2928 (file-name (git-file-name name version))
2929 (sha256
2930 (base32
2931 "1pv41y02c9xg9k1bg4i4ll3w7hxxzdr651i08f092b9q5hr57mqn"))))
2932 (build-system linux-module-build-system)
2933 (arguments
2934 (list #:tests? #f)) ; no test suite
2935 (home-page "https://github.com/Bumblebee-Project/bbswitch")
2936 (synopsis "Kernel module that disables discrete Nvidia graphics cards")
2937 (description "The bbswitch module provides a way to toggle the Nvidia
2938graphics card on Optimus laptops.")
2939 (license license:gpl2))))
2940
2941(define-public bin-graph
2942 (package
2943 (name "bin-graph")
2944 (version "1.2.0")
2945 (source
2946 (origin
2947 (method git-fetch)
2948 (uri (git-reference
2949 (url "https://github.com/8dcc/bin-graph")
2950 (commit (string-append "v" version))))
2951 (file-name (git-file-name name version))
2952 (sha256
2953 (base32 "1msr4fj1nh6hf5h6j5pimfrgd37xy4xbik3iml9gd3b1fdkxsdv7"))))
2954 (arguments
2955 (list #:tests? #f ; no tests
2956 #:make-flags
2957 #~(list (string-append "CC=" #$(cc-for-target))
2958 (string-append "PREFIX=" #$output)
2959 (string-append "INSTALL_DIR=" #$output "/bin"))
2960 #:phases
2961 #~(modify-phases %standard-phases
2962 (delete 'configure)))) ; no configure script
2963 (build-system gnu-build-system)
2964 (inputs (list libpng))
2965 (home-page "https://github.com/8dcc/bin-graph")
2966 (synopsis "Visualize binary files")
2967 (description
2968 "@code{bin-graph} provides a simple way of visualizing the different regions
2969of a binary file.")
2970 (license license:gpl3)))
2971
2972(define-public ddcci-driver-linux
2973 (let ((revision "0")
2974 (commit "7f8f8e6c221a286d57a643c2909109a54e084eed"))
2975 (package
2976 (name "ddcci-driver-linux")
2977 (version (git-version "0.4.5" revision commit))
2978 (source
2979 (origin
2980 (method git-fetch)
2981 (uri
2982 (git-reference
2983 (url "https://gitlab.com/ddcci-driver-linux/ddcci-driver-linux.git")
2984 (commit commit)))
2985 (file-name (git-file-name name version))
2986 (sha256
2987 (base32 "0sgldghd8n4qjm5nv9dgxjibj1hg4kkk1811wndf3vx3dacsmkl9"))))
2988 (build-system linux-module-build-system)
2989 (arguments
2990 (list #:tests? #f ; no tests
2991 #:phases
2992 #~(modify-phases %standard-phases
2993 (replace 'build
2994 (lambda args
2995 (for-each
2996 (lambda (module)
2997 (with-directory-excursion module
2998 (apply (assoc-ref %standard-phases 'build) args)))
2999 '("ddcci" "ddcci-backlight"))))
3000 (replace 'install
3001 (lambda args
3002 (for-each
3003 (lambda (module)
3004 (with-directory-excursion module
3005 (apply (assoc-ref %standard-phases 'install) args)))
3006 '("ddcci" "ddcci-backlight")))))))
3007 (home-page "https://gitlab.com/ddcci-driver-linux/ddcci-driver-linux")
3008 (synopsis "Pair of Linux kernel drivers for DDC/CI monitors")
3009 (description "This package provides two Linux kernel drivers, ddcci and
3010ddcci-backlight, that allows the control of DDC/CI monitors through the sysfs
3011interface. The ddcci module creates a character device for each DDC/CI
3012monitors in @file{/dev/bus/ddcci/[I²C busnumber]}. While the ddcci-backlight
3013module allows the control of the backlight level or luminance property when
3014supported under @file{/sys/class/backlight/}.")
3015 (license license:gpl2+))))
3016
3017(define-public reform2-lpc-module
3018 (package
3019 (name "reform2-lpc-module")
3020 (version "1.79")
3021 (source
3022 (origin
3023 (method git-fetch)
3024 (uri (git-reference
3025 (url "https://source.mnt.re/reform/reform-tools.git")
3026 (commit version)))
3027 (file-name (git-file-name name version))
3028 (sha256
3029 (base32 "16xzdygf14zksvqjbp5gwiqsn0mb7kphvzrmqbl9db4kvyj4ajqa"))))
3030 (build-system linux-module-build-system)
3031 (arguments
3032 '(#:tests? #f ;no tests
3033 #:source-directory "lpc"))
3034 (synopsis "Linux kernel module for the Reform 2 system controller")
3035 (description
3036 "The reform2_lpc module allows for interaction with the NXP LPC11U24
3037Cortex-M0 MCU system controller in the Reform 2 open hardware laptop. It
3038provides battery status information and is necessary to completely shut down
3039the system when powering it off via userspace.")
3040 (home-page "https://source.mnt.re/reform/reform-tools/")
3041 (license license:gpl3+)))
3042
3043(define-public v4l2loopback-linux-module
3044 (package
3045 (name "v4l2loopback-linux-module")
3046 (version "0.15.3")
3047 (source (origin
3048 (method git-fetch)
3049 (uri (git-reference
3050 (url "https://github.com/v4l2loopback/v4l2loopback")
3051 (commit (string-append "v" version))))
3052 (file-name (git-file-name name version))
3053 (sha256
3054 (base32
3055 "1fpzsymsas4d2maj81k1al02m62d81ll4q15xwc4n0rhh88hkdv7"))))
3056 (build-system linux-module-build-system)
3057 (arguments
3058 (list #:tests? #f)) ; no test suite
3059 (home-page "https://github.com/v4l2loopback/v4l2loopback")
3060 (synopsis "Linux kernel module to create virtual V4L2 video devices")
3061 (description
3062 "This Linux module creates virtual video devices. @acronym{V4L2, Video
3063for Linux 2} applications will treat these as ordinary video devices but read
3064video data generated by another application, instead of a hardware device such
3065as a capture card.
3066
3067This lets you apply nifty effects to your Jitsi video, for example, but also
3068allows some more serious things like adding streaming capabilities to an
3069application by hooking GStreamer into the loopback device.")
3070 (license license:gpl2+)))
3071
3072(define-public xpadneo
3073 (package
3074 (name "xpadneo")
3075 (version "0.9.8")
3076 (source (origin
3077 (method git-fetch)
3078 (uri (git-reference
3079 (url "https://github.com/atar-axis/xpadneo")
3080 (commit (string-append "v" version))))
3081 (file-name (git-file-name name version))
3082 (sha256
3083 (base32
3084 "0928yr832may1ibximnvd6qjzr6sipyg8iclqgpcsa7wpxb4320b"))))
3085 (build-system linux-module-build-system)
3086 (arguments
3087 (list #:tests? #f ; no `check' target
3088 #:source-directory "hid-xpadneo/src"
3089 #:phases
3090 #~(modify-phases %standard-phases
3091 (add-after 'install 'post-install
3092 (lambda _
3093 (copy-recursively "hid-xpadneo/etc-modprobe.d"
3094 (string-append #$output "/etc/modprobe.d"))
3095 ;; udev-service-type takes its rules from /lib rather than
3096 ;; /etc, so copy it there instead
3097 (copy-recursively "hid-xpadneo/etc-udev-rules.d"
3098 (string-append #$output
3099 "/lib/udev/rules.d")))))))
3100 (home-page "https://atar-axis.github.io/xpadneo/")
3101 (synopsis "Xbox One Wireless Controller driver for the kernel Linux")
3102 (description
3103 "This package provides a driver for the XBox One S Wireless controller
3104and some newer models when connected via Bluetooth. In addition to the included
3105Linux kernel module, it also contains a modprobe configuration and udev rules,
3106which need to be installed separately.")
3107 (license license:gpl3+)))
3108
3109
3110;;;
3111;;; Pluggable authentication modules (PAM).
3112;;;
3113
3114(define-public linux-pam
3115 (package
3116 (name "linux-pam")
3117 (version "1.7.2")
3118 (source
3119 (origin
3120 (method git-fetch)
3121 (uri (git-reference
3122 (url "https://github.com/linux-pam/linux-pam")
3123 (commit (string-append "v" version))))
3124 (file-name (git-file-name name version))
3125 (sha256
3126 (base32
3127 "1z5apric696zsci28c7651spvdll0zrpfm9z574gcjf45mp22gmi"))
3128 (patches (search-patches "linux-pam-unix_chkpwd.patch"
3129 "linux-pam-no-setfsuid.patch"))))
3130 (build-system meson-build-system)
3131 (outputs '("out" "doc")) ;; 0.8 MiB of html
3132 (inputs (list libxcrypt))
3133 (native-inputs
3134 (list gettext-minimal
3135 flex bison
3136 ;; manpages
3137 libxslt
3138 libxml2
3139 docbook-xml
3140 docbook-xsl))
3141 (arguments
3142 (list
3143 #:configure-flags
3144 #~(list
3145 ;; lastlog is deprecated since 1.5.3
3146 "-Dpam_lastlog=enabled"
3147 (string-append "-Dvendordir=" #$output "/share/pam")
3148 (string-append "-Ddocbook-rng="
3149 #$(let ((docbook-xml (this-package-native-input
3150 "docbook-xml")))
3151 (file-append docbook-xml
3152 "/xml/docbook/"
3153 (package-version docbook-xml)
3154 "/rng/docbookxi.rng")))
3155 (string-append "-Dhtmldir=" #$output:doc "/share/doc/" #$name "/html"))
3156 ;; XXX: Tests won't run in chroot, presumably because /etc/pam.d
3157 ;; isn't available.
3158 #:tests? #f))
3159 (home-page "http://www.linux-pam.org/")
3160 (synopsis "Pluggable authentication modules for Linux")
3161 (description
3162 "A *Free* project to implement OSF's RFC 86.0.
3163Pluggable authentication modules are small shared object files that can
3164be used through the PAM API to perform tasks, like authenticating a user
3165at login. Local and dynamic reconfiguration are its key features.")
3166 (license license:bsd-3)))
3167
3168(define-public python-pamela
3169 (package
3170 (name "python-pamela")
3171 (version "1.0.0")
3172 (source
3173 (origin
3174 (method git-fetch)
3175 (uri (git-reference
3176 (url "https://github.com/minrk/pamela")
3177 (commit version)))
3178 (file-name (git-file-name name version))
3179 (sha256
3180 (base32 "0cg3w6np1fbjpvzhv54xg567hpf38szwp2d4gvzb9r736nxbv0vr"))))
3181 (build-system pyproject-build-system)
3182 (arguments
3183 (list
3184 #:tests? #f ;Test suite isn't designed to be run inside a container.
3185 #:phases
3186 #~(modify-phases %standard-phases
3187 (add-after 'unpack 'hardcode-pam.so
3188 (lambda* (#:key inputs #:allow-other-keys)
3189 (substitute* "pamela.py"
3190 (("find_library\\(\"pam\")")
3191 (format #f "~s"
3192 (search-input-file inputs "lib/libpam.so"))))))
3193 (replace 'check
3194 (lambda* (#:key tests? #:allow-other-keys)
3195 (when (and tests? (file-exists? "test_pamela.py"))
3196 (invoke "pytest" "--assert=plain" "test_pamela.py")
3197 (invoke "python" "-m" "pamela" "-a" "`whoami`")))))))
3198 (inputs (list linux-pam))
3199 (native-inputs (list python-pytest python-setuptools))
3200 (home-page "https://github.com/minrk/pamela")
3201 (synopsis "PAM interface using ctypes")
3202 (description "This package provides a PAM interface using @code{ctypes}.")
3203 (license license:expat)))
3204
3205(define-public pam-gnupg
3206 (package
3207 (name "pam-gnupg")
3208 (version "0.3")
3209 (source (origin
3210 (method git-fetch)
3211 (uri (git-reference
3212 (url "https://github.com/cruegge/pam-gnupg")
3213 (commit (string-append "v" version))))
3214 (file-name (git-file-name name version))
3215 (sha256
3216 (base32
3217 "1bf91gi6zmfzzmczxm7pajxdlgnikasvg5xsd3j0a368rcr7lf9l"))))
3218 (build-system gnu-build-system)
3219 (inputs
3220 (list gnupg linux-pam))
3221 (native-inputs
3222 (list autoconf automake libtool))
3223 (arguments
3224 `(#:tests? #f ;no tests suite
3225 #:configure-flags
3226 (list (string-append "--with-moduledir="
3227 (assoc-ref %outputs "out") "/lib/security"))))
3228
3229 (home-page "https://github.com/cruegge/pam-gnupg")
3230 (synopsis "Unlock GnuPG keys on login")
3231 (description "This package provides a PAM module that hands over your
3232login password to @code{gpg-agent}. This can be useful if you are using a
3233GnuPG-based password manager like @code{pass}.")
3234 (license license:gpl3+)))
3235
3236
3237;;;
3238;;; Kernel documentation
3239;;;
3240
3241(define-public linux-libre-documentation
3242 (package
3243 (inherit linux-libre)
3244 (name "linux-libre-documentation")
3245 (arguments
3246 (list
3247 #:tests? #f
3248 #:phases #~(modify-phases %standard-phases
3249 (delete 'configure)
3250 (replace 'build
3251 (lambda* (#:key parallel-build? #:allow-other-keys)
3252 (substitute* "Documentation/Makefile"
3253 ;; Remove problematic environment check script.
3254 ((".*sphinx-pre-install --version-check") ""))
3255 (invoke "make" "infodocs"
3256 "-j" (if parallel-build?
3257 (number->string (parallel-job-count))
3258 "1"))))
3259 (replace 'install
3260 (lambda _
3261 (let* ((info-dir (string-append #$output "/share/info"))
3262 (info (string-append info-dir
3263 "/TheLinuxKernel.info.gz")))
3264 (with-directory-excursion "Documentation/output"
3265 (invoke "make" "-C" "texinfo" "install-info"
3266 (string-append "infodir=" info-dir)))
3267 ;; Create a symlink, for convenience.
3268 (symlink info (string-append info-dir
3269 "/linux.info.gz"))))))))
3270 (native-inputs
3271 (list graphviz
3272 perl
3273 python
3274 python-sphinx
3275 python-pyyaml
3276 texinfo
3277 which))
3278 (synopsis "Documentation for the kernel Linux-Libre")
3279 (description "This package provides the documentation for the kernel
3280Linux-Libre, as an Info manual. To consult it, run @samp{info linux}.")))
3281
3282;;;
3283;;; Miscellaneous.
3284;;;
3285
3286(define-public powercap
3287 (package
3288 (name "powercap")
3289 (version "0.6.0")
3290 (source
3291 (origin
3292 (method git-fetch)
3293 (uri (git-reference
3294 (url "https://github.com/powercap/powercap")
3295 (commit (string-append "v" version))))
3296 (file-name (git-file-name name version))
3297 (sha256
3298 (base32 "087almlx34nzjbv8a40kxlmgy8691z2zlzkfyca8a2b7l0b2kqlp"))))
3299 (build-system cmake-build-system)
3300 (arguments
3301 (list #:configure-flags
3302 #~(list "-DBUILD_SHARED_LIBS=ON")))
3303 (home-page "https://github.com/powercap/powercap")
3304 (synopsis "Utilities for accessing the powercap Linux kernel feature")
3305 (description "This package contains utilities for accessing the powercap
3306Linux kernel feature through sysfs. It includes an implementation for working
3307with Intel @acronym{RAPL, Running Average Power Limit}.
3308It provides the commands @code{powercap-info} and @code{powercap-set}.")
3309 (license license:bsd-3)))
3310
3311(define-public powerstat
3312 (package
3313 (name "powerstat")
3314 (version "0.04.03")
3315 (source
3316 (origin
3317 (method git-fetch)
3318 (uri (git-reference
3319 (url "https://github.com/ColinIanKing/powerstat")
3320 (commit (string-append "V" version))))
3321 (file-name (git-file-name name version))
3322 (sha256
3323 (base32 "1a1fnw4rb8fx4wrcl0yc6dbjj49k6vagnq7diyw4fs4i5nin7mv3"))))
3324 (build-system gnu-build-system)
3325 (arguments
3326 `(#:make-flags
3327 (list (string-append "CC=" ,(cc-for-target))
3328 (string-append "prefix=" (assoc-ref %outputs "out")))
3329 #:tests? #f ; no test suite
3330 #:phases
3331 (modify-phases %standard-phases
3332 (delete 'configure)))) ; no configure script
3333 (home-page "https://kernel.ubuntu.com/~cking/powerstat/")
3334 (synopsis "Measure system power consumption")
3335 (description
3336 "Powerstat measures and reports your computer's power consumption in real
3337time. On mobile PCs, it uses ACPI battery information to measure the power
3338drain of the entire system.
3339
3340Powerstat can also report @acronym{RAPL, Running Average Power Limit} power
3341domain measurements. These are available only on some hardware such as Intel
3342Sandybridge and newer, and cover only part of the machine's components such as
3343CPU, DRAM, and graphics. However, they provide accurate and immediate readings
3344and don't require a battery at all.
3345
3346The output is like @command{vmstat} but also shows power consumption statistics:
3347at the end of a run, @command{powerstat} will calculate the average, standard
3348deviation, and minimum and maximum values. It can show a nice histogram too.")
3349 (license license:gpl2)))
3350
3351(define-public psmisc
3352 (package
3353 (name "psmisc")
3354 (version "23.7")
3355 (source
3356 (origin
3357 (method url-fetch)
3358 (uri (string-append "mirror://sourceforge/psmisc/psmisc/psmisc-"
3359 version ".tar.xz"))
3360 (sha256
3361 (base32 "09y30ywh1d4s4f0wgvki115kgpliq48rarmfmmjl0iq22jf5viaq"))))
3362 (build-system gnu-build-system)
3363 (arguments
3364 (list
3365 #:configure-flags
3366 (if (%current-target-system)
3367 #~(list "ac_cv_func_malloc_0_nonnull=yes"
3368 "ac_cv_func_realloc_0_nonnull=yes")
3369 #~'())))
3370 (inputs (list ncurses))
3371 (home-page "https://gitlab.com/psmisc/psmisc")
3372 (synopsis "Small utilities that use the proc file system")
3373 (description
3374 "psmisc is a set of small utilities that use the proc file system.
3375@itemize @bullet
3376@item @command{fuser} identifies processes using files or sockets;
3377@item @command{killall} kills processes by name;
3378@item @command{prtstat} prints statistics of a process;
3379@item @command{pslog} prints the log file(s) of a process;
3380@item @command{pstree} shows the currently running processes as a tree;
3381@item @command{peekfd} shows the data travelling over a file descriptor.
3382@end itemize")
3383 (license license:gpl2+)))
3384
3385(define-public util-linux
3386 (package
3387 (name "util-linux")
3388 (version "2.42.2")
3389 (source (origin
3390 (method url-fetch)
3391 (uri (string-append "mirror://kernel.org/linux/utils/"
3392 "util-linux/v" (version-major+minor version) "/"
3393 "util-linux-" version ".tar.xz"))
3394 (sha256
3395 (base32
3396 "12nfg4300x0g6z03fmqy6l6fcp10nf25p81diw9fy0lnvwx5v803"))
3397 (patches (search-patches "util-linux-tests.patch"))
3398 (modules '((guix build utils)))
3399 (snippet
3400 ;; We take 'nologin' from Shadow, the 'logger' program from
3401 ;; GNU Inetutils and 'kill' from GNU Coreutils.
3402 '(begin
3403 (substitute* "configure"
3404 (("build_nologin=yes") "build_nologin=no")
3405 (("build_logger=yes") "build_logger=no")
3406 (("build_kill=yes") "build_kill=no"))))))
3407 (build-system gnu-build-system)
3408 (outputs '("out" ;6.4 MiB executables and documentation
3409 "lib" ;8.8 MiB shared libraries, headers and locales
3410 "static")) ;2.9 MiB static .a libraries
3411 (arguments
3412 (list #:configure-flags
3413 #~(list "--disable-use-tty-group"
3414 (string-append
3415 "--enable-fs-paths-default="
3416 "/run/setuid-programs"
3417 ":/run/current-system/profile/sbin")
3418 ;; Don't try to chown root:root mount and umount
3419 "--disable-makeinstall-chown"
3420 "--localstatedir=/var"
3421 "--sysconfdir=/etc"
3422 (string-append "--localedir=" #$output:lib
3423 "/share/locale")
3424 ;; Install completions where our bash-completion package
3425 ;; expects them.
3426 (string-append "--with-bashcompletiondir=" #$output
3427 "/etc/bash_completion.d")
3428 ;; XXX: 32-bit Hurd platforms don't support 64bit time_t
3429 #$@(if (target-hurd32?)
3430 '("--disable-year2038")
3431 '()))
3432
3433 ;; FIXME: For now we cannot reliably run tests on GNU/Hurd:
3434 ;; <https://bugs.gnu.org/47791>.
3435 #:tests? (and (not (%current-target-system))
3436 (not (system-hurd?)))
3437
3438 #:phases
3439 #~(modify-phases %standard-phases
3440 (add-before 'configure 'patch-build-scripts
3441 (lambda _
3442 (substitute* "configure"
3443 ;; The build system assumes that we want to install
3444 ;; libraries below $exec_prefix when $libdir does not
3445 ;; match any of the "usual" locations. Fix that.
3446 (("usrlib_execdir='\\$\\{exec_prefix\\}'\\$libdir")
3447 "usrlib_execdir=$libdir"))))
3448 (add-before 'build 'set-umount-file-name
3449 (lambda _
3450 ;; Tell 'eject' the right file name of 'umount'.
3451 (substitute* "sys-utils/eject.c"
3452 (("\"/bin/umount\"")
3453 (string-append "\"" #$output "/bin/umount\"")))))
3454 (add-before 'check 'pre-check
3455 (lambda* (#:key native-inputs inputs #:allow-other-keys)
3456
3457 ;; Some tests use the invalid pw_shell
3458 (setenv "SHELL" (which "sh"))
3459
3460 (let ((services (search-input-file (or native-inputs inputs)
3461 "etc/services")))
3462 ;; Change the test to refer to the right file.
3463 (substitute* "tests/ts/mcookie/mcookie"
3464 (("/etc/services")
3465 services))
3466 (substitute* "tests/helpers/test_mkfds.c"
3467 (("/etc/fstab")
3468 (which "sh")))
3469 (substitute* "tests/ts/coresched/coresched"
3470 (("/bin/bash -c")
3471 (string-append (which "bash") " -c")))
3472 (substitute* "tests/ts/fincore/count"
3473 (("\"\\$FS\" = \"overlay\"")
3474 "\"$FS\" = \"overlay\" || \"$FS\" = \"btrfs\""))
3475 (substitute* "tests/helpers/test_enosys.c"
3476 (("/bin/false")
3477 (which "false"))))))
3478 (add-before 'check 'disable-setarch-test
3479 (lambda _
3480 ;; The setarch tests are unreliable in QEMU's user-mode
3481 ;; emulation, which is our primary method of building
3482 ;; ARMv7 packages. See
3483 ;; <https://github.com/karelzak/util-linux/issues/601>.
3484 (substitute* "tests/ts/setarch/setarch"
3485 (("ts_init_subtest.*" all)
3486 (string-append
3487 all "\n"
3488 "ts_skip \"setarch tests are unreliable under QEMU\"")))))
3489 (add-before 'check 'disable-lsns-test
3490 (lambda _
3491 ;; The lsns tests can fail due to ioctl(_, NS_GET_USERNS)
3492 ;; returning ENOTTY, indicating this kernel does not
3493 ;; support user namespaces. Curiously, this test can fail
3494 ;; on i686 even if the same test passes on x86_64 on the
3495 ;; same machine. See <https://issues.guix.gnu.org/49933>.
3496 (delete-file "tests/ts/lsns/ioctl_ns")))
3497 (add-before 'check 'disable-choom-test
3498 (lambda _
3499 ;; This test relies on writing to /proc/%d/oom_score_adj
3500 (delete-file "tests/ts/choom/choom")))
3501 (add-before 'check 'disable-lslogins-tests
3502 (lambda _
3503 ;; these test require that a user with name root exists
3504 ;; In the build sandbox there is no such user
3505 (delete-file "tests/ts/lslogins/checkuser")
3506 (delete-file "tests/ts/lslogins/json_mode")))
3507 #$@(if (target-ppc32?)
3508 #~((add-before 'check 'disable-enosys-ioctl
3509 ;; It is unclear why this test specifically
3510 ;; fails in Guix's port of powerpc-linux.
3511 (lambda _
3512 (substitute* "tests/ts/misc/enosys"
3513 (("ts_init_subtest ioctl")
3514 (string-append
3515 "ts_init_subtest ioctl\n\n"
3516 "ts_skip \"unexplained failure on powerpc\"\n"))))))
3517 #~())
3518 (add-after 'install 'move-static-libraries
3519 (lambda _
3520 (let ((lib #$output:lib)
3521 (static #$output:static))
3522
3523 ;; Move static libraries to the "static" output.
3524 (mkdir-p (string-append static "/lib"))
3525 (with-directory-excursion lib
3526 (for-each (lambda (file)
3527 (rename-file file
3528 (string-append static "/"
3529 file)))
3530 (find-files "lib" "\\.a$"))
3531
3532 ;; Remove references to the static library from the '.la'
3533 ;; files so that Libtool does the right thing when both
3534 ;; the shared and static library is available.
3535 (substitute* (find-files "lib" "\\.la$")
3536 (("old_library=.*") "old_library=''\n"))))))
3537 (add-after 'install 'adjust-pkg-config-files
3538 (lambda _
3539 ;; Drop the unused "prefix=" and "exec_prefix=" variables from
3540 ;; the pkg-config files to avoid a cyclic reference on "out".
3541 (substitute* (find-files (string-append #$output:lib
3542 "/lib/pkgconfig")
3543 "\\.pc$")
3544 (("^(exec_)?prefix=.*") "")))))))
3545 (inputs
3546 (list file ;for libmagic
3547 ncurses
3548 sqlite
3549 zlib))
3550 (native-inputs
3551 (list net-base ;for tests
3552 perl
3553 pkg-config))
3554 (home-page "https://www.kernel.org/pub/linux/utils/util-linux/")
3555 (synopsis "Collection of utilities for the Linux kernel")
3556 (description "Util-linux is a diverse collection of Linux kernel
3557utilities. It provides dmesg and includes tools for working with file systems,
3558block devices, UUIDs, TTYs, and many other tools.")
3559
3560 (properties '((upstream-name . "util-linux")))
3561 ;; Note that util-linux doesn't use the same license for all the
3562 ;; code. GPLv2+ is the default license for a code without an
3563 ;; explicitly defined license.
3564 (license (list license:gpl3+ license:gpl2+ license:gpl2 license:lgpl2.0+
3565 license:bsd-4 license:public-domain))))
3566
3567;; util-linux optionally supports udev, which allows lsblk to read file system
3568;; metadata without special privileges. Add it as a separate package to avoid
3569;; a circular dependency, and to keep the size small.
3570(define-public util-linux+udev
3571 (package/inherit
3572 util-linux
3573 (name "util-linux-with-udev")
3574 (inputs
3575 (modify-inputs inputs
3576 (prepend eudev)))))
3577
3578(define-public chimerautils
3579 (package
3580 (name "chimerautils")
3581 (version "15.0.3")
3582 (source
3583 (origin
3584 (method git-fetch)
3585 (uri (git-reference
3586 (url "https://github.com/chimera-linux/chimerautils")
3587 (commit (string-append "v" version))))
3588 (file-name (git-file-name name version))
3589 (sha256
3590 (base32 "1inagax7gg2rl2a9ymfxxk71xrwd4sngwc45ph61rlk345jhnxpw"))))
3591 (build-system meson-build-system)
3592 (arguments
3593 (list
3594 #:tests? #f)) ;no test suite
3595 (inputs (list acl
3596 libedit
3597 libxo
3598 ncurses
3599 openssl
3600 zlib
3601 (list zstd "lib")))
3602 (native-inputs (list flex bison pkg-config))
3603 (home-page "https://github.com/chimera-linux/chimerautils")
3604 (synopsis "The FreeBSD-based core Linux userland from Chimera Linux")
3605 (description
3606 "This is a port of the FreeBSD userland for Linux provided by
3607the Chimera Linux distribution. Essentially, it is a collection of UNIX tools
3608such as @command{grep}, @command{cp}, @command{vi}, etc. and can be used as an
3609alternative to the corresponding implementations from the GNU project.")
3610 (license license:bsd-2)))
3611
3612(define-public dislocker
3613 (package
3614 (name "dislocker")
3615 (version "0.7.3")
3616 (home-page "https://github.com/Aorimn/dislocker")
3617 (source (origin
3618 (method git-fetch)
3619 (uri (git-reference
3620 (url home-page)
3621 (commit (string-append "v" version))))
3622 (file-name (git-file-name name version))
3623 (sha256
3624 (base32
3625 "1ak68s1v5dwh8y2dy5zjybmrh0pnqralmyqzis67y21m87g47h2k"))))
3626 (build-system cmake-build-system)
3627 (arguments
3628 '(#:tests? #f)) ;no test suite
3629 (inputs (list fuse-2 mbedtls-lts))
3630 (synopsis "FUSE driver to read/write Windows BitLocker drives")
3631 (description
3632 "This package provides means to to read BitLocker encrypted
3633partitions. Write functionality is also provided but check the README.")
3634 (license license:gpl2+)))
3635
3636(define-public dwarves
3637 (package
3638 (name "dwarves")
3639 (version "1.29")
3640 (source (origin
3641 (method git-fetch)
3642 (uri (git-reference
3643 (url "https://github.com/acmel/dwarves")
3644 (commit (string-append "v" version))))
3645 (file-name (git-file-name name version))
3646 (sha256
3647 (base32
3648 "1ia3r77zyw7r8mydy1zrrdnqzm9ginsvf9pqviq48rglihhddvli"))
3649 (patches
3650 (search-patches "dwarves-threading-reproducibility.patch"))))
3651 (build-system cmake-build-system)
3652 (arguments (list #:configure-flags #~(list "-D__LIB=lib"
3653 "-DLIBBPF_EMBEDDED=OFF")
3654 #:tests? #f)) ;no test suite
3655 (native-inputs (list pkg-config))
3656 (inputs (list libbpf))
3657 (home-page "https://github.com/acmel/dwarves")
3658 (synopsis "Debugging information processing library and utilities")
3659 (description "Dwarves is a set of tools that use the debugging information
3660inserted in ELF binaries by compilers such as GCC, used by well known
3661debuggers such as GDB.
3662
3663Utilities in the Dwarves suite include @command{pahole}, that can be used to
3664find alignment holes in structures and classes in languages such as C, C++,
3665but not limited to these. These tools can also be used to encode and read the
3666BTF type information format used with the kernel Linux @code{bpf} syscall.
3667
3668The @command{codiff} command can be used to compare the effects changes in
3669source code generate on the resulting binaries.
3670
3671The @command{pfunct} command can be used to find all sorts of information
3672about functions, inlines, decisions made by the compiler about inlining, etc.
3673
3674The @command{pahole} command can be used to use all this type information to
3675pretty print raw data according to command line directions.
3676
3677Headers can have its data format described from debugging info and offsets from
3678it can be used to further format a number of records.
3679
3680Finally, the @command{btfdiff} command can be used to compare the output of
3681pahole from BTF and DWARF, to make sure they produce the same results.")
3682 (license license:gpl2+)))
3683
3684(define-public fbset
3685 (package
3686 (name "fbset")
3687 (version "2.1")
3688 (source
3689 (origin
3690 (method url-fetch)
3691 (uri (string-append "http://users.telenet.be/geertu/Linux/fbdev/fbset-"
3692 version ".tar.gz"))
3693 (sha256
3694 (base32 "080wnisi0jq7dp0jcwdp83rq8q8s3kw41vc712516xbv4jq4mzs0"))))
3695 (build-system gnu-build-system)
3696 (arguments
3697 '(#:modules ((guix build gnu-build-system)
3698 (guix build utils)
3699 (srfi srfi-26))
3700 #:phases
3701 (modify-phases %standard-phases
3702 (delete 'configure) ; no configure script
3703 (add-before 'install 'pre-install
3704 (lambda* (#:key outputs #:allow-other-keys)
3705 (let ((out (assoc-ref outputs "out")))
3706 (substitute* "Makefile"
3707 (("mknod ") "true ")
3708 ;; The Makefile doesn't honour PREFIX or similar.
3709 (("/usr") out))
3710 (mkdir out)
3711 (with-directory-excursion out
3712 (for-each mkdir-p (list "sbin"
3713 "man/man5"
3714 "man/man8")))
3715 #t)))
3716 (add-after 'install 'install-fb.modes
3717 (lambda* (#:key outputs #:allow-other-keys)
3718 (let* ((out (assoc-ref outputs "out"))
3719 (etc (string-append out "/etc")))
3720 (for-each (cut install-file <> etc)
3721 (find-files "etc" "^fb\\.modes"))
3722 (symlink "fb.modes.ATI"
3723 (string-append etc "/fb.modes"))
3724 #t))))
3725 ;; Parallel building races to create modes.tab.c.
3726 #:parallel-build? #f
3727 #:tests? #f)) ; no test suite
3728 (native-inputs
3729 (list bison flex))
3730 (home-page "http://users.telenet.be/geertu/Linux/fbdev/")
3731 (synopsis "Show and modify Linux frame buffer settings")
3732 (description
3733 "The kernel Linux's @dfn{frame buffers} provide a simple interface to
3734different kinds of graphic displays. The @command{fbset} utility can query and
3735change various device settings such as depth, virtual resolution, and timing
3736parameters.")
3737 (license license:gpl2)))
3738
3739(define-public procps
3740 (package
3741 (name "procps")
3742 (version "4.0.3")
3743 (source (origin
3744 (method url-fetch)
3745 (uri (string-append "mirror://sourceforge/procps-ng/Production/"
3746 "procps-ng-" version ".tar.xz"))
3747 (sha256
3748 (base32
3749 "14ms9mkqr1mgl3h5yl6w8m57cf39k382nv7qms78vqbaz728wg1h"))
3750 (patches (search-patches "procps-strtod-test.patch"))))
3751 (build-system gnu-build-system)
3752 (arguments
3753 (list #:modules '((guix build utils)
3754 (guix build gnu-build-system)
3755 (srfi srfi-1)
3756 (srfi srfi-26))
3757 #:configure-flags
3758 (if (%current-target-system)
3759 #~'("ac_cv_func_malloc_0_nonnull=yes"
3760 "ac_cv_func_realloc_0_nonnull=yes")
3761 #~'())
3762 #:phases
3763 #~(modify-phases %standard-phases
3764 (add-after 'install 'post-install
3765 ;; Remove commands and man pages redudant with
3766 ;; Coreutils.
3767 (lambda* (#:key outputs #:allow-other-keys)
3768 (let* ((out #$output)
3769 (dup (append-map (cut find-files out <>)
3770 '("^kill" "^uptime"))))
3771 (for-each delete-file dup))))
3772 #$@(if (system-hurd?)
3773 #~((add-after 'unpack 'skip-tests
3774 (lambda _
3775 (substitute* "library/tests/test_version.c"
3776 (("^int main\\(.*" all)
3777 (string-append all "{\n exit (77);//"))))))
3778 #~()))))
3779 (inputs (list ncurses))
3780 (native-inputs (list pkg-config))
3781 (home-page "https://gitlab.com/procps-ng/procps/")
3782 (synopsis "Utilities that give information about processes")
3783 (description
3784 "Procps is the package that has a bunch of small useful utilities
3785that give information about processes using the Linux /proc file system.
3786The package includes the programs free, pgrep, pidof, pkill, pmap, ps, pwdx,
3787slabtop, tload, top, vmstat, w, watch and sysctl.")
3788 (properties '((upstream-name . "procps-ng")))
3789 (license license:gpl2)))
3790
3791(define-public usbutils
3792 (package
3793 (name "usbutils")
3794 (version "018")
3795 (source
3796 (origin
3797 (method url-fetch)
3798 (uri (string-append "mirror://kernel.org/linux/utils/usb/usbutils/"
3799 "usbutils-" version ".tar.xz"))
3800 (sha256
3801 (base32 "14xd7j9fl3pm0z4dhqj3mf9paqk431kq4vi602f5hiw5nmcqpxl3"))))
3802 (build-system meson-build-system)
3803 (outputs (list "out" "python"))
3804 (arguments
3805 (list
3806 #:phases
3807 #~(modify-phases %standard-phases
3808 (add-after 'install 'separate-python-output
3809 ;; Separating one Python script shaves more than 106 MiB from :out.
3810 (lambda _
3811 (for-each (lambda (file)
3812 (let ((old (string-append #$output "/" file))
3813 (new (string-append #$output:python "/" file)))
3814 (mkdir-p (dirname new))
3815 (rename-file old new)))
3816 (list "bin/lsusb.py"))))
3817 (add-after 'install 'install-usbreset
3818 (lambda _
3819 (install-file "usbreset"
3820 (string-append #$output "/bin")))))))
3821 (native-inputs (list pkg-config))
3822 (inputs (list eudev libusb python))
3823 (home-page "http://www.linux-usb.org/")
3824 (synopsis
3825 "Tools for working with USB devices")
3826 (description
3827 "Collection of tools to query what type of USB devices are connected to
3828the system, including @command{lsusb}. The experimental @command{usbreset}
3829command included in the package, but be aware that it may not work for all
3830devices.")
3831 (license license:gpl2+)))
3832
3833(define-public usbip-utils
3834 (package
3835 (name "usbip-utils")
3836 (version (package-version linux-libre))
3837 (source (package-source linux-libre))
3838 (build-system gnu-build-system)
3839 (arguments
3840 '(#:configure-flags '("--disable-static")
3841 #:phases (modify-phases %standard-phases
3842 (add-after 'unpack 'enter-subdirectory
3843 (lambda _
3844 (chdir "tools/usb/usbip")
3845 #t)))))
3846 (native-inputs
3847 `(("automake" ,automake)
3848 ("autoreconf" ,autoconf)
3849 ("libtool" ,libtool)))
3850 (inputs (list eudev))
3851 (home-page (package-home-page linux-libre))
3852 (synopsis "Utilities for sharing USB devices over IP networks")
3853 (description
3854 "The USB/IP protocol enables to pass USB device from a server to
3855a client over the network. The server is a machine which shares an
3856USB device and the client is a machine which uses USB device provided by
3857a server over the network. The USB device may be either physical device
3858connected to a server or software entity created on a server using USB
3859gadget subsystem. The usbip-utils are userspace tools to used to handle
3860connection and management on both side. The client needs the @file{vhci-hcd}
3861Linux kernel module and the server needs the @file{usbip_host} Linux kernel
3862module.")
3863 (license license:gpl2)))
3864
3865(define-public e2fsprogs
3866 (package
3867 (name "e2fsprogs")
3868 (version "1.47.2")
3869 (source (origin
3870 (method url-fetch)
3871 (uri (string-append
3872 "mirror://kernel.org/linux/kernel/people/tytso/"
3873 "e2fsprogs/v" version "/"
3874 "e2fsprogs-" version ".tar.xz"))
3875 (sha256
3876 (base32
3877 "0g76fhnyzr2awwybd6c16439l80r5dv4kbfaq7cr908fr9j2w908"))))
3878 (build-system gnu-build-system)
3879 (inputs
3880 `((,util-linux "lib") ,@(if (target-hurd?) '() (list fuse))))
3881 (native-inputs (list pkg-config
3882 texinfo ;for the libext2fs Info manual
3883 ;; For tests.
3884 perl
3885 procps))
3886 (arguments
3887 `(;; util-linux is the preferred source for some of the libraries and
3888 ;; commands, so disable them (see, e.g.,
3889 ;; <http://git.buildroot.net/buildroot/commit/?id=e1ffc2f791b33633>.)
3890 #:configure-flags (list "--disable-libblkid"
3891 "--disable-libuuid" "--disable-uuidd"
3892 "--disable-fsck"
3893
3894 ;; Use symlinks instead of hard links for
3895 ;; 'fsck.extN' etc. This makes the resulting nar
3896 ;; smaller and is preserved across copies.
3897 "--enable-symlink-install"
3898
3899 (string-append "LDFLAGS=-Wl,-rpath="
3900 (assoc-ref %outputs "out")
3901 "/lib")
3902
3903 ;; Install libext2fs et al.
3904 "--enable-elf-shlibs")
3905
3906 #:phases
3907 (modify-phases %standard-phases
3908 (add-before 'configure 'patch-shells
3909 (lambda _
3910 (substitute* "configure"
3911 (("/bin/sh (.*)parse-types.sh" _ dir)
3912 (string-append (which "sh") " " dir
3913 "parse-types.sh")))
3914 (substitute* "MCONFIG.in"
3915 (("INSTALL_SYMLINK = /bin/sh")
3916 "INSTALL_SYMLINK = sh"))
3917 (substitute* (find-files "." "^Makefile.in$")
3918 (("#!/bin/sh")
3919 (string-append "#!" (which "sh"))))))
3920 (add-after 'install 'install-libs
3921 (lambda* (#:key outputs #:allow-other-keys)
3922 (let* ((out (assoc-ref outputs "out"))
3923 (lib (string-append out "/lib")))
3924 (invoke "make" "install-libs")
3925
3926 ;; Make the .a writable so that 'strip' works.
3927 ;; Failing to do that, due to debug symbols, we
3928 ;; retain a reference to the final
3929 ;; linux-libre-headers, which refer to the
3930 ;; bootstrap binaries.
3931 (let ((archives (find-files lib "\\.a$")))
3932 (for-each (lambda (file)
3933 (chmod file #o666))
3934 archives)))))
3935 ,@(if (system-hurd?)
3936 '((add-after 'unpack 'skip-tests
3937 (lambda _
3938 (with-directory-excursion "tests"
3939 (for-each
3940 (lambda (directory)
3941 (delete-file-recursively directory))
3942 '("d_bad_ostype"
3943 "f_detect_junk"
3944 "f_extent_oobounds"
3945 "j_ext_long_revoke_trans"
3946 "j_ext_long_trans"
3947 "j_long_revoke_trans"
3948 "j_long_revoke_trans_mcsum_32bit"
3949 "j_long_revoke_trans_mcsum_64bit"
3950 "j_long_trans"
3951 "j_long_trans_mcsum_32bit"
3952 "j_long_trans_mcsum_64bit"
3953 "j_short_revoke_trans"
3954 "j_short_revoke_trans_mcsum_64bit"
3955 "j_short_trans_64bit"
3956 "j_short_trans"
3957 "j_short_trans_mcsum_64bit"
3958 "j_short_trans_old_csum"
3959 "j_short_trans_open_recover"
3960 "j_short_trans_recover"
3961 "j_short_trans_recover_mcsum_64bit"
3962 "j_short_uncommitted_trans"
3963 "j_short_uncommitted_trans_mcsum_64bit"
3964 "m_error_behavior"
3965 "m_minrootdir"
3966 "m_rootdir"
3967 "r_32to64bit_expand_full"
3968 "r_expand_full"
3969 "r_fixup_lastbg_big"
3970 "t_change_uuid"
3971 "t_change_uuid_mcsum"
3972 "t_change_uuid_mcsum_mounted"
3973 "t_change_uuid_mcsum_seed_mounted"
3974 "t_change_uuid_mounted"
3975 "t_disable_changed_csum_seed"
3976 "t_disable_changed_csum_seed_mounted"
3977 "t_disable_csum_seed"
3978 "t_disable_meta_csum_and_seed"
3979 "t_enable_csum_seed"
3980 "t_format_csum_seed"
3981 "t_replay_and_set"
3982 "u_compound_rollback"
3983 "u_corrupt_blk_csum"
3984 "u_corrupt_blk_csum_force"
3985 "u_corrupt_key_csum"
3986 "u_debugfs_opt"
3987 "u_dryrun"
3988 "u_e2fsck_opt"
3989 "u_errorout"
3990 "u_force"
3991 "u_force_dryrun"
3992 "u_incomplete"
3993 "u_mke2fs_opt"
3994 "u_mke2fs_opt_oddsize"
3995 "u_offset"
3996 "u_onefile_bad"
3997 "u_resize2fs_opt"
3998 "u_revert_64bitmcsum_onefile"
3999 "u_revert_all_onefile"
4000 "u_revert_upgrade_to_64bitmcsum"
4001 "u_tune2fs_opt"
4002 "u_undo_undo"
4003 "u_wrong_fs"))))))
4004 '()))))
4005 (home-page "https://e2fsprogs.sourceforge.net/")
4006 (synopsis "Creating and checking ext2/ext3/ext4 file systems")
4007 (description
4008 "This package provides tools for manipulating ext2/ext3/ext4 file systems.")
4009 (license (list license:gpl2 ;programs
4010 license:lgpl2.0 ;libext2fs
4011 license:x11)))) ;libuuid
4012
4013(define e2fsprogs/static
4014 (static-package
4015 (package (inherit e2fsprogs)
4016 (arguments
4017 ;; Do not build shared libraries.
4018 (substitute-keyword-arguments arguments
4019 ((#:configure-flags _)
4020 '(list "--disable-blkid" "--disable-fuse2fs"))
4021 ((#:make-flags _)
4022 '(list)))))))
4023
4024(define-public e2fsck/static
4025 (package
4026 (name "e2fsck-static")
4027 (version (package-version e2fsprogs))
4028 (build-system trivial-build-system)
4029 (source #f)
4030 (inputs
4031 (list e2fsprogs/static))
4032 (arguments
4033 `(#:modules ((guix build utils))
4034 #:builder
4035 (begin
4036 (use-modules (guix build utils)
4037 (ice-9 ftw)
4038 (srfi srfi-26))
4039
4040 (let ((e2fsck (search-input-file %build-inputs "/sbin/e2fsck"))
4041 (bin (string-append (assoc-ref %outputs "out") "/sbin")))
4042 (mkdir-p bin)
4043 (with-directory-excursion bin
4044 (copy-file e2fsck "e2fsck")
4045 (remove-store-references "e2fsck")
4046 (chmod "e2fsck" #o555))
4047 #t))))
4048 (home-page (package-home-page e2fsprogs))
4049 (synopsis "Statically-linked e2fsck command from e2fsprogs")
4050 (description "This package provides statically-linked e2fsck command taken
4051from the e2fsprogs package. It is meant to be used in initrds.")
4052 (license (package-license e2fsprogs))))
4053
4054(define-public extundelete
4055 (package
4056 (name "extundelete")
4057 (version "0.2.4")
4058 (source
4059 (origin
4060 (method url-fetch)
4061 (uri (string-append "mirror://sourceforge/extundelete/"
4062 "extundelete/" version "/extundelete-"
4063 version ".tar.bz2"))
4064 (sha256
4065 (base32
4066 "1x0r7ylxlp9lbj3d7sqf6j2a222dwy2nfpff05jd6mkh4ihxvyd1"))
4067 (patches (search-patches "extundelete-e2fsprogs-1.44.patch"))))
4068 (build-system gnu-build-system)
4069 (inputs (list e2fsprogs))
4070 (home-page "https://extundelete.sourceforge.net/")
4071 (synopsis "Recover deleted files from ext2/3/4 partitions")
4072 (description
4073 "Extundelete is a set of tools that can recover deleted files from an
4074ext3 or ext4 partition.")
4075 (license license:gpl2)))
4076
4077(define-public zerofree
4078 (package
4079 (name "zerofree")
4080 (version "1.1.1")
4081 (home-page "https://frippery.org/uml/")
4082 (source
4083 (origin
4084 (method url-fetch)
4085 (uri (string-append home-page name "-" version ".tgz"))
4086 (sha256
4087 (base32 "0rrqfa5z103ws89vi8kfvbks1cfs74ix6n1wb6vs582vnmhwhswm"))))
4088 (build-system gnu-build-system)
4089 (arguments
4090 (list
4091 #:tests? #f ;no tests
4092 #:phases
4093 #~(modify-phases %standard-phases
4094 (delete 'configure) ;no configure script
4095 (replace 'install
4096 ;; The Makefile lacks an ‘install’ target.
4097 (lambda _
4098 (chmod "zerofree" #o555)
4099 (install-file "zerofree" (string-append #$output "/bin")))))))
4100 (inputs (list e2fsprogs))
4101 (synopsis "Zero non-allocated regions in ext2/ext3/ext4 file systems")
4102 (description
4103 "Zerofree finds the unallocated blocks with non-zero value content in an
4104ext2, ext3, or ext4 file system and fills them with zeroes (or another value).
4105This is a simple way to make disk images more compressible.
4106Zerofree requires the file system to be unmounted or mounted read-only.")
4107 (license license:gpl2)))
4108
4109(define-public strace
4110 (package
4111 (name "strace")
4112 (version "7.0")
4113 (source
4114 (origin
4115 (method git-fetch)
4116 (uri (git-reference
4117 (url "https://github.com/strace/strace")
4118 (commit (string-append "v" version))))
4119 (file-name (git-file-name name version))
4120 (sha256
4121 (base32 "1rrcak1kg2w2dc7dbj6vfyp6a3j0ad7b2jrv6wmkw8h9p8zscx02"))
4122 (patches (search-patches "strace-readlink-tests.patch"))))
4123 (build-system gnu-build-system)
4124 (arguments
4125 (list
4126 #:phases
4127 #~(modify-phases %standard-phases
4128 ;; Needed for the 'bootstrap phase.
4129 (add-after 'unpack 'patch-source-shebangs-initial
4130 (assoc-ref %standard-phases 'patch-source-shebangs))
4131 (add-after 'unpack 'patch-test-shebangs
4132 (lambda _
4133 (substitute* '("tests/detach-vfork.test"
4134 "tests/gen_tests.sh"
4135 "tests/kill-on-exit.sh")
4136 (("#!/bin/sh")
4137 (string-append "#!" (which "sh")))))))
4138 #:configure-flags
4139 ''("--with-libunwind"
4140 ;; Don't fail if the architecture doesn't support different
4141 ;; personalities.
4142 "--enable-mpers=check")
4143 ;; See <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=32459>.
4144 #:parallel-tests? #f)) ; undeterministic failures
4145 (inputs (list libunwind))
4146 (native-inputs
4147 (list autoconf
4148 automake
4149 perl
4150 m4
4151 ;; For some tests
4152 util-linux))
4153 (home-page "https://strace.io")
4154 (synopsis "System call tracer for Linux")
4155 (description
4156 "strace is a system call tracer, i.e. a debugging tool which prints out a
4157trace of all the system calls made by a another process/program.")
4158 (license license:lgpl2.1+)))
4159
4160(define-public ltrace
4161 (package
4162 (name "ltrace")
4163 (version "0.7.3")
4164 (source (origin
4165 (method url-fetch)
4166 (uri (string-append "http://www.ltrace.org/ltrace_" version
4167 ".orig.tar.bz2"))
4168 (sha256
4169 (base32
4170 "00wmbdghqbz6x95m1mcdd3wd46l6hgcr4wggdp049dbifh3qqvqf"))))
4171 (build-system gnu-build-system)
4172 (arguments
4173 ;; Compilation uses -Werror by default, but it fails.
4174 (list #:configure-flags #~'("--disable-werror")))
4175 (inputs (list elfutils))
4176 (home-page "https://www.ltrace.org/")
4177 (synopsis "Library call tracer for Linux")
4178 (description
4179 "ltrace intercepts and records dynamic library calls which are called by
4180an executed process and the signals received by that process. It can also
4181intercept and print the system calls executed by the program.")
4182 (license license:gpl2+)))
4183
4184(define-public alsa-ucm-conf
4185 (package
4186 (name "alsa-ucm-conf")
4187 (version "1.2.16.1")
4188 (source
4189 (origin
4190 (method git-fetch)
4191 (uri (git-reference
4192 (url "https://github.com/alsa-project/alsa-ucm-conf")
4193 (commit (string-append "v" version))))
4194 (file-name (git-file-name name version))
4195 (sha256
4196 (base32 "1dgr8dlxzm4cx4sbp6mbb9ihharyym1qmb8zy9zq171h33k4061w"))))
4197 (build-system copy-build-system)
4198 (arguments
4199 '(#:install-plan
4200 '(("ucm" "share/alsa/ucm")
4201 ("ucm2" "share/alsa/ucm2"))))
4202 (home-page "https://www.alsa-project.org/wiki/Main_Page")
4203 (synopsis "The Advanced Linux Sound Architecture Use Case Manager")
4204 (description
4205 "This package contains @acronym{ALSA, Advanced Linux Sound Architecture}
4206@acronym{UCM, Use Case Manager} configuration of audio input/output names and
4207routing for specific audio hardware.")
4208 (license license:bsd-3)))
4209
4210(define-public alsa-topology-conf
4211 (package
4212 (name "alsa-topology-conf")
4213 (version "1.2.5.1")
4214 (source
4215 (origin
4216 (method git-fetch)
4217 (uri (git-reference
4218 (url "https://github.com/alsa-project/alsa-topology-conf")
4219 (commit (string-append "v" version))))
4220 (file-name (git-file-name name version))
4221 (sha256
4222 (base32 "150065nc5ksrxcay0ia0f8ad2s0gpp3xgn7gc5xsyf0k5dwdby49"))))
4223 (build-system copy-build-system)
4224 (arguments
4225 '(#:install-plan
4226 '(("topology" "share/alsa/topology"))))
4227 (home-page "https://www.alsa-project.org/wiki/Main_Page")
4228 (synopsis "The Advanced Linux Sound Architecture libraries")
4229 (description
4230 "This package contains @acronym{ALSA, Advanced Linux Sound Architecture}
4231topology configuration files that can be used for specific audio hardware.")
4232 (license license:bsd-3)))
4233
4234(define-public alsa-lib
4235 (package
4236 (name "alsa-lib")
4237 (version "1.2.16.1")
4238 (source
4239 (origin
4240 (method git-fetch)
4241 (uri (git-reference
4242 (url "https://github.com/alsa-project/alsa-lib")
4243 (commit (string-append "v" version))))
4244 (file-name (git-file-name name version))
4245 (sha256
4246 (base32 "06r315gq2ps11w72bh3hpljpqjwx2avba3lxccmqpwl9njfcvfmc"))))
4247 (build-system gnu-build-system)
4248 (arguments
4249 (list
4250 #:configure-flags
4251 #~(list (string-append "LDFLAGS=-Wl,-rpath=" #$output "/lib"))
4252 #:phases
4253 #~(modify-phases %standard-phases
4254 (replace 'bootstrap
4255 (lambda _
4256 (invoke "libtoolize" "--force" "--copy" "--automake")
4257 (invoke "aclocal")
4258 (invoke "autoheader")
4259 (invoke "automake" "--foreign" "--copy" "--add-missing")
4260 (invoke "autoconf")))
4261 (add-before 'install 'pre-install
4262 (lambda* _
4263 (let* ((ucm #$(this-package-input "alsa-ucm-conf"))
4264 (topology #$(this-package-input "alsa-topology-conf"))
4265 (alsa (string-append #$output "/share/alsa"))
4266 (ucm-share (string-append ucm "/share/alsa/ucm"))
4267 (ucm2-share (string-append ucm "/share/alsa/ucm2"))
4268 (topology-share (string-append topology "/share/alsa/topology")))
4269 (mkdir-p alsa)
4270 (symlink ucm-share (string-append alsa "/ucm"))
4271 (symlink ucm2-share (string-append alsa "/ucm2"))
4272 (symlink topology-share (string-append alsa "/topology"))))))))
4273 (inputs
4274 (list autoconf-2.72
4275 automake
4276 alsa-ucm-conf
4277 alsa-topology-conf
4278 libtool))
4279 (supported-systems (remove target-hurd? %supported-systems))
4280 (home-page "https://www.alsa-project.org/wiki/Main_Page")
4281 (synopsis "The Advanced Linux Sound Architecture libraries")
4282 (description
4283 "@acronym{ALSA, Advanced Linux Sound Architecture} provides audio and
4284@acronym{MIDI, Musical Instrument Digital Interface} functionality to the
4285Linux-based operating system.")
4286 (license license:lgpl2.1+)))
4287
4288(define-public alsa-utils
4289 (package
4290 (name "alsa-utils")
4291 (version "1.2.16")
4292 (source (origin
4293 (method url-fetch)
4294 (uri (string-append
4295 "https://www.alsa-project.org/files/pub/utils/"
4296 name "-" version ".tar.bz2"))
4297 (sha256
4298 (base32
4299 "0b13yb7jirxwkfvynq1vd5slpv0wa9bk2fcf31g1v6klx3arj8q9"))))
4300 (build-system gnu-build-system)
4301 (arguments
4302 (list
4303 #:configure-flags
4304 #~(list
4305 ;; The udev rule is responsible for restoring the volume.
4306 (string-append "--with-udev-rules-dir=" #$output "/lib/udev/rules.d"))
4307 #:phases
4308 #~(modify-phases %standard-phases
4309 (add-before 'install 'pre-install
4310 (lambda _
4311 ;; Don't try to mkdir /var/lib/alsa.
4312 (substitute* "Makefile"
4313 (("\\$\\(MKDIR_P\\) .*ASOUND_STATE_DIR.*")
4314 "true\n")))))))
4315 (native-inputs
4316 (list docbook-xml-4.2 docbook-xsl gettext-minimal pkg-config xmlto))
4317 (inputs
4318 (list libsamplerate ncurses alsa-lib))
4319 (home-page "http://www.alsa-project.org/")
4320 (synopsis "Utilities for the Advanced Linux Sound Architecture (ALSA)")
4321 (description
4322 "The Advanced Linux Sound Architecture (ALSA) provides audio and
4323MIDI functionality to the Linux-based operating system.")
4324
4325 ;; This is mostly GPLv2+ but a few files such as 'alsactl.c' are
4326 ;; GPLv2-only.
4327 (license license:gpl2)))
4328
4329(define-public alsa-plugins
4330 (package
4331 (name "alsa-plugins")
4332 (version "1.2.12")
4333 (source
4334 (origin
4335 (method git-fetch)
4336 (uri (git-reference
4337 (url "https://github.com/alsa-project/alsa-plugins")
4338 (commit (string-append "v" version))))
4339 (file-name (git-file-name name version))
4340 (sha256
4341 (base32 "0izvzdvw3nj69l4a968p9d9xjxfxs7i3bdpj1r4cvm6b8w7j33z8"))))
4342 (build-system gnu-build-system)
4343 ;; TODO: Split libavcodec and speex if possible. It looks like they can not
4344 ;; be split, there are references to both in files.
4345 ;; TODO: Remove OSS related plugins, they add support to run native
4346 ;; ALSA applications on OSS however we do not offer OSS and OSS is
4347 ;; obsolete.
4348 (outputs '("out" "pulseaudio" "jack"))
4349 (native-search-paths
4350 (list (search-path-specification
4351 (variable "ALSA_PLUGIN_DIR")
4352 (files '("lib/alsa-lib"))
4353 (separator #f))))
4354 (arguments
4355 `(#:configure-flags '(;; Do not install a "local" configuration targeted
4356 ;; for /etc/alsa. On Guix System plugins are loaded from
4357 ;; the ALSA service, and other distributions likely
4358 ;; won't use these files.
4359 "--with-alsalconfdir=/tmp/noop")
4360 #:phases
4361 (modify-phases %standard-phases
4362 (add-after 'install 'split
4363 (lambda* (#:key inputs outputs #:allow-other-keys)
4364 ;; Distribute the binaries to the various outputs.
4365 (let* ((out (assoc-ref outputs "out"))
4366 (jack (assoc-ref outputs "jack"))
4367 (jacklib (string-append jack "/lib/alsa-lib"))
4368 (pua (assoc-ref outputs "pulseaudio"))
4369 (pualib (string-append pua "/lib/alsa-lib")))
4370 ;; For jack.
4371 (mkdir-p jacklib)
4372 (for-each (lambda (file)
4373 (rename-file file (string-append jacklib "/" (basename file))))
4374 (find-files out ".*jack\\.(la|so)"))
4375 ;; For pulseaudio.
4376 (mkdir-p pualib)
4377 (for-each (lambda (file)
4378 (rename-file file (string-append pualib "/" (basename file))))
4379 (find-files out ".*pulse\\.(la|so)"))
4380 #t))))))
4381 (inputs
4382 (list alsa-lib
4383 jack-1
4384 speex ; libspeexdsp resampling plugin
4385 libsamplerate ; libsamplerate resampling plugin
4386 ffmpeg ; libavcodec resampling plugin, a52 plugin
4387 pulseaudio)) ; PulseAudio plugin
4388 (native-inputs
4389 (list autoconf automake libtool pkg-config))
4390 (home-page "http://www.alsa-project.org/")
4391 (synopsis "Plugins for the Advanced Linux Sound Architecture (ALSA)")
4392 (description
4393 "@acronym{ALSA, Advanced Linux Sound Architecture} provides audio and
4394@acronym{MIDI, Musical Instrument Digital Interface} functionality to the
4395Linux-based operating system. This package enhances @acronym{ALSA} by
4396providing additional plugins which include: upmixing, downmixing, jackd and
4397pulseaudio support for native alsa applications, format conversion (s16 to
4398a52), and external rate conversion.")
4399 (license (list license:gpl2+
4400 ;; `rate/rate_samplerate.c': LGPL v2.1 or later.
4401 license:lgpl2.1+))))
4402
4403(define-public snd-rane-sl3
4404 (let ((commit "01099892261b55ec5ee814292d840eeb664c1904")
4405 (revision "0"))
4406 (package
4407 (name "snd-rane-sl3")
4408 (version (git-version "0" revision commit))
4409 (source
4410 (origin
4411 (method git-fetch)
4412 (uri (git-reference
4413 (url "https://github.com/nvgeele/snd-rane-sl3")
4414 (commit commit)))
4415 (file-name (git-file-name name version))
4416 (sha256
4417 (base32 "1j2aan5xmbi8hgkzzwjb7rarqh4g65rg3s1qd1c8x5m6fpqdnvli"))))
4418 (build-system linux-module-build-system)
4419 (arguments
4420 (list
4421 #:tests? #f ;No tests.
4422 #:phases
4423 #~(modify-phases %standard-phases
4424 (delete 'configure)
4425 (add-before 'build 'change-directory
4426 (lambda _
4427 (chdir "snd-rane-sl3"))))))
4428 (inputs (list linux-libre-headers))
4429 (home-page "https://github.com/nvgeele/snd-rane-sl3")
4430 (synopsis
4431 "Linux ALSA kernel driver for the Rane SL3 USB Audio interface")
4432 (description
4433 "snd-rane-sl3 provides a native Linux kernel module that
4434enables the Rane SL3 to work as a standard ALSA audio device, supporting 6
4435channels (3 stereo pairs) of 24-bit PCM audio at 44.1kHz and 48kHz sample
4436rates.")
4437 (license license:gpl3))))
4438
4439(define-public iptables
4440 (package
4441 (name "iptables")
4442 (version "1.8.11")
4443 (source
4444 (origin
4445 (method url-fetch)
4446 (uri (list (string-append "mirror://netfilter.org/iptables/iptables-"
4447 version ".tar.xz")))
4448 (sha256
4449 (base32 "1cp7kw0d3fpmfmbl4adh88v02wnj4s5rfgyxsk52pjgqbvah6wyq"))))
4450 (build-system gnu-build-system)
4451 (native-inputs
4452 (list pkg-config flex bison))
4453 (inputs
4454 (list libmnl libnftnl/pinned))
4455 (arguments
4456 (list #:tests? #f ; no test suite
4457 #:configure-flags ; add $libdir to the RUNPATH of executables
4458 #~(list (string-append "LDFLAGS=-Wl,-rpath=" #$output "/lib"))))
4459 (home-page "https://www.netfilter.org/projects/iptables/index.html")
4460 (synopsis "Programs to configure Linux IP packet filtering rules")
4461 (description
4462 "@command{iptables} is the user-space command line program used to
4463configure the Linux 2.4.x and later IPv4 packet filtering ruleset
4464(@dfn{firewall}), including @dfn{NAT} (Network Address Translation).
4465
4466This package also includes @command{ip6tables}, which is used to configure the
4467IPv6 packet filter.
4468
4469Both commands are targeted at system administrators.")
4470 (properties
4471 '((release-monitoring-url . "https://www.netfilter.org/pub/iptables/")))
4472 (license license:gpl2+)))
4473
4474(define-public iptables-nft
4475 (package
4476 (inherit iptables)
4477 (name "iptables-nft")
4478 (source #f)
4479 (build-system copy-build-system)
4480 (arguments
4481 (list
4482 #:phases
4483 #~(modify-phases %standard-phases
4484 (delete 'unpack)
4485 (replace 'install
4486 (lambda* (#:key inputs #:allow-other-keys)
4487 (for-each
4488 (lambda (command-path)
4489 (let ((link-path (string-append #$output command-path)))
4490 (mkdir-p (dirname link-path))
4491 (symlink (search-input-file inputs "sbin/xtables-nft-multi")
4492 link-path)))
4493 (apply append
4494 '("/bin/iptables-xml")
4495 (map (lambda (xtables)
4496 (list (string-append "/sbin/" xtables)
4497 (string-append "/sbin/" xtables "-restore")
4498 (string-append "/sbin/" xtables "-save")))
4499 '("arptables"
4500 "ebtables"
4501 "iptables"
4502 "ip6tables")))))))))
4503 (inputs (list iptables))
4504 (native-inputs '())
4505 (synopsis
4506 "Programs to configure Linux IP packet filtering rules (nftables API)")))
4507
4508(define-public irqbalance
4509 (package
4510 (name "irqbalance")
4511 (version "1.9.4")
4512 (source
4513 (origin
4514 (method git-fetch)
4515 (uri (git-reference
4516 (url "https://github.com/irqbalance/irqbalance")
4517 (commit (string-append "v" version))))
4518 (file-name (git-file-name name version))
4519 (sha256
4520 (base32 "1jswxr0jcxz83j1nanl6xaxpw001l0hfb2xvvy2k970g1g1kpszd"))))
4521 (build-system gnu-build-system)
4522 (inputs (list glib ncurses libnl libcap-ng))
4523 (native-inputs (list autoconf automake libtool pkg-config))
4524 (home-page "https://irqbalance.github.io/irqbalance/")
4525 (synopsis "Daemon used to load balance CPU interrupts")
4526 (description
4527 "Irqbalance is a daemon to help balance the CPU load generated by
4528interrupts across all of a systems CPUs. Irqbalance identifies the highest
4529volume interrupt sources, and isolates each of them to a single unique CPU, so
4530that load is spread as much as possible over an entire processor set, while
4531minimizing cache miss rates for irq handlers.")
4532 (license license:gpl2)))
4533
4534(define-public bolt
4535 (package
4536 (name "bolt")
4537 (version "0.9.10")
4538 (source (origin
4539 (method git-fetch)
4540 (uri (git-reference
4541 (url "https://gitlab.freedesktop.org/bolt/bolt")
4542 (commit version)))
4543 (file-name (git-file-name name version))
4544 (sha256
4545 (base32
4546 "1vw4vzyhkpm73snnfciy7x88ja72cv5isc27k91jvmy2350b29yx"))))
4547 (build-system meson-build-system)
4548 (arguments
4549 (list #:configure-flags '(list "--localstatedir=/var")
4550 #:glib-or-gtk? #t ;To wrap binaries and/or compile schemas
4551 #:phases #~(modify-phases %standard-phases
4552 (add-after 'unpack 'replace-directories
4553 (lambda* (#:key outputs #:allow-other-keys)
4554 (substitute* "meson.build"
4555 (("udev.get_variable\\(pkgconfig: 'udevdir'\\)")
4556 (string-append "'" #$output "/lib/udev'"))
4557 ;; Don't install in /var
4558 (("not systemd\\.found\\(\\)")
4559 "false"))))
4560 (add-before 'install 'no-polkit-magic
4561 (lambda* (#:key outputs #:allow-other-keys)
4562 (setenv "PKEXEC_UID" "something"))))))
4563 (native-inputs (list pkg-config
4564 `(,glib "bin") python asciidoc umockdev))
4565 (inputs (list eudev dbus polkit))
4566 (synopsis "Thunderbolt 3 device manager")
4567 (description
4568 "This package provides @command{boltd}, a userspace daemon
4569for Thunderbolt devices, and @command{boltctl}, a command-line utility for
4570managing those devices.
4571
4572The daemon @command{boltd} exposes devices via D-Bus to clients. It also
4573stores a database of previously authorized devices and will, depending on the
4574policy set for the individual devices, automatically authorize newly connected
4575devices without user interaction.
4576
4577The command-line utility @command{boltctl} manages Thunderbolt devices via
4578@command{boltd}. It can list devices, monitor changes, and initiate
4579authorization of devices.")
4580 (home-page "https://gitlab.freedesktop.org/bolt/bolt")
4581 (properties `((lint-hidden-cpe-vendors . ("boltcms" "puppet"))))
4582 (license license:gpl2+)))
4583
4584(define-public jitterentropy-rngd
4585 (package
4586 (name "jitterentropy-rngd")
4587 (version "1.2.8")
4588 (source
4589 (origin
4590 (method git-fetch)
4591 (uri (git-reference
4592 (url "https://github.com/smuellerDD/jitterentropy-rngd")
4593 (commit (string-append "v" version))))
4594 (file-name (git-file-name name version))
4595 (sha256
4596 (base32 "13br8s6gqnfc844ps38ya5nny3pndsmskszv3dsp1cxcgvmscg1c"))))
4597 (build-system gnu-build-system)
4598 (arguments
4599 (list
4600 #:tests? #f ; no test suite
4601 #:make-flags
4602 #~(list (string-append "CC=" #$(cc-for-target))
4603 (string-append "PREFIX=" #$output)
4604 "UNITDIR=$(PREFIX)/lib/systemd/system")
4605 #:phases
4606 #~(modify-phases %standard-phases
4607 (delete 'configure)))) ; no ./configure script
4608 (home-page "https://www.chronox.de/jent.html")
4609 (synopsis "CPU jitter random number generator daemon")
4610 (description
4611 "This simple daemon feeds entropy from the CPU Jitter @acronym{RNG, random
4612number generator} core to the kernel Linux's entropy estimator. This prevents
4613the @file{/dev/random} device from blocking and should benefit users of the
4614preferred @file{/dev/urandom} and @code{getrandom()} interfaces too.
4615
4616The CPU Jitter RNG itself is part of the kernel and claims to provide good
4617entropy by collecting and magnifying differences in CPU execution time as
4618measured by the high-resolution timer built into modern CPUs. It requires no
4619additional hardware or external entropy source.
4620
4621The random bit stream generated by @command{jitterentropy-rngd} is not processed
4622by a cryptographically secure whitening function. Nonetheless, its authors
4623believe it to be a suitable source of cryptographically secure key material or
4624other cryptographically sensitive data.
4625
4626If you agree with them, start this daemon as early as possible to provide
4627properly seeded random numbers to services like SSH or those using TLS during
4628early boot when entropy may be low, especially in virtualised environments.")
4629 (license (list license:bsd-3 ; or
4630 license:gpl2+))))
4631
4632(define-public ebtables
4633 (package
4634 (name "ebtables")
4635 (version "2.0.11")
4636 (source (origin
4637 (method url-fetch)
4638 (uri (string-append
4639 "mirror://netfilter.org/ebtables/ebtables-"
4640 version ".tar.gz"))
4641 (sha256
4642 (base32
4643 "0apxgmkhsk3vxn9q3libxn3dgrdljrxyy4mli2gk49m7hi3na7xp"))))
4644 (build-system gnu-build-system)
4645 (inputs
4646 (list perl iptables))
4647 (synopsis "Ethernet bridge frame table administration")
4648 (home-page "https://ebtables.netfilter.org/")
4649 (description
4650 "ebtables is an application program used to set up and maintain the
4651tables of rules (inside the Linux kernel) that inspect Ethernet frames. It is
4652analogous to the iptables application, but less complicated, due to the fact
4653that the Ethernet protocol is much simpler than the IP protocol.")
4654 (license license:gpl2+)))
4655
4656(define-public iproute
4657 (package
4658 (name "iproute2")
4659 (version "7.0.0")
4660 (source (origin
4661 (method url-fetch)
4662 (uri (string-append
4663 "mirror://kernel.org/linux/utils/net/iproute2/iproute2-"
4664 version ".tar.xz"))
4665 (sha256
4666 (base32
4667 "0kiggxwnjsglxnj43wqkc0rmq0acxf6xqcgk7ddc0qyynpvr0a76"))))
4668 (build-system gnu-build-system)
4669 (arguments
4670 (list
4671 ;; There is a test suite, but it wants network namespaces and sudo.
4672 #:tests? #f
4673 #:make-flags
4674 #~(let ((out #$output))
4675 (list (string-append "CC=" #$(cc-for-target))
4676 "HOSTCC=gcc"
4677 (string-append "BASH_COMPDIR=" out
4678 "/etc/bash_completion.d")
4679 (string-append "PREFIX=" out)
4680 (string-append "LIBDIR=" out "/lib")
4681 (string-append "HDRDIR=" out "/include")
4682 (string-append "SBINDIR=" out "/sbin")
4683 (string-append "CONFDIR=" out "/etc")
4684 (string-append "MANDIR=" out "/share/man")
4685 #$@(if (target-ppc64le?)
4686 '("CCOPTS=-O2 -pipe -Wno-incompatible-pointer-types")
4687 '())))
4688 #:phases
4689 #~(modify-phases %standard-phases
4690 (replace 'configure
4691 (lambda* (#:key (configure-flags #~'()) #:allow-other-keys)
4692 ;; The configure script does not understand some of the
4693 ;; default options of gnu-build-system.
4694 (setenv "PKG_CONFIG" #$(pkg-config-for-target))
4695 (apply invoke "./configure"
4696 "--prefix" #$output
4697 configure-flags)))
4698 (add-before 'install 'pre-install
4699 (lambda _
4700 ;; Don't attempt to create /var/lib/arpd.
4701 (substitute* "Makefile"
4702 (("^.*ARPDDIR.*$") "")))))))
4703 (inputs
4704 (list bdb iptables libmnl))
4705 (native-inputs
4706 (list bison flex pkg-config))
4707 ;; For tests.
4708 ;; ("libmnl" ,libmnl)
4709 ;; ("util-linux" ,util-linux)
4710 (home-page
4711 "https://wiki.linuxfoundation.org/networking/iproute2")
4712 (synopsis
4713 "Utilities for controlling TCP/IP networking and traffic in Linux")
4714 (description
4715 "Iproute2 is a collection of utilities for controlling TCP/IP networking
4716and traffic with the Linux kernel. The most important of these are
4717@command{ip}, which configures IPv4 and IPv6, and @command{tc} for traffic
4718control.
4719
4720Most network configuration manuals still refer to ifconfig and route as the
4721primary network configuration tools, but ifconfig is known to behave
4722inadequately in modern network environments, and both should be deprecated.")
4723 (license license:gpl2+)))
4724
4725(define-public net-tools
4726 ;; XXX: This package is basically unmaintained, but it provides a few
4727 ;; commands not yet provided by Inetutils, such as 'route', so we have to
4728 ;; live with it.
4729 (let ((commit "479bb4a7e11a4084e2935c0a576388f92469225b")
4730 (revision "0"))
4731 (package
4732 (name "net-tools")
4733 (version (string-append "1.60-" revision "."
4734 (string-take commit 7)))
4735 (source
4736 (origin
4737 (method url-fetch)
4738 (uri (string-append "https://sourceforge.net/code-snapshots/git/"
4739 "n/ne/net-tools/code.git/net-tools-code-" commit
4740 ".zip"))
4741 (file-name (string-append name "-" version ".zip"))
4742 (sha256
4743 (base32 "0hz9fda9d78spp774b6rr5xaxav7cm4h0qcpxf70rvdbrf6qx7vy"))))
4744 (home-page "https://net-tools.sourceforge.net/")
4745 (build-system gnu-build-system)
4746 (arguments
4747 (list
4748 ;; Binaries that depend on libnet-tools.a don't declare that
4749 ;; dependency, making it parallel-unsafe.
4750 #:parallel-build? #f
4751
4752 #:tests? #f ;no test suite
4753 #:make-flags
4754 #~(list #$(string-append "CC=" (cc-for-target))
4755 (string-append "BASEDIR=" #$output)
4756 (string-append "INSTALLNLSDIR=" #$output "/share/locale")
4757 (string-append "mandir=/share/man"))
4758 #:modules `((guix build gnu-build-system)
4759 (guix build utils)
4760 (srfi srfi-1)
4761 (srfi srfi-26))
4762 #:phases
4763 #~(modify-phases %standard-phases
4764 (replace 'configure
4765 (lambda _
4766 (mkdir-p (string-append #$output "/bin"))
4767 (mkdir-p (string-append #$output "/sbin"))
4768
4769 ;; Pretend we have everything...
4770 (system "yes | make config")
4771
4772 ;; ... except for the things we don't have.
4773 ;; HAVE_AFDECnet requires libdnet, which we don't have.
4774 ;; HAVE_HWSTRIP and HAVE_HWTR require kernel headers
4775 ;; that have been removed.
4776 ;; XXX SELINUX and AFBLUETOOTH are removed for now, but we should
4777 ;; think about adding them later.
4778 (substitute* '("config.make" "config.h")
4779 (("^.*HAVE_(AFDECnet|HWSTRIP|HWTR|SELINUX|AFBLUETOOTH)[ =]1.*$")
4780 ""))))
4781 (add-after 'install 'remove-redundant-commands
4782 (lambda _
4783 ;; Remove commands and man pages redundant with Inetutils.
4784 (for-each delete-file
4785 (append-map (cute find-files #$output <>)
4786 '("^hostname"
4787 "^(yp|nis|dns)?domainname"))))))))
4788 (native-inputs (list gettext-minimal unzip))
4789 (supported-systems (remove target-hurd? %supported-systems))
4790 (synopsis "Tools for controlling the network subsystem in Linux")
4791 (description
4792 "This package includes the important tools for controlling the network
4793subsystem of the Linux kernel. This includes arp, ifconfig, netstat, rarp and
4794route. Additionally, this package contains utilities relating to particular
4795network hardware types (plipconfig, slattach) and advanced aspects of IP
4796configuration (iptunnel, ipmaddr).")
4797 (license license:gpl2+))))
4798
4799(define-public libcap
4800 (package
4801 (name "libcap")
4802 (version "2.64")
4803 (source (origin
4804 (method url-fetch)
4805 (uri (string-append
4806 "mirror://kernel.org/linux/libs/security/linux-privs/"
4807 "libcap2/libcap-" version ".tar.xz"))
4808 (sha256
4809 (base32
4810 "04qy0z6yhlljb29xxcb2srbdnymcrhsi28wrc705z3861cgmwin8"))))
4811 (build-system gnu-build-system)
4812 (arguments
4813 (list #:phases
4814 #~(modify-phases %standard-phases
4815 (delete 'configure)
4816 #$@(if (target-ppc32?)
4817 #~((add-after 'unpack 'apply-patch
4818 (lambda _
4819 (let ((patch
4820 #$(local-file
4821 (search-patch
4822 "libcap-magic-glibc-constant.patch"))))
4823 (invoke "patch" "--force" "-p1" "-i" patch)))))
4824 #~()))
4825 #:test-target "test"
4826 #:make-flags
4827 #~(list "lib=lib"
4828 (string-append "prefix=" #$output)
4829 (string-append "LDFLAGS=-Wl,-rpath=" #$output "/lib")
4830 "RAISE_SETFCAP=no"
4831 ;; Tell the makefile to use TARGET-gcc and friends
4832 ;; when cross-compiling.
4833 #$@(if (%current-target-system)
4834 `((string-append "CROSS_COMPILE="
4835 ,(%current-target-system) "-")
4836 "BUILD_CC=gcc")
4837 '()))))
4838 (native-inputs (list perl))
4839 (supported-systems (remove target-hurd? %supported-systems))
4840 (home-page "https://sites.google.com/site/fullycapable/")
4841 (synopsis "Library for working with POSIX capabilities")
4842 (description
4843 "Libcap2 provides a programming interface to POSIX capabilities on
4844Linux-based operating systems.")
4845
4846 ;; License is BSD-3 or GPLv2, at the user's choice.
4847 (license (list license:bsd-3 license:gpl2))))
4848
4849(define-public bridge-utils
4850 (package
4851 (name "bridge-utils")
4852 (version "1.7.1")
4853 (source
4854 (origin
4855 (method url-fetch)
4856 (uri (string-append "mirror://kernel.org/linux/utils/net/"
4857 "bridge-utils/bridge-utils-" version ".tar.xz"))
4858 (sha256
4859 (base32 "03p6cmhm6cqhnfsfa1wv7frhb361y12daf7gr1h5qh51y7j8n7d6"))))
4860 (build-system gnu-build-system)
4861
4862 ;; The tarball lacks all the generated files.
4863 (native-inputs (list autoconf automake))
4864 (arguments
4865 '(#:tests? #f)) ; no 'check' target
4866
4867 (home-page "https://wiki.linuxfoundation.org/networking/bridge")
4868 (synopsis "Manipulate Ethernet bridges")
4869 (description
4870 "Utilities for Linux's Ethernet bridging facilities. A bridge is a way
4871to connect two Ethernet segments together in a protocol independent way.
4872Packets are forwarded based on Ethernet address, rather than IP address (like
4873a router). Since forwarding is done at Layer 2, all protocols can go
4874transparently through a bridge.")
4875 (license license:gpl2+)))
4876
4877(define-public libnl
4878 (package
4879 (name "libnl")
4880 (version "3.12.0")
4881 (source (origin
4882 (method url-fetch)
4883 (uri (string-append
4884 "https://github.com/thom311/libnl/releases/download/"
4885 "libnl" (string-join (string-split version #\.) "_")
4886 "/libnl-" version ".tar.gz"))
4887 (sha256
4888 (base32
4889 "066xq01y2mx0xi7bwa5y6ciw1ygla15qdlzzyvyzb8zijrqwllgw"))))
4890 (build-system gnu-build-system)
4891 (native-inputs
4892 `(("bison" ,bison)
4893 ("flex" ,flex)
4894 ("pkg-config" ,pkg-config)
4895 ("swig" ,swig-4.0)
4896 ("libnl3-doc"
4897 ,(origin
4898 (method url-fetch)
4899 (uri (string-append
4900 "https://github.com/thom311/libnl/releases/download/libnl"
4901 (string-join (string-split version #\.) "_")
4902 "/libnl-doc-" version ".tar.gz"))
4903 (sha256
4904 (base32 "18f14pdycghy6fcd27faqgh19zpam6b45s8bgsk85kb9wwzq3yd4"))))))
4905 (outputs `("out" "doc"))
4906 (arguments
4907 `(#:phases
4908 (modify-phases %standard-phases
4909 (add-after 'install 'install-doc
4910 (lambda* (#:key inputs native-inputs outputs #:allow-other-keys)
4911 (let ((dest (string-append (assoc-ref outputs "doc")
4912 "/share/doc/libnl")))
4913 (mkdir-p dest)
4914 (invoke "tar" "xf" (assoc-ref
4915 (or native-inputs inputs)
4916 "libnl3-doc")
4917 "--strip-components=1" "-C" dest)))))))
4918 (home-page "https://www.infradead.org/~tgr/libnl/")
4919 (synopsis "NetLink protocol library suite")
4920 (description
4921 "The libnl suite is a collection of libraries providing APIs to netlink
4922protocol based Linux kernel interfaces. Netlink is an IPC mechanism primarily
4923between the kernel and user space processes. It was designed to be a more
4924flexible successor to ioctl to provide mainly networking related kernel
4925configuration and monitoring interfaces.")
4926
4927 ;; Most files are LGPLv2.1-only, but some are GPLv2-only (like
4928 ;; 'nl-addr-add.c'), so the result is GPLv2-only.
4929 (license license:gpl2)))
4930
4931;; libnl python extensions used to be outputs of libnl. However, as
4932;; cross-compiling python extensions is currently broken, create separate
4933;; packages for libnl python extensions.
4934(define (libnl-python-package python)
4935 (let ((name (string-append "libnl-" python)))
4936 (package
4937 (inherit libnl)
4938 (name name)
4939 (outputs '("out"))
4940 (arguments
4941 (list
4942 #:modules `((guix build gnu-build-system)
4943 (guix build utils)
4944 (srfi srfi-1))
4945 #:phases
4946 #~(modify-phases %standard-phases
4947 (replace 'install
4948 (lambda* (#:key inputs #:allow-other-keys)
4949 (define (python-inst python)
4950 (invoke python "setup.py" "build")
4951 (invoke python "setup.py" "install"
4952 (string-append "--prefix=" #$output))
4953 (invoke python "setup.py" "clean"))
4954 (let ((libdir (dirname (search-input-directory inputs
4955 "lib/libnl"))))
4956 (setenv "LDFLAGS" (string-append "-Wl,-rpath=" libdir)))
4957 (with-directory-excursion "./python"
4958 (python-inst #$python)))))))
4959 (inputs
4960 (append (cond
4961 ((string=? python "python2")
4962 (list python-2))
4963 ((string=? python "python3")
4964 (list python-setuptools python-wrapper)))
4965 (list libxcrypt))) ;required by Python.h
4966 (propagated-inputs (list libnl)))))
4967
4968(define-public libnl-python3 (libnl-python-package "python3"))
4969
4970(define-public iw
4971 (package
4972 (name "iw")
4973 (version "5.19")
4974 (source (origin
4975 (method url-fetch)
4976 (uri (string-append
4977 "mirror://kernel.org/software/network/iw/iw-"
4978 version ".tar.xz"))
4979 (sha256
4980 (base32
4981 "0kjdrihc7ibnjdpjqkq8sv0kmmvavgsww78cpjgbnlyx8zlvnrzi"))))
4982 (build-system gnu-build-system)
4983 (native-inputs (list pkg-config))
4984 (inputs (list libnl))
4985 (arguments
4986 (list #:make-flags
4987 #~(list
4988 (string-append "CC=" #$(cc-for-target))
4989 (string-append "PKG_CONFIG=" #$(pkg-config-for-target))
4990 (string-append "PREFIX=" (assoc-ref %outputs "out")))
4991 #:phases
4992 #~(modify-phases %standard-phases
4993 (delete 'configure)))) ; no configure script
4994 (home-page "https://wireless.wiki.kernel.org/")
4995 (synopsis "Tool for configuring wireless devices")
4996 (description
4997 "iw is a new nl80211 based CLI configuration utility for wireless
4998devices. It replaces @code{iwconfig}, which is deprecated.")
4999 (license license:isc)))
5000
5001(define-public powertop
5002 (package
5003 (name "powertop")
5004 (version "2.15")
5005 (source
5006 (origin
5007 (method git-fetch)
5008 (uri (git-reference
5009 (url "https://github.com/fenrus75/powertop")
5010 (commit (string-append "v" version))))
5011 (file-name (git-file-name name version))
5012 (sha256
5013 (base32 "10vbk4vplmzp3p1mhwnhj81g6i5xvam9pdvmiy6cmd0xvnmdyy77"))))
5014 (build-system gnu-build-system)
5015 (arguments
5016 (list
5017 #:configure-flags #~(list "LDFLAGS=-pthread")
5018 #:phases
5019 #~(modify-phases %standard-phases
5020 ;; TODO: Patch some hardcoded "wlan0" in calibrate/calibrate.cpp to
5021 ;; allow calibrating the network interface in Guix System.
5022 (add-after 'unpack 'patch-absolute-file-names
5023 (lambda* (#:key inputs #:allow-other-keys)
5024 (let ((kmod (assoc-ref inputs "kmod")))
5025 ;; Fix for using a more modern gettext.
5026 (substitute* "autogen.sh"
5027 (("autoreconf")
5028 "autoreconf --force"))
5029 (substitute* "configure.ac"
5030 (("^AM_GNU_GETTEXT_VERSION.*$")
5031 (string-append "AM_GNU_GETTEXT_VERSION(["
5032 #$(package-version (this-package-native-input "gettext-minimal"))
5033 "])\n")))
5034 ;; Give the right 'modprobe' file name so that essential
5035 ;; modules such as msr.ko can be loaded.
5036 (substitute* (find-files "src" "\\.cpp$")
5037 (("/sbin/modprobe") (string-append kmod "/bin/modprobe"))
5038 ;; These programs are only needed to calibrate, so using
5039 ;; relative file names avoids adding extra inputs. When they
5040 ;; are missing powertop gracefully handles it.
5041 (("/usr/s?bin/(hciconfig|hcitool|xset)" _ command)
5042 command
5043 command))))))))
5044 (native-inputs
5045 (list autoconf
5046 autoconf-archive
5047 automake
5048 gettext-minimal
5049 libtool
5050 pkg-config))
5051 (inputs
5052 (list kmod libnl ncurses pciutils zlib))
5053 (home-page "https://01.org/powertop/")
5054 (synopsis "Analyze power consumption on x86-based laptops")
5055 (description
5056 "PowerTOP is a Linux tool to diagnose issues with power consumption and
5057power management. In addition to being a diagnostic tool, PowerTOP also has
5058an interactive mode where the user can experiment various power management
5059settings for cases where the operating system has not enabled these
5060settings.")
5061 (license license:gpl2)))
5062
5063(define-public aumix
5064 (package
5065 (name "aumix")
5066 (version "2.9.1")
5067 (source (origin
5068 (method url-fetch)
5069 (uri (string-append
5070 "https://web.archive.org/web/20211201184543/"
5071 "http://www.jpj.net/~trevor/aumix/releases/aumix-"
5072 version ".tar.bz2"))
5073 (sha256
5074 (base32
5075 "0a8fwyxnc5qdxff8sl2sfsbnvgh6pkij4yafiln0fxgg6bal7knj"))))
5076 (build-system gnu-build-system)
5077 (arguments
5078 ;; Allow compilation with GCC 10.
5079 '(#:configure-flags '("CFLAGS=-O2 -g -fcommon")))
5080 (inputs (list ncurses))
5081 (home-page (string-append "https://web.archive.org/web/20211201184543/"
5082 "http://jpj.net/~trevor/aumix.html"))
5083 (synopsis "Audio mixer for X and the console")
5084 (description
5085 "Aumix adjusts an audio mixer from X, the console, a terminal,
5086the command line or a script.")
5087 (license license:gpl2+)))
5088
5089(define-public iotop-python
5090 ;; The last release is from 2013 and gives a misleading CONFIG_TASK_DELAY_ACCT
5091 ;; error on ‘newer’ kernels.
5092 (let ((revision "0")
5093 (commit "a14256a3ff74eeee59493ac088561f1bafab85a7"))
5094 (package
5095 (name "iotop-python")
5096 (version (git-version "0.6" revision commit))
5097 (source
5098 (origin
5099 (method git-fetch)
5100 (uri (git-reference
5101 (url "https://repo.or.cz/iotop.git")
5102 (commit commit)))
5103 (file-name (git-file-name name version))
5104 (sha256
5105 (base32 "00h5p8fk1zi237q8mqds8apqbis9iw0yih1hl0pr63dsnyzmmrpw"))))
5106 (build-system pyproject-build-system)
5107 (arguments
5108 (list
5109 #:tests? #f ; No tests.
5110 #:phases
5111 #~(modify-phases %standard-phases
5112 (add-after 'unpack 'fix-build-with-python3
5113 (lambda _
5114 (substitute* "setup.py"
5115 (("itervalues")
5116 "values")))))))
5117 (native-inputs (list python python-setuptools))
5118 (home-page "http://guichaz.free.fr/iotop/")
5119 (synopsis "Displays the IO activity of running processes")
5120 (description
5121 "Iotop is a Python program with a top like user interface to show the
5122processes currently causing I/O.")
5123 (license license:gpl2+))))
5124
5125(define-public iotop
5126 (package
5127 (name "iotop")
5128 (version "1.31")
5129 (source
5130 (origin
5131 (method git-fetch)
5132 (uri (git-reference
5133 (url "https://github.com/Tomas-M/iotop")
5134 (commit (string-append "v" version))))
5135 (file-name (git-file-name name version))
5136 (sha256
5137 (base32 "19ccdiw3flzk7gki90rc1nifmma79g2l87vhls4d2xr4z763m4nc"))))
5138 (build-system gnu-build-system)
5139 (arguments
5140 (list #:make-flags
5141 #~(list (string-append "CC=" #$(cc-for-target))
5142 (string-append "PREFIX=" #$output))
5143 #:tests? #f ; no tests
5144 #:phases
5145 #~(modify-phases %standard-phases
5146 (delete 'configure)))) ; no configure script
5147 (native-inputs (list pkg-config))
5148 (inputs (list ncurses))
5149 (home-page "https://github.com/Tomas-M/iotop")
5150 (synopsis "Interactive @command{top}-like input/output activity monitor")
5151 (description
5152 "iotop identifies which processes and threads are most responsible for
5153@acronym{I/O, input/output} activity such as disc reads and writes. It sorts
5154them in a live, interactive table overview similar to that of the well-known
5155@command{top}.
5156
5157This information makes it much easier for an administrator to see which tasks
5158are blocking others and adjust their priority (using @command{ionice}) or stop
5159or kill them altogether.")
5160 (license license:gpl2+)))
5161
5162(define-public fuse
5163 (package
5164 (name "fuse")
5165 (version "3.18.1")
5166 (source (origin
5167 (method url-fetch)
5168 (uri
5169 (string-append "https://github.com/libfuse/libfuse/releases/"
5170 "download/fuse-" version
5171 "/fuse-" version ".tar.gz"))
5172 (sha256
5173 (base32
5174 "0b1jp5gp2gv40gv6cvmv86rcr4l0mdh050qbvnxl0xcwya45qffx"))))
5175 (build-system meson-build-system)
5176 (outputs (list "out" "debug" "static"))
5177 (inputs
5178 (list bash-minimal util-linux))
5179 (arguments
5180 `(#:configure-flags
5181 ,#~(list
5182 (string-append "-Dudevrulesdir=" #$output "/udev/rules.d")
5183 "-Duseroot=false"
5184 ;; Build static libraries.
5185 "--default-library=both")
5186 #:tests? #f
5187 #:modules ((guix build meson-build-system)
5188 (guix build utils)
5189 (ice-9 ftw))
5190 #:phases
5191 ,#~(modify-phases %standard-phases
5192 (add-after 'unpack 'set-file-names
5193 (lambda* (#:key inputs #:allow-other-keys)
5194 ;; libfuse calls out to mount(8) and umount(8). Make sure
5195 ;; it refers to the right ones.
5196 (substitute* '("lib/mount_util.c")
5197 (("/bin/(u?)mount" _ maybe-u)
5198 (search-input-file inputs
5199 (string-append "bin/"
5200 maybe-u "mount"))))
5201 (substitute* '("util/mount.fuse.c")
5202 (("/bin/sh")
5203 (search-input-file inputs "/bin/sh")))
5204
5205 ;; This hack leads libfuse to search for 'fusermount' in
5206 ;; $PATH, where it may find a setuid-root binary, instead of
5207 ;; trying solely $out/sbin/fusermount and failing because
5208 ;; it's not setuid.
5209 (substitute* "lib/meson.build"
5210 (("-DFUSERMOUNT_DIR=[[:graph:]]+")
5211 "-DFUSERMOUNT_DIR=\"/var/empty\"'"))))
5212 (add-after 'unpack 'fix-install
5213 (lambda* (#:key inputs #:allow-other-keys)
5214 (substitute* '("util/meson.build")
5215 (("install_helper.sh") "true"))
5216 (substitute* '("util/meson.build")
5217 (("fuseconf_path = .*")
5218 "fuseconf_path = '/etc/fuse.conf'"))))
5219 (add-before 'configure 'set-paths
5220 (lambda* (#:key inputs outputs #:allow-other-keys)
5221 (let ((dummy-init.d
5222 (string-append (getcwd) "/etc/init.d")))
5223 (setenv "MOUNT_FUSE_PATH"
5224 (string-append #$output "/sbin"))
5225 (setenv "UDEV_RULES_PATH"
5226 (string-append #$output
5227 "/lib/udev/rules.d")))))
5228 (add-after 'install 'install-static-libraries
5229 (lambda* (#:key outputs #:allow-other-keys)
5230 (let ((out (assoc-ref outputs "out"))
5231 (static (assoc-ref outputs "static")))
5232 (mkdir-p (string-append static "/lib"))
5233 (for-each
5234 (lambda (static-library)
5235 (rename-file
5236 (string-append out "/lib/" static-library)
5237 (string-append static "/lib/" static-library)))
5238 (scandir (string-append out "/lib")
5239 (lambda (file-name)
5240 (string-suffix? ".a" file-name))))))))))
5241 (supported-systems (remove target-hurd? %supported-systems))
5242 (home-page "https://github.com/libfuse/libfuse")
5243 (synopsis "Support file systems implemented in user space")
5244 (description
5245 "As a consequence of its monolithic design, file system code for Linux
5246normally goes into the kernel itself---which is not only a robustness issue,
5247but also an impediment to system extensibility. FUSE, for \"file systems in
5248user space\", is a kernel module and user-space library that tries to address
5249part of this problem by allowing users to run file system implementations as
5250user-space processes.")
5251 (license (list license:lgpl2.1 ; library
5252 license:gpl2+)))) ; command-line utilities
5253
5254(define-public fuse-2
5255 (package
5256 (inherit fuse)
5257 (name "fuse")
5258 (version "2.9.9")
5259 (source
5260 (origin
5261 (method url-fetch)
5262 (uri (string-append "https://github.com/libfuse/libfuse/releases/"
5263 "download/fuse-" version
5264 "/fuse-" version ".tar.gz"))
5265 (sha256
5266 (base32 "1ddlq6kzxilccgbvxjfx80jx6kamgw4sv49phks2zhlcc1frvrnh"))
5267 (patches (search-patches "fuse-overlapping-headers.patch"
5268 "fuse-glibc-2.34.patch"))))
5269 (build-system gnu-build-system)
5270 (native-inputs
5271 (list autoconf automake gettext-minimal libtool))
5272 (arguments
5273 '(#:configure-flags (list (string-append "MOUNT_FUSE_PATH="
5274 (assoc-ref %outputs "out")
5275 "/sbin")
5276 (string-append "INIT_D_PATH="
5277 (assoc-ref %outputs "out")
5278 "/etc/init.d")
5279
5280 ;; The rule makes /dev/fuse 666.
5281 (string-append "UDEV_RULES_PATH="
5282 (assoc-ref %outputs "out")
5283 "/lib/udev/rules.d"))
5284 #:phases
5285 (modify-phases %standard-phases
5286 (add-before 'bootstrap 'force-bootstrap
5287 (lambda _
5288 ;; Force a bootstrap to make the patch changes effective.
5289 (delete-file "configure")))
5290 (add-before 'build 'set-file-names
5291 (lambda* (#:key inputs #:allow-other-keys)
5292 ;; libfuse calls out to mount(8) and umount(8). Make sure
5293 ;; it refers to the right ones.
5294 (substitute* '("lib/mount_util.c" "util/mount_util.c")
5295 (("/bin/(u?)mount" _ maybe-u)
5296 (search-input-file inputs
5297 (string-append "bin/"
5298 maybe-u "mount"))))
5299 (substitute* '("util/mount.fuse.c")
5300 (("/bin/sh")
5301 (search-input-file inputs "/bin/sh")))
5302
5303 ;; This hack leads libfuse to search for 'fusermount' in
5304 ;; $PATH, where it may find a setuid-root binary, instead of
5305 ;; trying solely $out/sbin/fusermount and failing because
5306 ;; it's not setuid.
5307 (substitute* "lib/Makefile"
5308 (("-DFUSERMOUNT_DIR=[[:graph:]]+")
5309 "-DFUSERMOUNT_DIR=\\\"/var/empty\\\"")))))))))
5310
5311(define-public unionfs-fuse
5312 (package
5313 (name "unionfs-fuse")
5314 (version "3.3")
5315 (source (origin
5316 (method git-fetch)
5317 (uri (git-reference
5318 (url "https://github.com/rpodgorny/unionfs-fuse")
5319 (commit (string-append "v" version))))
5320 (file-name (git-file-name name version))
5321 (sha256
5322 (base32
5323 "1wl5m5qnwf3s1792xphr35pb80sx8ybaqi3n3ddi5vvk3qjc4iws"))))
5324 (build-system cmake-build-system)
5325 (arguments
5326 (list
5327 #:phases
5328 #~(modify-phases %standard-phases
5329 (replace 'check
5330 ;; The epitome of ‘I tried’: run the 2 trivial tests that don't rely
5331 ;; on the fuse kernel module being loaded. All others would fail.
5332 (lambda* (#:key tests? #:allow-other-keys)
5333 (when tests?
5334 (invoke "pytest" "../source/test_all.py" "-k" "test_help")))))))
5335 (native-inputs
5336 (list pkg-config
5337
5338 ;; Only for the test ‘suite’.
5339 python
5340 python-pytest))
5341 (inputs
5342 (list fuse))
5343 (home-page "https://github.com/rpodgorny/unionfs-fuse")
5344 (synopsis "User-space union file system")
5345 (description
5346 "UnionFS-FUSE is a flexible union file system implementation in user
5347space, using the FUSE library. Mounting a union file system allows you to
5348\"aggregate\" the contents of several directories into a single mount point.
5349UnionFS-FUSE additionally supports copy-on-write.")
5350 (license license:bsd-3)))
5351
5352(define fuse-static
5353 (package (inherit fuse)
5354 (name "fuse-static")
5355 (source
5356 (origin
5357 (inherit (package-source fuse))
5358 (modules '((guix build utils)))
5359 (snippet
5360 #~(begin
5361 ;; Normally libfuse invokes mount(8) so that /etc/mtab is updated.
5362 ;; Change calls to 'mtab_needs_update' to 0 so that it doesn't do
5363 ;; that, allowing us to remove the dependency on util-linux
5364 ;; (something that is useful in initrds.)
5365 (substitute* "lib/mount_util.c"
5366 (("mtab_needs_update[[:blank:]]*\\([a-z_]+\\)") "0")
5367 (("/bin/") ""))))))
5368 (arguments
5369 (substitute-keyword-arguments arguments
5370 ((#:configure-flags flags '())
5371 #~(cons "-Ddefault_library=static"
5372 #$flags))))))
5373
5374(define-public unionfs-fuse/static
5375 (package (inherit unionfs-fuse)
5376 (synopsis "User-space union file system (statically linked)")
5377 (name (string-append (package-name unionfs-fuse) "-static"))
5378 (source
5379 (origin
5380 (inherit (package-source unionfs-fuse))
5381 (modules '((guix build utils)))
5382 (snippet
5383 #~(begin
5384 ;; Add -ldl to the libraries, because libfuse.a needs that.
5385 (substitute* "src/CMakeLists.txt"
5386 (("target_link_libraries(.*)\\)" _ libs)
5387 (string-append "target_link_libraries"
5388 libs " dl)")))))))
5389 (arguments
5390 (substitute-keyword-arguments arguments
5391 ((#:configure-flags flags #~'())
5392 #~(cons "-DCMAKE_EXE_LINKER_FLAGS=-static" #$flags))
5393 ((#:phases phases #~%standard-phases)
5394 #~(modify-phases #$phases
5395 (add-after 'install 'post-install
5396 (lambda _
5397 ;; By default, 'unionfs' keeps references to
5398 ;; $glibc/share/locale and similar stuff. Remove them.
5399 (remove-store-references (string-append #$output "/bin/unionfs"))
5400 ;; 'unionfsctl' has references to glibc as well. Since
5401 ;; we don't need it, remove it.
5402 (delete-file (string-append #$output "/bin/unionfsctl"))))))))
5403 (inputs (list fuse-static))))
5404
5405(define-public sshfs
5406 (package
5407 (name "sshfs")
5408 (version "3.7.6")
5409 (source (origin
5410 (method url-fetch)
5411 (uri (string-append "https://github.com/libfuse/sshfs/releases/"
5412 "download/sshfs-" version "/sshfs-" version
5413 ".tar.xz"))
5414 (sha256
5415 (base32
5416 "14sq94g160i56v5sc39wgilxnd6yf661bzxpn6f7w1qa8lqwn6va"))))
5417 (build-system meson-build-system)
5418 (arguments
5419 ;; XXX: tests are skipped: FUSE kernel module does not seem to be loaded
5420 '(#:tests? #f))
5421 (inputs
5422 (list fuse glib))
5423 (native-inputs
5424 (list pkg-config
5425 ;; man page
5426 python-docutils))
5427 (home-page "https://github.com/libfuse/sshfs")
5428 (synopsis "Mount remote file systems over SSH")
5429 (description
5430 "This is a file system client based on the SSH File Transfer Protocol.
5431Since most SSH servers already support this protocol it is very easy to set
5432up: on the server side there's nothing to do; on the client side mounting the
5433file system is as easy as logging into the server with an SSH client.")
5434 (license license:gpl2+)))
5435
5436(define-public archivemount
5437 (package
5438 (name "archivemount")
5439 (version "0.9.1")
5440 (source
5441 (origin
5442 (method url-fetch)
5443 (uri (string-append "https://www.cybernoia.de/software/archivemount/"
5444 "archivemount-" version ".tar.gz"))
5445 (sha256
5446 (base32 "1cy5b6qril9c3ry6fv7ir87s8iyy5vxxmbyx90dm86fbra0vjaf5"))))
5447 (build-system gnu-build-system)
5448 (inputs (list fuse-2 libarchive))
5449 (native-inputs (list pkg-config))
5450 (home-page "https://www.cybernoia.de/software/archivemount.html")
5451 (synopsis "Tool for mounting archive files with FUSE")
5452 (description "archivemount is a FUSE-based file system for Unix variants,
5453including Linux. Its purpose is to mount archives (i.e. tar, tar.gz, etc.) to a
5454mount point where it can be read from or written to as with any other file
5455system. This makes accessing the contents of the archive, which may be
5456compressed, transparent to other programs, without decompressing them.")
5457 (license license:lgpl2.0+)))
5458
5459(define-public numactl
5460 (package
5461 (name "numactl")
5462 (version "2.0.16")
5463 (source (origin
5464 (method url-fetch)
5465 (uri (string-append
5466 "https://github.com/numactl/numactl/releases/download/v"
5467 version "/numactl-" version ".tar.gz"))
5468 (sha256
5469 (base32
5470 "1j67wx3383fwqbvhg4nwqf72vpdgimmrvkpn3b9s2xzr7a4jy90v"))))
5471 (build-system gnu-build-system)
5472 (arguments
5473 `(,@(if (target-riscv64?)
5474 `(#:make-flags (list "LDFLAGS=-latomic"))
5475 '())
5476 ;; There's a 'test' target, but it requires NUMA support in the kernel
5477 ;; to run, which we can't assume to have.
5478 #:tests? #f))
5479 (home-page "https://github.com/numactl/numactl")
5480 (synopsis "Tools for non-uniform memory access (NUMA) machines")
5481 (description
5482 "NUMA stands for Non-Uniform Memory Access, in other words a system whose
5483memory is not all in one place. The @command{numactl} program allows you to
5484run your application program on specific CPUs and memory nodes. It does this
5485by supplying a NUMA memory policy to the operating system before running your
5486program.
5487
5488The package contains other commands, such as @command{numastat},
5489@command{memhog}, and @command{numademo} which provides a quick overview of
5490NUMA performance on your system.")
5491 (license (list license:gpl2 ;programs
5492 license:lgpl2.1)))) ;library
5493
5494(define-public kbd-neo
5495 (package
5496 (name "kbd-neo")
5497 (version "2486")
5498 (source
5499 (origin
5500 (method url-fetch)
5501 (uri (string-append "https://svn.neo-layout.org/!svn/bc/"
5502 version "/linux/console/neo.map"))
5503 (file-name (string-append name "-" version ".map"))
5504 (sha256
5505 (base32
5506 "19mfrd31vzpsjiwc7pshxm0b0sz5dd17xrz6k079cy4im1vf0r4g"))))
5507 (build-system trivial-build-system)
5508 (arguments
5509 `(#:modules ((guix build utils))
5510 #:builder (begin
5511 (use-modules (guix build utils))
5512 (let ((out (string-append %output "/share/keymaps"))
5513 (source (assoc-ref %build-inputs "source")))
5514 (mkdir-p out)
5515 (copy-file source (string-append out "/neo.map"))
5516 #t))))
5517 (home-page "https://neo-layout.org")
5518 (synopsis "Neo2 console layout")
5519 (description
5520 "Kbd-neo provides the Neo2 keyboard layout for use with
5521@command{loadkeys(1)} from @code{kbd(4)}.")
5522 ;; The file is located in an svn directory, the entire content of
5523 ;; the directory is licensed as GPL3.
5524 (license license:gpl3+)))
5525
5526(define-public kbd
5527 (package
5528 (name "kbd")
5529 (version "2.5.1")
5530 (source
5531 (origin
5532 (method url-fetch)
5533 (uri (string-append "mirror://kernel.org/linux/utils/kbd/kbd-" version
5534 ".tar.xz"))
5535 (sha256
5536 (base32 "10s608i4blprgy9nynlid0hglfdrrgln6wwjs9rhjf56hwilbpyc"))
5537 (modules '((guix build utils)))
5538 (snippet
5539 '(begin
5540 (substitute* '("src/unicode_start" "src/unicode_stop")
5541 ;; Assume the Coreutils are in $PATH.
5542 (("/usr/bin/tty")
5543 "tty"))))))
5544 (build-system gnu-build-system)
5545 (arguments
5546 (list
5547 #:phases
5548 #~(modify-phases %standard-phases
5549 (add-before 'build 'pre-build
5550 (lambda* (#:key inputs #:allow-other-keys)
5551 (substitute* "src/libkbdfile/kbdfile.c"
5552 (("bzip2")
5553 (search-input-file inputs "/bin/bzip2"))
5554 (("gzip")
5555 (search-input-file inputs "/bin/gzip"))
5556 (("xz -d")
5557 (string-append (search-input-file inputs "/bin/xz") " -d"))
5558 (("zstd")
5559 (search-input-file inputs "/bin/zstd")))))
5560 (add-after 'install 'post-install
5561 (lambda _
5562 ;; Make sure these programs find their comrades.
5563 (let ((bin (string-append #$output "/bin")))
5564 (for-each (lambda (prog)
5565 (wrap-program (string-append bin "/" prog)
5566 `("PATH" ":" prefix (,bin))))
5567 '("unicode_start" "unicode_stop"))))))))
5568 (native-inputs (list autoconf pkg-config))
5569 (inputs
5570 (list bash-minimal
5571 ;; for wrap-program
5572 bzip2
5573 gzip
5574 linux-pam
5575 xz
5576 zstd))
5577 (native-search-paths
5578 (list (search-path-specification
5579 (variable "LOADKEYS_KEYMAP_PATH")
5580 ;; Append ‘/**’ to recursively search all directories. One can then
5581 ;; run (for example) ‘loadkeys en-latin9’ instead of having to find
5582 ;; and type ‘i386/colemak/en-latin9’ on a mislabelled keyboard.
5583 (files (list "share/keymaps/**")))))
5584 (home-page "https://kbd-project.org/")
5585 (synopsis "Linux keyboard utilities and keyboard maps")
5586 (description
5587 "This package contains keytable files and keyboard utilities compatible
5588for systems using the Linux kernel. This includes commands such as
5589@code{loadkeys}, @code{setfont}, @code{kbdinfo}, and @code{chvt}.")
5590 (license license:gpl2+)))
5591
5592(define-public loadkeys-static
5593 (package
5594 (inherit kbd)
5595 (name "loadkeys-static")
5596 (arguments
5597 (substitute-keyword-arguments arguments
5598 ((#:configure-flags flags #~(list))
5599 #~(append '("LDFLAGS=-static" "--disable-shared" "--disable-nls"
5600 "--disable-vlock" ;so we don't need libpam
5601 "--disable-libkeymap")
5602 #$flags))
5603 ((#:make-flags flags #~(list))
5604 #~(cons "LDFLAGS=-all-static -lrt -lpthread" #$flags))
5605 ((#:phases phases #~%standard-phases)
5606 #~(modify-phases #$phases
5607 (replace 'install
5608 (lambda _
5609 ;; The binary keeps references to gzip, among other things,
5610 ;; which we don't need in the initrd, so strip references.
5611 (remove-store-references "src/loadkeys")
5612
5613 (install-file "src/loadkeys"
5614 (string-append #$output "/bin"))))
5615 (delete 'post-install)))
5616 ((#:strip-flags _ #~(list))
5617 #~(list "--strip-all"))
5618 ((#:allowed-references _ '())
5619 '())))
5620
5621 (synopsis "Statically-linked @command{loadkeys} program")
5622
5623 ;; This package is meant to be used internally in the initrd so don't
5624 ;; expose it.
5625 (properties '((hidden? . #t)))))
5626
5627(define-public inotify-tools
5628 (package
5629 (name "inotify-tools")
5630 (version "3.22.6.0")
5631 (source (origin
5632 (method git-fetch)
5633 (uri (git-reference
5634 (url "https://github.com/rvoicilas/inotify-tools")
5635 (commit version)))
5636 (file-name (git-file-name name version))
5637 (sha256
5638 (base32
5639 "1j9j8k5zjp8m4cl53zjncnll9z4dnvzr4ygmfcjk0ci81i59b18i"))))
5640 (build-system gnu-build-system)
5641 (native-inputs
5642 (list autoconf automake libtool))
5643 (arguments
5644 `(#:configure-flags
5645 (list "--disable-static")))
5646 (home-page "https://github.com/rvoicilas/inotify-tools/wiki")
5647 (synopsis "Monitor file accesses")
5648 (description
5649 "The inotify-tools packages provides a C library and command-line tools
5650to use Linux' inotify mechanism, which allows file accesses to be monitored.")
5651 (license license:gpl2+)))
5652
5653(define-public kmod
5654 (package
5655 (name "kmod")
5656 (version "29")
5657 (source (origin
5658 (method url-fetch)
5659 (uri
5660 (string-append "mirror://kernel.org/linux/utils/kernel/kmod/"
5661 "kmod-" version ".tar.xz"))
5662 (sha256
5663 (base32
5664 "0am54mi5rk72g5q7k6l6f36gw3r9vwgjmyna43ywcjhqmakyx00b"))
5665 (patches (search-patches "kmod-module-directory.patch"))))
5666 (build-system gnu-build-system)
5667 (arguments
5668 (list #:configure-flags #~(list "--with-xz" "--with-zlib" "--with-zstd"
5669 "--disable-test-modules")
5670 #:phases
5671 #~(modify-phases %standard-phases
5672 (add-after 'unpack 'disable-tests
5673 (lambda _
5674 ;; XXX: These tests need '--sysconfdir=/etc' to pass.
5675 (substitute* "Makefile.in"
5676 (("testsuite/test-modprobe") "")
5677 (("testsuite/test-depmod") "")
5678 (("testsuite/test-blacklist") ""))))
5679 (add-after 'install 'install-modprobe&co
5680 (lambda _
5681 (for-each (lambda (tool)
5682 (symlink "kmod"
5683 (string-append #$output "/bin/" tool)))
5684 '("insmod" "rmmod" "lsmod" "modprobe"
5685 "modinfo" "depmod")))))))
5686 (native-inputs (list pkg-config zstd)) ;zstd needed for tests
5687 (inputs (list xz zlib `(,zstd "lib")))
5688 (supported-systems (remove target-hurd? %supported-systems))
5689 (home-page "https://www.kernel.org/")
5690 (synopsis "Kernel module tools")
5691 (description "Kmod is a set of tools to handle common tasks with Linux
5692kernel modules like insert, remove, list, check properties, resolve
5693dependencies and aliases.
5694
5695These tools are designed on top of libkmod, a library that is shipped with
5696kmod. The aim is to be compatible with tools, configurations and indices
5697from the module-init-tools project.")
5698 (license license:gpl2+))) ; library under lgpl2.1+
5699
5700(define-public earlyoom
5701 (package
5702 (name "earlyoom")
5703 (version "1.9.0")
5704 (source (origin
5705 (method git-fetch)
5706 (uri (git-reference
5707 (url "https://github.com/rfjakob/earlyoom")
5708 (commit (string-append "v" version))))
5709 (file-name (git-file-name name version))
5710 (sha256
5711 (base32
5712 "107d2vgdlkqm8ggacxn1biamganvqz29nhi0zbn7yhmfmzvs1mbq"))))
5713 (build-system gnu-build-system)
5714 (arguments
5715 (list
5716 #:imported-modules %go-build-system-modules
5717 #:modules '((guix build gnu-build-system)
5718 ((guix build go-build-system) #:prefix go:)
5719 (guix build union)
5720 (guix build utils))
5721 #:phases
5722 #~(modify-phases %standard-phases
5723 (delete 'configure) ; no configure script
5724 (add-before 'build 'setup-go-environment
5725 (assoc-ref go:%standard-phases 'setup-go-environment))
5726 (add-before 'check 'set-go-HOME
5727 (lambda _
5728 (setenv "HOME" (getcwd))))
5729 (add-before 'check 'disable-failing-test
5730 (lambda _
5731 ;; This test relies on writing to /proc/%d/oom_score_adj.
5732 (substitute* "Makefile"
5733 (("go test -v" match)
5734 (string-append match " -vet=off -skip 'TestI'"))))))
5735 #:make-flags
5736 #~(list (string-append "CC=" #$(cc-for-target))
5737 (string-append "VERSION=v" #$version)
5738 (string-append "PREFIX=" #$output)
5739 (string-append "SYSCONFDIR=" #$output "/etc")
5740 ;; Do not try installing systemd files to /etc/systemd.
5741 "SYSTEMDUNITDIR=/tmp/dummy")
5742 #:test-target "test"))
5743 (native-inputs
5744 (append
5745 ;; To generate the manpage.
5746 (if (or (target-x86-64?) (target-x86-32?))
5747 (list pandoc)
5748 '())
5749 (list
5750 ;; For the test suite.
5751 cppcheck
5752 go
5753 go-github-com-c9s-goprocinfo)))
5754 (home-page "https://github.com/rfjakob/earlyoom")
5755 (synopsis "Simple out of memory (OOM) daemon for the Linux kernel")
5756 (description "Early OOM is a minimalist out of memory (OOM) daemon that
5757runs in user space and provides a more responsive and configurable alternative
5758to the in-kernel OOM killer.")
5759 (license license:expat)))
5760
5761(define-public eudev
5762 (package
5763 (name "eudev")
5764 (version "3.2.14")
5765 (source (origin
5766 (method git-fetch)
5767 (uri (git-reference (url "https://github.com/eudev-project/eudev")
5768 (commit (string-append "v" version))))
5769 (file-name (git-file-name name version))
5770 (sha256
5771 (base32
5772 "1f6lz57igi7iw2ls3fpzgw42bfznam4nf9368h7x8yf1mb737yxz"))))
5773 (build-system gnu-build-system)
5774 (arguments
5775 (list
5776 ;; The binary should be built to look for its rules under
5777 ;; /etc/udev/rules.d, which is where the udev-shepherd-service keeps
5778 ;; them.
5779 #:make-flags #~(list "udevrulesdir=/etc/udev/rules.d")
5780 #:phases
5781 #~(modify-phases %standard-phases
5782 (add-before 'bootstrap 'patch-file-names
5783 (lambda* (#:key inputs native-inputs #:allow-other-keys)
5784 (substitute* "man/make.sh"
5785 (("/usr/bin/xsltproc")
5786 (search-input-file (or native-inputs inputs) "/bin/xsltproc")))))
5787 (add-before 'bootstrap 'install-in-lib
5788 (lambda _
5789 ;; When the udev-service-type instantiates /etc, it collects
5790 ;; hardware files from the <package>/lib/udev/hwdb.d directories
5791 ;; of different packages. Since we set sysconfdir to /etc, the
5792 ;; only package-dependent location we can install hwdb files is
5793 ;; in <package>/lib/udev/hwdb.d. Eudev is configured to install
5794 ;; these files in sysconfdir, but they should be placed into
5795 ;; udevlibexecdir.
5796 (copy-file "hwdb/Makefile.am" "hwdb/files.am")
5797 (call-with-output-file "hwdb/Makefile.am"
5798 (lambda (port)
5799 (format port "hardwarelibdir = $(udevlibexecdir)/hwdb.d\n")
5800 (format port "include ./files.am")))
5801 (substitute* "hwdb/files.am"
5802 (("dist_udevhwdb_DATA =")
5803 "dist_hardwarelib_DATA ="))
5804 ;; Do not install the empty udev.conf template.
5805 (substitute* "src/udev/Makefile.am"
5806 (("dist_udevconf_DATA =")
5807 "dist_noinst_DATA ="))
5808 ;; Do not ensure that /etc/udev/rules.d exists.
5809 (substitute* "rules/Makefile.am"
5810 (("\\$\\(MKDIR_P\\) \\$\\(DESTDIR\\)\\$\\(udevconfdir\\)/rules\\.d")
5811 "true"))))
5812 (add-after 'install 'move-static-library
5813 (lambda _
5814 (let ((source (string-append #$output "/lib/libudev.a"))
5815 (target (string-append #$output:static "/lib/libudev.a")))
5816 (mkdir-p (dirname target))
5817 (link source target)
5818 (delete-file source)
5819 ;; Remove reference to the static library from the .la file
5820 ;; such that Libtool looks for it in the usual places.
5821 (substitute* (string-append #$output "/lib/libudev.la")
5822 (("old_library=.*")
5823 "old_library=''\n")))))
5824 (replace 'install
5825 (lambda* (#:key make-flags #:allow-other-keys #:rest args)
5826 ;; Although the runtime udevrulesdir is set to
5827 ;; /etc/udev/rules.d, the package should provide its default
5828 ;; rules under $libdir/udev/rules.d.
5829 (let* ((default-udev-rules.d (string-append #$output
5830 "/lib/udev/rules.d"))
5831 (make-flags (cons (string-append "udevrulesdir="
5832 default-udev-rules.d)
5833 (delete "udevrulesdir=/etc/udev/rules.d"
5834 make-flags))))
5835 (apply (assoc-ref %standard-phases 'install)
5836 `(,@args #:make-flags ,make-flags))))))
5837 #:configure-flags
5838 #~(list "--enable-manpages"
5839 ;; By default, autoconf uses $prefix/etc. The udev-service-type
5840 ;; makes sure /etc is set up with rules and hardware file
5841 ;; descriptions.
5842 "--sysconfdir=/etc")))
5843 (native-search-paths
5844 (list (search-path-specification
5845 (variable "UDEV_HWDB_PATH")
5846 (files '("lib/udev/hwdb.d")))))
5847 (native-inputs
5848 (list autoconf
5849 automake
5850 gperf
5851 libtool
5852 pkg-config
5853 ;; For tests.
5854 perl
5855 python-wrapper
5856 ;; For documentation.
5857 docbook-xml-4.2
5858 docbook-xsl
5859 libxslt))
5860 (inputs
5861 ;; When linked against libblkid, eudev can populate /dev/disk/by-label
5862 ;; and similar; it also installs the '60-persistent-storage.rules' file,
5863 ;; which contains the rules to do that.
5864 (list `(,util-linux "lib") ;for blkid
5865 kmod))
5866 (outputs '("out" "static"))
5867 (home-page "https://github.com/eudev-project/eudev")
5868 (synopsis "Userspace device management")
5869 (description "Udev is a daemon which dynamically creates and removes
5870device nodes from /dev/, handles hotplug events and loads drivers at boot
5871time.")
5872 (license license:gpl2+)))
5873
5874(define-public python-evdev
5875 (package
5876 (name "python-evdev")
5877 (version "1.9.1")
5878 (source
5879 (origin
5880 (method git-fetch) ; no tests data in PyPi package
5881 (uri (git-reference
5882 (url "https://github.com/gvalkov/python-evdev")
5883 (commit (string-append "v" version))))
5884 (file-name (git-file-name name version))
5885 (sha256
5886 (base32 "09p7pj0xhv23hqlpx865klrxrf7x6sw1bdsgs6pq900jvz92pl16"))))
5887 (build-system pyproject-build-system)
5888 (arguments
5889 (list
5890 #:test-flags
5891 ;; Silent tests requiring access to /dev/uinput.
5892 #~(list "-k" (string-append "not test_open"
5893 " and not test_open_context"
5894 " and not test_enable_events"
5895 " and not test_abs_values"
5896 " and not test_write"))
5897 #:phases
5898 #~(modify-phases %standard-phases
5899 (add-before 'build 'fix-hard-coded-directory
5900 (lambda* (#:key inputs #:allow-other-keys)
5901 (substitute* "setup.py"
5902 (("/usr/include/linux")
5903 (string-append
5904 (assoc-ref inputs "kernel-headers") "/include/linux"))))))))
5905 (native-inputs
5906 (list python-pytest python-setuptools python-wheel))
5907 (home-page "https://github.com/gvalkov/python-evdev")
5908 (synopsis "Bindings to the Linux input handling subsystem")
5909 (description
5910 "Python-evdev provides bindings to the generic input event interface in
5911Linux. The @code{evdev} interface serves the purpose of passing events
5912generated in the kernel directly to userspace through character devices that
5913are typically located in @file{/dev/input/}.
5914
5915This package also comes with bindings to @code{uinput}, the userspace input
5916subsystem. @code{uinput} allows userspace programs to create and handle input
5917devices that can inject events directly into the input subsystem.")
5918 (license license:bsd-3)))
5919
5920(define-public interception-tools
5921 (package
5922 (name "interception-tools")
5923 (version "0.6.8")
5924 (home-page "https://gitlab.com/interception/linux/tools")
5925 (source (origin
5926 (method git-fetch)
5927 (uri (git-reference
5928 (url home-page)
5929 (commit (string-append "v" version))))
5930 (file-name (git-file-name name version))
5931 (sha256
5932 (base32
5933 "1sbidym6ld4c8cx2ww5i54zsv8v0kygv15zq1yimz44v4my605wf"))))
5934 (build-system cmake-build-system)
5935 (native-inputs
5936 (list pkg-config))
5937 (inputs
5938 (list boost libevdev eudev yaml-cpp))
5939 (arguments
5940 `(#:tests? #f)) ; no test suite
5941 (synopsis "Utilities for operating on input events of evdev devices")
5942 (description
5943 "Interception Tools provides a composable infrastructure on top of
5944@code{libudev} and @code{libevdev}. The following utilities are provided:
5945
5946@itemize
5947@item @command{udevmon} --- monitor input devices for launching tasks
5948@item @command{intercept} --- redirect device input events to stdout
5949@item @command{uinput} --- redirect device input events from stding to virtual device
5950@item @command{mux} --- mux streams of input events
5951@end itemize")
5952 ;; Dual-licensed under GPLv3+ or "something else" on request, per
5953 ;; 'README.md'.
5954 (license license:gpl3+)))
5955
5956(define-public interception-dual-function-keys
5957 (package
5958 (name "interception-dual-function-keys")
5959 (version "1.5.0")
5960 (home-page "https://gitlab.com/interception/linux/plugins/dual-function-keys")
5961 (source (origin
5962 (method git-fetch)
5963 (uri (git-reference
5964 (url home-page)
5965 (commit version)))
5966 (file-name (git-file-name name version))
5967 (sha256
5968 (base32
5969 "17jc02wh45yk427qryb0ydyim16607i31wyghbsahahd6mrh9ylv"))))
5970 (build-system gnu-build-system)
5971 (inputs
5972 (list libevdev yaml-cpp))
5973 (arguments
5974 `(#:make-flags (list ,(string-append "CC=" (cc-for-target))
5975 ,(string-append "CXX=" (cxx-for-target))
5976 (string-append "PREFIX=" %output))
5977 #:phases
5978 (modify-phases %standard-phases
5979 (add-after 'unpack 'fix-libevdev-path
5980 (lambda* (#:key inputs #:allow-other-keys)
5981 (let ((libevdev (assoc-ref inputs "libevdev")))
5982 (substitute* "config.mk"
5983 (("/usr/include/libevdev-1.0")
5984 (string-append libevdev "/include/libevdev-1.0")))
5985 #t)))
5986 ;; No configure script
5987 (delete 'configure))
5988 ;; No tests are included.
5989 #:tests? #f))
5990 (synopsis "Tap for one key, hold for another")
5991 (description
5992 "Dual Function Keys is a plugin for @code{interception-tools} that allows
5993one to send arbitrary keycodes when a given key is tapped or held.")
5994 (license license:expat)))
5995
5996(define-public lvm2
5997 (package
5998 (name "lvm2")
5999 (version "2.03.22")
6000 (source (origin
6001 (method url-fetch)
6002 (uri (list (string-append "https://sourceware.org/ftp/lvm2/LVM2."
6003 version ".tgz")
6004 (string-append "ftp://sources.redhat.com/pub/lvm2/releases/LVM2."
6005 version ".tgz")))
6006 (sha256
6007 (base32
6008 "0z6w6bknhwh1n3qfkb5ij6x57q3wjf28lq3l8kh7rkhsplinjnjc"))
6009 (patches (search-patches "lvm2-no-systemd.patch"))
6010 (modules '((guix build utils)))
6011 (snippet
6012 '(begin
6013 (use-modules (guix build utils))
6014
6015 ;; Honor sysconfdir.
6016 (substitute* "make.tmpl.in"
6017 (("^confdir = .*$")
6018 "confdir = @sysconfdir@\n")
6019 (("DEFAULT_SYS_DIR = @DEFAULT_SYS_DIR@")
6020 "DEFAULT_SYS_DIR = @sysconfdir@"))))))
6021 (build-system gnu-build-system)
6022 (arguments
6023 (list
6024 #:tests? #f ;The tests use 'mknod', which requires root access.
6025 #:configure-flags
6026 #~(list (string-append "--sysconfdir=" #$output "/etc/lvm")
6027 "--enable-udev_sync"
6028 "--enable-udev_rules"
6029 "--enable-pkgconfig"
6030 "--enable-cmdlib"
6031 "--enable-dmeventd" ;Requires '--enable-cmdlib'.
6032 ;; Make sure programs such as 'dmsetup' can
6033 ;; find libdevmapper.so.
6034 (string-append "LDFLAGS=-Wl,-rpath="
6035 #$output "/lib,-rpath="
6036 #$output "/lib/device-mapper")
6037 ;; This is needed when cross-compiling.
6038 #$@(if (%current-target-system)
6039 '("ac_cv_func_malloc_0_nonnull=yes"
6040 "ac_cv_func_realloc_0_nonnull=yes")
6041 '()))
6042 #:phases
6043 #~(modify-phases %standard-phases
6044 (add-after 'unpack 'update-config
6045 (lambda* (#:key inputs native-inputs #:allow-other-keys)
6046 (install-file (search-input-file (or native-inputs inputs)
6047 "/bin/config.sub")
6048 "autoconf")
6049 (install-file (search-input-file (or native-inputs inputs)
6050 "/bin/config.guess")
6051 "autoconf")))
6052 (add-after 'configure 'set-makefile-shell
6053 (lambda _
6054 ;; Use 'sh', not 'bash', so that '. lib/utils.sh' works as
6055 ;; expected.
6056 (setenv "SHELL" (which "sh"))
6057
6058 ;; Replace /bin/sh with the right file name.
6059 (patch-makefile-SHELL "make.tmpl"))))))
6060 (native-inputs (list config pkg-config procps)) ;tests use 'pgrep'
6061 (inputs (list libaio eudev))
6062 (supported-systems (remove target-hurd? %supported-systems))
6063 (home-page "https://sourceware.org/lvm2/")
6064 (synopsis "Logical volume management for Linux")
6065 (description
6066 "LVM2 is the logical volume management tool set for Linux-based systems.
6067This package includes the user-space libraries and tools, including the device
6068mapper. Kernel components are part of Linux-libre.")
6069
6070 ;; Libraries (liblvm2, libdevmapper) are LGPLv2.1.
6071 ;; Command-line tools are GPLv2.
6072 (license (list license:gpl2 license:lgpl2.1))))
6073
6074(define-public (libdevmapper-propagated-inputs)
6075 (list eudev))
6076
6077(define-public lvm2-static
6078 (package
6079 (inherit lvm2)
6080 (name "lvm2-static")
6081 (arguments
6082 (substitute-keyword-arguments arguments
6083 ((#:configure-flags flags #~(list))
6084 ;; LVM2 doesn't use Libtool, hence the custom option.
6085 #~(append (list "--enable-static_link")
6086 ;; Building dmeventd statically is complicated due to a
6087 ;; requirement on libdevmapper.a, which is being phased out
6088 ;; in favor of libdevice-mapper.a, which in turn is is not
6089 ;; easily made available at dmeventd build time. Just ignore
6090 ;; it until the situation improves.
6091 (delete "--enable-dmeventd" #$flags)))
6092 ((#:phases phases)
6093 #~(modify-phases #$phases
6094 (add-before 'configure 'adjust-Makefile
6095 (lambda _
6096 ;; These fixes are related to the upstream libdm->device_mapper
6097 ;; migration and will hopefully be fixed upstream in due time.
6098 (substitute* "tools/Makefile.in"
6099 ;; This variable is empty in a static configuration and causes
6100 ;; an erroneous GCC command line.
6101 (("-L\\$\\(interfacebuilddir\\)") "")
6102 ;; Remove obsolete reference to libdevmapper.a.
6103 (("-ldevmapper")
6104 ""))))
6105 (add-after 'install 'adjust-pkgconfig
6106 ;; The static eudev is missing its pkg config file, and I am not
6107 ;; rebuilding it at this point.
6108 (lambda* (#:key inputs #:allow-other-keys)
6109 (substitute* (string-append #$output
6110 "/lib/pkgconfig/devmapper.pc")
6111 (("Requires.private: .*")
6112 "")
6113 (("Libs.private:")
6114 (format #f "Libs.private: -L~a -ludev"
6115 (dirname
6116 (search-input-file inputs
6117 "lib/libudev.a")))))))))))
6118 (inputs (modify-inputs inputs
6119 (append (list eudev "static"))))
6120 (synopsis "Logical volume management for Linux (statically linked)")))
6121
6122(define-public thin-provisioning-tools
6123 (package
6124 (name "thin-provisioning-tools")
6125 (version "0.8.5")
6126 (source
6127 (origin
6128 (method git-fetch)
6129 (uri (git-reference
6130 (url "https://github.com/jthornber/thin-provisioning-tools")
6131 (commit (string-append "v" version))))
6132 (file-name (git-file-name name version))
6133 (sha256
6134 (base32 "01wl8c0cjbx1smbhj8dx6av5bnw5775m58gasc3vqwvsj0s9hq19"))))
6135 (build-system gnu-build-system)
6136 (arguments
6137 ;; Doesn't build with --enable-testing due to a function name collision
6138 ;; with glibc. Fixed upstream. TODO: Enable tests when 0.9.0 is released.
6139 (list #:tests? #f))
6140 (native-inputs (list autoconf automake))
6141 (inputs (list boost expat libaio))
6142 (synopsis "Tools for manipulating the metadata of device-mapper targets")
6143 (description "A suite of tools for manipulating the metadata of the
6144dm-thin, dm-cache and dm-era device-mapper targets.")
6145 (home-page "https://github.com/jthornber/thin-provisioning-tools")
6146 (license license:gpl3+)))
6147
6148(define-public watchdogd
6149 (package
6150 (name "watchdogd")
6151 (version "4.1")
6152 (source (origin
6153 (method git-fetch)
6154 (uri (git-reference
6155 (url "https://github.com/troglobit/watchdogd")
6156 (commit version)))
6157 (file-name (git-file-name name version))
6158 (sha256
6159 (base32
6160 "1n5xq5gxrj8b8j2g323k0jpxabjnq9piw8v2fqcyphj33kmgay23"))))
6161 (build-system gnu-build-system)
6162 (native-inputs (list autoconf automake libtool pkg-config))
6163 (inputs (list libconfuse libite libuev))
6164 (synopsis "Advanced system & process supervisor for Linux")
6165 (description "This package provides an advanced monitor of critical system
6166resources, supervises the heartbeat of processes, records deadline
6167transgressions, and initiates a controlled reset if needed.")
6168 (home-page "https://troglobit.com/projects/watchdogd/")
6169 (license license:isc)))
6170
6171(define-public wireless-tools
6172 (package
6173 (name "wireless-tools")
6174 (version "30.pre9")
6175 (source
6176 (origin
6177 (method url-fetch)
6178 (uri (string-append "http://www.hpl.hp.com/personal/Jean_Tourrilhes/"
6179 "Linux/wireless_tools." version ".tar.gz"))
6180 (sha256
6181 (base32 "0qscyd44jmhs4k32ggp107hlym1pcyjzihiai48xs7xzib4wbndb"))
6182 (snippet
6183 #~(begin
6184 ;; Remove the older header files that are not free software.
6185 (for-each (lambda (n)
6186 (delete-file (format #f "wireless.~a.h" n)))
6187 '(10 11 12 13 14 15 16 17 18 19 20))))))
6188 (build-system gnu-build-system)
6189 (arguments
6190 (list #:make-flags
6191 #~(list (string-append "PREFIX=" #$output)
6192 (string-append "INSTALL_MAN=" #$output "/share/man")
6193 (string-append "LDFLAGS=-Wl,-rpath=" #$output "/lib")
6194 "BUILD_STATIC=")
6195 #:phases
6196 #~(modify-phases %standard-phases
6197 (replace 'configure
6198 (lambda* (#:key target #:allow-other-keys)
6199 (when target
6200 ;; Cross-compilation: use the cross tools.
6201 (substitute* (find-files "." "Makefile")
6202 (("CC = .*$")
6203 (string-append "CC = " target "-gcc\n"))
6204 (("AR = .*$")
6205 (string-append "AR = " target "-ar\n"))
6206 (("RANLIB = .*$")
6207 (string-append "RANLIB = " target "-ranlib\n")))))))
6208 #:tests? #f))
6209 (synopsis "Tools for manipulating Linux Wireless Extensions")
6210 (description "Wireless Tools are used to manipulate the now-deprecated
6211Linux Wireless Extensions; consider using @code{iw} instead. The Wireless
6212Extension was an interface allowing you to set Wireless LAN specific
6213parameters and get the specific stats. It is deprecated in favor the nl80211
6214interface.")
6215 (home-page "https://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html")
6216 ;; wireless.21.h and wireless.22.h are distributed under lgpl2.1+, the
6217 ;; other files are distributed under gpl2.
6218 (license (list license:gpl2 license:lgpl2.1+))))
6219
6220(define-public crda
6221 (package
6222 (name "crda")
6223 (version "4.15")
6224 (source
6225 (origin
6226 (method git-fetch)
6227 (uri (git-reference
6228 (url "https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/crda.git")
6229 (commit (string-append "v" version))))
6230 (file-name (git-file-name name version))
6231 (sha256
6232 (base32 "1ajh8zx84p15y9wawh764zawniwn059iw9m32v56ajvkz9xbnkp2"))
6233 (patches (search-patches "crda-optional-gcrypt.patch"))))
6234 (build-system gnu-build-system)
6235 (arguments
6236 (list #:phases
6237 #~(modify-phases %standard-phases
6238 (delete 'configure)
6239 (add-after 'unpack 'gzip-deterministically
6240 (lambda _
6241 (substitute* "Makefile"
6242 (("gzip" command)
6243 (string-append command " --no-name")))))
6244 #$@(if (%current-target-system)
6245 #~((add-after 'unpack 'fix-pkg-config
6246 (lambda* (#:key target #:allow-other-keys)
6247 (substitute* "Makefile"
6248 (("pkg-config" command)
6249 (string-append target "-" command))))))
6250 #~())
6251 (add-before 'build 'patch-Makefile
6252 (lambda _
6253 (substitute* "Makefile"
6254 (("ldconfig") "true"))))
6255 (add-before 'build 'set-regulatory-db-file-name
6256 (lambda* (#:key native-inputs inputs #:allow-other-keys)
6257 ;; Tell CRDA where to find our database.
6258 (let ((regdb (assoc-ref (or native-inputs inputs)
6259 "wireless-regdb")))
6260 (substitute* "crda.c"
6261 (("\"/lib/crda/regulatory.bin\"")
6262 (string-append "\"" regdb
6263 "/lib/crda/regulatory.bin\"")))))))
6264 #:test-target "verify"
6265 #:make-flags
6266 #~(list
6267 (string-append "CC=" #$(cc-for-target))
6268 "V=1"
6269
6270 ;; Disable signature-checking on 'regulatory.bin'.
6271 ;; The reason is that this simplifies maintenance
6272 ;; on our side (no need to manage a distro key
6273 ;; pair), and we can guarantee integrity of
6274 ;; 'regulatory.bin' by other means anyway, such as
6275 ;; 'guix gc --verify'. See
6276 ;; <https://wireless.wiki.kernel.org/en/developers/regulatory/wireless-regdb>
6277 ;; for a discssion.
6278 "USE_OPENSSL=0"
6279
6280 (string-append "PREFIX=" #$output)
6281 (string-append "SBINDIR=" #$output "/sbin/")
6282 (string-append "UDEV_RULE_DIR="
6283 #$output "/lib/udev/rules.d")
6284 (string-append "LDFLAGS=-Wl,-rpath="
6285 #$output "/lib -L.")
6286 (string-append "REG_BIN="
6287 #$(this-package-native-input "wireless-regdb")
6288 "/lib/crda/regulatory.bin")
6289 "all_noverify")))
6290 (native-inputs (list pkg-config wireless-regdb))
6291 (inputs (list libnl))
6292 (home-page
6293 "https://wireless.wiki.kernel.org/en/developers/Regulatory/CRDA")
6294 (synopsis "@acronym{CRDA, Central Regulatory Domain Agent} for WiFi")
6295 (description
6296 "The @acronym{CRDA, Central Regulatory Domain Agent} acts as the udev
6297helper for communication between the kernel Linux and user space for regulatory
6298compliance.")
6299 (license license:copyleft-next)))
6300
6301(define-public wireless-regdb
6302 (package
6303 (name "wireless-regdb")
6304 (version "2023.05.03")
6305 (source (origin
6306 (method url-fetch)
6307 (uri (string-append
6308 "mirror://kernel.org/software/network/wireless-regdb/"
6309 "wireless-regdb-" version ".tar.xz"))
6310 (sha256
6311 (base32 "04lc9jp8zxhyqxvkhrm637sswi2xm48jw8jnp3iflnknnf5d0m7j"))
6312
6313 ;; We're building 'regulatory.bin' by ourselves.
6314 (snippet '(begin
6315 (delete-file "regulatory.bin")))))
6316 (build-system gnu-build-system)
6317 (arguments
6318 (list
6319 #:phases
6320 #~(modify-phases %standard-phases
6321 (add-after 'unpack 'gzip-determinism
6322 (lambda _
6323 (substitute* "Makefile"
6324 (("gzip") "gzip --no-name"))))
6325 (add-after 'unpack 'omit-signature
6326 (lambda _
6327 (substitute* "Makefile"
6328 ;; Signing requires a REGDB_PUBCERT and REGDB_PRIVKEY which we
6329 ;; don't provide (see below). Disable it.
6330 ((" regulatory\\.db\\.p7s") "")
6331 ;; regulatory.db is built as a dependency of regulatory.db.p7s,
6332 ;; but ‘make install’ depends only on the latter while
6333 ;; installing both (and failing). Depend on it explicitly.
6334 (("^install: " all) (string-append all "regulatory.db ")))))
6335 (delete 'configure)) ; no configure script
6336
6337 ;; The 'all' target of the makefile depends on $(REGDB_CHANGED), which
6338 ;; is computed and can be equal to 'maintainer-clean'; when that
6339 ;; happens, we can end up deleting the 'regulatory.bin' file that we
6340 ;; just built. Thus, build things sequentially.
6341 #:parallel-build? #f
6342
6343 #:tests? #f ; no tests
6344 #:make-flags
6345 #~(list (string-append "PREFIX=" #$output)
6346 (string-append "FIRMWARE_PATH=$(PREFIX)/lib/firmware")
6347
6348 ;; Leave this empty so that db2bin.py doesn't try to sign
6349 ;; ‘regulatory.bin’. This allows us to avoid managing a key
6350 ;; pair for the whole distribution.
6351 (string-append "REGDB_PRIVKEY=")
6352 ;; Don't generate a public key for the same reason. These are
6353 ;; used as Makefile targets and can't be the empty string.
6354 (string-append "REGDB_PUBCERT=/dev/null")
6355 (string-append "REGDB_PUBKEY=/dev/null"))))
6356 (native-inputs
6357 (list python-wrapper))
6358 (home-page
6359 "https://wireless.wiki.kernel.org/en/developers/regulatory/wireless-regdb")
6360 (synopsis "Wireless regulatory database")
6361 (description
6362 "This package contains the wireless regulatory database for the
6363@acronym{CRDA, Central Regulatory Database Agent}. The database contains
6364information on country-specific regulations for the wireless spectrum.")
6365 (license license:isc)))
6366
6367(define-public lm-sensors
6368 (package
6369 (name "lm-sensors")
6370 (version "3.6.2")
6371 (source
6372 (origin
6373 (method git-fetch)
6374 (uri (git-reference
6375 (url "https://github.com/hramrach/lm-sensors")
6376 (commit (string-append "V" (string-join
6377 (string-split version #\.) "-")))))
6378 (file-name (git-file-name name version))
6379 (sha256
6380 (base32 "0p2ck8p9zb1w53l37pvm6c10vi6r8bfz51nd3sdwwsfhfhgvsr0j"))
6381 (patches (search-patches "lm-sensors-hwmon-attrs.patch"))))
6382 (build-system gnu-build-system)
6383 (outputs '("lib" ; avoid perl in closure
6384 "out"))
6385 (arguments
6386 (list
6387 #:tests? #f ; no 'check' target
6388 #:make-flags
6389 #~(list (string-append "PREFIX=" #$output)
6390 (string-append "ETCDIR=" #$output:lib "/etc")
6391 (string-append "INCLUDEDIR=" #$output:lib "/include")
6392 (string-append "MANDIR=" #$output "/share/man")
6393 (string-append "LIBDIR=" #$output:lib "/lib"))
6394 #:phases
6395 #~(modify-phases %standard-phases
6396 (delete 'configure)
6397 (add-before 'build 'patch-exec-paths
6398 (lambda* (#:key inputs #:allow-other-keys)
6399 (substitute* "prog/detect/sensors-detect"
6400 (("`uname")
6401 (string-append
6402 "`" (assoc-ref inputs "coreutils") "/bin/uname"))
6403 (("(`|\")modprobe" all open-quote)
6404 (string-append
6405 open-quote #$(this-package-input "kmod") "/bin/modprobe")))
6406 (substitute* '("prog/pwm/pwmconfig" "prog/pwm/fancontrol")
6407 (("gnuplot")
6408 (search-input-file inputs "/bin/gnuplot"))
6409 (("cat ")
6410 (string-append (search-input-file inputs "/bin/cat") " "))
6411 (("e?grep " match)
6412 (string-append
6413 (search-input-file
6414 inputs (string-append "/bin/" (string-trim-right match)))
6415 " "))
6416 (("sed -e")
6417 (string-append (search-input-file inputs "/bin/sed") " -e"))
6418 (("cut -d")
6419 (string-append (search-input-file inputs "/bin/cut") " -d"))
6420 (("sleep ")
6421 (string-append (search-input-file inputs "/bin/sleep") " "))
6422 (("readlink -f")
6423 (string-append
6424 (search-input-file inputs "/bin/readlink") " -f"))))))))
6425 (inputs
6426 (list gnuplot kmod perl rrdtool))
6427 (native-inputs
6428 (list bison flex pkg-config which))
6429 (home-page "https://hwmon.wiki.kernel.org/lm_sensors")
6430 (synopsis "Utilities to read temperature/voltage/fan sensors")
6431 (description
6432 "Lm-sensors is a hardware health monitoring package for Linux. It allows
6433you to access information from temperature, voltage, and fan speed sensors.
6434It works with most newer systems.")
6435 (license license:gpl2+)))
6436
6437(define-public iucode-tool
6438 (package
6439 (name "iucode-tool")
6440 (version "2.3.1")
6441 (source (origin
6442 (method url-fetch)
6443 (uri (string-append "https://gitlab.com/iucode-tool/releases"
6444 "/raw/latest/iucode-tool_" version ".tar.xz"))
6445 (sha256
6446 (base32
6447 "159gvf6ljgg3g4vlhyy6pyr0wz11rcyhp985vc4az58d9px8xf0j"))))
6448 (build-system gnu-build-system)
6449 (home-page "https://gitlab.com/iucode-tool/iucode-tool/wikis/home")
6450 (synopsis "Manipulate Intel microcode bundles")
6451 (description
6452 "@command{iucode_tool} is a utility to work with microcode packages for
6453Intel processors. It can convert between formats, extract specific versions,
6454create a firmware image suitable for the Linux kernel, and more.")
6455 ;; cpuid.h is available for i686, x86_64, and ia64.
6456 (supported-systems '("i686-linux" "x86_64-linux"))
6457 (license license:gpl2+)))
6458
6459(define-public i2c-tools
6460 (package
6461 (name "i2c-tools")
6462 (version "4.3")
6463 (source (origin
6464 (method url-fetch)
6465 (uri (string-append
6466 "http://jdelvare.nerim.net/mirror/i2c-tools/i2c-tools-"
6467 version ".tar.xz"))
6468 (sha256
6469 (base32
6470 "1y0fphjd5ah2j886x8i175r7viq0hmx666hyca0wi4dzrm290qxk"))))
6471 (build-system gnu-build-system)
6472 (arguments
6473 `(#:tests? #f ; no 'check' target
6474 #:make-flags
6475 ,#~(list (string-append "PREFIX=" #$output)
6476 (string-append "LDFLAGS+=-Wl,-rpath=" #$output "/lib")
6477 (string-append "CC=" #$(cc-for-target)))
6478 ;; No configure script.
6479 #:phases (modify-phases %standard-phases (delete 'configure))))
6480 (inputs
6481 (list perl))
6482 (home-page "http://jdelvare.nerim.net/devel.html#i2ctools")
6483 (synopsis "I2C tools for Linux")
6484 (description
6485 "The i2c-tools package contains a heterogeneous set of I2C tools for
6486Linux: a bus probing tool, a chip dumper, register-level SMBus access helpers,
6487EEPROM decoding scripts, EEPROM programming tools, and a python module for
6488SMBus access.")
6489 (license license:gpl2+)))
6490
6491(define-public i2c-tools-3
6492 (package
6493 (inherit i2c-tools)
6494 (name "i2c-tools")
6495 (version "3.1.2")
6496 (source (origin
6497 (method url-fetch)
6498 (uri (string-append
6499 "http://jdelvare.nerim.net/mirror/i2c-tools/i2c-tools-"
6500 version ".tar.bz2"))
6501 (sha256
6502 (base32 "0hd4c1w8lnwc3j95h3vpd125170l1d4myspyrlpamqx6wbr6jpnv"))))
6503 (arguments
6504 (substitute-keyword-arguments arguments
6505 ((#:make-flags _)
6506 #~(list (string-append "prefix=" #$output)
6507 (string-append "CC=" #$(cc-for-target))))))))
6508
6509(define-public python-smbus
6510 (package
6511 (inherit i2c-tools)
6512 (name "python-smbus")
6513 (build-system pyproject-build-system)
6514 (arguments
6515 (list #:tests? #f ;; No test suite.
6516 #:phases
6517 #~(modify-phases %standard-phases
6518 (add-after 'unpack 'change-directory
6519 (lambda _ (chdir "py-smbus")))
6520 (add-after 'change-directory 'set-library-path
6521 (lambda _
6522 (substitute* "setup.py"
6523 (("-L\\.\\./lib")
6524 (string-append "-L" #$(this-package-input "i2c-tools")
6525 "/lib"))))))))
6526 (inputs (list i2c-tools))
6527 (native-inputs (list python-setuptools python-wheel))
6528 (synopsis "I2C/SMBus access for Python")
6529 (description "This package provides a Python library to access
6530@acronym{I2C, Inter-Integrated Circuit} and @acronym{SMBus, System
6531Management Bus} devices on Linux.")))
6532
6533(define-public xsensors
6534 (package
6535 (name "xsensors")
6536 (version "0.70")
6537 (source (origin
6538 (method url-fetch)
6539 (uri (string-append
6540 "http://www.linuxhardware.org/xsensors/xsensors-"
6541 version ".tar.gz"))
6542 (sha256
6543 (base32
6544 "1siplsfgvcxamyqf44h71jx6jdfmvhfm7mh0y1q8ps4zs6pj2zwh"))))
6545 (build-system gnu-build-system)
6546 (arguments
6547 `(#:phases
6548 (modify-phases %standard-phases
6549 (add-before 'configure 'enable-deprecated
6550 (lambda _
6551 (substitute* "src/Makefile.in"
6552 (("-DGDK_DISABLE_DEPRECATED") "")
6553 (("-DGTK_DISABLE_DEPRECATED") ""))))
6554 (add-before 'configure 'remove-Werror
6555 (lambda _
6556 (substitute* '("configure" "src/Makefile.in")
6557 (("-Werror") "")))))))
6558 (inputs (list (list lm-sensors "lib") gtk+-2))
6559 (native-inputs (list pkg-config))
6560 (home-page "http://www.linuxhardware.org/xsensors/")
6561 (synopsis "Hardware health information viewer")
6562 (description
6563 "Xsensors reads data from the libsensors library regarding hardware
6564health such as temperature, voltage and fan speed and displays the information
6565in a digital read-out.")
6566 (license license:gpl2+)))
6567
6568(define-public perf
6569 (package
6570 (name "perf")
6571 (version (package-version linux-libre))
6572 (source (package-source linux-libre))
6573 (build-system gnu-build-system)
6574 (arguments
6575 '(#:phases
6576 (modify-phases %standard-phases
6577 (replace 'configure
6578 (lambda* (#:key inputs #:allow-other-keys)
6579 (setenv "SHELL_PATH" (which "bash"))
6580 (chdir "tools/perf")
6581
6582 ;; In Linux 6.10.6, 'Makefile.config' overrides PKG_CONFIG_PATH
6583 ;; when looking for libtraceevent and thus fails to find it.
6584 ;; Remove that.
6585 (substitute* "Makefile.config"
6586 (("PKG_CONFIG_PATH=[[:graph:]]+")
6587 ""))
6588
6589 ;; This file hard-codes file system layouts for specific distros
6590 ;; but not for ours; address that. With this change, one can run
6591 ;; "perf report --symfs=$HOME/.guix-profile" (without
6592 ;; "/lib/debug") and 'perf' should be able to find separate debug
6593 ;; info files.
6594 (substitute* "util/dso.c"
6595 (("/usr/lib/debug")
6596 "/lib/debug")))))
6597 #:make-flags (list (string-append "prefix="
6598 (assoc-ref %outputs "out"))
6599 "CC=gcc"
6600 "WERROR=0"
6601
6602 ;; By default, 'config/Makefile' uses lib64 on
6603 ;; x86_64. Work around that.
6604 "lib=lib")
6605 #:tests? #f)) ;no tests
6606 (native-inputs
6607 (list pkg-config
6608 bison
6609 flex
6610 ;; For build scripts.
6611 python-3
6612 ;; Documentation
6613 docbook-xsl
6614 xmlto
6615 asciidoc))
6616 (inputs
6617 (list slang ;for the interactive TUI
6618 zlib
6619 ;; newt
6620 python-3 ;'perf' links against libpython
6621 elfutils
6622 libiberty ;used alongside BDF for symbol demangling
6623 libunwind ;better stack walking
6624 libtraceevent
6625 numactl)) ;for 'perf bench numa mem'
6626 (home-page "https://perf.wiki.kernel.org/")
6627 (synopsis "Linux profiling with performance counters")
6628 (description
6629 "perf is a tool suite for profiling using hardware performance counters,
6630with support in the Linux kernel. perf can instrument CPU performance
6631counters, tracepoints, kprobes, and uprobes (dynamic tracing). It is capable
6632of lightweight profiling. This package contains the user-land tools and in
6633particular the @code{perf} command.")
6634 (license (package-license linux-libre))))
6635
6636(define-public pflask
6637 (package
6638 (name "pflask")
6639 (version "0.2")
6640 (source (origin
6641 (method git-fetch)
6642 (uri (git-reference
6643 (url "https://github.com/ghedo/pflask")
6644 (commit (string-append "v" version))))
6645 (file-name (git-file-name name version))
6646 (sha256
6647 (base32
6648 "1jikjbhlxlqracnai3v9krzcgd2xwp0p4adw5n07yxc7b857damz"))))
6649 (build-system cmake-build-system)
6650 (arguments
6651 '(#:tests? #f)) ; no tests
6652 (home-page "https://ghedo.github.io/pflask/")
6653 (synopsis "Simple tool for creating Linux namespace containers")
6654 (description "pflask is a simple tool for creating Linux namespace
6655containers. It can be used for running a command or even booting an OS inside
6656an isolated container, created with the help of Linux namespaces. It is
6657similar in functionality to chroot, although pflask provides better isolation
6658thanks to the use of namespaces.")
6659 (license license:bsd-2)))
6660
6661(define-public singularity
6662 (package
6663 (name "singularity")
6664 (version "2.6.1")
6665 (source (origin
6666 (method url-fetch)
6667 (uri (string-append "https://github.com/singularityware/singularity/"
6668 "releases/download/" version
6669 "/singularity-" version ".tar.gz"))
6670 (sha256
6671 (base32
6672 "1whx0hqqi1326scgdxxxa1d94vn95mnq0drid6s8wdp84ni4d3gk"))
6673 (modules '((guix build utils)))
6674 (snippet
6675 '(begin
6676 ;; Do not create directories in /var.
6677 (substitute* "Makefile.in"
6678 (("\\$\\(MAKE\\) .*install-data-hook") ""))
6679
6680 ;; The original source overrides PATH so that it points to
6681 ;; /bin, /usr/local/bin, etc., which obviously doesn't work
6682 ;; on Guix System. Leave PATH unchanged so we refer to the
6683 ;; installed Coreutils, grep, etc.
6684 (substitute* "bin/singularity.in"
6685 (("^PATH=.*" all)
6686 (string-append "#" all "\n")))
6687
6688 (substitute* (find-files "libexec/cli" "\\.exec$")
6689 (("\\$SINGULARITY_libexecdir/singularity/bin/([a-z]+)-suid"
6690 _ program)
6691 (string-append "/run/privileged/bin/singularity-"
6692 program "-helper")))
6693
6694 ;; These squashfs mount options are apparently no longer
6695 ;; supported since Linux-libre 5.4.5.
6696 (substitute* "src/lib/image/squashfs/mount.c"
6697 (("\"errors=remount-ro\"")
6698 "NULL"))))))
6699 (build-system gnu-build-system)
6700 (arguments
6701 (list
6702 #:configure-flags #~(list "--localstatedir=/var")
6703 #:phases
6704 #~(modify-phases %standard-phases
6705 (add-after 'unpack 'patch-references
6706 (lambda _
6707 (substitute* "libexec/cli/build.exec.in"
6708 (("-mksquashfs") (string-append "-" (which "mksquashfs"))))
6709 (substitute* (append
6710 (find-files "libexec" "functions")
6711 (find-files "libexec/bootstrap-scripts" ".*sh$")
6712 (find-files "libexec/cli" ".*exec$"))
6713 (("\\| grep ")
6714 (string-append "| " (which "grep") " "))
6715 (("egrep ")
6716 (string-append (which "egrep") " "))
6717 ((" sed ")
6718 (string-append " " (which "sed") " ")))))
6719 (add-after 'install 'set-PATH
6720 (lambda _
6721 ;; Have the 'singularity' and 'run-singularity' self-sufficient.
6722 ;; But don't override PATH, so that other tools like zcat and
6723 ;; tar can still be found if they are available.
6724 (let ((coreutils #$(this-package-input "coreutils")))
6725 (wrap-program (string-append #$output "/bin/singularity")
6726 `("PATH" prefix (,(string-append coreutils "/bin"))))
6727 (substitute* (string-append #$output "/bin/run-singularity")
6728 (("/usr/bin/env singularity")
6729 (string-append (which "env") " "
6730 #$output "/bin/singularity")))))))))
6731 (inputs
6732 (list bash-minimal
6733 coreutils
6734 libarchive
6735 python-wrapper
6736 squashfs-tools
6737 zlib))
6738 (home-page "https://singularity.lbl.gov/")
6739 (synopsis "Container platform")
6740 (description "Singularity is a container platform supporting a number of
6741container image formats. It can build SquashFS container images or import
6742existing Docker images. Singularity requires kernel support for container
6743isolation or root privileges.")
6744 (license license:bsd-3)))
6745
6746(define-public python-spython
6747 (package
6748 (name "python-spython")
6749 (version "0.3.13")
6750 (source
6751 (origin
6752 (method url-fetch)
6753 (uri (pypi-uri "spython" version))
6754 (sha256
6755 (base32 "0kly851k6mj7xzcybciav5d0pq5q04pzg7c5a1g712bqbxkha4ck"))))
6756 (build-system pyproject-build-system)
6757 (arguments
6758 (list
6759 #:phases
6760 #~(modify-phases %standard-phases
6761 ;; Configure absolute path to singularity.
6762 (add-after 'unpack 'configure
6763 (lambda* (#:key inputs #:allow-other-keys)
6764 (let ((singularity (search-input-file inputs "bin/singularity")))
6765 (substitute* "spython/utils/terminal.py"
6766 (("software=\"singularity\"")
6767 (string-append "software=\"" singularity "\"")))
6768 (substitute* (list "spython/utils/terminal.py"
6769 "spython/main/help.py"
6770 "spython/main/base/command.py")
6771 (("\\[\"singularity\"")
6772 (string-append "[\"" singularity "\"")))
6773 (substitute* "spython/main/execute.py"
6774 (("shutil.which\\(\"singularity\"\\)")
6775 (string-append "shutil.which(\"" singularity "\")"))))))
6776 ;; Skip tests that require network access.
6777 (add-before 'check 'skip-tests
6778 (lambda _
6779 (delete-file "spython/tests/test_client.py"))))))
6780 (inputs
6781 (list singularity))
6782 (native-inputs
6783 (list python-pytest python-setuptools python-wheel))
6784 (home-page "https://github.com/singularityhub/singularity-cli")
6785 (synopsis "Singularity Python client")
6786 (description "@code{python-spython} is a Python library to interact with
6787Singularity containers.")
6788 (license license:mpl2.0)))
6789
6790(define-public libnvme
6791 (package
6792 (name "libnvme")
6793 (version "1.16.2")
6794 (source (origin
6795 (method git-fetch)
6796 (uri (git-reference
6797 (url "https://github.com/linux-nvme/libnvme.git")
6798 (commit (string-append "v" version))))
6799 (sha256
6800 (base32 "05h1kjs8lgdmfsdz5vcfl470zhw7j36jp7a9wip20ibb6g3s9r1k"))
6801 (file-name (git-file-name name version))))
6802 (build-system meson-build-system)
6803 (outputs (list "out" "doc")) ; docs are 80% of all output
6804 (arguments
6805 (list
6806 #:configure-flags
6807 #~(let ((doc (string-append #$output:doc "/share/doc/" #$name)))
6808 (list (string-append "-Dhtmldir=" doc "/html")
6809 (string-append "-Drstdir=" doc "/rst")
6810 "-Ddocs-build=true" "-Ddocs=all"))))
6811 (native-inputs (list pkg-config perl python python-sphinx))
6812 ;; libnvme.pc, libnvme-mi.pc lists these in Requires.private.
6813 (propagated-inputs (list dbus json-c openssl))
6814 (home-page "https://github.com/linux-nvme/libnvme")
6815 (synopsis "C Library for NVM Express on Linux")
6816 (description "libnvme provides type definitions for NVMe specification
6817structures, enumerations, and bit fields, helper functions to construct,
6818dispatch, and decode commands and payloads, and utilities to connect, scan,
6819and manage nvme devices on a Linux system.")
6820 (license license:lgpl2.1+)))
6821
6822(define-public nvme-cli
6823 (package
6824 (name "nvme-cli")
6825 (version "2.16")
6826 (home-page "https://github.com/linux-nvme/nvme-cli")
6827 (source (origin
6828 (method git-fetch)
6829 (uri (git-reference
6830 (url home-page)
6831 (commit (string-append "v" version))))
6832 (sha256
6833 (base32 "1877fvhd4573900zwk7y2mk2vvmgnws2wa37sv176ikxj647jvw1"))
6834 (file-name (git-file-name name version))))
6835 (build-system meson-build-system)
6836 (outputs (list "out" "doc")) ; docs make up ~70% of total size
6837 (arguments
6838 (list
6839 #:configure-flags #~(list (format #f "-Dhtmldir=~a/share/doc/~a/html"
6840 #$output:doc #$name)
6841 "-Ddocs=all")))
6842 (native-inputs (list pkg-config))
6843 (inputs (list libnvme json-c zlib))
6844 (synopsis "NVM-Express user space tooling for Linux")
6845 (description "Nvme-cli is a utility to provide standards compliant tooling
6846for NVM-Express drives. It was made specifically for Linux as it relies on the
6847IOCTLs defined by the mainline kernel driver.")
6848 (license license:gpl2+)))
6849
6850(define-public acpi
6851 (package
6852 (name "acpi")
6853 (version "1.7")
6854 (source (origin
6855 (method url-fetch)
6856 (uri (string-append "mirror://sourceforge/acpiclient/acpiclient/"
6857 version "/" name "-" version ".tar.gz"))
6858 (sha256
6859 (base32
6860 "01ahldvf0gc29dmbd5zi4rrnrw2i1ajnf30sx2vyaski3jv099fp"))))
6861 (build-system gnu-build-system)
6862 (home-page "http://acpiclient.sourceforge.net")
6863 (synopsis "Display information on ACPI devices")
6864 (description "@code{acpi} attempts to replicate the functionality of the
6865\"old\" @code{apm} command on ACPI systems, including battery and thermal
6866information. It does not support ACPI suspending, only displays information
6867about ACPI devices.")
6868 (license license:gpl2+)))
6869
6870(define-public acpid
6871 (package
6872 (name "acpid")
6873 (version "2.0.34")
6874 (source (origin
6875 (method url-fetch)
6876 (uri (string-append "mirror://sourceforge/acpid2/acpid-"
6877 version ".tar.xz"))
6878 (sha256
6879 (base32
6880 "0cxkdbd087kj9ikprvvjpk0ixzqbipf2rmj6qyp7r15wzj65q29d"))))
6881 (build-system gnu-build-system)
6882 (home-page "https://sourceforge.net/projects/acpid2/")
6883 (synopsis "Daemon for delivering ACPI events to user-space programs")
6884 (description
6885 "acpid is designed to notify user-space programs of Advanced
6886Configuration and Power Interface (ACPI) events. acpid should be started
6887during the system boot, and will run as a background process. When an ACPI
6888event is received from the kernel, acpid will examine the list of rules
6889specified in /etc/acpi/events and execute the rules that match the event.")
6890 (license license:gpl2+)))
6891
6892(define-public sysfsutils
6893 (package
6894 (name "sysfsutils")
6895 (version "2.1.0")
6896 (source
6897 (origin
6898 (method url-fetch)
6899 (uri
6900 (string-append
6901 "mirror://sourceforge/linux-diag/sysfsutils/" version "/sysfsutils-"
6902 version ".tar.gz"))
6903 (sha256
6904 (base32 "12i0ip11xbfcjzxz4r10cvz7mbzgq1hfcdn97w6zz7sm3wndwrg8"))))
6905 (build-system gnu-build-system)
6906 (home-page "https://linux-diag.sourceforge.net/Sysfsutils.html")
6907 (synopsis "System utilities based on Linux sysfs")
6908 (description
6909 "These are a set of utilities built upon sysfs, a virtual file system in
6910Linux kernel versions 2.5+ that exposes a system's device tree. The package
6911also contains the libsysfs library.")
6912 ;; The library is under lgpl2.1+ (all files say "or any later version").
6913 ;; The rest is mostly gpl2, with a few files indicating gpl2+.
6914 (license (list license:gpl2 license:gpl2+ license:lgpl2.1+))))
6915
6916(define-public cpufrequtils
6917 (let ((commit "a2f0c39d5f21596bb9f5223e895c0ff210b265d0")
6918 (revision "1"))
6919 (package
6920 (name "cpufrequtils")
6921 (version (git-version "008" revision commit))
6922 (source
6923 (origin
6924 (method git-fetch)
6925 (uri
6926 (git-reference
6927 (url "https://git.kernel.org/pub/scm/linux/kernel/git/brodo/cpufrequtils.git")
6928 (commit commit)))
6929 (file-name (git-file-name name version))
6930 (sha256
6931 (base32 "01n2hp6v89cilqqvqvlcprphyhnljsjclh4h1zf3b1l7ypz29lbp"))))
6932 (build-system gnu-build-system)
6933 (arguments
6934 (list
6935 #:tests? #f ;no test suite
6936 #:make-flags
6937 #~(let ((out #$output))
6938 (list "PROC=false" ;obsoleted by sysfs in Linux 2.6(!)
6939 (string-append "CC=" #$(cc-for-target))
6940 (string-append "LDFLAGS=-Wl,-rpath=" out "/lib")
6941 "INSTALL=install"
6942 (string-append "bindir=" out "/bin")
6943 (string-append "sbindir=" out "/sbin")
6944 (string-append "mandir=" out "/share/man")
6945 (string-append "includedir=" out "/include")
6946 (string-append "libdir=" out "/lib")
6947 (string-append "localedir=" out "/share/locale")
6948 (string-append "docdir=" out "/share/doc/" #$name)))
6949 #:phases
6950 #~(modify-phases %standard-phases
6951 (delete 'configure)))) ;no configure script
6952 (native-inputs (list gettext-minimal))
6953 (home-page
6954 "http://ftp.be.debian.org/pub/linux/utils/kernel/cpufreq/cpufrequtils.html")
6955 (synopsis "Utilities to get and set CPU frequency on Linux")
6956 (description
6957 "The cpufrequtils suite contains utilities to retrieve CPU frequency
6958information, and set the CPU frequency if supported, using the cpufreq
6959capabilities of the Linux kernel.")
6960 (license license:gpl2))))
6961
6962(define-public libite
6963 (package
6964 (name "libite")
6965 (version "2.5.2")
6966 (source
6967 (origin
6968 (method git-fetch)
6969 (uri (git-reference
6970 (url "https://github.com/troglobit/libite")
6971 (commit (string-append "v" version))))
6972 (file-name (git-file-name name version))
6973 (sha256
6974 (base32 "0i27ppb557kdc1hm7nf0f5r7sxvqma31pr57h79whl6qcp28gy4a"))))
6975 (build-system gnu-build-system)
6976 (arguments
6977 `(#:configure-flags
6978 (list "--disable-static")
6979 #:phases
6980 (modify-phases %standard-phases
6981 (add-after 'unpack 'fix-tests
6982 (lambda* (#:key inputs #:allow-other-keys)
6983 ;; replace paths to the executables
6984 (substitute* "test/which.c"
6985 (("/usr/bin/which")
6986 (search-input-file inputs "/bin/which"))
6987 (("ls\"")
6988 (string-append
6989 (search-input-file inputs "/bin/ls") "\"")))
6990 ;; create pidfile in /tmp instead of /var
6991 (substitute* "test/pidfile.c" (("/var/tmp") "/tmp")))))))
6992 (native-inputs (list autoconf automake libtool which))
6993 (synopsis "Library providing missing pieces in GNU libc")
6994 (description "This package provides many of the missing pieces in GNU
6995libc. Most notably the string functions: strlcpy(3), strlcat(3) and the *BSD
6996sys/queue.h and sys/tree.h API's.")
6997 (home-page "https://troglobit.com/projects/libite/")
6998 (license license:expat)))
6999
7000(define-public libuev
7001 (package
7002 (name "libuev")
7003 (version "2.4.0")
7004 (source
7005 (origin
7006 (method git-fetch)
7007 (uri (git-reference
7008 (url "https://github.com/troglobit/libuev")
7009 (commit (string-append "v" version))))
7010 (file-name (git-file-name name version))
7011 (sha256
7012 (base32
7013 "0ih82lxfdcq179kknzdl5c8vi1l0n5j7yh68y8f6kwsrm457paf7"))))
7014 (build-system gnu-build-system)
7015 (native-inputs (list autoconf automake libtool))
7016 (synopsis "Lightweight event loop library for epoll family APIs")
7017 (description "This package provides small event loop that wraps the
7018epoll family of APIs.")
7019 (home-page "https://troglobit.com/projects/libuev/")
7020 (license license:expat)))
7021
7022(define-public libraw1394
7023 (package
7024 (name "libraw1394")
7025 (version "2.1.2")
7026 (source (origin
7027 (method url-fetch)
7028 (uri (string-append
7029 "mirror://kernel.org/linux/libs/ieee1394/"
7030 name "-" version ".tar.xz"))
7031 (sha256
7032 (base32
7033 "0pm5b415j1qdzyw38wdv8h7ff4yx20831z1727mpsb6jc6bwdk03"))))
7034 (build-system gnu-build-system)
7035 (home-page "https://ieee1394.wiki.kernel.org/index.php/Main_Page")
7036 (synopsis "Interface library for the Linux IEEE1394 drivers")
7037 (description
7038 "Libraw1394 is the only supported interface to the kernel side raw1394 of
7039the Linux IEEE-1394 subsystem, which provides direct access to the connected
70401394 buses to user space. Through libraw1394/raw1394, applications can directly
7041send to and receive from other nodes without requiring a kernel driver for the
7042protocol in question.")
7043 (license license:lgpl2.1+)))
7044
7045(define-public libavc1394
7046 (package
7047 (name "libavc1394")
7048 (version "0.5.4")
7049 (source (origin
7050 (method url-fetch)
7051 (uri (string-append "mirror://sourceforge/libavc1394/libavc1394/"
7052 name "-" version ".tar.gz"))
7053 (sha256
7054 (base32
7055 "0lsv46jdqvdx5hx92v0z2cz3yh6212pz9gk0k3513sbaa04zzcbw"))))
7056 (build-system gnu-build-system)
7057 (native-inputs
7058 (list pkg-config))
7059 (propagated-inputs
7060 (list libraw1394)) ; required by libavc1394.pc
7061 (home-page "https://sourceforge.net/projects/libavc1394/")
7062 (synopsis "AV/C protocol library for IEEE 1394")
7063 (description
7064 "Libavc1394 is a programming interface to the AV/C specification from
7065the 1394 Trade Association. AV/C stands for Audio/Video Control.")
7066 (license license:lgpl2.1+)))
7067
7068(define-public libiec61883
7069 (package
7070 (name "libiec61883")
7071 (version "1.2.0")
7072 (source (origin
7073 (method url-fetch)
7074 (uri (string-append
7075 "mirror://kernel.org/linux/libs/ieee1394/"
7076 name "-" version ".tar.xz"))
7077 (sha256
7078 (base32
7079 "17ph458zya2l8dr2xwqnzy195qd9swrir31g78qkgb3g4xz2rq6i"))))
7080 (build-system gnu-build-system)
7081 (native-inputs
7082 (list pkg-config))
7083 (propagated-inputs
7084 (list libraw1394)) ; required by libiec61883.pc
7085 (home-page "https://ieee1394.wiki.kernel.org/index.php/Main_Page")
7086 (synopsis "Isochronous streaming media library for IEEE 1394")
7087 (description
7088 "The libiec61883 library provides a higher level API for streaming DV,
7089MPEG-2 and audio over Linux IEEE 1394.")
7090 (license license:lgpl2.1+)))
7091
7092(define-public mdadm
7093 (package
7094 (name "mdadm")
7095 (version "4.2")
7096 (source (origin
7097 (method url-fetch)
7098 (uri (string-append
7099 "mirror://kernel.org/linux/utils/raid/mdadm/mdadm-"
7100 version ".tar.xz"))
7101 (sha256
7102 (base32
7103 "07ghmibmbnkdy91ng87zdllzicm299l20dhs9m5bfjw6f1b22726"))))
7104 (build-system gnu-build-system)
7105 (arguments
7106 (list #:make-flags
7107 #~(list (string-append "CC=" #$(cc-for-target))
7108 "INSTALL=install"
7109 "CHECK_RUN_DIR=0"
7110 ;; TODO: tell it where to find 'sendmail'
7111 ;; (string-append "MAILCMD=" <???> "/sbin/sendmail")
7112 (string-append "BINDIR=" #$output "/sbin")
7113 (string-append "MANDIR=" #$output "/share/man")
7114 (string-append "UDEVDIR=" #$output "/lib/udev"))
7115 #:phases
7116 #~(modify-phases %standard-phases
7117 (add-before 'build 'patch-program-paths
7118 (lambda* (#:key native-inputs inputs #:allow-other-keys)
7119 (let ((coreutils (assoc-ref (or native-inputs inputs)
7120 "coreutils")))
7121 (substitute* "udev-md-raid-arrays.rules"
7122 (("/usr/bin/(readlink|basename)" all program)
7123 (string-append coreutils "/bin/" program))))))
7124 (add-before 'build 'remove-W-error
7125 (lambda _
7126 ;; We cannot build with -Werror on i686 due to a
7127 ;; 'sign-compare' warning in util.c.
7128 (substitute* "Makefile"
7129 (("-Werror") ""))))
7130 (delete 'configure))
7131 ;; Tests must be run as root.
7132 #:tests? #f))
7133 (inputs
7134 (list eudev))
7135 (supported-systems (remove target-hurd? %supported-systems))
7136 (home-page "http://neil.brown.name/blog/mdadm")
7137 (synopsis "Tool for managing Linux Software RAID arrays")
7138 (description
7139 "mdadm is a tool for managing Linux Software RAID arrays. It can create,
7140assemble, report on, and monitor arrays. It can also move spares between raid
7141arrays when needed.")
7142 (license license:gpl2+)))
7143
7144(define-public mdadm-static
7145 (package
7146 (inherit mdadm)
7147 (name "mdadm-static")
7148 (arguments
7149 (substitute-keyword-arguments arguments
7150 ((#:make-flags flags)
7151 #~(cons* "LDFLAGS = -static"
7152 "CXFLAGS = -DNO_LIBUDEV"
7153 #$flags))
7154 ((#:phases phases)
7155 #~(modify-phases #$phases
7156 (add-after 'install 'remove-cruft
7157 (lambda* (#:key outputs #:allow-other-keys)
7158 (let* ((out (assoc-ref outputs "out"))
7159 (precious? (lambda (file)
7160 (member file '("." ".." "sbin"))))
7161 (directories (scandir out (negate precious?))))
7162 (with-directory-excursion out
7163 (for-each delete-file-recursively directories)
7164 (remove-store-references "sbin/mdadm")
7165 (delete-file "sbin/mdmon")))))))
7166 ((#:modules modules %default-gnu-modules)
7167 `((ice-9 ftw) ,@modules))
7168 ((#:strip-flags _ '())
7169 ''("--strip-all")) ;strip a few extra KiB
7170 ((#:allowed-references _ '("out"))
7171 '("out")))) ;refer only self
7172 (synopsis "Statically-linked 'mdadm' command for use in an initrd")))
7173
7174(define-public multipath-tools
7175 (package
7176 (name "multipath-tools")
7177 (version "0.11.0")
7178 (home-page "https://github.com/opensvc/multipath-tools")
7179 (source (origin
7180 (method git-fetch)
7181 (uri (git-reference (url home-page) (commit version)))
7182 (file-name (git-file-name name version))
7183 (sha256
7184 (base32
7185 "1yl2cd4xgw2l5xzx5dbdf7awhrvfbjsrspli9i6bmxc5j4jkvazr"))
7186 (modules '((guix build utils)))
7187 (snippet
7188 '(begin
7189 ;; Drop bundled valgrind headers.
7190 (delete-file-recursively "third-party")
7191 (substitute* '("multipathd/main.c"
7192 "libmpathutil/debug.c")
7193 (("#include \"../third-party/")
7194 "#include \""))))))
7195 (build-system gnu-build-system)
7196 (arguments
7197 (list
7198 #:test-target "test"
7199 #:make-flags #~(list (string-append "CC=" #$(cc-for-target))
7200 (string-append "prefix=" #$output)
7201 ;; Install Udev rules below this directory, relative
7202 ;; to the prefix.
7203 (string-append "systemd_prefix=" #$output))
7204 #:phases
7205 #~(modify-phases %standard-phases
7206 (add-after 'unpack 'patch-source
7207 (lambda* (#:key inputs #:allow-other-keys)
7208 (let ((libdevmapper.h
7209 (search-input-file inputs "include/libdevmapper.h"))
7210 (libudev.h
7211 (search-input-file inputs "include/libudev.h")))
7212 (substitute* "Makefile.inc"
7213 (("/bin/echo") "echo")
7214 (("\\$\\(prefix\\)/usr") "$(prefix)")
7215 (("configdir.*:= \\$\\(prefix\\)/etc/multipath/conf.d")
7216 "configdir := /etc/multipath/conf.d")
7217 ;; Do not save timestamp to avoid gzip "timestamp
7218 ;; out-of-range" warnings.
7219 (("gzip -9") "gzip -9n"))
7220 (substitute* '("kpartx/Makefile" "libmultipath/Makefile")
7221 (("/usr/include/libdevmapper.h") libdevmapper.h)
7222 (("/usr/include/libudev.h") libudev.h)))))
7223 (add-after 'unpack 'skip-failing-tests
7224 (lambda _
7225 ;; This test and the module's setup() test an arbitrary block
7226 ;; device node name, but the build environment has none.
7227 (substitute* "tests/devt.c"
7228 (("return get_one_devt.*") "return 0;\n")
7229 (("cmocka_unit_test\\(test_devt2devname_devt_good\\),") ""))
7230 ;; The above triggers -Werror=unused-function. Ignore it.
7231 (substitute* "tests/Makefile"
7232 (("CFLAGS \\+= " match)
7233 (string-append match "-Wno-error=unused-function ")))))
7234 (delete 'configure) ;no configure script
7235 (add-before 'build 'no-fortify-3
7236 (lambda _
7237 ;; NOTE: The check made seems to wrongly assume the
7238 ;; FORTIFY_SOURCE=3 is valid. However, when compiling, warnings
7239 ;; are emitted from glibc, resulting in failed build. Fix this
7240 ;; by forcing the usage of FORTIFY_SOURCE=2.
7241 (substitute* "create-config.mk"
7242 (("FORTIFY_SOURCE=3")
7243 "FORTIFY_SOURCE=2"))))
7244 (add-before 'build 'set-LDFLAGS
7245 (lambda _
7246 ;; Note: this cannot be passed as a make flag because that will
7247 ;; override the build system LDFLAGS.
7248 (setenv "LDFLAGS"
7249 (string-append "-Wl,-rpath=" #$output "/lib")))))))
7250
7251 (native-inputs
7252 (list perl pkg-config valgrind/pinned
7253 ;; For tests.
7254 cmocka))
7255 (inputs
7256 (list json-c
7257 libaio
7258 liburcu
7259 lvm2
7260 readline
7261 eudev
7262 ;; For libmount.
7263 `(,util-linux "lib")))
7264 (synopsis "Access block devices through multiple paths")
7265 (description
7266 "This package provides the following binaries to drive the
7267Linux Device Mapper multipathing driver:
7268@enumerate
7269@item @command{multipath} - Device mapper target autoconfig.
7270@item @command{multipathd} - Multipath daemon.
7271@item @command{mpathpersist} - Manages SCSI persistent reservations on
7272@code{dm} multipath devices.
7273@item @command{kpartx} - Create device maps from partition tables.
7274@end enumerate")
7275 (license (list license:gpl2+ ;main distribution
7276 license:lgpl2.0+)))) ;libmpathcmd/mpath_cmd.h
7277
7278(define-public libaio
7279 (package
7280 (name "libaio")
7281 (version "0.3.113")
7282 (source (origin
7283 (method url-fetch)
7284 (uri (list
7285 (string-append "https://releases.pagure.org/libaio/"
7286 name "-" version ".tar.gz")))
7287 (sha256
7288 (base32
7289 "02r0g2vfv6kfljplm3ga93w4xw13q2wixbn9hwi7ahqdzp2x2i1c"))
7290 (patches (search-patches "libaio-32bit-test.patch"))))
7291 (build-system gnu-build-system)
7292 (arguments
7293 (list #:make-flags
7294 #~(list (string-append "prefix=" #$output)
7295 (string-append "CC=" #$(cc-for-target)))
7296 #:test-target "partcheck" ; need root for a full 'check'
7297 #:phases
7298 #~(modify-phases %standard-phases
7299 (add-after 'unpack 'disable-problematic-tests
7300 (lambda _
7301 (with-directory-excursion "harness/cases"
7302 ;; The 21.t test fails with "Expected 4096, got
7303 ;; 18446744073709551605" (see:
7304 ;; https://pagure.io/libaio/issue/26).
7305 (rename-file "21.t" "21.t.disabled"))))
7306 (delete 'configure) ; no configure script
7307 #$@(if (target-riscv64?)
7308 #~((add-after 'unpack 'patch-test
7309 (lambda* (#:key build-inputs #:allow-other-keys)
7310 (invoke "patch" "-p1" "-i"
7311 #$(local-file
7312 (search-patch
7313 "libaio-riscv-test5.patch"))))))
7314 #~()))))
7315 (native-inputs
7316 (if (target-riscv64?)
7317 (list (search-patch "libaio-riscv-test5.patch")
7318 patch)
7319 '()))
7320 (home-page "https://pagure.io/libaio")
7321 (synopsis "Linux-native asynchronous I/O access library")
7322 (description
7323 "This library enables userspace to use Linux kernel asynchronous I/O
7324system calls, important for the performance of databases and other advanced
7325applications.")
7326 (license license:lgpl2.1+)))
7327
7328(define-public blktrace
7329 ;; Take a newer commit to get the latest patches.
7330 (let ((commit "b9ea6e507e8849f01d06aa48c0c59c5cee4820be")
7331 (revision "1"))
7332 (package
7333 (name "blktrace")
7334 (version (git-version "1.3.0" revision commit))
7335 (home-page
7336 "https://git.kernel.org/pub/scm/linux/kernel/git/axboe/blktrace.git")
7337 (source (origin
7338 (method git-fetch)
7339 (uri (git-reference
7340 (url home-page)
7341 (commit commit)))
7342 (sha256
7343 (base32 "0a4830mlqckbhchar1xcn2w4f24bzb75bigdig5wpm2axl0zc8cq"))
7344 (file-name (git-file-name name version))))
7345 (build-system gnu-build-system)
7346 (arguments
7347 (list
7348 #:make-flags
7349 #~(list (string-append "CC=" #$(cc-for-target))
7350 (string-append "prefix=" #$output))
7351 #:tests? #f ; no tests
7352 #:phases
7353 #~(modify-phases %standard-phases
7354 (delete 'configure) ; no configure script
7355 (add-after 'unpack 'fix-gnuplot-path
7356 (lambda* (#:key inputs #:allow-other-keys)
7357 (substitute* "btt/bno_plot.py"
7358 (("gnuplot %s")
7359 (string-append
7360 (search-input-file inputs "/bin/gnuplot" ) " %s"))))))))
7361 (inputs
7362 (list libaio
7363 gnuplot
7364 python-wrapper)) ; for 'bno_plot.py'
7365 (synopsis "Block layer IO tracing mechanism")
7366 (description "Blktrace is a block layer IO tracing mechanism which provides
7367detailed information about request queue operations to user space. It extracts
7368event traces from the kernel (via the relaying through the debug file system).")
7369 (license license:gpl2))))
7370
7371(define-public sbc
7372 (package
7373 (name "sbc")
7374 (version "2.2")
7375 (source
7376 (origin
7377 (method url-fetch)
7378 (uri (string-append "mirror://kernel.org/linux/bluetooth/sbc-" version
7379 ".tar.xz"))
7380 (sha256
7381 (base32 "17mfhc9rn25vrqgfpihpjjc8syp3r56paqyhzg1gjnjyydpagbd1"))))
7382 (build-system gnu-build-system)
7383 (arguments
7384 (list
7385 #:configure-flags
7386 #~(list "--disable-tester")))
7387 (home-page "https://www.kernel.org/pub/linux/bluetooth/")
7388 (synopsis "Bluetooth subband audio codec")
7389 (description
7390 "The SBC is a digital audio encoder and decoder used to transfer data to
7391Bluetooth audio output devices like headphones or loudspeakers.")
7392 (license license:gpl2+)))
7393
7394(define-public sbctester
7395 (package
7396 (inherit sbc)
7397 (name "sbctester")
7398 (arguments
7399 (list
7400 #:phases
7401 #~(modify-phases %standard-phases
7402 (add-after 'unpack 'write-build-files
7403 (lambda _
7404 (begin
7405 (for-each delete-file
7406 (list "Makefile.in" "aclocal.m4" "configure"
7407 "config.h.in"))
7408 (delete-file-recursively "build-aux")
7409 (with-output-to-file "configure.ac"
7410 (lambda _
7411 (format #t
7412 "AC_PREREQ([2.69])
7413 AC_INIT([sbctester], [~a])
7414 AC_CONFIG_HEADERS(config.h)
7415 AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects])
7416 COMPILER_FLAGS
7417 AC_LANG([C])
7418 AC_PROG_CC
7419 AC_PROG_CC_PIE
7420 AC_PROG_INSTALL
7421 AC_PROG_LIBTOOL
7422 PKG_CHECK_MODULES(SNDFILE, sndfile, dummy=yes,
7423 AC_MSG_ERROR(sndfile library is required))
7424 AC_SUBST(SNDFILE_LIBS)
7425 AC_CONFIG_FILES([Makefile])
7426 AC_OUTPUT
7427 AC_MSG_RESULT([$PACKAGE_NAME $VERSION])
7428 ~%"
7429 #$(package-version sbc))))
7430 (with-output-to-file "Makefile.am"
7431 (lambda _
7432 (format #t
7433 "bin_PROGRAMS = src/sbctester
7434 src_sbctester_SOURCES = src/sbctester.c
7435 src_sbctester_LDADD = @SNDFILE_LIBS@ -lm")))))))))
7436 (inputs (list libsndfile))
7437 (native-inputs (list autoconf automake libtool pkg-config))
7438 (synopsis "Test utility for the sbc codec")
7439 (description
7440 "Utility to detect differences between two audio files, encoded with
7441SBC.")))
7442
7443(define-public bluez
7444 (package
7445 (name "bluez")
7446 (version "5.79")
7447 (source (origin
7448 (method url-fetch)
7449 (uri (string-append
7450 "mirror://kernel.org/linux/bluetooth/bluez-"
7451 version ".tar.xz"))
7452 (sha256
7453 (base32
7454 "12pal1m4xlr8k7kxb6isv5lbaca2wc5zcgy0907wfwcz78qaar21"))))
7455 (build-system gnu-build-system)
7456 (arguments
7457 (list
7458 #:configure-flags
7459 #~(list "--sysconfdir=/etc"
7460 "--localstatedir=/var"
7461 "--enable-library"
7462 "--enable-wiimote"
7463 "--disable-systemd"
7464 ;; TODO: is this needed? Not installed by default since 5.55.
7465 "--enable-hid2hci"
7466 ;; Install dbus/udev files to the correct location.
7467 (string-append "--with-dbusconfdir=" #$output "/etc")
7468 (string-append "--with-udevdir=" #$output "/lib/udev"))
7469 #:phases
7470 #~(modify-phases %standard-phases
7471 ;; Test unit/test-gatt fails unpredictably. Seems to be a timing
7472 ;; issue (discussion on upstream mailing list:
7473 ;; https://marc.info/?t=149578476300002&r=1&w=2)
7474 (add-before 'check 'skip-wonky-test
7475 (lambda _
7476 (substitute* "unit/test-gatt.c"
7477 (("tester_init\\(&argc, &argv\\);") "return 77;"))))
7478 (replace 'install
7479 (lambda* (#:key make-flags #:allow-other-keys #:rest args)
7480 ;; Override the sysconfdir and localstatedir locations only for
7481 ;; the installation phase. Otherwise, the installation fails when
7482 ;; it tries to write to /etc/bluetooth and /var.
7483 (define make-flags*
7484 (append make-flags (list (string-append "sysconfdir="
7485 #$output "/etc")
7486 (string-append "localstatedir="
7487 #$output "/var"))))
7488 (apply (assoc-ref %standard-phases 'install)
7489 (append args (list #:make-flags make-flags*)))))
7490 (add-after 'install 'post-install
7491 (lambda* (#:key inputs outputs #:allow-other-keys)
7492 (let* ((servicedir (string-append #$output
7493 "/share/dbus-1/services"))
7494 (service "obexd/src/org.bluez.obex.service")
7495 (rule (string-append
7496 #$output "/lib/udev/rules.d/97-hid2hci.rules")))
7497 ;; Install the obex dbus service file.
7498 (substitute* service
7499 (("/bin/false")
7500 (string-append #$output "/libexec/bluetooth/obexd")))
7501 (install-file service servicedir)
7502 ;; Fix paths in the udev rule.
7503 (substitute* rule
7504 (("hid2hci --method")
7505 (string-append #$output "/lib/udev/hid2hci --method"))
7506 (("/sbin/udevadm")
7507 (search-input-file inputs "/bin/udevadm")))))))))
7508 (native-inputs
7509 (list gettext-minimal
7510 pkg-config
7511 python
7512 python-docutils
7513 python-pygments))
7514 (inputs
7515 (list glib dbus eudev libical readline))
7516 (home-page "https://www.bluez.org/")
7517 (synopsis "Linux Bluetooth protocol stack")
7518 (description
7519 "BlueZ provides support for the core Bluetooth layers and protocols. It
7520is flexible, efficient and uses a modular implementation.")
7521 (license license:gpl2+)))
7522
7523(define-public fuse-exfat
7524 (package
7525 (name "fuse-exfat")
7526 (version "1.4.0")
7527 (source (origin
7528 (method url-fetch)
7529 (uri (string-append
7530 "https://github.com/relan/exfat/releases/download/v"
7531 version "/" name "-" version ".tar.gz"))
7532 (sha256
7533 (base32
7534 "07h0ngnydfy8n8h9ni3jn8zlmcj4pzqa0nk0hk0i4yhfbv2yvkx1"))))
7535 (build-system gnu-build-system)
7536 (native-inputs
7537 (list pkg-config))
7538 (inputs
7539 (list fuse-2))
7540 (home-page "https://github.com/relan/exfat")
7541 (synopsis "Mount exFAT file systems")
7542 (description
7543 "This package provides a FUSE-based file system that provides read and
7544write access to exFAT devices.")
7545 (license license:gpl2+)))
7546
7547(define-public gpm
7548 (package
7549 (name "gpm")
7550 (version "1.20.7")
7551 (source (origin
7552 (method url-fetch)
7553 (uri (string-append
7554 "https://www.nico.schottelius.org/software/gpm/archives/"
7555 "gpm-" version ".tar.bz2"))
7556 (patches (search-patches "gpm-glibc-2.26.patch"))
7557 (sha256
7558 (base32
7559 "13d426a8h403ckpc8zyf7s2p5rql0lqbg2bv0454x0pvgbfbf4gh"))
7560 (modules '((guix build utils)))
7561 (snippet
7562 '(begin
7563 ;; Take a patch from upstream to fix building with -fno-common,
7564 ;; which is default in GCC 10:
7565 ;; https://github.com/telmich/gpm/pull/37
7566 (substitute* "src/headers/daemon.h"
7567 (("^time_t[[:blank:]]+last_selection_time;")
7568 "extern time_t last_selection_time;"))))))
7569 (build-system gnu-build-system)
7570 (arguments
7571 '(#:phases (modify-phases %standard-phases
7572 (replace 'bootstrap
7573 (lambda _
7574 ;; The tarball was not generated with 'make dist' so we
7575 ;; need to bootstrap things ourselves.
7576 (substitute* "autogen.sh"
7577 (("/bin/sh") (which "sh")))
7578 (invoke "./autogen.sh")
7579 (patch-makefile-SHELL "Makefile.include.in")
7580 #t)))
7581
7582 ;; Make sure programs find libgpm.so.
7583 #:configure-flags (list (string-append "LDFLAGS=-Wl,-rpath="
7584 (assoc-ref %outputs "out")
7585 "/lib"))))
7586 (native-inputs
7587 (list texinfo
7588 bison
7589 flex
7590 autoconf
7591 automake
7592 libtool))
7593 (supported-systems (remove target-hurd? %supported-systems))
7594 (home-page "https://www.nico.schottelius.org/software/gpm/")
7595 (synopsis "Mouse support for the Linux console")
7596 (description
7597 "The GPM (general-purpose mouse) daemon is a mouse server for
7598applications running on the Linux console. It allows users to select items
7599and copy/paste text in the console and in xterm.")
7600 (license license:gpl2+)))
7601
7602(define-public gamemode
7603 (package
7604 (name "gamemode")
7605 (version "1.8.2")
7606 (source (origin
7607 (method git-fetch)
7608 (uri (git-reference
7609 (url "https://github.com/FeralInteractive/gamemode")
7610 (commit version)))
7611 (file-name (git-file-name name version))
7612 (sha256
7613 (base32 "14i3y385jzpr30lxk38z84rq76sy4cz0pwm54rm62f4mnk0xwjjp"))))
7614 (build-system meson-build-system)
7615 (arguments
7616 (list
7617 #:configure-flags
7618 #~(list
7619 ;; Don't build sample programs.
7620 "-Dwith-examples=false"
7621 ;; Build gamemoderun and other utilities.
7622 "-Dwith-util=true"
7623 ;; Use elogind instead of systemd for sd-bus.
7624 "-Dwith-sd-bus-provider=elogind"
7625 ;; Install PAM limits.d config to the package prefix; a Guix
7626 ;; service can then install it to /etc/security/limits.d/.
7627 (string-append "-Dwith-pam-limits-dir=" #$output
7628 "/etc/security/limits.d")
7629 ;; Guix does not use systemd.
7630 "-Dwith-systemd-user-unit=false"
7631 "-Dwith-systemd-group=false")
7632 #:phases
7633 #~(modify-phases %standard-phases
7634 (add-after 'unpack 'patch-references
7635 (lambda _
7636 (substitute* '("lib/gamemode_client.h"
7637 "data/gamemoderun")
7638 (("libgamemode(auto)?\\.so\\.0" lib)
7639 (string-append #$output "/lib/" lib))))))))
7640 (native-inputs
7641 (list pkg-config))
7642 (inputs
7643 (list
7644 dbus
7645 elogind
7646 libinih))
7647 (synopsis "Optimise Linux system performance on demand")
7648 (description "GameMode is a daemon and library for Linux that allows games to
7649request a set of optimisations be temporarily applied to the host OS and/or a
7650game process. GameMode was designed primarily as a stop-gap solution to problems
7651with the Intel and AMD CPU powersave or ondemand governors, but is now host to a
7652range of optimisation features and configurations, including CPU governor, I/O
7653priority, process niceness, kernel scheduler, screensaver inhibiting, GPU
7654performance mode, and custom scripts.")
7655 (home-page "https://github.com/FeralInteractive/gamemode")
7656 (license license:bsd-3)))
7657
7658(define-public btrfs-progs
7659 (package
7660 (name "btrfs-progs")
7661 (version "7.0")
7662 (source (origin
7663 (method url-fetch)
7664 (uri (string-append "mirror://kernel.org/linux/kernel/"
7665 "people/kdave/btrfs-progs/" "btrfs-progs-v"
7666 version ".tar.xz"))
7667 (sha256
7668 (base32
7669 "16cs5n1hm06ppkylkd9p7v13wdc0sb7y85xll0kj7mxwdj3xd1n2"))))
7670 (build-system gnu-build-system)
7671 (outputs '("out" "static")) ;static versions of the binaries in "out"
7672 (arguments
7673 (list
7674 #:configure-flags
7675 #~(list
7676 ;; Without --disable-documentation, it complains about missing
7677 ;; python-sphinx on systems where this package isn't available
7678 ;; (because it requires Rust).
7679 #$@(if (member (%current-system)
7680 (package-transitive-supported-systems
7681 python-sphinx))
7682 '()
7683 '("--disable-documentation"))
7684 ;; The ‘Python support’ was never actually installed by previous
7685 ;; versions of this package, but did prevent cross-compilation.
7686 "--disable-python")
7687 #:phases #~(modify-phases %standard-phases
7688 (add-after 'unpack 'patch-makefile
7689 (lambda* (#:key outputs #:allow-other-keys)
7690 (substitute* "Makefile"
7691 (("\\$\\(DESTDIR\\)\\$\\(udevruledir\\)")
7692 (string-append (assoc-ref outputs "out")
7693 "/lib/udev/rules.d")))))
7694 (add-after 'build 'build-static
7695 (lambda _
7696 (invoke "make" "static")))
7697 (add-after 'install 'install-bash-completion
7698 (lambda* (#:key outputs #:allow-other-keys)
7699 (let* ((out (assoc-ref outputs "out"))
7700 (bashcomp (string-append out
7701 "/etc/bash_completion.d")))
7702 (mkdir-p bashcomp)
7703 (copy-file "btrfs-completion"
7704 (string-append bashcomp "/btrfs")))))
7705 (add-after 'install 'install-static
7706 (let ((staticbin (string-append (assoc-ref %outputs
7707 "static")
7708 "/bin")))
7709 (lambda _
7710 (invoke "make"
7711 (string-append "bindir=" staticbin)
7712 "install-static")))))
7713 #:tests? #f ;XXX: require the 'btrfs' kernel module.
7714 #:test-target "test"
7715 #:parallel-tests? #f)) ;tests fail when run in parallel
7716 (inputs (list e2fsprogs ;for btrfs-convert
7717 eudev
7718 lzo
7719 `(,util-linux "lib") ;for libblkid and libuuid
7720 `(,util-linux "static") ;ditto
7721 zlib
7722 `(,zlib "static")
7723 `(,zstd "lib")
7724 `(,zstd "static")))
7725 (native-inputs
7726 (append
7727 ;; For building documentation. Since python-sphinx requires Rust, add
7728 ;; it conditionally depending on such support.
7729 (if (supported-package? python-sphinx)
7730 (list python-wrapper python-sphinx python-sphinx-rtd-theme)
7731 '())
7732 (list pkg-config
7733 acl ;for tests
7734 lvm2 ;for dmsetup
7735 grep ;need Perl regexp support
7736 libaio
7737 liburing
7738 util-linux ;for fallocate
7739 which)))
7740 (home-page "https://btrfs.wiki.kernel.org/index.php/Main_Page")
7741 (synopsis "Create and manage btrfs copy-on-write file systems")
7742 (description
7743 "Btrfs is a @acronym{CoW, copy-on-write} file system for Linux
7744aimed at implementing advanced features while focusing on fault tolerance,
7745repair and easy administration.")
7746 ;; GPL2+: crc32.c, radix-tree.c, raid6.c, rbtree.c.
7747 ;; GPL2: Everything else.
7748 (license (list license:gpl2 license:gpl2+))))
7749
7750(define-public btrfs-progs/static
7751 (package
7752 (name "btrfs-progs-static")
7753 (version (package-version btrfs-progs))
7754 (source #f)
7755 (build-system trivial-build-system)
7756 (inputs
7757 `(("btrfs-progs:static" ,btrfs-progs "static")))
7758 (arguments
7759 `(#:modules ((guix build utils))
7760 #:builder
7761 (begin
7762 (use-modules (guix build utils)
7763 (ice-9 ftw)
7764 (srfi srfi-26))
7765
7766 (let* ((btrfs (assoc-ref %build-inputs "btrfs-progs:static"))
7767 (out (assoc-ref %outputs "out"))
7768 (source (string-append btrfs "/bin/btrfs.static"))
7769 (target (string-append out "/bin/btrfs")))
7770 (mkdir-p (dirname target))
7771 (copy-file source target)
7772 (remove-store-references target)
7773 (chmod target #o555)
7774 #t))))
7775 (home-page (package-home-page btrfs-progs))
7776 (synopsis "Statically-linked btrfs command from btrfs-progs")
7777 (description "This package provides the statically-linked @command{btrfs}
7778from the btrfs-progs package. It is meant to be used in initrds.")
7779 (license (package-license btrfs-progs))))
7780
7781(define-public cramfs-tools
7782 (package
7783 (name "cramfs-tools")
7784 (home-page "https://github.com/npitre/cramfs-tools")
7785 (version "2.2")
7786 (source (origin
7787 (method git-fetch)
7788 (uri (git-reference
7789 (url home-page)
7790 (commit (string-append "v" version))))
7791 (sha256
7792 (base32 "1rx63qx2sdpzrgcmp7cskin670rnlp45jn90wxqgnqxvc5vr9l5k"))
7793 (file-name (git-file-name name version))))
7794 (build-system gnu-build-system)
7795 (arguments
7796 (list #:tests? #f ; No tests.
7797 #:phases
7798 #~(modify-phases %standard-phases
7799 (delete 'configure)
7800 (replace 'install
7801 (lambda _
7802 (let ((sbin (string-append #$output "/sbin")))
7803 (install-file "mkcramfs" sbin)
7804 (install-file "cramfsck" sbin)))))))
7805 (inputs
7806 (list zlib))
7807 (synopsis "Tools to manage Cramfs file systems")
7808 (description "Cramfs is a Linux file system designed to be simple, small,
7809and to compress things well. It is used on a number of embedded systems and
7810small devices. This version has additional features such as uncompressed
7811blocks and random block placement.")
7812 (license license:gpl2+)))
7813
7814(define-public compsize
7815 (let ((commit "d79eacf77abe3b799387bb8a4e07a18f1f1031e8")
7816 (revision "0"))
7817 (package
7818 (name "compsize")
7819 (version (git-version "1.5" revision commit))
7820 (home-page "https://github.com/kilobyte/compsize")
7821 (source (origin
7822 (method git-fetch)
7823 (uri (git-reference
7824 (url home-page)
7825 (commit commit)))
7826 (sha256
7827 (base32 "02fvgy12m50rg1snp555a1kc3cm01g2imb81cih7ikhkbjbca0d7"))
7828 (file-name (git-file-name name version))
7829 (patches
7830 (search-patches "compsize-fix-btrfs-progs-compatibility.patch"))))
7831 (build-system gnu-build-system)
7832 (inputs
7833 (list btrfs-progs))
7834 (arguments
7835 `(#:tests? #f ; No tests.
7836 #:make-flags
7837 (list (string-append "CC=" ,(cc-for-target)))
7838 #:phases
7839 (modify-phases %standard-phases
7840 (delete 'configure)
7841 (replace 'install
7842 (lambda* (#:key outputs #:allow-other-keys)
7843 (let ((out (assoc-ref outputs "out")))
7844 (install-file "compsize" (string-append out "/bin"))
7845 (install-file "compsize.8" (string-append out "/share/man/man8"))))))))
7846 (synopsis "Find compression type/ratio on Btrfs files")
7847 (description "@command{compsize} takes a list of files (given as
7848arguments) on a Btrfs file system and measures used compression types and
7849effective compression ratio, producing a report.
7850
7851A directory has no extents but has a (recursive) list of files. A non-regular
7852file is silently ignored.
7853
7854As it makes no sense to talk about compression ratio of a partial extent,
7855every referenced extent is counted whole, exactly once -- no matter if you use
7856only a few bytes of a 1GB extent or reflink it a thousand times. Thus, the
7857uncompressed size will not match the number given by @command{tar} or
7858@command{du}. On the other hand, the space used should be accurate (although
7859obviously it can be shared with files outside our set).")
7860 (license license:gpl2+))))
7861
7862(define-public f2fs-tools
7863 (package
7864 (name "f2fs-tools")
7865 (version "1.16.0")
7866 (source (origin
7867 (method git-fetch)
7868 (uri (git-reference
7869 (url "https://git.kernel.org/pub/scm/linux/kernel\
7870/git/jaegeuk/f2fs-tools.git")
7871 (commit (string-append "v" version))))
7872 (file-name (git-file-name name version))
7873 (sha256
7874 (base32
7875 "0832ix3jnmfagx53wr6clc3q4ay7cbashfj7jirk01gyzwbvblfc"))))
7876 (build-system gnu-build-system)
7877 (native-inputs
7878 (list autoconf automake libtool pkg-config))
7879 (inputs
7880 (list `(,util-linux "lib"))) ;for libuuid
7881 (home-page "https://f2fs.wiki.kernel.org/")
7882 (synopsis "Userland tools for f2fs")
7883 (description
7884 "F2FS, the Flash-Friendly File System, is a modern file system
7885designed to be fast and durable on flash devices such as solid-state
7886disks and SD cards. This package provides the userland utilities.")
7887 ;; The formatting utility, libf2fs and include/f2fs_fs.h is dual
7888 ;; GPL2/LGPL2.1, everything else is GPL2 only. See 'COPYING'.
7889 (license (list license:gpl2 license:lgpl2.1))))
7890
7891(define-public f2fs-tools-1.7
7892 (package
7893 (inherit f2fs-tools)
7894 (name "f2fs-tools")
7895 (version "1.7.0")
7896 (source (origin
7897 (method git-fetch)
7898 (uri (git-reference
7899 (url (git-reference-url
7900 (origin-uri (package-source f2fs-tools))))
7901 (commit (string-append "v" version))))
7902 (file-name (git-file-name name version))
7903 (sha256
7904 (base32
7905 "0wpzklw8smnngng0dm25jdmi7v5zfhpz02dksyxpz0a7kzzvnqqm"))))
7906 (inputs
7907 (list `(,util-linux "lib") libselinux))
7908 (arguments
7909 '(#:configure-flags '("CFLAGS=-fcommon")
7910 #:phases
7911 (modify-phases %standard-phases
7912 (add-after 'install 'install-headers
7913 (lambda* (#:key outputs #:allow-other-keys)
7914 (let* ((out (assoc-ref outputs "out"))
7915 (out-include (string-append out "/include")))
7916 (install-file "include/f2fs_fs.h" out-include)
7917 (install-file "mkfs/f2fs_format_utils.h" out-include)))))))))
7918
7919(define-public f2fs-tools/static
7920 (static-package
7921 (package
7922 (inherit f2fs-tools)
7923 (name "f2fs-tools-static")
7924 (arguments
7925 `(#:configure-flags
7926 (let ((libuuid-static (assoc-ref %build-inputs "libuuid:static"))
7927 (libuuid (assoc-ref %build-inputs "libuuid")))
7928 (list
7929 (string-append "libuuid_CFLAGS=-I" libuuid "/include/uuid")
7930 (string-append "libuuid_LIBS=-L" libuuid-static "/lib -luuid")
7931 (string-append "libblkid_CFLAGS=-I" libuuid "/include/uuid "
7932 "-I" libuuid "/include/blkid")
7933 (string-append "libblkid_LIBS=-L" libuuid-static "/lib -lblkid")))
7934 #:disallowed-references (,(this-package-input "libuuid"))
7935 #:make-flags '("LDFLAGS=-all-static")
7936 #:phases
7937 (modify-phases %standard-phases ; TODO: f2fs phases.
7938 (add-after 'install 'remove-store-references
7939 (lambda* (#:key outputs #:allow-other-keys)
7940 ;; Work around bug in our util-linux.
7941 ;; <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=41019>.
7942 (remove-store-references (string-append (assoc-ref outputs "out")
7943 "/sbin/mkfs.f2fs"))
7944 #t)))))
7945 (inputs
7946 `(("libuuid:static" ,util-linux "static")
7947 ("libuuid" ,util-linux "lib")))))) ; for include files
7948
7949(define-public f2fs-fsck/static
7950 (package
7951 (name "f2fs-fsck-static")
7952 (version (package-version f2fs-tools/static))
7953 (source #f)
7954 (build-system trivial-build-system)
7955 (arguments
7956 `(#:modules ((guix build utils))
7957 #:builder
7958 (begin
7959 (use-modules (guix build utils)
7960 (ice-9 ftw)
7961 (srfi srfi-26))
7962 (let* ((f2fs-tools (assoc-ref %build-inputs "f2fs-tools-static"))
7963 (fsck "fsck.f2fs")
7964 (out (assoc-ref %outputs "out"))
7965 (sbin (string-append out "/sbin")))
7966 (mkdir-p sbin)
7967 (with-directory-excursion sbin
7968 (install-file (string-append f2fs-tools "/sbin/" fsck)
7969 ".")
7970 (remove-store-references fsck)
7971 (chmod fsck #o555))
7972 #t))))
7973 (inputs
7974 (list f2fs-tools/static))
7975 (home-page (package-home-page f2fs-tools/static))
7976 (synopsis "Statically-linked fsck.f2fs command from f2fs-tools")
7977 (description "This package provides statically-linked fsck.f2fs command taken
7978from the f2fs-tools package. It is meant to be used in initrds.")
7979 (license (package-license f2fs-tools/static))))
7980
7981(define-public freefall
7982 (package
7983 (name "freefall")
7984 (version (package-version linux-libre))
7985 (source (package-source linux-libre))
7986 (build-system gnu-build-system)
7987 (arguments
7988 '(#:phases (modify-phases %standard-phases
7989 (add-after 'unpack 'enter-subdirectory
7990 (lambda _
7991 (chdir "tools/laptop/freefall")
7992 #t))
7993 (delete 'configure)
7994 (add-before 'build 'increase-timeout
7995 (lambda _
7996 ;; The default of 2 seconds is too low: it assumes an
7997 ;; open lid and AC power without actually checking.
7998 (substitute* "freefall.c"
7999 (("alarm\\(2\\)") "alarm(5)"))
8000 #t)))
8001 #:make-flags (list (string-append "PREFIX="
8002 (assoc-ref %outputs "out"))
8003 "CC=gcc")
8004 #:tests? #f)) ;no tests
8005 (home-page (package-home-page linux-libre))
8006 (synopsis "Free-fall protection for spinning laptop hard drives")
8007 (description
8008 "Prevents shock damage to the internal spinning hard drive(s) of some
8009HP and Dell laptops. When sudden movement is detected, all input/output
8010operations on the drive are suspended and its heads are parked on the ramp,
8011where they are less likely to cause damage to the spinning disc. Requires a
8012drive that supports the ATA/ATAPI-7 IDLE IMMEDIATE command with unload
8013feature, and a laptop with an accelerometer. It has no effect on SSDs.")
8014 (license license:gpl2)))
8015
8016
8017(define-public nbfc-linux
8018 (let ((version "0.1.7")
8019 (commit "4c2b75e4a875459e86a9892319889ff945e9cadf")
8020 (revision "0"))
8021 (package
8022 (name "nbfc-linux")
8023 (version (git-version version revision commit))
8024 (source (origin
8025 (method git-fetch)
8026 (uri (git-reference
8027 (url "https://github.com/nbfc-linux/nbfc-linux")
8028 (commit commit)))
8029 (file-name (git-file-name name version))
8030 (sha256
8031 (base32
8032 "0mmyfaigrh3fd5v11a8p38km4m02qzsfx8yh72g0z405bzhqn5jk"))))
8033 (build-system gnu-build-system)
8034 (arguments
8035 `(#:make-flags (list (string-append "CC="
8036 ,(cc-for-target))
8037 (string-append "PREFIX="
8038 (assoc-ref %outputs "out")))
8039 #:tests? #f
8040 #:phases (modify-phases %standard-phases
8041 (delete 'configure))))
8042 (native-inputs (list pkg-config))
8043 (propagated-inputs (list python dmidecode))
8044 (synopsis "NoteBook FanControl ported to Linux")
8045 (description
8046 "This package provides a C port of NoteBook FanControl (NBFC), a fan
8047control service for notebooks. It provides the same utilities with the same
8048interfaces as the original NBFC, although the implementation differs.")
8049 (home-page "https://github.com/nbfc-linux/nbfc-linux")
8050 (license license:gpl3+))))
8051
8052(define-public thinkfan
8053 (package
8054 (name "thinkfan")
8055 (version "2.0.0")
8056 (source
8057 (origin
8058 (method git-fetch)
8059 (uri (git-reference
8060 (url "https://github.com/vmatare/thinkfan")
8061 (commit version)))
8062 (file-name (git-file-name name version))
8063 (sha256
8064 (base32 "1jdjqdbv0m7yf9g4rxs7nq1ldh2b81a7qx4vcf9lzw7jwlydd822"))))
8065 (build-system cmake-build-system)
8066 (arguments
8067 (list
8068 #:modules '((guix build cmake-build-system)
8069 (guix build utils)
8070 (srfi srfi-26))
8071 #:tests? #f ; no test target
8072 #:configure-flags
8073 ;; Enable reading temperatures from hard disks via S.M.A.R.T.
8074 ;; Upstream ‘defaults to OFF because libatasmart seems to be horribly
8075 ;; inefficient’.
8076 #~(list "-DUSE_ATASMART:BOOL=ON")
8077 #:phases
8078 #~(modify-phases %standard-phases
8079 (add-after 'unpack 'create-init-scripts
8080 ;; CMakeLists.txt relies on build-time symptoms of OpenRC and
8081 ;; systemd to patch and install their service files. Fake their
8082 ;; presence rather than duplicating the build system below. Leave
8083 ;; things like ‘/bin/kill’ because they're not worth a dependency.
8084 ;; The sysvinit needs manual patching, but since upstream doesn't
8085 ;; even provide the option to install it: don't.
8086 (lambda _
8087 (substitute* "CMakeLists.txt"
8088 (("pkg_check_modules\\((OPENRC|SYSTEMD) .*" _ package)
8089 (format #f "option(~a_FOUND \"Faked\" ON)\n" package))
8090 ;; That was easy! Now we just need to fix the destinations.
8091 (("/etc" directory)
8092 (string-append #$output directory))))))))
8093 (native-inputs
8094 (list pkg-config))
8095 (inputs
8096 `(("libatasmart" ,libatasmart)
8097 ("lm-sensors" ,lm-sensors "lib")
8098 ("yaml-cpp" ,yaml-cpp)))
8099 (home-page "https://github.com/vmatare/thinkfan")
8100 (synopsis "Simple fan control program")
8101 (description
8102 "Thinkfan is a simple fan control program. It reads temperatures,
8103checks them against configured limits and switches to appropriate (also
8104pre-configured) fan level. It requires a working @code{thinkpad_acpi} or any
8105other @code{hwmon} driver that enables temperature reading and fan control
8106from userspace.")
8107 (license license:gpl3+)))
8108
8109(define-public tpacpi-bat
8110 (package
8111 (name "tpacpi-bat")
8112 (version "3.2")
8113 (source
8114 (origin
8115 (method git-fetch)
8116 (uri (git-reference
8117 (url "https://github.com/teleshoes/tpacpi-bat")
8118 (commit (string-append "v" version))))
8119 (file-name (git-file-name name version))
8120 (sha256
8121 (base32 "0nd8s2bqbhl0sjpflphb4l9ix71p7kvnbvkq4dg9a1v0sxafyygm"))))
8122 (build-system gnu-build-system)
8123 (arguments
8124 `(#:tests? #f ; no test target
8125 #:phases
8126 (modify-phases %standard-phases
8127 (add-after 'unpack 'refer-to-inputs
8128 (lambda* (#:key inputs #:allow-other-keys)
8129 (substitute* "tpacpi-bat"
8130 (("cat ")
8131 (string-append (search-input-file inputs "bin/cat") " "))
8132 ;; tpacpi-bat modprobes the acpi_call kernel module if it's not
8133 ;; loaded. That's the administrator's prerogative; disable it.
8134 (("system \"(modprobe .*)\"" _ match)
8135 (format #f "die \"Please run ‘~a’ first.\\n\"" match)))))
8136 (delete 'configure) ; nothing to configure
8137 (delete 'build) ; nothing to build
8138 (replace 'install
8139 (lambda* (#:key outputs #:allow-other-keys)
8140 (let* ((out (assoc-ref outputs "out"))
8141 (bin (string-append out "/bin"))
8142 (doc (string-append out "/share/doc/" ,name "-" ,version)))
8143 (install-file "tpacpi-bat" bin)
8144
8145 ;; There's no man page. Install other forms of documentation.
8146 (for-each (lambda (file)
8147 (let ((target (string-append doc "/" file)))
8148 (mkdir-p (dirname target))
8149 (copy-recursively file target)))
8150 (list "battery_asl" "examples" "README.md"))))))))
8151 (inputs
8152 (list coreutils-minimal
8153 perl))
8154 (home-page "https://github.com/teleshoes/tpacpi-bat")
8155 (synopsis "ThinkPad battery charge controller")
8156 (description
8157 "Tpacpi-bat is a command-line interface to control battery charging on
8158@uref{https://github.com/teleshoes/tpacpi-bat/wiki/Supported-Hardware, Lenovo
8159ThinkPad models released after 2011}, starting with the xx20 series. It can
8160query and set the thresholds at which one or both batteries will start and stop
8161charging, inhibit charging batteries for a set period of time, or force them to
8162discharge when they otherwise would not.
8163
8164This tool merely exposes ACPI calls provided by the @code{acpi_call} Linux
8165kernel module provided by the @code{acpi-call-linux-module} package, which must
8166be installed and loaded separately. Only the original vendor firmware is
8167supported.")
8168 (license license:gpl3+)))
8169
8170(define-public tmon
8171 (package
8172 (name "tmon")
8173 ;; Tmon's ‘VERSION = 1.0’ hasn't been touched since 2013; the code has.
8174 (version (package-version linux-libre))
8175 (source (package-source linux-libre))
8176 (build-system gnu-build-system)
8177 (arguments
8178 (list
8179 #:tests? #f ; no test suite
8180 #:make-flags
8181 #~(list (string-append "CC=" #$(cc-for-target))
8182 (string-append "INSTALL_ROOT=" #$output)
8183 "BINDIR=bin")
8184 #:phases
8185 #~(modify-phases %standard-phases
8186 (add-after 'unpack 'enter-subdirectory
8187 (lambda _
8188 (chdir "tools/thermal/tmon")))
8189 (add-after 'install 'install-man-page
8190 (lambda _
8191 (let ((man8 (string-append #$output "/share/man/man8")))
8192 (install-file "tmon.8" man8))))
8193 (delete 'configure)))) ; no configure script
8194 (inputs
8195 (list ncurses))
8196 (home-page (package-home-page linux-libre))
8197 (synopsis "Monitor and test the Linux thermal subsystem in real time")
8198 (description
8199 "Tmon is a tool to interact with the complex thermal subsystem of the
8200kernel Linux. It helps visualize thermal relationships and real-time thermal
8201data, tune and test cooling devices and sensors, and collect thermal data for
8202further analysis.
8203
8204As computers become smaller and more thermally constrained, more sensors are
8205added and new cooling capabilities introduced. Thermal relationships can change
8206dynamically. Their complexity grows exponentially among cooling devices, zones,
8207sensors, and trip points.
8208
8209Linux exposes this relationship through @file{/sys/class/thermal} with a matrix
8210of symbolic links, trip point bindings, and device instances. To traverse it
8211by hand is no trivial task: @command{tmon} aims to make it understandable.")
8212 (license (list license:gpl2 ; the man page
8213 license:gpl2+)))) ; the actual rest
8214
8215(define-public turbostat
8216 (package
8217 (name "turbostat")
8218 ;; XXX turbostat reports a version like ‘20.09.30’ but using it here would
8219 ;; make it harder to benefit from ‘free’ linux-libre package updates.
8220 (version (package-version linux-libre))
8221 (source (package-source linux-libre))
8222 (build-system gnu-build-system)
8223 (arguments
8224 (list
8225 #:tests? #f ;no test suite
8226 #:make-flags
8227 #~(list (string-append "CC=" #$(cc-for-target))
8228 (string-append "PREFIX=" #$output))
8229 #:phases
8230 #~(modify-phases %standard-phases
8231 (add-after 'unpack 'enter-subdirectory
8232 (lambda _
8233 (chdir "tools/power/x86/turbostat")))
8234 (delete 'configure)))) ;no configure script
8235 (inputs
8236 (list libcap))
8237 (supported-systems '("i686-linux" "x86_64-linux"))
8238 (home-page (package-home-page linux-libre))
8239 (synopsis "Report x86 processor frequency and idle statistics")
8240 (description
8241 "Turbostat reports x86 processor topology, frequency, idle power state
8242statistics, temperature, and power consumption. Some information is unavailable
8243on older processors.
8244
8245It can be used to identify machines that are inefficient in terms of power usage
8246or idle time, report the rate of @acronym{SMI, system management interrupt}s
8247occurring on the system, or verify the effects of power management tuning.
8248
8249@command{turbostat} reads hardware counters but doesn't write to them, so it
8250won't interfere with the OS or other running processes---including multiple
8251invocations of itself.")
8252 (license license:gpl2)))
8253
8254(define-public ntfs-3g
8255 (package
8256 (name "ntfs-3g")
8257 (version "2026.7.7")
8258 (source (origin
8259 (method git-fetch)
8260 (uri
8261 (git-reference
8262 (url "https://github.com/tuxera/ntfs-3g")
8263 (commit version)))
8264 (file-name (git-file-name name version))
8265 (sha256
8266 (base32
8267 "0kkpmi28qihwmnyvdnkj0azrd7zr6wkv590pjfmbbhn1w4qfp7gd"))
8268 (patches
8269 (search-patches "ntfs-3g-autoconf-sbin-helpers.patch"
8270 "ntfs-3g-consistent-sbindir-usage.patch"))))
8271 (build-system gnu-build-system)
8272 (inputs (list util-linux ; libuuid
8273 kmod
8274 fuse-2))
8275 (native-inputs (list pkg-config autoconf automake libtool
8276 libgcrypt)) ; for m4 macros
8277 (arguments
8278 (list
8279 #:configure-flags
8280 #~(list "--disable-static"
8281 "--disable-ldconfig" ;not necessary
8282 "--exec-prefix=${prefix}"
8283 "--with-fuse=external" ;use our own FUSE
8284 "--enable-mount-helper"
8285 (string-append "--with-modprobe-helper="
8286 #$(this-package-input "kmod") "/bin/modprobe")
8287 "--enable-posix-acls"
8288 "--enable-xattr-mappings")
8289 #:phases
8290 #~(modify-phases %standard-phases
8291 ;; If users install ntfs-3g, they probably want to make it the
8292 ;; default driver as well, so we opt for sensible defaults and link
8293 ;; mount.ntfs to mount.ntfs-3g. (libmount tries to run mount.ntfs to
8294 ;; mount NTFS file systems.)
8295 (add-after 'install 'install-link
8296 (lambda* (#:key outputs #:allow-other-keys)
8297 (let* ((out (assoc-ref outputs "out"))
8298 (sbin (string-append out "/sbin")))
8299 (symlink "mount.ntfs-3g"
8300 (string-append sbin "/mount.ntfs"))))))))
8301 (home-page "https://www.tuxera.com/community/open-source-ntfs-3g/")
8302 (synopsis "Read-write access to NTFS file systems")
8303 (description
8304 "NTFS-3G provides read-write access to NTFS file systems, which are
8305commonly found on Microsoft Windows. It is implemented as a FUSE file system.
8306The package provides additional NTFS tools.")
8307 (license license:gpl2+)))
8308
8309(define-public ntfs-3g/static
8310 (static-package
8311 (package
8312 (inherit ntfs-3g)
8313 (name "ntfs-3g-static")
8314 (arguments
8315 (substitute-keyword-arguments arguments
8316 ((#:configure-flags flags)
8317 #~(cons* "--enable-really-static"
8318 ;; The FUSE driver isn't currently used by our initrd.
8319 "--disable-ntfs-3g"
8320 #$flags))
8321 ((#:phases phases)
8322 #~(modify-phases #$phases
8323 (add-after 'unpack 'make-really-static-really-static
8324 (lambda _
8325 (substitute* "ntfsprogs/Makefile.am"
8326 ((" -static") " -all-static"))))
8327 (delete 'install-link))))))))
8328
8329(define-public ntfsfix/static
8330 (package
8331 (name "ntfsfix-static")
8332 (version (package-version ntfs-3g/static))
8333 (source #f)
8334 (build-system trivial-build-system)
8335 (arguments
8336 (list
8337 #:modules `((guix build utils))
8338 #:builder
8339 #~(begin
8340 (use-modules (guix build utils))
8341 (let ((bin (string-append #$output "/bin")))
8342 (install-file (search-input-file %build-inputs "/bin/ntfsfix") bin)
8343 (with-directory-excursion bin
8344 (remove-store-references "ntfsfix"))))))
8345 (inputs (list ntfs-3g/static))
8346 (home-page (package-home-page ntfs-3g/static))
8347 (synopsis "Statically linked @command{ntfsfix} from ntfs-3g")
8348 (description
8349 "This package provides a statically linked @command{ntfsfix} taken
8350from the ntfs-3g package. It is meant to be used in initrds.")
8351 (license (package-license ntfs-3g/static))))
8352
8353(define-public rdma-core
8354 (package
8355 (name "rdma-core")
8356 (version "62.0")
8357 (source (origin
8358 (method url-fetch)
8359 (uri (string-append "https://github.com/linux-rdma/rdma-core"
8360 "/releases/download/v" version "/rdma-core-"
8361 version ".tar.gz"))
8362 (sha256
8363 (base32
8364 "1802afy4q80zl7qkxlyq71ll5fsksva43f8xfd6vlqj1c47dc2n0"))))
8365 (build-system cmake-build-system)
8366 (arguments
8367 `(#:tests? #f ;no tests
8368
8369 ;; Upstream uses the "ninja" build system and encourage distros
8370 ;; to do the same for consistency.
8371 #:generator "Ninja"
8372 #:configure-flags
8373 (list (string-append "-DRST2MAN_EXECUTABLE="
8374 (search-input-file
8375 %build-inputs "/bin/rst2man.py")))))
8376 (native-inputs
8377 (list pkg-config python-wrapper python-docutils-0.19)) ;for 'rst2man'
8378 (inputs
8379 (list libnl eudev))
8380 (home-page "https://github.com/linux-rdma/rdma-core")
8381 (synopsis "Utilities and libraries for working with RDMA devices")
8382 (description
8383 "This package provides userspace components for the InfiniBand
8384subsystem of the Linux kernel. Specifically it contains userspace
8385libraries for the following device nodes:
8386
8387@enumerate
8388@item @file{/dev/infiniband/uverbsX} (@code{libibverbs})
8389@item @file{/dev/infiniband/rdma_cm} (@code{librdmacm})
8390@item @file{/dev/infiniband/umadX} (@code{libibumad})
8391@end enumerate
8392
8393The following service daemons are also provided:
8394@enumerate
8395@item @code{srp_daemon} (for the @code{ib_srp} kernel module)
8396@item @code{iwpmd} (for iWARP kernel providers)
8397@item @code{ibacm} (for InfiniBand communication management assistant)
8398@end enumerate")
8399 ;; All library code is dual licensed under GPL2 and a custom MIT
8400 ;; variant. The package also includes some components covered by
8401 ;; other licenses. Consult COPYING.md for full details.
8402 (license
8403 (list license:gpl2
8404 (license:x11-style "See COPYING.BSD_MIT in the distribution")
8405 license:bsd-2 ; Files referring to COPYING.BSD_FB
8406 license:cc0 ; most files in ccan/
8407 license:bsd-3)))) ; providers/hfi1verbs are dual GPL2/BSD-3
8408
8409(define-public perftest
8410 (package
8411 (name "perftest")
8412 (version "4.5-0.20")
8413 (home-page "https://github.com/linux-rdma/perftest")
8414 (source (origin
8415 (method git-fetch)
8416 (uri (git-reference (url home-page)
8417 (commit (string-append "v" version))))
8418 (file-name (git-file-name name version))
8419 (sha256
8420 (base32
8421 "1hrpzmkz1kq4jwpy6b5fl8073iy7dllcq2hfzdw6waaf5920vd64"))))
8422 (build-system gnu-build-system)
8423 (native-inputs
8424 (list autoconf automake libtool))
8425 (inputs (list pciutils rdma-core))
8426 (synopsis "Open Fabrics Enterprise Distribution (OFED) Performance Tests")
8427 (description "This is a collection of tests written over uverbs intended
8428for use as a performance micro-benchmark. The tests may be used for hardware
8429or software tuning as well as for functional testing.
8430
8431The collection contains a set of bandwidth and latency benchmark such as:
8432@enumerate
8433@item Send - @code{ib_send_bw} and @code{ib_send_lat}
8434@item RDMA Read - @code{ib_read_bw} and @code{ib_read_lat}
8435@item RDMA Write - @code{ib_write_bw} and @code{ib_wriet_lat}
8436@item RDMA Atomic - @code{ib_atomic_bw} and @code{ib_atomic_lat}
8437@item Native Ethernet (when working with MOFED2) - @code{raw_ethernet_bw}, @code{raw_ethernet_lat}
8438@end enumerate")
8439 (license license:gpl2)))
8440
8441(define-public rng-tools
8442 (package
8443 (name "rng-tools")
8444 (home-page "https://github.com/nhorman/rng-tools")
8445 (version "6.17")
8446 (source (origin
8447 (method git-fetch)
8448 (uri (git-reference (url home-page)
8449 (commit (string-append "v" version))))
8450 (file-name (git-file-name name version))
8451 (sha256
8452 (base32
8453 "0vvqi9ha4jbk4086x2q98p4ip3z56sfdpyckdyknsd36zhp6z8n2"))
8454 (patches
8455 (search-patches "rng-tools-revert-build-randstat.patch"))
8456 (patch-flags '("-p0"))))
8457 (build-system gnu-build-system)
8458 (arguments
8459 (list
8460 ;; Disable support for various hardware entropy sources as they need
8461 ;; dependencies that are not yet in Guix, and would significantly
8462 ;; increase closure size.
8463 #:configure-flags #~(list "--without-nistbeacon"
8464 "--without-pkcs11"
8465 "--without-rtlsdr"
8466 "--without-qrypt")
8467 #:phases
8468 #~(modify-phases %standard-phases
8469 (add-before 'check 'disable-failing-test
8470 (lambda _
8471 (substitute* "tests/Makefile"
8472 ;; This test requires a hwrng, rdrand, or tpm device.
8473 ;; Worse, it appears to fail if that isn't sufficiently random.
8474 (("\\brngtestjitter\\.sh\\b") " ")))))))
8475 (native-inputs
8476 (list autoconf automake pkg-config))
8477 (inputs
8478 (list libcap sysfsutils openssl))
8479 (synopsis "Random number generator daemon")
8480 (description
8481 "Monitor a hardware random number generator, and supply entropy
8482from that to the system kernel's @file{/dev/random} machinery.")
8483 ;; The source package is offered under the GPL2+, but the files
8484 ;; 'rngd_rdrand.c' and 'rdrand_asm.S' are only available under the GPL2.
8485 (license (list license:gpl2 license:gpl2+))))
8486
8487(define-public cpupower
8488 (package
8489 (name "cpupower")
8490 (version (package-version linux-libre))
8491 (source (package-source linux-libre))
8492 (build-system gnu-build-system)
8493 (arguments
8494 (list #:make-flags
8495 #~(list "CC=gcc"
8496 (string-append "DESTDIR=" #$output)
8497 (string-append "LDFLAGS=-Wl,-rpath=" #$output "/lib")
8498 "docdir=/share/doc/cpupower" ;drop default ‘packages/’
8499 "confdir=$(docdir)/examples"
8500 ;; The Makefile recommends the following changes.
8501 "DEBUG=false"
8502 "[email protected]")
8503 #:tests? #f ; no tests
8504 #:phases
8505 #~(modify-phases %standard-phases
8506 (add-after 'unpack 'enter-subdirectory
8507 (lambda _
8508 (chdir "tools/power/cpupower")))
8509 (delete 'configure) ; no configure script
8510 (add-before 'build 'fix-makefiles
8511 (lambda _
8512 (substitute* "Makefile"
8513 (("/usr/") "/")
8514 (("/bin/(install)" _ command) command))
8515 (substitute* "bench/Makefile"
8516 (("\\$\\(CC\\) -o") "$(CC) $(LDFLAGS) -o")))))))
8517 (native-inputs (list gettext-minimal
8518 which)) ;to find gettext
8519 (inputs (list pciutils))
8520 (home-page (package-home-page linux-libre))
8521 (synopsis "CPU frequency and voltage scaling tools for Linux")
8522 (description
8523 "cpupower is a set of user-space tools that use the cpufreq feature of the
8524Linux kernel to retrieve and control processor features related to power saving,
8525such as frequency and voltage scaling.")
8526 (license license:gpl2)))
8527
8528(define-public x86-energy-perf-policy
8529 (package
8530 (name "x86-energy-perf-policy")
8531 (version (package-version linux-libre))
8532 (source (package-source linux-libre))
8533 (build-system gnu-build-system)
8534 (arguments
8535 '(#:tests? #f
8536 #:phases
8537 (modify-phases %standard-phases
8538 (add-after 'unpack 'enter-subdirectory
8539 (lambda _
8540 (chdir "tools/power/x86/x86_energy_perf_policy")
8541 #t))
8542 (delete 'configure)
8543 (add-before 'build 'fix-makefile
8544 (lambda _
8545 (substitute* "Makefile" (("/usr") ""))
8546 #t)))
8547 #:make-flags
8548 (let ((out (assoc-ref %outputs "out")))
8549 (list (string-append "DESTDIR=" out)
8550 (string-append "LDFLAGS=-Wl,-rpath=" out "/lib")))))
8551 (supported-systems '("i686-linux" "x86_64-linux"))
8552 (home-page (package-home-page linux-libre))
8553 (synopsis "Display and update Intel-CPU energy-performance policy")
8554 (description
8555 "@command{x86_energy_perf_policy} displays and updates energy-performance
8556policy settings specific to Intel Architecture Processors. Settings are
8557accessed via Model Specific Register (MSR) updates, no matter if the Linux
8558cpufreq sub-system is enabled or not.")
8559 (license license:gpl2)))
8560
8561(define-public haveged
8562 (package
8563 (name "haveged")
8564 (version "1.9.19")
8565 (source
8566 (origin
8567 (method git-fetch)
8568 (uri (git-reference
8569 (url "https://github.com/jirka-h/haveged")
8570 (commit (string-append "v" version))))
8571 (file-name (git-file-name name version))
8572 (sha256
8573 (base32 "1qka68dlfz9z3gjfvfwvh60l2121c1yx0z264jqsf2vjp5f0xbmn"))))
8574 (build-system gnu-build-system)
8575 (arguments
8576 `(#:configure-flags
8577 (list "--disable-static")))
8578 (home-page "https://www.issihosts.com/haveged")
8579 (synopsis "Entropy source for the Linux random number generator")
8580 (description
8581 "haveged generates an unpredictable stream of random numbers for use by
8582Linux's @file{/dev/random} and @file{/dev/urandom} devices. The kernel's
8583standard mechanisms for filling the entropy pool may not be sufficient for
8584systems with high needs or limited user interaction, such as headless servers.
8585
8586@command{haveged} runs as a privileged daemon, harvesting randomness from the
8587indirect effects of hardware events on hidden processor state using the
8588@acronym{HAVEGE, HArdware Volatile Entropy Gathering and Expansion} algorithm.
8589It tunes itself to its environment and provides the same built-in test suite
8590for the output stream as used on certified hardware security devices.
8591
8592The quality of the randomness produced by this algorithm has not been proven.
8593It is recommended to run it together with another entropy source like rngd, and
8594not as a replacement for it.")
8595 (license (list (license:non-copyleft "file://nist/mconf.h")
8596 (license:non-copyleft "file://nist/packtest.c")
8597 license:public-domain ; nist/dfft.c
8598 license:gpl3+)))) ; everything else
8599
8600(define-public hotspot
8601 (package
8602 (name "hotspot")
8603 (version "1.6.0")
8604 (source (origin
8605 (method git-fetch)
8606 (uri (git-reference
8607 (url "https://github.com/KDAB/hotspot")
8608 (commit version)
8609 ;; Include the bundled perfparser and PrefixTickLabels
8610 ;; libraries, which are to be used in source form.
8611 (recursive? #t)))
8612 (file-name (git-file-name name version))
8613 (sha256
8614 (base32
8615 "065pcibr4m2ixjlq9nf45g22f73zsxabll361bjjnmkfv6xhz1r4"))))
8616 (build-system qt-build-system)
8617 (arguments
8618 (list
8619 ;; As mentioned in the option help text, the KAuth helper cannot be
8620 ;; installed to a custom prefix and the build fails with "file cannot
8621 ;; create directory: /polkit-1/actions. Maybe need administrative"
8622 ;; (see: <https://bugs.kde.org/show_bug.cgi?id=363678>).
8623 #:configure-flags #~(list "-DINSTALL_KAUTH_HELPER=OFF"
8624 "-DQT6_BUILD=ON")
8625 #:qtbase qtbase
8626 ;; The 'tst_models' and 'tst_callgraphgenerator' fail, with
8627 ;; the later seemingly requiring sudo or access to the kernel
8628 ;; trace points.
8629 #:test-exclude
8630 (string-append
8631 "("
8632 (string-join
8633 ;; The 'tst_models' expected output doesn't exactly
8634 ;; match.
8635 '("tst_models"
8636 ;; The 'tst_callgraphgenerator' perf invocation
8637 ;; fails when run in the build container.
8638 "tst_callgraphgenerator"
8639 ;; The 'tst_perfparser' test requires sudo/access
8640 ;; to the kernel scheduler trace points.
8641 "tst_perfparser")
8642 "|")
8643 ")")
8644 #:phases
8645 #~(modify-phases %standard-phases
8646 (add-after 'unpack 'patch-perfparser
8647 ;; XXX: This phase is copied from qt-creator: keep them in sync!
8648 (lambda* (#:key inputs #:allow-other-keys)
8649 ;; perfparser attempts to dynamically load the demangle
8650 ;; libraries; use their absolute file name to avoid having to
8651 ;; set LD_LIBRARY_PATH.
8652 (let ((librustc_demangle.so
8653 (with-exception-handler (lambda (ex)
8654 (if (search-error? ex)
8655 #f
8656 (raise-exception ex)))
8657 (lambda ()
8658 (search-input-file inputs "lib/librustc_demangle.so"))
8659 #:unwind? #t)))
8660 (substitute* "3rdparty/perfparser/app/demangler.cpp"
8661 (("loadDemangleLib\\(QStringLiteral\\(\"rustc_demangle\")"
8662 all)
8663 (if librustc_demangle.so
8664 (format #f "loadDemangleLib(QStringLiteral(~s)"
8665 librustc_demangle.so)
8666 all)) ;no rustc_demangle; leave unchanged
8667 (("loadDemangleLib\\(QStringLiteral\\(\"d_demangle\")")
8668 (format #f "loadDemangleLib(QStringLiteral(~s)"
8669 (search-input-file inputs
8670 "lib/libd_demangle.so")))))))
8671 (add-after 'unpack 'path-paths
8672 (lambda* (#:key inputs #:allow-other-keys)
8673 (substitute* "src/perfoutputwidgetkonsole.cpp"
8674 (("\"tail\"")
8675 (format #f "~s" (search-input-file inputs "bin/tail"))))
8676 (substitute* "src/perfrecord.cpp"
8677 (("\"perf( )?\"" _ space)
8678 (string-append "\"" (search-input-file inputs "bin/perf")
8679 (or space "") "\""))))))))
8680 (native-inputs
8681 (list extra-cmake-modules
8682 vulkan-headers))
8683 (inputs
8684 (append
8685 (list coreutils-minimal
8686 d-demangler
8687 elfutils
8688 karchive
8689 kconfig
8690 kcoreaddons
8691 kddockwidgets
8692 kgraphviewer
8693 ki18n
8694 kio
8695 kiconthemes
8696 kitemmodels
8697 kitemviews
8698 knotifications
8699 kparts
8700 ksyntaxhighlighting
8701 kwindowsystem
8702 libxkbcommon
8703 perf
8704 qtdeclarative
8705 qtsvg
8706 solid
8707 threadweaver
8708 `(,zstd "lib"))
8709 (if (supported-package? rust-rustc-demangle-capi-0.1)
8710 (list rust-rustc-demangle-capi-0.1)
8711 '())))
8712 (home-page "https://github.com/KDAB/hotspot")
8713 (synopsis "Performance analysis GUI for Linux perf")
8714 (description "Hotspot is a standalone GUI for performance data analysis.
8715It aims to be similar to KCachegrind, but for data collected with
8716@command{perf}, a profiler for use with the kernel Linux. Its main feature is
8717graphically visualizing a @file{perf.data} file.")
8718 (license (list license:gpl2+ license:gpl3+)))) ;dual licensed
8719
8720(define-public ecryptfs-utils
8721 (package
8722 (name "ecryptfs-utils")
8723 (version "111")
8724 (source
8725 (origin
8726 (method url-fetch)
8727 (uri (string-append "https://launchpad.net/ecryptfs/trunk/"
8728 version "/+download/ecryptfs-utils_"
8729 version ".orig.tar.gz"))
8730 (sha256
8731 (base32
8732 "0zwq19siiwf09h7lwa7n7mgmrr8cxifp45lmwgcfr8c1gviv6b0i"))))
8733 (build-system gnu-build-system)
8734 (arguments
8735 `(#:configure-flags (list "--disable-pywrap")
8736 #:modules (,@%default-gnu-modules
8737 (ice-9 binary-ports)
8738 (rnrs bytevectors)
8739 (srfi srfi-26))
8740 #:phases
8741 (modify-phases %standard-phases
8742 (add-after 'patch-source-shebangs 'patch-hardcoded-paths
8743 (lambda* (#:key inputs outputs #:allow-other-keys)
8744 (let ((out (assoc-ref outputs "out"))
8745 (util-linux (assoc-ref inputs "util-linux"))
8746 (cryptsetup (assoc-ref inputs "cryptsetup-minimal"))
8747 (linux-pam (assoc-ref inputs "linux-pam"))
8748 (lvm2 (assoc-ref inputs "lvm2")))
8749 (substitute* '("src/utils/ecryptfs-mount-private"
8750 "src/utils/ecryptfs-umount-private"
8751 "src/utils/ecryptfs-setup-private"
8752 "src/utils/ecryptfs-setup-swap"
8753 "src/utils/mount.ecryptfs.c"
8754 "src/utils/umount.ecryptfs.c"
8755 "src/pam_ecryptfs/pam_ecryptfs.c"
8756 "src/desktop/ecryptfs-mount-private.desktop.in"
8757 "src/desktop/ecryptfs-setup-private.desktop.in")
8758 (("/bin/mount")
8759 (string-append util-linux "/bin/mount"))
8760 (("/bin/umount")
8761 (string-append util-linux "/bin/umount"))
8762 (("/sbin/mount.ecryptfs_private")
8763 (string-append out "/sbin/mount.ecryptfs_private"))
8764 (("/sbin/umount.ecryptfs_private")
8765 (string-append out "/sbin/umount.ecryptfs_private"))
8766 (("/usr/bin/ecryptfs-mount-private")
8767 (string-append out "/bin/ecryptfs-mount-private"))
8768 (("/usr/bin/ecryptfs-rewrite-file")
8769 (string-append out "/bin/ecryptfs-rewrite-file"))
8770 (("/usr/bin/ecryptfs-setup-private")
8771 (string-append out "/bin/ecryptfs-setup-private"))
8772 (("/sbin/cryptsetup")
8773 (string-append cryptsetup "/sbin/cryptsetup"))
8774 (("/sbin/unix_chkpwd")
8775 (string-append linux-pam "/sbin/unix_chkpwd"))
8776 (("/sbin/dmsetup")
8777 (string-append lvm2 "/sbin/dmsetup"))))))
8778 (add-after 'install 'wrap-scripts
8779 (lambda* (#:key inputs outputs #:allow-other-keys)
8780 (let* ((out (assoc-ref outputs "out"))
8781 (bin (string-append out "/bin"))
8782 (add (map (lambda (bin)
8783 (dirname (search-input-file
8784 inputs (string-append "bin/" bin))))
8785 ;; For simplicity, we wrap all scripts the same.
8786 (list "awk" "find" "gettext" "grep" "keyctl" "ls"
8787 "lsof" "mount" "rsync" "sed" "which")))
8788 (script? (lambda (file)
8789 (call-with-input-file file
8790 (lambda (port)
8791 (bytevector=? (string->utf8 "#!")
8792 (get-bytevector-n port 2)))))))
8793 (for-each (lambda (file)
8794 (when (script? file)
8795 (wrap-program file
8796 ;; '= would be better than 'suffix but break
8797 ;; setuid binaries.
8798 `("PATH" ":" suffix (,@add
8799 ,(string-append bin))))))
8800 (find-files bin "."))))))))
8801 (native-inputs
8802 (list intltool perl ; for pod2man
8803 pkg-config))
8804 (inputs
8805 (list coreutils
8806 cryptsetup-minimal
8807 findutils
8808 gawk
8809 grep
8810 keyutils
8811 linux-pam
8812 lsof
8813 lvm2
8814 nss
8815 rsync
8816 sed
8817 util-linux
8818 which))
8819 (home-page "https://ecryptfs.org/")
8820 (synopsis "Cryptographic file system utilities")
8821 (description
8822 "eCryptfs is a POSIX-compliant stacked cryptographic file system for Linux.
8823Each file's cryptographic meta-data is stored inside the file itself, along
8824with the encrypted contents. This allows individual encrypted files to be
8825copied between hosts and still be decrypted with the proper key. eCryptfs is a
8826native Linux file system, and has been part of the Linux kernel since version
88272.6.19. This package contains the userland utilities to manage it.")
8828 ;; The files src/key_mod/ecryptfs_key_mod_{openssl,pkcs11_helper,tspi}.c
8829 ;; grant additional permission to link with OpenSSL.
8830 (license license:gpl2+)))
8831
8832(define-public module-init-tools
8833 (package
8834 (name "module-init-tools")
8835 (version "3.16")
8836 (source (origin
8837 (method url-fetch)
8838 (uri (string-append
8839 "mirror://kernel.org/linux/utils/kernel/module-init-tools/"
8840 "module-init-tools-" version ".tar.bz2"))
8841 (sha256
8842 (base32
8843 "0jxnz9ahfic79rp93l5wxcbgh4pkv85mwnjlbv1gz3jawv5cvwp1"))
8844 (patches (search-patches "module-init-tools-moduledir.patch"))))
8845 (build-system gnu-build-system)
8846 (arguments
8847 ;; FIXME: The upstream tarball lacks man pages, and building them would
8848 ;; require DocBook & co. We used to use Gentoo's pre-built man pages,
8849 ;; but they vanished. In the meantime, fake it.
8850 '(#:phases
8851 (modify-phases %standard-phases
8852 (add-before 'configure 'fake-docbook
8853 (lambda _
8854 (substitute* "Makefile.in"
8855 (("^DOCBOOKTOMAN.*$")
8856 "DOCBOOKTOMAN = true\n"))
8857 #t)))))
8858 (home-page "https://www.kernel.org/pub/linux/utils/kernel/module-init-tools/")
8859 (synopsis "Tools for loading and managing Linux kernel modules")
8860 (description
8861 "Tools for loading and managing Linux kernel modules, such as
8862@code{modprobe}, @code{insmod}, @code{lsmod}, and more.")
8863 (license license:gpl2+)))
8864
8865(define-public mce-inject
8866 (let ((revision "0") ; no git tags :-/
8867 (commit "4cbe46321b4a81365ff3aafafe63967264dbfec5"))
8868 (package
8869 (name "mce-inject")
8870 (version (git-version "0.0.0" revision commit))
8871 (source
8872 (origin
8873 (method git-fetch)
8874 (uri (git-reference
8875 (url "https://git.kernel.org/pub/scm/utils/cpu/mce/mce-inject.git")
8876 (commit commit)))
8877 (file-name (git-file-name name version))
8878 (sha256
8879 (base32 "0gjapg2hrlxp8ssrnhvc19i3r1xpcnql7xv0zjgbv09zyha08g6z"))))
8880 (build-system gnu-build-system)
8881 (arguments
8882 ;; There is no test suite. There's a test/ directory, but it just holds
8883 ;; example text files you could feed to the programme to crash something.
8884 (list #:tests? #f
8885 #:make-flags
8886 #~(list (string-append "prefix=" #$output)
8887 (string-append "CC=" #$(cc-for-target)))
8888 #:phases
8889 #~(modify-phases %standard-phases
8890 (delete 'configure) ; no configure script
8891 (add-after 'install 'install-examples
8892 (lambda* (#:key outputs #:allow-other-keys)
8893 (let* ((out (assoc-ref outputs "out"))
8894 (doc (string-append out "/share/doc/" #$name))
8895 (dir (string-append doc "/examples")))
8896 (copy-recursively "test" dir )))))))
8897 (native-inputs
8898 (list bison flex))
8899 (supported-systems (list "i686-linux" "x86_64-linux"))
8900 (home-page
8901 "https://git.kernel.org/pub/scm/utils/cpu/mce/mce-inject.git/about/")
8902 (synopsis
8903 "Inject x86 @acronym{MCEs, machine-check exceptions} into Linux")
8904 (description
8905 "This simple tool injects fake @acronym{MCEs, machine-check exceptions}
8906into a running Linux kernel, to debug or test the kernel's @acronym{EDAC, error
8907detection and correction}-handling code specific to x86 and x86_64 platforms.
8908
8909Real MCEs are internal CPU errors. Handling them correctly can be important to
8910system stability and even prevent physical damage. In contrast, simulated MCEs
8911produced by @command{mce-inject} are purely synthetic: injection happens only at
8912the software level, inside the kernel, and is not visible to the platform
8913hardware or firmware.
8914
8915A convenient feature of @command{mce-inject} is that the input language used to
8916describe MCEs is similar to the format used in Linux panic messages, with a few
8917extensions. In general, you should be able to pipe in any logged MCE panic to
8918simulate that same MCE.
8919
8920The target kernel must have the @code{CONFIG_X86_MCE_INJECT} option enabled and
8921the @code{mce-inject} module loaded if it exists.")
8922 (license license:gpl2))))
8923
8924(define-public mcelog
8925 (package
8926 (name "mcelog")
8927 (version "195")
8928 (source
8929 (origin
8930 (method git-fetch)
8931 (uri (git-reference
8932 (url "https://git.kernel.org/pub/scm/utils/cpu/mce/mcelog.git")
8933 (commit (string-append "v" version))))
8934 (file-name (git-file-name name version))
8935 (sha256
8936 (base32 "1bg2bj8flybd8kzmmaaslisc6lc1fs9nbv09im6r32dq48skx5aj"))
8937 (modules '((guix build utils)))
8938 (snippet
8939 `(begin
8940 ;; The checkout lacks a .git directory, breaking ‘git describe’.
8941 (substitute* "Makefile"
8942 (("\"unknown\"") (string-append "\"v" ,version "\"")))))))
8943 (build-system gnu-build-system)
8944 (arguments
8945 (list
8946 ;; The tests will only run as root on certain supported CPU models.
8947 #:tests? #f
8948 #:make-flags
8949 #~(list (string-append "CC=" #$(cc-for-target))
8950 (string-append "prefix=" #$output)
8951 (string-append "DOCDIR=" #$output "/share/doc/"
8952 #$name "-" #$version)
8953 "etcprefix=$(DOCDIR)/examples")
8954 #:phases
8955 #~(modify-phases %standard-phases
8956 (delete 'configure)))) ; no configure script
8957 (native-inputs
8958 (list python-wrapper)) ; to generate example mcelog.conf
8959 (supported-systems (list "i686-linux" "x86_64-linux"))
8960 (home-page "https://mcelog.org/")
8961 (synopsis "Machine check monitor for x86 Linux systems")
8962 (description
8963 "The mcelog daemon logs memory, I/O, CPU, and other hardware errors on x86
8964systems running the kernel Linux. It can also perform user-defined tasks, such
8965as bringing bad pages off-line, when configurable error thresholds are
8966exceeded.")
8967 (license license:gpl2)))
8968
8969(define-public mtd-utils
8970 (package
8971 (name "mtd-utils")
8972 (version "2.1.5")
8973 (source (origin
8974 (method url-fetch)
8975 (uri (string-append
8976 "ftp://ftp.infradead.org/pub/mtd-utils/"
8977 "mtd-utils-" version ".tar.bz2"))
8978 (sha256
8979 (base32
8980 "0ilz8hkcyvfcnqpy25kbr8fb71x9vl28wbmw56vvd68n2byjfviq"))))
8981 (arguments
8982 (list #:configure-flags
8983 (if (%current-target-system) ; When cross-compiling.
8984 #~(list)
8985 #~(list "--enable-unit-tests"))
8986
8987 #:parallel-tests? #f)) ;tests may fail when running in parallel
8988 (native-inputs
8989 (list cmocka pkg-config))
8990 (inputs
8991 (list acl ; extended attributes (xattr)
8992 lzo
8993 openssl ; optional crypto support
8994 `(,util-linux "lib")
8995 zlib
8996 `(,zstd "lib")))
8997 (build-system gnu-build-system)
8998 (synopsis "MTD Flash Storage Utilities")
8999 (description "This package provides utilities for testing, partitioning, etc
9000of flash storage.")
9001 (home-page "http://www.linux-mtd.infradead.org/")
9002 (license
9003 (list license:gpl2 ; Almost everything is gpl2 or gpl2+
9004 license:mpl1.1 ; All ftl* files
9005 license:expat)))) ; libiniparser
9006
9007(define-public libseccomp
9008 (package
9009 (name "libseccomp")
9010 (version "2.6.0")
9011 (source (origin
9012 (method git-fetch)
9013 (uri (git-reference
9014 (url "https://github.com/seccomp/libseccomp")
9015 (commit (string-append "v" version))))
9016 (file-name (git-file-name name version))
9017 (sha256
9018 (base32
9019 "189yh66aj3z3jvns739qbj504f3mcl3w44pxxizw877pbj3kal11"))))
9020 (build-system gnu-build-system)
9021 (arguments
9022 (list
9023 #:configure-flags #~(list "--disable-static")
9024 #:phases #~(modify-phases %standard-phases
9025 #$@(if (target-ppc32?)
9026 ;; This test is removed upstream. See upstream commit
9027 ;; 7db46d72f13c172b290818f624c2966bd0db5677
9028 #~((add-after 'unpack 'skip-62-sim-arch-tests
9029 (lambda _
9030 (substitute*
9031 "tests/62-sim-arch_transactions.tests"
9032 (("test type: bpf-sim-fuzz") "")
9033 (("62-sim-arch_transactions 5") "")))))
9034 #~())
9035 (add-before 'check 'skip-load-test
9036 (lambda _
9037 ;; This test does a native system call and fails when
9038 ;; run under QEMU user-mode emulation. Just skip it.
9039 (delete-file "tests/52-basic-load.tests"))))))
9040 (native-inputs
9041 (list autoconf automake gperf libtool which))
9042 (synopsis "Interface to Linux's seccomp syscall filtering mechanism")
9043 (description "The libseccomp library provides an easy to use, platform
9044independent, interface to the Linux Kernel's syscall filtering mechanism. The
9045libseccomp API is designed to abstract away the underlying BPF based syscall
9046filter language and present a more conventional function-call based filtering
9047interface that should be familiar to, and easily adopted by, application
9048developers.")
9049 (home-page "https://github.com/seccomp/libseccomp")
9050 (license license:lgpl2.1)))
9051
9052(define-public radeontop
9053 (package
9054 (name "radeontop")
9055 (version "1.4")
9056 (source
9057 (origin
9058 (method git-fetch)
9059 (uri (git-reference
9060 (url "https://github.com/clbr/radeontop")
9061 (commit (string-append "v" version))))
9062 (file-name (git-file-name name version))
9063 (sha256
9064 (base32 "0kwqddidr45s1blp0h8r8h1dd1p50l516yb6mb4s6zsc827xzgg3"))))
9065 (build-system gnu-build-system)
9066 (arguments
9067 `(#:phases (modify-phases %standard-phases
9068 ;; getver.sh uses ‘git --describe’, isn't worth an extra git
9069 ;; dependency, and doesn't even work on release(!) tarballs.
9070 (add-after 'unpack 'report-correct-version
9071 (lambda _
9072 (substitute* "getver.sh"
9073 (("ver=unknown")
9074 (string-append "ver=" ,version)))))
9075 (delete 'configure)) ; no configure script
9076 #:make-flags (list (string-append "CC=" ,(cc-for-target))
9077 (string-append "PREFIX=" %output))
9078 #:tests? #f)) ; no tests
9079 (native-inputs
9080 (list gettext-minimal pkg-config))
9081 (inputs
9082 (list libdrm libpciaccess libxcb ncurses))
9083 (home-page "https://github.com/clbr/radeontop/")
9084 (synopsis "Usage monitor for AMD Radeon graphics")
9085 (description "RadeonTop monitors resource consumption on supported AMD
9086Radeon Graphics Processing Units (GPUs), either in real time as bar graphs on
9087a terminal or saved to a file for further processing. It measures both the
9088activity of the GPU as a whole, which is also accurate during OpenCL
9089computations, as well as separate component statistics that are only meaningful
9090under OpenGL graphics workloads.")
9091 (license license:gpl3)))
9092
9093(define-public efivar
9094 (package
9095 (name "efivar")
9096 (version "39")
9097 (source (origin
9098 (method git-fetch)
9099 (uri (git-reference
9100 (url "https://github.com/rhboot/efivar")
9101 (commit version)))
9102 (file-name (git-file-name name version))
9103 (sha256
9104 (base32
9105 "1zd9dghg1z2rrsazv3d9rj7nik6kdqz42jiak65pipz7mpjn9zdk"))
9106 (patches (search-patches "efivar-fix-fprint-format.patch"))))
9107 (build-system gnu-build-system)
9108 (arguments
9109 (list
9110 ;; Tests require a UEFI system and is not detected in the chroot.
9111 #:tests? #f
9112 #:make-flags #~(list (string-append "prefix="
9113 #$output)
9114 (string-append "libdir="
9115 #$output "/lib")
9116 (string-append "CC="
9117 #$(cc-for-target))
9118 "HOSTCC=gcc"
9119 (string-append "LDFLAGS=-Wl,-rpath="
9120 #$output "/lib")
9121 ;; Strictly only needed for i686-linux/32bit
9122 "CFLAGS=-g -O2 -Wno-error=format")
9123 #:phases #~(modify-phases %standard-phases
9124 (add-after 'unpack 'build-deterministically
9125 (lambda _
9126 (substitute* "src/include/defaults.mk"
9127 ;; Don't use -march=native.
9128 (("-march=native")
9129 ""))))
9130 (delete 'configure))))
9131 (native-inputs (list mandoc pkg-config))
9132 (inputs (list popt))
9133 (home-page "https://github.com/rhboot/efivar")
9134 (synopsis "Tool and library to manipulate EFI variables")
9135 (description "This package provides a library and a command line
9136interface to the variable facility of UEFI boot firmware.")
9137 (license license:lgpl2.1+)))
9138
9139(define-public efibootmgr
9140 (package
9141 (name "efibootmgr")
9142 (version "18")
9143 (source
9144 (origin
9145 (method git-fetch)
9146 (uri (git-reference
9147 (url "https://github.com/rhboot/efibootmgr")
9148 (commit version)))
9149 (file-name (git-file-name name version))
9150 (sha256
9151 (base32 "1j19m3dngcb7jl88ib32phbh5r7c02dhhakq8jk6z7y408c111hd"))))
9152 (build-system gnu-build-system)
9153 (arguments
9154 (list
9155 #:tests? #f ;no tests
9156 #:make-flags
9157 #~(append (list (string-append "prefix=" #$output)
9158 (string-append "libdir=" #$output "/lib")
9159 ;; EFIDIR denotes a subdirectory relative to the
9160 ;; EFI System Partition where the loader will be
9161 ;; installed (known as OS_VENDOR in the code).
9162 ;; GRUB overrides this, as such it's only used if
9163 ;; nothing else is specified on the command line.
9164 "EFIDIR=gnu")
9165 #$(if (%current-target-system)
9166 #~(list
9167 (string-append "CC=" #$(cc-for-target))
9168 (string-append "PKG_CONFIG=" #$(pkg-config-for-target))
9169 (string-append "EXTRAINCDIRS="
9170 #$(this-package-input "efivar") "/include"))
9171 #~'()))
9172 #:phases #~(modify-phases %standard-phases (delete 'configure))))
9173 (native-inputs
9174 (list pkg-config))
9175 (inputs
9176 (list efivar popt))
9177 (home-page "https://github.com/rhboot/efibootmgr")
9178 (synopsis "Modify the Extensible Firmware Interface (EFI) boot manager")
9179 (description
9180 "@code{efibootmgr} is a user-space application to modify the Intel
9181Extensible Firmware Interface (EFI) Boot Manager. This application can
9182create and destroy boot entries, change the boot order, change the next
9183running boot option, and more.")
9184 (license license:gpl2+)))
9185
9186(define-public sysstat
9187 (package
9188 (name "sysstat")
9189 (version "12.7.5")
9190 (source
9191 (origin
9192 (method url-fetch)
9193 (uri (string-append "https://sysstat.github.io/sysstat-packages/"
9194 "sysstat-" version ".tar.xz"))
9195 (sha256
9196 (base32 "0ssdrm3k0fclq5b5i0aznfwdkbac9l9cf88idaq3pls9lm040rjp"))))
9197 (build-system gnu-build-system)
9198 (native-inputs (list gettext-minimal))
9199 (arguments
9200 `(#:tests? #f ; no test suite.
9201 ;; Without this flag, it tries to install the man pages with group 'root'
9202 ;; and fails because /etc/passwd lacks an entry for the root user.
9203 #:configure-flags
9204 (list "--disable-file-attr"
9205 (string-append "conf_dir=" (assoc-ref %outputs "out") "/etc"))
9206 #:phases
9207 (modify-phases %standard-phases
9208 ;; The build process tries to create '/var/lib/sa', so we skip that
9209 ;; instruction.
9210 (add-after 'build 'skip-touching-var
9211 (lambda _
9212 (substitute* "Makefile"
9213 (("mkdir -p \\$\\(DESTDIR\\)\\$\\(SA_DIR\\)")
9214 "")))))))
9215 (home-page "https://sysstat.github.io")
9216 (synopsis "Performance monitoring tools for Linux")
9217 (description "The sysstat utilities are a collection of performance
9218monitoring tools for Linux. These include @code{mpstat}, @code{iostat},
9219@code{tapestat}, @code{cifsiostat}, @code{pidstat}, @code{sar}, @code{sadc},
9220@code{sadf} and @code{sa}.")
9221 (license license:gpl2+)))
9222
9223(define-public acpilight
9224 (package
9225 (name "acpilight")
9226 (version "1.2")
9227 (source (origin
9228 (method git-fetch)
9229 (uri (git-reference
9230 (url "https://gitlab.com/wavexx/acpilight.git")
9231 (commit (string-append "v" version))))
9232 (file-name (git-file-name name version))
9233 (sha256
9234 (base32
9235 "1r0r3nx6x6vkpal6vci0zaa1n9dfacypldf6k8fxg7919vzxdn1w"))))
9236 (build-system gnu-build-system)
9237 (arguments
9238 (list #:tests? #f ; no tests
9239 #:make-flags
9240 #~(list (string-append "prefix=" #$output)
9241 (string-append "sysconfdir=" #$output "/lib")) ;udev rule
9242 #:phases
9243 #~(modify-phases %standard-phases
9244 (delete 'configure)
9245 (add-after 'unpack 'patch
9246 (lambda* (#:key inputs #:allow-other-keys)
9247 ;; Prevent reloading udev at build time
9248 (substitute* "Makefile"
9249 (("udevadm") "true"))
9250 (substitute* "90-backlight.rules"
9251 (("/bin")
9252 (string-append #$(this-package-input "coreutils")
9253 "/bin"))))))))
9254 (inputs (list coreutils python))
9255 (home-page "https://gitlab.com/wavexx/acpilight")
9256 (synopsis "Backward-compatibile xbacklight replacement")
9257 (description "acpilight is a backward-compatibile replacement for
9258xbacklight that uses the ACPI interface to set the display brightness. On
9259modern laptops acpilight can control both display and keyboard backlight
9260uniformly on either X11, the console or Wayland.")
9261 (license license:gpl3+)))
9262
9263(define-public light
9264 (package
9265 (name "light")
9266 (version "1.2.2")
9267 (source
9268 (origin
9269 (method git-fetch)
9270 (uri (git-reference
9271 (url "https://github.com/haikarainen/light")
9272 (commit (string-append "v" version))))
9273 (sha256
9274 (base32 "1a70zcf88ifsnwll486aicjnh48zisdf8f7vi34ihw61kdadsq9s"))
9275 (file-name (git-file-name name version))))
9276 (build-system gnu-build-system)
9277 (arguments
9278 `(#:configure-flags '("CFLAGS=-fcommon")
9279 #:phases
9280 (modify-phases %standard-phases
9281 (add-after 'unpack 'patch-udev-rules-absolute-path-bins
9282 (lambda* (#:key inputs #:allow-other-keys)
9283 (substitute* "90-backlight.rules"
9284 (("/bin/chgrp") (which "chgrp"))
9285 (("/bin/chmod") (which "chmod")))
9286 #t))
9287 (add-after 'install 'install-udev-rules
9288 (lambda* (#:key outputs #:allow-other-keys)
9289 (let ((out (assoc-ref outputs "out")))
9290 (install-file
9291 "90-backlight.rules" (string-append out "/lib/udev/rules.d"))
9292 #t))))))
9293 (native-inputs
9294 (list autoconf automake))
9295 (home-page "https://haikarainen.github.io/light/")
9296 (synopsis "GNU/Linux application to control backlights")
9297 (description
9298 "Light is a program to send commands to screen backlight controllers
9299under GNU/Linux. Features include:
9300
9301@itemize
9302@item It does not rely on X.
9303@item Light can automatically figure out the best controller to use, making
9304full use of underlying hardware.
9305@item It is possible to set a minimum brightness value, as some controllers
9306set the screen to be pitch black at a value of 0 (or higher).
9307@end itemize\n")
9308 (license license:gpl3+)))
9309
9310(define-public brightnessctl
9311 (package
9312 (name "brightnessctl")
9313 (version "0.5.1")
9314 (home-page "https://github.com/Hummer12007/brightnessctl")
9315 (source (origin
9316 (method git-fetch)
9317 (uri (git-reference (url home-page) (commit version)))
9318 (file-name (git-file-name name version))
9319 (sha256
9320 (base32
9321 "0immxc7almmpg80n3bdn834p3nrrz7bspl2syhb04s3lawa5y2lq"))
9322 (patches (search-patches "brightnessctl-elogind-support.patch"))))
9323 (build-system gnu-build-system)
9324 (arguments
9325 `(#:tests? #f ; no tests
9326 #:make-flags (list (string-append "CC=" ,(cc-for-target))
9327 (string-append "PREFIX=" %output)
9328 (string-append "UDEVDIR=" %output "/lib/udev/rules.d/")
9329 "ENABLE_SYSTEMD=1")
9330 #:phases
9331 (modify-phases %standard-phases
9332 (delete 'configure)
9333 (add-after 'unpack 'adjust-udev-rules
9334 (lambda _
9335 (substitute* "Makefile"
9336 (("INSTALL_UDEV_RULES=0") "INSTALL_UDEV_RULES=1"))
9337 (substitute* "90-brightnessctl.rules"
9338 (("/bin/") "/run/current-system/profile/bin/"))
9339 #t)))))
9340 (native-inputs
9341 (list pkg-config))
9342 (inputs
9343 (list elogind))
9344 (synopsis "Backlight and LED brightness control")
9345 (description
9346 "This program allows you read and control device brightness. Devices
9347include backlight and LEDs. It can also preserve current brightness before
9348applying the operation, such as on lid close.
9349
9350The appropriate permissions must be set on the backlight or LED control
9351interface in sysfs, which can be accomplished with the included udev rules.")
9352 (license license:expat)))
9353
9354(define-public tlp
9355 (package
9356 (name "tlp")
9357 (version "1.9.0")
9358 (source
9359 (origin
9360 (method git-fetch)
9361 (uri (git-reference
9362 (url "https://github.com/linrunner/TLP")
9363 (commit version)))
9364 (file-name (git-file-name name version))
9365 (sha256
9366 (base32 "0msskz42yy0ddq6gqak0dsl77wsym24ly3bkpymfwl9dr3wzikv8"))))
9367 (native-inputs
9368 (list shellcheck))
9369 (inputs
9370 `(("dbus" ,dbus)
9371 ("ethtool" ,ethtool)
9372 ("eudev" ,eudev)
9373 ("grep" ,grep)
9374 ("guile" ,guile-3.0) ;for wrap-script
9375 ("hdparm" ,hdparm)
9376 ("inetutils" ,inetutils)
9377 ("iw" ,iw)
9378 ("kmod" ,kmod)
9379 ("pciutils" ,pciutils)
9380 ("perl" ,perl)
9381 ("sed" ,sed)
9382 ("usbutils" ,usbutils)
9383 ("util-linux" ,util-linux)
9384 ("wireless-tools" ,wireless-tools)
9385 ,@(if (let ((system (or (%current-target-system)
9386 (%current-system))))
9387 (or (string-prefix? "i686-" system)
9388 (string-prefix? "x86_64-" system)))
9389 `(("x86-energy-perf-policy" ,x86-energy-perf-policy))
9390 '())))
9391 (build-system gnu-build-system)
9392 (arguments
9393 ;; XXX: The full test suite is run with "checkall" but it requires
9394 ;; "checkbashisms" and "perlcritic", not yet packaged in Guix.
9395 (list
9396 #:make-flags
9397 #~(list "TLP_CONFUSR=/etc/tlp.conf" "TLP_CONFDIR=/etc/tlp.d")
9398 #:test-target "shellcheck"
9399 #:modules '((guix build gnu-build-system)
9400 (guix build utils)
9401 (srfi srfi-1))
9402 #:phases
9403 #~(modify-phases %standard-phases
9404 (delete 'configure) ; no configure script
9405 (add-before 'build 'setenv
9406 (lambda _
9407 (setenv "TLP_WITH_SYSTEMD" "0")
9408 (setenv "TLP_NO_INIT" "1")))
9409 (add-before 'build 'fix-installation
9410 (lambda _
9411 ;; Stop the Makefile from trying to create system directories.
9412 (substitute* "Makefile"
9413 (("= /usr") (string-append "= " #$output))
9414 (("= /etc") (string-append "= " #$output "/etc"))
9415 (("install -d -m 755 \\$\\(_VAR\\)") "#"))))
9416 (add-before 'build 'fix-perl-calls
9417 ;; Shell scripts in "bat.d" and "func.d" call "perl". Fix
9418 ;; invocation without wrapping every one of them.
9419 (lambda* (#:key inputs #:allow-other-keys)
9420 (substitute* (append (find-files "bat.d" ".")
9421 (find-files "func.d" "."))
9422 (("(^|[^/])perl" _ prefix)
9423 (string-append prefix
9424 (search-input-file inputs "bin/perl"))))))
9425 (replace 'install
9426 (lambda _ (invoke "make" "install-tlp" "install-man-tlp")))
9427 (add-after 'install 'wrap
9428 (lambda* (#:key inputs outputs #:allow-other-keys)
9429 (let* ((bin (string-append (assoc-ref outputs "out") "/bin"))
9430 (sbin (string-append (assoc-ref outputs "out") "/sbin"))
9431 ;; Used to ignore symlinks which don't need wrapping
9432 (regular-file-predicate
9433 (lambda (file stat) (eq? 'regular (stat:type stat))))
9434 (bin-files (find-files bin regular-file-predicate))
9435 (sbin-files (find-files sbin regular-file-predicate)))
9436 (define (bin-directory input-name)
9437 (let ((p (assoc-ref inputs input-name)))
9438 (and p (string-append p "/bin"))))
9439 (define (sbin-directory input-name)
9440 (string-append (assoc-ref inputs input-name) "/sbin"))
9441 (for-each (lambda (program)
9442 ;; Programs rely on $0 so we use wrap-script
9443 ;; instead of wrap-program
9444 (wrap-script program
9445 `("PATH" ":" prefix
9446 ,(append
9447 (filter-map bin-directory
9448 '("bash"
9449 "coreutils"
9450 "dbus"
9451 "eudev"
9452 "grep"
9453 "inetutils"
9454 "kmod"
9455 "perl"
9456 "sed"
9457 "usbutils"
9458 "util-linux"
9459 "x86-energy-perf-policy"))
9460 (filter-map sbin-directory
9461 '("ethtool"
9462 "hdparm"
9463 "iw"
9464 "pciutils"
9465 "util-linux"
9466 "wireless-tools"))))))
9467 (append bin-files sbin-files))))))))
9468 (home-page "https://linrunner.de/en/tlp/tlp.html")
9469 (synopsis "Power management tool for Linux")
9470 (description "TLP is a power management tool for Linux. It comes with
9471a default configuration already optimized for battery life. Nevertheless,
9472TLP is customizable to fulfil system requirements. TLP settings are applied
9473every time the power supply source is changed.")
9474 ;; 'COPYING' is a custom version that says that one file is GPLv3+ and the
9475 ;; rest is GPLv2+.
9476 (license (list license:gpl2+ license:gpl3+))))
9477
9478(define-public tlpui
9479 (package
9480 (name "tlpui")
9481 (version "1.9.0")
9482 (source
9483 (origin
9484 (method git-fetch)
9485 (uri (git-reference
9486 (url "https://github.com/d4nj1/TLPUI")
9487 (commit (string-append "tlpui-" version))))
9488 (file-name (git-file-name name version))
9489 (sha256
9490 (base32 "00rkq389zs525s7ckjj6cm34s25rsrgz47p28pp43ld35i538g9w"))))
9491 (build-system pyproject-build-system)
9492 (arguments
9493 (list
9494 #:phases
9495 #~(modify-phases %standard-phases
9496 (add-after 'unpack 'set-absolute-locations
9497 (lambda* (#:key inputs #:allow-other-keys)
9498 (let ((defaults.conf
9499 (search-input-file inputs "/share/tlp/defaults.conf"))
9500 (lspci (search-input-file inputs "/bin/lspci"))
9501 (lsusb (search-input-file inputs "/bin/lsusb"))
9502 (tlp-stat (search-input-file inputs "/bin/tlp-stat")))
9503 (with-directory-excursion "tlpui"
9504 (substitute* '("file.py" "settingshelper.py" "statui.py")
9505 (("\"tlp-stat\"")
9506 (string-append "'" tlp-stat "'"))
9507 (("/usr/share/tlp/defaults.conf")
9508 defaults.conf))
9509 (substitute* "ui_config_objects/gtkusblist.py"
9510 (("\"lsusb\"")
9511 (string-append "'" lsusb "'")))
9512 (substitute* "ui_config_objects/gtkpcilist.py"
9513 (("\"lspci\"")
9514 (string-append "'" lspci "'")))
9515 ;; Settings check if various tlp executables, lspci and
9516 ;; usbutils are available. Skip this phase since we know
9517 ;; for sure they are (and it avoids patching each location).
9518 (substitute* "settingshelper.py"
9519 (("(command_exists = ).*" _ lead)
9520 (string-append lead "True\n")))))))
9521 (add-after 'install 'install-desktop-file
9522 (lambda _
9523 (let ((dir (string-append #$output "/share/applications")))
9524 (install-file "tlpui.desktop" dir))))
9525 (add-after 'wrap 'wrap-gi-python
9526 (lambda _
9527 (let ((gi-typelib-path (getenv "GI_TYPELIB_PATH")))
9528 (wrap-program (string-append #$output "/bin/tlpui")
9529 `("GI_TYPELIB_PATH" ":" prefix (,gi-typelib-path)))))))))
9530 (native-inputs
9531 (list `(,glib "bin")
9532 gobject-introspection
9533 python-poetry-core
9534 python-pytest
9535 python-pyyaml))
9536 (inputs
9537 (list gtk+
9538 pciutils
9539 python-pygobject
9540 tlp
9541 usbutils))
9542 (propagated-inputs (list (librsvg-for-system)))
9543 (home-page "https://github.com/d4nj1/TLPUI")
9544 (synopsis "User interface for TLP written in Python")
9545 (description
9546 "The Python scripts in this project generate a GTK-UI to change
9547TLP configuration files easily. It aims to protect users from setting
9548bad configuration and to deliver a basic overview of all the valid
9549configuration values.")
9550 (license license:gpl2+)))
9551
9552(define-public lshw
9553 (package
9554 (name "lshw")
9555 (version "B.02.19.2")
9556 (source (origin
9557 (method url-fetch)
9558 (uri (string-append "https://www.ezix.org/software/"
9559 "files/lshw-" version
9560 ".tar.gz"))
9561 (sha256
9562 (base32
9563 "100gm1c6gb2hkfws22h0xhvv7nz38p49lxd1csikj8qlhyn4gcwv"))))
9564 (build-system gnu-build-system)
9565 (arguments
9566 `(#:phases (modify-phases %standard-phases (delete 'configure))
9567 #:tests? #f ; no tests
9568 #:make-flags
9569 (list (string-append "PREFIX=" (assoc-ref %outputs "out")))))
9570 (synopsis "List hardware information")
9571 (description
9572 "@command{lshw} (Hardware Lister) is a small tool to provide
9573detailed information on the hardware configuration of the machine.
9574It can report exact memory configuration, firmware version, mainboard
9575configuration, CPU version and speed, cache configuration, bus speed,
9576and more on DMI-capable x86 or EFI (IA-64) systems and on some PowerPC
9577machines (PowerMac G4 is known to work).")
9578 (home-page "https://www.ezix.org/project/wiki/HardwareLiSter")
9579 (license license:gpl2+)))
9580
9581(define-public libmnl
9582 (package
9583 (name "libmnl")
9584 (version "1.0.5")
9585 (source
9586 (origin
9587 (method url-fetch)
9588 (uri (string-append "mirror://netfilter.org/libmnl/"
9589 "libmnl-" version ".tar.bz2"))
9590 (sha256
9591 (base32
9592 "09851ns07399rbz0y8slrlmnw3fn1nakr8d37pxjn5gkks8rnjr7"))))
9593 (build-system gnu-build-system)
9594 (home-page "https://www.netfilter.org/projects/libmnl/")
9595 (synopsis "Netlink utility library")
9596 (description "Libmnl is a minimalistic user-space library oriented to
9597Netlink developers. There are a lot of common tasks in parsing, validating,
9598constructing of both the Netlink header and TLVs that are repetitive and easy to
9599get wrong. This library aims to provide simple helpers that allows you to
9600re-use code and to avoid re-inventing the wheel.")
9601 (properties
9602 '((release-monitoring-url . "https://www.netfilter.org/pub/libmnl/")))
9603 (license license:lgpl2.1+)))
9604
9605(define-public libnftnl
9606 (package
9607 (name "libnftnl")
9608 (version "1.2.8")
9609 (source
9610 (origin
9611 (method url-fetch)
9612 (uri (string-append "mirror://netfilter.org/libnftnl/"
9613 "libnftnl-" version ".tar.xz"))
9614 (sha256
9615 (base32 "15ddcyp91lxjh2wfi8xicjpffhn9rpiqsa8djbkqvc69npbabzip"))))
9616 (build-system gnu-build-system)
9617 (native-inputs
9618 (list pkg-config))
9619 (inputs
9620 (list libmnl))
9621 (home-page "https://www.netfilter.org/projects/libnftnl/index.html")
9622 (synopsis "Netlink programming interface to the Linux nf_tables subsystem")
9623 (description "Libnftnl is a userspace library providing a low-level netlink
9624programming interface to the in-kernel nf_tables subsystem. The library
9625libnftnl has been previously known as libnftables. This library is currently
9626used by nftables.")
9627 (license license:gpl2+)))
9628
9629;;; The symbol libnftl/fixed should be used when libnftnl needs fixes
9630;;; (security or else) and this deprecation could be removed.
9631(define-deprecated/public-alias libnftnl/fixed libnftnl/pinned)
9632
9633;; This is used in iptables, which contributes to rust. We're pinning this
9634;; variant to avoid accidental rebuilds of rust.
9635(define-public libnftnl/pinned
9636 (package
9637 (inherit libnftnl)
9638 (version "1.2.8")
9639 (source
9640 (origin
9641 (method url-fetch)
9642 (uri (string-append "mirror://netfilter.org/libnftnl/"
9643 "libnftnl-" version ".tar.xz"))
9644 (sha256
9645 (base32 "15ddcyp91lxjh2wfi8xicjpffhn9rpiqsa8djbkqvc69npbabzip"))))
9646 (build-system gnu-build-system)
9647 (native-inputs
9648 (list pkg-config))
9649 (inputs
9650 (list libmnl))))
9651
9652(define-public nftables
9653 (package
9654 (name "nftables")
9655 (version "1.0.8")
9656 (source
9657 (origin
9658 (method url-fetch)
9659 (uri (list (string-append "mirror://netfilter.org/nftables/nftables-"
9660 version ".tar.xz")
9661 (string-append "https://www.nftables.org/projects/nftables"
9662 "/files/nftables-" version ".tar.xz")))
9663 (sha256
9664 (base32 "0l1xpwr9qfbl3bxa97v8s2lbibiz0xma9q0qi34xp0hswh6p8wwk"))))
9665 (build-system gnu-build-system)
9666 (arguments `(#:configure-flags
9667 '("--disable-static"
9668 "--with-cli=readline"
9669 "--with-json")
9670 #:phases
9671 (modify-phases %standard-phases
9672 (add-before 'configure 'autoreconf
9673 (lambda _
9674 (invoke "autoreconf" "-fi"))))))
9675 (inputs (list gmp libmnl libnftnl readline jansson))
9676 (native-inputs (list pkg-config
9677 bison
9678 flex
9679 docbook2x
9680 autoconf
9681 automake
9682 libtool))
9683 (home-page "https://www.nftables.org")
9684 (synopsis "Userspace utility for Linux packet filtering")
9685 (description "nftables is the project that aims to replace the existing
9686{ip,ip6,arp,eb}tables framework. Basically, this project provides a new packet
9687filtering framework, a new userspace utility and also a compatibility layer for
9688{ip,ip6}tables. nftables is built upon the building blocks of the Netfilter
9689infrastructure such as the existing hooks, the connection tracking system, the
9690userspace queueing component and the logging subsystem.")
9691 (license license:gpl2)))
9692
9693(define-public libnetfilter-conntrack
9694 (package
9695 (name "libnetfilter-conntrack")
9696 (version "1.0.9")
9697 (source
9698 (origin
9699 (method url-fetch)
9700 (uri (string-append "https://netfilter.org/projects/"
9701 "libnetfilter_conntrack/files/"
9702 "libnetfilter_conntrack-"
9703 version ".tar.bz2"))
9704 (sha256
9705 (base32 "1a3rnpsba64dzy97wwjrxal89wr0nf9znvag2j18nkp3kzs9vgb7"))))
9706 (build-system gnu-build-system)
9707 (native-inputs (list pkg-config))
9708 (inputs (list libnfnetlink libmnl))
9709 (synopsis "Library for kernel connection tracking state table")
9710 (description "libnetfilter_conntrack is a userspace library providing a
9711programming interface (API) to the in-kernel connection tracking state table.
9712The library libnetfilter_conntrack has been previously known as
9713libnfnetlink_conntrack and libctnetlink. This library is currently used by
9714conntrack-tools among many other applications.")
9715 (home-page "https://netfilter.org/projects/libnetfilter_conntrack/index.html")
9716 (supported-systems (filter target-linux? %supported-systems))
9717 (properties '((upstream-name . "libnetfilter_conntrack")))
9718 (license license:gpl2+)))
9719
9720(define-public libnetfilter-cttimeout
9721 (package
9722 (name "libnetfilter-cttimeout")
9723 (version "1.0.1")
9724 (source
9725 (origin
9726 (method url-fetch)
9727 (uri (string-append "https://netfilter.org/projects/"
9728 "libnetfilter_cttimeout/files/"
9729 "libnetfilter_cttimeout-" version ".tar.bz2"))
9730 (sha256
9731 (base32 "0983cpyvxyycbnzqlrzml80pph2z51r6s7sxp06ciq8468pxln8b"))))
9732 (build-system gnu-build-system)
9733 (native-inputs (list pkg-config))
9734 (inputs (list libmnl))
9735 (synopsis "Library for kernel connection tracking timeout infrastructure")
9736 (description "libnetfilter_cttimeout is the userspace library that
9737provides the programming interface to the fine-grain connection tracking
9738timeout infrastructure. With this library, you can create, update and delete
9739timeout policies that can be attached to traffic flows. This library is used
9740by conntrack-tools.")
9741 (home-page "https://netfilter.org/projects/libnetfilter_cttimeout/index.html")
9742 (supported-systems (filter target-linux? %supported-systems))
9743 (properties '((upstream-name . "libnetfilter_cttimeout")))
9744 (license license:gpl2)))
9745
9746(define-public libnetfilter-cthelper
9747 (package
9748 (name "libnetfilter-cthelper")
9749 (version "1.0.1")
9750 (source
9751 (origin
9752 (method url-fetch)
9753 (uri (string-append "https://netfilter.org/projects/"
9754 "libnetfilter_cthelper/files/"
9755 "libnetfilter_cthelper-" version ".tar.bz2"))
9756 (sha256
9757 (base32 "04n95ngil5l8m8v64dfjm1dwq0wd3kf4vw1zblsrff13hxa3s1ql"))))
9758 (build-system gnu-build-system)
9759 (native-inputs (list pkg-config))
9760 (inputs (list libmnl))
9761 (synopsis "Library for user-space connection tracking helpers")
9762 (description "libnetfilter_cthelper is a userspace library that provides a
9763programming interface to user-space connection tracking helpers.
9764@enumerate
9765@item
9766register new user-space connection tracking helpers
9767@item
9768unregister user-space connection tracking helpers
9769@item
9770list existing registered user-space connection tracking helpers
9771@end enumerate")
9772 (home-page "https://netfilter.org/projects/libnetfilter_cthelper/index.html")
9773 (supported-systems (filter target-linux? %supported-systems))
9774 (properties '((upstream-name . "libnetfilter_cthelper")))
9775 (license license:gpl2+)))
9776
9777(define-public libnetfilter-queue
9778 (package
9779 (name "libnetfilter-queue")
9780 (version "1.0.5")
9781 (source
9782 (origin
9783 (method url-fetch)
9784 (uri (string-append "https://netfilter.org/projects/"
9785 "libnetfilter_queue/files/"
9786 "libnetfilter_queue-" version ".tar.bz2"))
9787 (sha256
9788 (base32
9789 "1xdra6i4p8jkv943ygjw646qx8df27f7p5852kc06vjx608krzzr"))))
9790 (build-system gnu-build-system)
9791 (native-inputs (list pkg-config))
9792 (inputs (list libmnl libnfnetlink))
9793 (synopsis "Library for kernel netfilter infrastructure and state")
9794 (description "libnetfilter_queue is a userspace library providing an API
9795to packets that have been queued by the kernel packet filter. It is is part
9796of a system that deprecates the old ip_queue/libipq mechanism.")
9797 (home-page "https://netfilter.org/projects/libnetfilter_queue/index.html")
9798 (supported-systems (filter target-linux? %supported-systems))
9799 (properties '((upstream-name . "libnetfilter_queue")))
9800 (license license:gpl2+)))
9801
9802(define-public conntrack-tools
9803 (package
9804 (name "conntrack-tools")
9805 (version "1.4.8")
9806 (source
9807 (origin
9808 (method url-fetch)
9809 (uri (string-append "https://netfilter.org/projects/"
9810 "conntrack-tools/files/"
9811 "conntrack-tools-" version ".tar.xz"))
9812 (sha256
9813 (base32 "1mnynl5a63j25arapwvkjbm3a2cqm3aaklwfwwclhmpnqps7fxh6"))))
9814 (build-system gnu-build-system)
9815 (native-inputs (list bison flex pkg-config))
9816 (inputs (list libtirpc
9817 libnetfilter-conntrack
9818 libnetfilter-cttimeout
9819 libnetfilter-cthelper
9820 libnetfilter-queue
9821 libnfnetlink
9822 libmnl))
9823 (synopsis "Set of tools targeting the conntrack kernel subsystem")
9824 (description "The tool conntrack provides a full featured interface that
9825is intended to replace the old @file{/proc/net/ip_conntrack} interface. Using
9826conntrack, you can view and manage the in-kernel connection tracking state
9827table from userspace. On the other hand, conntrackd covers the specific
9828aspects of stateful firewalls to enable highly available scenarios, and can be
9829used as statistics collector as well.
9830
9831Since 1.2.0, the conntrack-tools includes the @command{nfct} command line
9832utility. This utility only supports the nfnetlink_cttimeout by now. In the
9833long run, we expect that it will replace conntrack by providing a syntax
9834similar to nftables.")
9835 (home-page "https://netfilter.org/projects/conntrack-tools/index.html")
9836 (supported-systems (filter target-linux? %supported-systems))
9837 (license license:gpl2+)))
9838
9839(define-public libnetfilter-acct
9840 (package
9841 (name "libnetfilter-acct")
9842 (version "1.0.3")
9843 (source
9844 (origin
9845 (method url-fetch)
9846 (uri (string-append "https://netfilter.org/projects/"
9847 "libnetfilter_acct/files/"
9848 "libnetfilter_acct-" version ".tar.bz2"))
9849 (sha256
9850 (base32
9851 "06lsjndgfjsgfjr43px2n2wk3nr7whz6r405mks3887y7vpwwl22"))))
9852 (build-system gnu-build-system)
9853 (native-inputs (list pkg-config))
9854 (inputs (list libmnl))
9855 (synopsis "Library providing interface to extended accounting infrastructure")
9856 (description "libnetfilter_acct is the userspace library providing interface
9857to extended accounting infrastructure.
9858
9859@enumerate
9860@item
9861creating accounting objects
9862@item
9863retrieving accounting objects (and atomically set to zero)
9864@item
9865deleting accounting objects
9866@end enumerate
9867For the nfnetlink_acct subsystem.")
9868 (home-page "https://netfilter.org/projects/libnetfilter_acct/index.html")
9869 (supported-systems (filter target-linux? %supported-systems))
9870 (properties '((upstream-name . "libnetfilter_acct")))
9871 (license license:lgpl2.1+)))
9872
9873(define-public nfacct
9874 (package
9875 (name "nfacct")
9876 (version "1.0.2")
9877 (source
9878 (origin
9879 (method url-fetch)
9880 (uri (string-append "https://netfilter.org/projects/" name
9881 "/files/nfacct-" version ".tar.bz2"))
9882 (sha256
9883 (base32
9884 "0sdxbxjyapbqcp2ami5jd10vz4xbbdvx39f3wfy1iqsbflc25zzc"))))
9885 (build-system gnu-build-system)
9886 (native-inputs (list pkg-config))
9887 (inputs (list libmnl libnetfilter-acct))
9888 (synopsis "Command line tool to create/retrieve/delete accounting objects")
9889 (description "nfacct is the command line tool to create/retrieve/delete
9890accounting objects
9891@enumerate
9892@item
9893listing the objects of the nfacct table in plain text/XML
9894@item
9895atomically get and reset objects of the nfacct table
9896@item
9897adding new objects to the nfacct table
9898@item
9899deleting objects from the nfacct table
9900@end enumerate")
9901 (home-page "https://netfilter.org/projects/nfacct/index.html")
9902 (supported-systems (filter target-linux? %supported-systems))
9903 (license license:gpl2+)))
9904
9905(define-public libnetfilter-log
9906 (package
9907 (name "libnetfilter-log")
9908 (version "1.0.2")
9909 (source
9910 (origin
9911 (method url-fetch)
9912 (uri (string-append "https://netfilter.org/projects/"
9913 "libnetfilter_log/files/"
9914 "libnetfilter_log-" version ".tar.bz2"))
9915 (sha256
9916 (base32
9917 "1spy9xs41v76kid5ana8n126f3mvgq6fjibbfbj4kn0larbhix73"))))
9918 (build-system gnu-build-system)
9919 (native-inputs (list pkg-config))
9920 (inputs (list libnfnetlink libmnl))
9921 (synopsis "Library providing interface to packets logged by netfilter")
9922 (description "libnetfilter_log is a userspace library providing interface to
9923packets that have been logged by the kernel packet filter. It is is part of a
9924system that deprecates the old syslog/dmesg based packet logging. This library
9925has been previously known as libnfnetlink_log.
9926
9927@enumerate
9928@item
9929receiving to-be-logged packets from the kernel nfnetlink_log subsystem
9930@end enumerate")
9931 (home-page "https://netfilter.org/projects/libnetfilter_log/index.html")
9932 (supported-systems (filter target-linux? %supported-systems))
9933 (properties '((upstream-name . "libnetfilter_log")))
9934 (license license:gpl2+)))
9935
9936(define-public ulogd
9937 (package
9938 (name "ulogd")
9939 (version "2.0.7")
9940 (source
9941 (origin
9942 (method url-fetch)
9943 (uri (string-append "https://netfilter.org/projects/" name
9944 "/files/ulogd-" version ".tar.bz2"))
9945 (sha256
9946 (base32
9947 "0ax9959c4bapq78n13bbaibcf1gwjir3ngx8l2dh45lw9m4ha2lr"))))
9948 (build-system gnu-build-system)
9949 (outputs '("out"
9950 ;; additional non-default output plugins
9951 "json" "pcap" "sqlite3" "pgsql" "mysql"))
9952 (native-inputs (list pkg-config))
9953 (inputs (list libnfnetlink
9954 libmnl
9955 libnetfilter-log
9956 libnetfilter-conntrack
9957 libnetfilter-acct
9958 sqlite
9959 libpcap
9960 jansson
9961 postgresql
9962 (list mariadb "dev")
9963 zlib
9964 openssl))
9965 (arguments
9966 (list #:configure-flags
9967 #~(list (string-append "--with-pgsql="
9968 (assoc-ref %build-inputs "postgresql"))
9969 (string-append "--with-mysql="
9970 (assoc-ref %build-inputs "mariadb")))
9971 #:phases
9972 #~(modify-phases %standard-phases
9973 (add-after 'install 'install-doc
9974 (lambda _
9975 (let ((out-etc (string-append #$output "/etc"))
9976 (ulogd.conf "ulogd.conf"))
9977 (mkdir-p out-etc)
9978 (copy-file ulogd.conf (string-append out-etc "/"
9979 ulogd.conf)))))
9980 (add-after 'install 'setup-plugin-outputs
9981 (lambda* (#:key outputs #:allow-other-keys)
9982 (with-directory-excursion
9983 (string-append #$output "/lib/ulogd/")
9984 (for-each
9985 (lambda (output-name)
9986 (let ((output-dir (string-append
9987 (assoc-ref outputs output-name)
9988 "/lib/ulogd/")))
9989 (mkdir-p output-dir)
9990 (for-each
9991 (lambda (plugin)
9992 (copy-file plugin (string-append output-dir plugin))
9993 (delete-file plugin))
9994 (find-files "."
9995 (string-append "ulogd_output_"
9996 (string-upcase output-name)
9997 ".*$")))))
9998 (list "json" "pcap" "sqlite3" "pgsql" "mysql"))))))))
9999 (synopsis "Logging daemon for netfilter and iptables")
10000 (description "ulogd is a userspace logging daemon for netfilter/iptables
10001related logging. This includes per-packet logging of security violations,
10002per-packet logging for accounting, per-flow logging and flexible user-defined
10003accounting.
10004
10005@enumerate
10006@item
10007Packet and flow-based traffic accounting
10008@item
10009Flexible user-defined traffic accounting via nfacct infrastructure
10010@item
10011SQL database back-end support: SQLite3, PostgreSQL, MySQL
10012@item
10013Text-based output formats: CSV, XML, Netfilter's LOG, Netfilter's conntrack
10014@end enumerate")
10015 (home-page "https://netfilter.org/projects/nfacct/index.html")
10016 (supported-systems (filter target-linux? %supported-systems))
10017 (license license:gpl2)))
10018
10019(define-public proot
10020 (package
10021 (name "proot")
10022 (version "5.4.0")
10023 (source
10024 (origin
10025 (method git-fetch)
10026 (uri (git-reference
10027 (url "https://github.com/proot-me/PRoot")
10028 (commit (string-append "v" version))))
10029 (file-name (git-file-name name version))
10030 (sha256
10031 (base32 "186qsg4yvisqjgf8w5jxhnlig7x341vpqwcgp8as3r59qmqkpmk7"))
10032 ;; Waiting for upstream inclusion at
10033 ;; https://github.com/proot-me/proot/pull/355
10034 (patches (search-patches "proot-add-clone3.patch"
10035 "proot-add-missing-include.patch"))))
10036 (build-system gnu-build-system)
10037 ;; Many architectures are not supported (see:
10038 ;; https://github.com/proot-me/proot/blob/master/src/arch.h#L51).
10039 (supported-systems '("x86_64-linux" "i686-linux"
10040 "armhf-linux" "aarch64-linux" "i586-gnu" "x86_64-gnu"))
10041 (arguments
10042 ;; Disable the test suite on armhf-linux, as there are too many
10043 ;; failures to keep track of (see for example:
10044 ;; https://github.com/proot-me/proot/issues/286).
10045 (list
10046 #:tests? (not (or (%current-target-system)
10047 (string-prefix? "armhf"
10048 (or (%current-system)))))
10049 #:make-flags
10050 #~'("-C" "src")
10051 #:phases
10052 #~(modify-phases %standard-phases
10053 (add-after 'unpack 'patch-sources
10054 (lambda* (#:key inputs #:allow-other-keys)
10055 (substitute* (find-files "src" "\\.[ch]$")
10056 (("\"/bin/sh\"")
10057 (format #f "~s" (search-input-file inputs "/bin/sh"))))
10058
10059 (substitute* "src/GNUmakefile"
10060 (("/bin/echo") (which "echo"))
10061 (("^VERSION = .*")
10062 (string-append "VERSION := " #$version "\n")))
10063
10064 (substitute* (find-files "test" "\\.sh$")
10065 ;; Some of the tests try to "bind-mount" /bin/true.
10066 (("-b /bin/true:")
10067 (string-append "-b " (which "true") ":"))
10068 ;; Likewise for /bin.
10069 (("-b /bin:") "-b /gnu:")
10070 ;; Others try to run /bin/sh.
10071 (("/bin/sh") (which "sh"))
10072 ;; Others assume /etc/fstab exists.
10073 (("/etc/fstab") "/etc/passwd"))
10074 (substitute* "test/GNUmakefile"
10075 (("-b /bin:") "-b /gnu:"))
10076 (substitute* "test/test-c6b77b77.mk"
10077 (("/bin/bash") (which "bash"))
10078 (("/usr/bin/test") (which "test")))
10079 (substitute* "test/test-16573e73.c"
10080 (("/bin/([a-z-]+)" _ program)
10081 (which program)))
10082 (substitute* "test/test-5467b986.sh"
10083 (("-w /usr") "-w /gnu")
10084 (("-w usr") "-w gnu")
10085 (("/usr/share") "/gnu/store")
10086 (("share") "store"))
10087 (substitute* "test/test-092c5e26.sh"
10088 (("-q echo ")
10089 "-q $(which echo) "))
10090
10091 ;; The socket tests requires networking.
10092 (for-each delete-file
10093 (find-files "test" "test-socket.*\\.sh$"))))
10094 (delete 'configure)
10095 (add-after 'build 'build-manpage
10096 (lambda _
10097 (with-directory-excursion "doc"
10098 (invoke "make" "proot/man.1" "SUFFIX=.py"))))
10099 (replace 'check
10100 (lambda* (#:key tests? #:allow-other-keys)
10101 (when tests?
10102 ;; Most of the tests expect "/bin" to be in $PATH so
10103 ;; they can run things that live in $ROOTFS/bin.
10104 (setenv "PATH" (string-append (getenv "PATH") ":/bin"))
10105 (invoke "make" "check" "-C" "test"
10106 "-j" (number->string (parallel-job-count))))))
10107 (replace 'install
10108 (lambda _
10109 ;; The 'install' rule does nearly nothing.
10110 (let ((man1 (string-append #$output "/share/man/man1")))
10111 ;; TODO: 'make install-care' (does not even
10112 ;; build currently.)
10113 (invoke "make" "-C" "src" "install"
10114 (string-append "PREFIX=" #$output))
10115 (mkdir-p man1)
10116 (copy-file "doc/proot/man.1"
10117 (string-append man1 "/proot.1"))))))))
10118 (native-inputs (list which
10119 ;; For 'mcookie', used by some of the tests.
10120 util-linux
10121 coreutils
10122 pkg-config
10123 ;; For rst2man, used to generate the manual page.
10124 python-docutils-0.19))
10125 (inputs (list libarchive talloc))
10126 (home-page "https://github.com/proot-me/PRoot")
10127 (synopsis "Unprivileged chroot, bind mount, and binfmt_misc")
10128 (description
10129 "PRoot is a user-space implementation of @code{chroot}, @code{mount --bind},
10130and @code{binfmt_misc}. This means that users don't need any privileges or
10131setup to do things like using an arbitrary directory as the new root
10132file system, making files accessible somewhere else in the file system
10133hierarchy, or executing programs built for another CPU architecture
10134transparently through QEMU user-mode. Also, developers can use PRoot as a
10135generic process instrumentation engine thanks to its extension mechanism.
10136Technically PRoot relies on @code{ptrace}, an unprivileged system-call
10137available in the kernel Linux.")
10138 (license license:gpl2+)))
10139
10140(define-public proot-static
10141 (package
10142 (inherit proot)
10143 (name "proot-static")
10144 (synopsis
10145 "Unprivileged chroot, bind mount, and binfmt_misc (statically linked)")
10146 (inputs (list talloc/static))
10147 (arguments
10148 (substitute-keyword-arguments arguments
10149 ((#:make-flags flags)
10150 #~(cons* "LDFLAGS = -ltalloc -static -static-libgcc" #$flags))
10151 ((#:phases phases)
10152 #~(modify-phases #$phases
10153 (add-after 'strip 'remove-store-references
10154 (lambda _
10155 (with-directory-excursion #$output
10156 (remove-store-references "bin/proot"))))))
10157 ((#:allowed-references _ '("out"))
10158 '("out"))))))
10159
10160(define-public cpuid
10161 (package
10162 (name "cpuid")
10163 (version "20260220")
10164 (source (origin
10165 (method url-fetch)
10166 (uri (string-append "http://www.etallen.com/cpuid/cpuid-"
10167 version ".src.tar.gz"))
10168 (sha256
10169 (base32
10170 "1ywg1fzbk153sil3n0mdrah3728j76dbjj8c24gig4g5bbbhyqp7"))))
10171 (build-system gnu-build-system)
10172 (arguments
10173 (list #:make-flags
10174 #~(list (string-append "CC=" #$(cc-for-target)))
10175 #:tests? #f ; no tests
10176 #:phases
10177 #~(modify-phases %standard-phases
10178 (delete 'configure) ; no configure script
10179 (add-before 'install 'fix-makefile
10180 (lambda* (#:key outputs #:allow-other-keys)
10181 (substitute* "Makefile"
10182 (("\\$\\(BUILDROOT\\)/usr")
10183 (assoc-ref outputs "out"))))))))
10184 (inputs (list perl))
10185 (supported-systems '("i686-linux" "x86_64-linux"))
10186 (home-page "https://www.etallen.com/cpuid.html")
10187 (synopsis "Dump x86 CPUID processor information")
10188 (description "cpuid dumps detailed information about the CPU(s) gathered
10189from the CPUID instruction, and also determines the exact model of CPU(s). It
10190supports Intel, AMD, and VIA CPUs, as well as older Transmeta, Cyrix, UMC,
10191NexGen, Rise, and SiS CPUs.")
10192 (license license:gpl2+)))
10193
10194(define-public jmtpfs
10195 (package
10196 (name "jmtpfs")
10197 (version "0.5")
10198 (source
10199 (origin
10200 (method git-fetch)
10201 (uri (git-reference
10202 (url "https://github.com/JasonFerrara/jmtpfs")
10203 (commit (string-append "v" version))))
10204 (file-name (git-file-name name version))
10205 (sha256
10206 (base32
10207 "1pm68agkhrwgrplrfrnbwdcvx5lrivdmqw8pb5gdmm3xppnryji1"))))
10208 (build-system gnu-build-system)
10209 (inputs
10210 (list file fuse-2 libmtp))
10211 (native-inputs
10212 (list pkg-config))
10213 (home-page "https://github.com/JasonFerrara/jmtpfs")
10214 (synopsis "Use a FUSE file system to access data over MTP")
10215 (description "jmtpfs uses @acronym{FUSE, File system in USEr space} to
10216provide access to data over @acronym{MTP, the Media Transfer Protocol}.
10217Unprivileged users can mount the MTP device as a file system.")
10218 (license license:gpl3)))
10219
10220(define-public procenv
10221 (package
10222 (name "procenv")
10223 (version "0.60")
10224 (source
10225 (origin
10226 (method git-fetch)
10227 (uri (git-reference
10228 (url "https://github.com/jamesodhunt/procenv")
10229 (commit version)))
10230 (file-name (git-file-name name version))
10231 (sha256
10232 (base32 "00d7q0h4qjc8lg435lq77lp2fx6ikm5piq90m81mr1dqqna1g6pz"))))
10233 (build-system gnu-build-system)
10234 (native-inputs
10235 (list pkg-config
10236 ;; For tests.
10237 check groff))
10238 (inputs
10239 (list expat libcap libselinux))
10240 (synopsis "Utility to show process environment")
10241 (description
10242 "Procenv is a command-line tool that displays as much detail about
10243itself and its environment as possible. It can be used as a test
10244tool, to understand the type of environment a process runs in, and for
10245comparing system environments.")
10246 (home-page "https://github.com/jamesodhunt/procenv/")
10247 (license license:gpl3+)))
10248
10249(define-public cassini-headers
10250 (package
10251 (name "cassini-headers")
10252 (version "14.0.0")
10253 (home-page "https://github.com/HewlettPackard/shs-cassini-headers")
10254 (source (origin
10255 (method git-fetch)
10256 (uri (git-reference
10257 (url home-page)
10258 (commit (string-append "release/shs-" version))))
10259 (file-name (git-file-name name version))
10260 (sha256
10261 (base32
10262 "074r1snc682f1b6vgswyz55n8zjf5rhqnsl31xsswih7q9q38jda"))
10263 (patches (search-patches "cassini-headers-memset.patch"))))
10264 (build-system copy-build-system)
10265 (arguments
10266 (list #:install-plan
10267 #~'(("include" "include")
10268 ("share/cassini-headers" "share/cassini-headers"))))
10269 (synopsis "Cassini network hardware definitions and headers")
10270 (description
10271 "This package provides hardware definitions and C headers for use by
10272the Linux driver and by user-space applications for the Cassini/Slingshot
10273high-speed network interconnect made by HPE (formerly Cray). User-land
10274software uses @file{cxi_prov_hw.h} from this package.")
10275 ;; As per include/cxi_prov_hw.h it is __aarch64__ or __x86_64__ only.
10276 (supported-systems '("x86_64-linux" "aarch64-linux"))
10277 (license (list license:gpl2 license:bsd-2)))) ;dual-licensed
10278
10279(define-public cxi-driver
10280 (package
10281 (name "cxi-driver")
10282 (version "14.0.0")
10283 (home-page "https://github.com/HewlettPackard/shs-cxi-driver")
10284 (source
10285 (origin
10286 (method git-fetch)
10287 (uri (git-reference
10288 (url home-page)
10289 (commit (string-append "release/shs-" version))))
10290 (file-name (git-file-name name version))
10291 (sha256
10292 (base32
10293 "07dhdm1az9hvy48iq8bn0wypwyml59yr5aqqyf1yhwrf1basry9g"))))
10294 ;; TODO: Actually build the Linux driver.
10295 (build-system copy-build-system)
10296 (arguments
10297 (list #:install-plan #~'(("include" "include"))))
10298 (propagated-inputs (list cassini-headers))
10299 (synopsis "Linux driver for the Cassini/Slingshot interconnect")
10300 (description
10301 "This is the Linux driver for the Cray/HPE Cassini 1 and 2 high-speed
10302network interconnect (aka. Slingshot), and its Ethernet driver. It includes
10303the @file{uapi/misc/cxi.h} C header file for use by user-land software.
10304
10305Currently the Linux driver itself is missing from this package.")
10306 (license license:gpl2+)))
10307
10308(define-public cxi-driver-for-libfabric-1
10309 ;; This old version defines constants such as 'CXI_MAP_IOVA_ALLOC' that
10310 ;; libfabric 1.22.0 relies on.
10311 (let ((commit "5f0ec0ead6ef3f98542a2ef5e76b89d14dd22150")
10312 (revision "0"))
10313 (package
10314 (inherit cxi-driver)
10315 (name "cxi-driver")
10316 (version (git-version "1.0.0" ;per .spec file
10317 revision commit))
10318 (home-page "https://github.com/HewlettPackard/shs-cxi-driver")
10319 (source
10320 (origin
10321 (method git-fetch)
10322 (uri (git-reference (url home-page) (commit commit)))
10323 (file-name (git-file-name name version))
10324 (sha256
10325 (base32
10326 "19cly014ihgdidrc1aki2xsbfhpc0g73v0vxcky8r27xza7rz5bg")))))))
10327
10328(define-public libcxi
10329 (package
10330 (name "libcxi")
10331 ;; Note: Do not upgrade until
10332 ;; <https://github.com/HewlettPackard/shs-libcxi/issues/18> is resolved.
10333 (version "13.0.0")
10334 (home-page "https://github.com/HewlettPackard/shs-libcxi")
10335 (source
10336 (origin
10337 (method git-fetch)
10338 (uri (git-reference (url home-page)
10339 (commit (string-append "release/shs-" version))))
10340 (file-name (git-file-name name version))
10341 (sha256
10342 (base32 "1m8mds1h8plhfn2ja9br31xaiy82ky69685cp1rznanl18inaiff"))))
10343 (build-system gnu-build-system)
10344 (arguments
10345 (list #:configure-flags
10346 #~(list "--disable-static"
10347 (string-append "--with-udevrulesdir="
10348 #$output "/lib/udev/rules.d"))
10349
10350 #:phases
10351 #~(modify-phases %standard-phases
10352 (add-before 'configure 'set-cassini-file-names
10353 (lambda* (#:key inputs #:allow-other-keys)
10354 (substitute* "utils/cxi_dump_csrs.py"
10355 (("/usr/share/cassini-headers/csr_defs.json")
10356 (search-input-file
10357 inputs
10358 "/share/cassini-headers/csr_defs.json"))))))))
10359 (native-inputs (list autoconf
10360 automake
10361 libtool
10362 pkg-config
10363 python-wrapper))
10364 (inputs (list libconfig
10365 libuv
10366 fuse-2
10367 libyaml
10368 libnl
10369 numactl
10370 eudev
10371 (list lm-sensors "lib")))
10372 (propagated-inputs (list cassini-headers cxi-driver))
10373 (synopsis "Interface to the Cassini/Slingshot high-speed interconnect")
10374 (description
10375 "Libcxi provides applications with a low-level interface to the
10376Cray/HPE Cassini high-speed @acronym{NIC, network interface controller}, also
10377known as Slingshot.")
10378
10379 ;; License is spelled out in 'cray-libcxi.spec' and in source file
10380 ;; headers.
10381 (license (list license:lgpl2.1+ license:bsd-3)))) ;dual-licensed
10382
10383(define-public libfabric
10384 (package
10385 (name "libfabric")
10386 (version "2.5.1")
10387 (source
10388 (origin
10389 (method git-fetch)
10390 (uri (git-reference
10391 (url "https://github.com/ofiwg/libfabric")
10392 (commit (string-append "v" version))))
10393 (file-name (git-file-name name version))
10394 (sha256 (base32 "15z0g1z62hv6kkiksvpxl6xv07wdmnvqhm5vnh0vq4ipr8f5vikp"))))
10395 (build-system gnu-build-system)
10396 (native-inputs
10397 (list autoconf
10398 automake
10399 libtool))
10400 (inputs
10401 (let ((if-supported ;XXX: modified from openmpi
10402 (lambda (package . extra)
10403 (if (and (not (%current-target-system))
10404 (member (%current-system)
10405 (package-transitive-supported-systems package)))
10406 (cons package extra)
10407 '()))))
10408 (append (list rdma-core libnl)
10409 (if-supported psm)
10410 (if-supported psm2)
10411 (if-supported libcxi curl json-c))))
10412 (arguments
10413 (list #:configure-flags
10414 #~(append (if #$(target-64bit?)
10415 (list "--enable-efa")
10416 '())
10417 (list #$@(if (this-package-input "libcxi")
10418 #~("--enable-cxi")
10419 #~())
10420 #$@(if (this-package-input "rocr-runtime")
10421 #~((string-append "--with-rocr="
10422 #$(this-package-input "rocr-runtime")))
10423 #~())
10424 "--enable-verbs"))
10425 #:phases
10426 #~(modify-phases %standard-phases
10427 (add-after 'install 'remove-libtool-archive
10428 (lambda _
10429 ;; 'libfabric.la' has '-ljson-c' without a corresponding
10430 ;; '-L' in 'dependency_libs', which in turn causes users
10431 ;; such as Open MPI to fail at link time due to '-ljson-c'
10432 ;; not being found, even when building a shared library.
10433 ;; So, remove the .la file.
10434 (delete-file
10435 (string-append #$output
10436 "/lib/libfabric.la")))))))
10437 (home-page "https://ofiwg.github.io/libfabric/")
10438 (synopsis "Open Fabric Interfaces")
10439 (description
10440 "OpenFabrics Interfaces (OFI) is a framework focused on exporting fabric
10441communication services to applications. OFI is best described as a collection
10442of libraries and applications used to export fabric services. The key
10443components of OFI are: application interfaces, provider libraries, kernel
10444services, daemons, and test applications.
10445
10446Libfabric is a core component of OFI. It is the library that defines and
10447exports the user-space API of OFI, and is typically the only software that
10448applications deal with directly. It works in conjunction with provider
10449libraries, which are often integrated directly into libfabric.")
10450 (license (list license:bsd-2 license:gpl2)))) ;dual
10451
10452;; Note: ROCm support is kept separate to avoid a significant increase in
10453;; closure size: <https://codeberg.org/guix/guix/issues/7225>.
10454(define-public libfabric-rocm
10455 (package/inherit libfabric
10456 (name "libfabric-rocm")
10457 (inputs (modify-inputs inputs
10458 (append rocr-runtime)))
10459 (synopsis "Open Fabric Interfaces (with ROCm support)")))
10460
10461(define-public libfabric-1 ;needed by Open MPI 4.x
10462 (package
10463 (inherit libfabric)
10464 (name "libfabric")
10465 (version "1.22.0")
10466 (source
10467 (origin
10468 (method git-fetch)
10469 (uri (git-reference
10470 (url "https://github.com/ofiwg/libfabric")
10471 (commit (string-append "v" version))))
10472 (file-name (git-file-name name version))
10473 (sha256 (base32 "1scwkfdnlg20hld03pdq83jq1q3nmvj1gravpn02pacqq18bv9xk"))))
10474 (inputs
10475 (modify-inputs inputs
10476 (append cxi-driver-for-libfabric-1)))))
10477
10478(define-public psm
10479 (package
10480 (name "psm")
10481 (version "3.3.20170428")
10482 (home-page "https://github.com/intel/psm")
10483 (source
10484 (origin
10485 (method git-fetch)
10486 (uri (git-reference (url home-page)
10487 (commit "604758e76dc31e68d1de736ccf5ddf16cb22355b")))
10488 (file-name (string-append "psm-" version ".tar.gz"))
10489 (sha256
10490 (base32 "0nsb325dmhn5ia3d2cnksqr0gdvrrx2hmvlylfgvmaqdpq76zm85"))
10491 (patches (search-patches
10492 "psm-arch.patch" ; uname -p returns "unknown" on Debian 9
10493 "psm-ldflags.patch" ; build shared lib with LDFLAGS
10494 "psm-repro.patch" ; reproducibility
10495 "psm-disable-memory-stats.patch"))
10496 (modules '((guix build utils)))
10497 (snippet
10498 ;; That file declares its own 'strlcat' as static. To avoid a
10499 ;; conflict with the function now in glibc 2.39, give it a
10500 ;; different name.
10501 #~(substitute* "ptl_ips/ips_proto_dump.c"
10502 (("strlcat")
10503 "psm_custom_strlcat")))))
10504 (build-system gnu-build-system)
10505 (outputs '("out" "debug"))
10506 (inputs `(("libuuid" ,util-linux "lib")))
10507 (arguments
10508 '(#:make-flags `("PSM_USE_SYS_UUID=1" "CC=gcc" "WERROR="
10509 ,(string-append "INSTALL_PREFIX=" %output)
10510 ,(string-append "CFLAGS=-Wall -fpic -fPIC -D_GNU_SOURCE"
10511 " -funwind-tables -O3 -g3"
10512 " -DPSM_USE_SYS_UUID"
10513 " -Wno-strict-aliasing -DNVALGRIND"
10514 " -fcommon")
10515 ,(string-append "LDFLAGS=-Wl,-rpath=" %output "/lib"))
10516 #:tests? #f
10517 #:phases (modify-phases %standard-phases
10518 (delete 'configure)
10519 (add-after 'unpack 'patch-/usr/include
10520 (lambda _
10521 (substitute* "Makefile"
10522 (("\\$\\{DESTDIR}/usr/include")
10523 (string-append %output "/include")))
10524 (substitute* "Makefile"
10525 (("/lib64") "/lib"))
10526 #t))
10527 (add-after 'unpack 'patch-sysmacros
10528 (lambda _
10529 (substitute* "ipath/ipath_proto.c"
10530 (("#include <sys/poll.h>" m)
10531 (string-append m "\n"
10532 "#include <sys/sysmacros.h>")))
10533 #t)))))
10534 (synopsis "Intel Performance Scaled Messaging (PSM) Libraries")
10535 (description
10536 "The PSM Messaging API, or PSM API, is Intel's low-level user-level
10537communications interface for the True Scale family of products. PSM users are
10538enabled with mechanisms necessary to implement higher level communications
10539interfaces in parallel environments.")
10540 ;; Only Intel-compatible processors are supported.
10541 (supported-systems '("i686-linux" "x86_64-linux"))
10542 (license (list license:bsd-2 license:gpl2)))) ;dual
10543
10544(define-public snapscreenshot
10545 (package
10546 (name "snapscreenshot")
10547 (version "1.0.14.3")
10548 (source
10549 (origin
10550 (method url-fetch)
10551 (uri (string-append "http://bisqwit.iki.fi/src/arch/"
10552 name "-" version ".tar.bz2"))
10553 (sha256
10554 (base32 "0gzvqsbf6a2sbd1mqvj1lbm57i2bm5k0cr6ncr821d1f32gw03mk"))))
10555 (build-system gnu-build-system)
10556 (arguments
10557 `(#:make-flags
10558 (let ((out (assoc-ref %outputs "out")))
10559 (list (string-append "BINDIR=" out "/bin")
10560 (string-append "MANDIR=" out "/share/man")))
10561 #:tests? #f ; no test suite
10562 #:phases
10563 (modify-phases %standard-phases
10564 (delete 'configure) ; ./configure is a snarky no-op
10565 (add-before 'install 'fix-ownership
10566 ;; Install binaries owned by ‘root’ instead of the nonexistent ‘bin’.
10567 (lambda _
10568 (substitute* "depfun.mak"
10569 ((" -o bin -g bin ") " "))
10570 #t))
10571 (add-before 'install 'create-output-directories
10572 (lambda* (#:key outputs #:allow-other-keys)
10573 (let ((out (assoc-ref outputs "out")))
10574 (mkdir-p (string-append out "/share/man/man1"))
10575 #t))))))
10576 (home-page "https://bisqwit.iki.fi/source/snapscreenshot.html")
10577 (synopsis "Take screenshots of one or more Linux text consoles")
10578 (description
10579 "snapscreenshot saves a screenshot of one or more Linux text consoles as a
10580Targa (@dfn{.tga}) image. It can be used by anyone with read access to the
10581relevant @file{/dev/vcs*} file(s).")
10582 (license license:gpl2)))
10583
10584(define-public fbcat
10585 (package
10586 (name "fbcat")
10587 (version "0.5.2")
10588 (source
10589 (origin
10590 (method url-fetch)
10591 (uri (string-append "https://github.com/jwilk/fbcat/releases/download/"
10592 version "/" name "-" version ".tar.gz"))
10593 (sha256
10594 (base32 "07q6f0xj7b4gjvn69qfn0g04yd0ch8ndzyigcz8nnrhli0cvsbh6"))))
10595 (build-system gnu-build-system)
10596 (outputs (list "out" "fbgrab"))
10597 (arguments
10598 (list
10599 #:make-flags
10600 #~(list "CC=gcc" (string-append "PREFIX=" #$output))
10601 #:tests? #f ;no tests
10602 #:phases
10603 #~(modify-phases %standard-phases
10604 (delete 'configure) ;no configure script
10605 (add-after 'build 'qualify-references
10606 (lambda* (#:key inputs #:allow-other-keys)
10607 (let ((pnmtopng (assoc-ref inputs "pnmtopng")))
10608 (substitute* "fbgrab"
10609 (("fbcat" all)
10610 (string-append #$output "/bin/" all))
10611 (("pnmtopng")
10612 (search-input-file inputs "/bin/pnmtopng"))))))
10613 (add-after 'install 'split-fbgrab-output
10614 (lambda _
10615 (for-each (lambda (file)
10616 (let ((old (string-append #$output "/" file))
10617 (new (string-append #$output:fbgrab "/" file)))
10618 (mkdir-p (dirname new))
10619 (rename-file old new)))
10620 (list "bin/fbgrab" "share/man/man1/fbgrab.1")))))))
10621 (inputs
10622 ;; The ‘fbgrab’ wrapper can use one of several PPM-to-PNG converters. We
10623 ;; choose netpbm simply because it's the smallest. It still adds ~94 MiB
10624 ;; to an otherwise tiny package, so we put ‘fbgrab’ in its own output.
10625 (list netpbm))
10626 (home-page "https://jwilk.net/software/fbcat")
10627 (synopsis "Take a screenshot of the contents of the Linux framebuffer")
10628 (description
10629 "fbcat saves the contents of the Linux framebuffer (@file{/dev/fb*}), or
10630a dump thereof. It supports a wide range of drivers and pixel formats.
10631
10632@command{fbcat} can take screenshots of virtually any application that can be
10633made to write its output to the framebuffer, including (but not limited to)
10634text-mode or graphical applications that don't use a display server.
10635
10636Also included is @command{fbgrab}, a wrapper around @command{fbcat} that
10637emulates the behaviour of Gunnar Monell's older fbgrab utility.")
10638 (license license:gpl2)))
10639
10640(define-public fbgrab
10641 (package
10642 (name "fbgrab")
10643 (version "1.5")
10644 (source (origin
10645 (method git-fetch)
10646 (uri (git-reference
10647 (url "https://github.com/GunnarMonell/fbgrab")
10648 (commit version)))
10649 (file-name (git-file-name name version))
10650 (sha256
10651 (base32
10652 "1npn7l8jg0nhjraybjl38v8635zawzmn06ql3hs3vhci1vi1r90r"))))
10653 (build-system gnu-build-system)
10654 (arguments
10655 (list #:tests? #f ;no test suite
10656 #:make-flags #~(list (string-append "CC=" #$(cc-for-target))
10657 (string-append "DESTDIR=" #$output))
10658 #:phases #~(modify-phases %standard-phases
10659 (add-after 'unpack 'strip-/usr-prefix
10660 (lambda _
10661 (substitute* "Makefile"
10662 (("/usr") ""))))
10663 (delete 'configure))))
10664 (inputs (list libpng zlib))
10665 (home-page "https://github.com/GunnarMonell/fbgrab")
10666 (synopsis "Linux framebuffer screenshot/conversion utility")
10667 (description "FBGrab is a framebuffer screenshot program that captures the
10668Linux framebuffer and converts it to a PNG image. It can also convert a
10669framebuffer dump file (copy) to a PNG image.")
10670 (license license:gpl2))) ;GPL 2.0 only (per SPDX identifier in fbgrab.c)
10671
10672(define-public libcgroup
10673 (package
10674 (name "libcgroup")
10675 (version "3.2.0")
10676 (home-page "https://github.com/libcgroup/libcgroup")
10677 (source
10678 (origin
10679 (method url-fetch)
10680 (uri (string-append
10681 "https://github.com/libcgroup/libcgroup/releases/download/v"
10682 version "/" name "-" version ".tar.gz"))
10683 (sha256
10684 (base32 "1zmxhqp8kj2n7yvj82nsy5sx07yrxj4r37w41lz5q8bpqgbc43ws"))))
10685 (build-system gnu-build-system)
10686 (arguments
10687 ;; Tests are virtualized with lxc, it is not very feasible
10688 ;; to make them executable under guix build. Also, note that
10689 ;; origin is using source tarball release which is prepared
10690 ;; after testing.
10691 (list #:tests? #f
10692 #:configure-flags
10693 #~'("--disable-systemd")))
10694 (native-inputs
10695 (list bison flex))
10696 (inputs
10697 (list linux-pam))
10698 (synopsis "Control groups management tools")
10699 (description "Control groups is Linux kernel method for process resource
10700restriction, permission handling and more. This package provides userspace
10701interface to this kernel feature.")
10702 (license license:lgpl2.1)))
10703
10704(define-public mbpfan
10705 (package
10706 (name "mbpfan")
10707 (version "2.4.0")
10708 (source
10709 (origin
10710 (method git-fetch)
10711 (uri (git-reference
10712 (url "https://github.com/dgraziotin/mbpfan")
10713 (commit (string-append "v" version))))
10714 (file-name (git-file-name name version))
10715 (sha256
10716 (base32 "146sshsjafi26n741jvi9mdbazwf74jlacxfwkky4fhbq98idlhp"))))
10717 (build-system gnu-build-system)
10718 (arguments
10719 (list #:tests? #f ; tests ask to be run as root
10720 #:make-flags
10721 #~(list (string-append "DESTDIR=" #$output)
10722 (string-append "CC=" #$(cc-for-target)))
10723 #:phases
10724 #~(modify-phases %standard-phases
10725 (add-after 'unpack 'patch-paths
10726 (lambda _
10727 (substitute* "Makefile"
10728 (("/usr") ""))))
10729 (delete 'configure)))) ; there's no configure phase
10730 (home-page "https://github.com/dgraziotin/mbpfan")
10731 (synopsis "Control fan speed on Macbooks")
10732 (description
10733 "mbpfan is a fan control daemon for Apple Macbooks. It uses input from
10734the @code{coretemp} module and sets the fan speed using the @code{applesmc}
10735module. It can be executed as a daemon or in the foreground with root
10736privileges.")
10737 (license license:gpl3+)))
10738
10739(define-public psm2
10740 (package
10741 (name "psm2")
10742 (version "12.0")
10743 (source (origin
10744 (method git-fetch)
10745 (uri (git-reference
10746 (url "https://github.com/intel/opa-psm2")
10747 ;; tag 'psm-v12.0' = commit ad5dd1b
10748 (commit (string-append "psm-v" version))))
10749 (file-name (git-file-name name version))
10750 (sha256
10751 (base32
10752 "04nar65ac11qqx41vkfs7iip8kfiah0zms7l4rmsxncpiz2iqfik"))
10753 (patches
10754 (search-patches
10755 "psm2-compile-ctor-without-avx.patch"))
10756 (modules '((guix build utils)))
10757 (snippet
10758 ;; That file declares its own 'strlcat' as static. To avoid a
10759 ;; conflict with the function now in glibc 2.39, give it a
10760 ;; different name.
10761 #~(substitute* "ptl_ips/ips_proto_dump.c"
10762 (("strlcat")
10763 "psm2_custom_strlcat")))))
10764 (build-system gnu-build-system)
10765 (arguments
10766 (list #:make-flags
10767 #~(list (string-append "LDFLAGS=-Wl,-rpath=" #$output "/lib"))
10768 #:tests? #f
10769 #:phases #~(modify-phases %standard-phases
10770 (delete 'configure)
10771 (add-after 'unpack 'patch-Makefiles
10772 (lambda _
10773 (substitute* "Makefile"
10774 (("/lib64") "/lib")
10775 (("/usr") ""))
10776 (substitute* "compat/Makefile"
10777 (("/lib64") "/lib")
10778 (("/usr") ""))))
10779 (replace 'install
10780 (lambda _
10781 (setenv "DESTDIR" #$output)
10782 (invoke "make" "install"))))))
10783 (inputs
10784 (list rdma-core numactl))
10785 (synopsis "Intel Performance Scaled Messaging 2 (PSM2) library")
10786 (description
10787 "This package is low-level user-level Intel's communications interface.
10788The PSM2 API is a high-performance vendor-specific protocol that provides a
10789low-level communications interface for the Intel Omni-Path family of
10790high-speed networking devices.")
10791 (home-page "https://github.com/intel/opa-psm2")
10792 ;; Only the x86_64 architecture is supported.
10793 (supported-systems '("x86_64-linux"))
10794 (license (list license:bsd-3 license:gpl2)))) ; dual
10795
10796(define-public libpfm4
10797 (package
10798 (name "libpfm4")
10799 (version "4.9.0")
10800 (source (origin
10801 (method url-fetch)
10802 (uri (string-append "mirror://sourceforge/perfmon2/"
10803 name "/libpfm-" version ".tar.gz"))
10804 (sha256
10805 (base32
10806 "1qp4g4n6dw42p2w5rkwzdb7ynk8h7g5vg01ybpmvxncgwa7bw3yv"))))
10807 (build-system gnu-build-system)
10808 (arguments
10809 '(#:modules ((guix build utils)
10810 (guix build gnu-build-system))
10811 #:phases (modify-phases %standard-phases
10812 (delete 'configure)
10813 (delete 'check)
10814 (replace 'build
10815 (lambda* (#:key inputs outputs #:allow-other-keys)
10816 (let* ((out (assoc-ref outputs "out")))
10817 (setenv "CC" "gcc")
10818 (setenv "CFLAGS" "-Wno-format-truncation")
10819 (invoke "make")
10820 #t)))
10821 (replace 'install
10822 (lambda* (#:key outputs #:allow-other-keys)
10823 (let* ((out (assoc-ref outputs "out")))
10824 (invoke "make"
10825 (string-append "PREFIX=" out)
10826 "install")
10827 #t))))))
10828 (synopsis "Performance event monitoring library")
10829 (description
10830 "This package provides a library called libpfm4, which is used to develop
10831monitoring tools exploiting the performance monitoring events such as those
10832provided by the Performance Monitoring Unit (PMU) of modern processors.
10833
10834Libpfm4 helps convert from an event name, expressed as a string, to the event
10835encoding that is either the raw event as documented by the hardware vendor or
10836the OS-specific encoding. In the latter case, the library is able to prepare
10837the OS-specific data structures needed by the kernel to setup the event.
10838
10839libpfm4 provides support for the @code{perf_events} interface, which was
10840introduced in Linux 2.6.31.")
10841 (home-page "https://perfmon2.sourceforge.net/")
10842 (license license:expat)))
10843
10844(define-public libnfnetlink
10845 (package
10846 (name "libnfnetlink")
10847 (version "1.0.2")
10848 (source (origin
10849 (method url-fetch)
10850 (uri (string-append
10851 "https://www.netfilter.org/projects/libnfnetlink/files/"
10852 "libnfnetlink-" version ".tar.bz2"))
10853 (sha256
10854 (base32
10855 "0xn3rcrzxr6g82kfxzs9bqn2zvl2kf2yda30drwb9vr6sk1wfr5h"))))
10856 (build-system gnu-build-system)
10857 (home-page "https://www.netfilter.org/projects/libnfnetlink/")
10858 (synopsis "Low-level netfilter netlink communication library")
10859 (description
10860 "@code{libnfnetlink} is the low-level library for netfilter related
10861kernel/userspace communication. It provides a generic messaging
10862infrastructure for in-kernel netfilter subsystems (such as nfnetlink_log,
10863nfnetlink_queue, nfnetlink_conntrack) and their respective users and/or
10864management tools in userspace.")
10865 (license license:gpl2)))
10866
10867(define-public libinih
10868 (package
10869 (name "libinih")
10870 (version "62")
10871 (source (origin
10872 (method git-fetch)
10873 (uri (git-reference
10874 (url "https://github.com/benhoyt/inih")
10875 (commit (string-append "r" version))))
10876 (file-name (git-file-name name version))
10877 (sha256
10878 (base32
10879 "0yl5057682gvk1iszjkz4hy73yv45l7wr3fwhbgyf7r7fwx0cwwf"))))
10880 (build-system meson-build-system)
10881 ;; Install static libraries for use by the initrd's xfsprogs/static.
10882 (outputs (list "out" "static"))
10883 (arguments
10884 `(#:configure-flags
10885 (list "-Ddistro_install=true"
10886 "-Ddefault_library=both")
10887 #:phases
10888 (modify-phases %standard-phases
10889 (add-after 'install 'separate-static
10890 (lambda* (#:key outputs #:allow-other-keys)
10891 (let ((out (assoc-ref outputs "out"))
10892 (static (assoc-ref outputs "static")))
10893 (with-directory-excursion out
10894 (for-each (lambda (source)
10895 (let ((target (string-append static "/" source)))
10896 (mkdir-p (dirname target))
10897 (rename-file source target)))
10898 (find-files "lib" "\\.a$")))))))))
10899 (home-page "https://github.com/benhoyt/inih")
10900 (synopsis "Simple .INI parser library for C")
10901 (description "The inih (INI Not Invented Here) library is a simple .INI file
10902parser written in C. It's only a couple of pages of code, and it was designed to
10903be small and simple, so it's good for embedded systems. It's also more or less
10904compatible with Python's ConfigParser style of .INI files, including RFC
10905822-style multi-line syntax and name: value entries.")
10906 (license license:bsd-3)))
10907
10908(define-public simpleini
10909 (package
10910 (name "simpleini")
10911 (version "4.25")
10912 (source (origin
10913 (method git-fetch)
10914 (uri (git-reference
10915 (url "https://github.com/brofield/simpleini")
10916 (commit (string-append "v" version))))
10917 (file-name (git-file-name name version))
10918 (sha256
10919 (base32
10920 "1v9s0kr5ca1gdbnlkdz7chzypy0wz95f09l0r6jnmff4qy6db56l"))))
10921 (build-system cmake-build-system)
10922 (arguments
10923 (list #:configure-flags #~(list "-DSIMPLEINI_USE_SYSTEM_GTEST=ON")))
10924 (native-inputs (list googletest))
10925 (home-page "https://github.com/brofield/simpleini")
10926 (synopsis "Simple API to read and write INI-style files")
10927 (description
10928 "SimpleIni provides a simple API to read and write INI-style
10929configuration files. It supports data files in ASCII, MBCS and Unicode.")
10930 (license license:expat)))
10931
10932(define-public xfsprogs
10933 (package
10934 (name "xfsprogs")
10935 (version "6.12.0")
10936 (source
10937 (origin
10938 (method url-fetch)
10939 (uri (string-append "mirror://kernel.org/linux/utils/fs/xfs/xfsprogs/"
10940 "xfsprogs-" version ".tar.gz"))
10941 (sha256
10942 (base32 "1n46n27fxx1137kni3drrhzhp1l8ksxabcsmi8yzxbhpbnl4q293"))))
10943 (build-system gnu-build-system)
10944 (outputs (list "out" "python"))
10945 (arguments
10946 (list
10947 #:tests? #f ;kernel/user integration tests are in package "xfstests"
10948 #:configure-flags
10949 #~(list "--disable-static")
10950 #:make-flags
10951 #~(list "V=1")
10952 #:phases
10953 #~(modify-phases %standard-phases
10954 (add-after 'install 'separate-python-output
10955 (lambda _
10956 (for-each
10957 (lambda (script)
10958 (mkdir-p (string-append #$output:python (dirname script)))
10959 (rename-file (string-append #$output script)
10960 (string-append #$output:python script)))
10961 (list "/sbin/xfs_scrub_all"))))
10962 (add-after 'install 'install-headers
10963 (lambda* (#:key make-flags #:allow-other-keys)
10964 (apply invoke "make" "install-dev" make-flags))))))
10965 (native-inputs (list gettext-minimal))
10966 (inputs (list libinih
10967 liburcu
10968 (list util-linux "lib")
10969 python-wrapper))
10970 (home-page "https://xfs.wiki.kernel.org/")
10971 (synopsis "XFS file system tools")
10972 (description "This package provides commands to create and check XFS
10973file systems.")
10974 ;; The library "libhandle" and the headers in "xfslibs-dev" are
10975 ;; licensed under lgpl2.1. the other stuff is licensed under gpl2.
10976 (license (list license:gpl2 license:lgpl2.1))))
10977
10978(define-public xfsprogs-5.9
10979 (package
10980 (inherit xfsprogs)
10981 (name "xfsprogs")
10982 (version "5.9.0")
10983 (source (origin
10984 (method url-fetch)
10985 (uri (string-append
10986 "mirror://kernel.org/linux/utils/fs/xfs/xfsprogs/"
10987 "xfsprogs-" version ".tar.gz"))
10988 (sha256
10989 (base32
10990 "13xkn9jpmwp4fm9r68vhgznkmxhnv83n2b39mhy2qdaph90w2a1l"))))
10991 (arguments
10992 (substitute-keyword-arguments arguments
10993 ((#:configure-flags configure-flags #~(list))
10994 #~(cons* "--enable-gettext=no" #$configure-flags))))
10995 (native-inputs
10996 (modify-inputs native-inputs
10997 (delete "gettext-minimal")))))
10998
10999(define-public xfsprogs/static
11000 (package
11001 (inherit xfsprogs)
11002 (name "xfsprogs-static")
11003 (outputs (list "out"))
11004 (arguments
11005 (substitute-keyword-arguments arguments
11006 ((#:configure-flags configure-flags #~(list))
11007 #~(append #$configure-flags
11008 (list "--enable-static")))
11009 ((#:make-flags make-flags #~(list))
11010 #~(cons* "LLDFLAGS=-all-static" #$make-flags))
11011 ((#:phases _ #~%standard-phases)
11012 #~(modify-phases %standard-phases
11013 (add-after 'install 'delete-useless-files
11014 (lambda _
11015 (with-directory-excursion #$output
11016 (for-each delete-file-recursively
11017 (list "include" "lib")))))))))
11018 (inputs
11019 (modify-inputs inputs
11020 (delete "python-wrapper")
11021 (prepend (list libinih "static")
11022 (list util-linux "static"))))
11023 (synopsis "Statically linked XFS file system tools")))
11024
11025(define-public xfs-repair/static
11026 (package
11027 (name "xfs-repair-static")
11028 (version (package-version xfsprogs/static))
11029 (source #f)
11030 (build-system trivial-build-system)
11031 (arguments
11032 (list
11033 #:modules `((guix build utils))
11034 #:builder
11035 #~(begin
11036 (use-modules (guix build utils))
11037 (let ((sbin (string-append #$output "/sbin")))
11038 (install-file (search-input-file %build-inputs "/sbin/xfs_repair")
11039 sbin)
11040 (with-directory-excursion sbin
11041 (remove-store-references "xfs_repair"))))))
11042 (inputs (list xfsprogs/static))
11043 (home-page (package-home-page xfsprogs/static))
11044 (synopsis "Statically linked @command{xfs_repair} from xfsprogs")
11045 (description
11046 "This package provides a statically linked @command{xfs_repair} taken
11047from the xfsprogs package. It is meant to be used in initrds.")
11048 (license (package-license xfsprogs/static))))
11049
11050(define-deprecated-package xfs_repair/static
11051 "xfs_repair-static" xfs-repair/static)
11052
11053(define-public genext2fs
11054 (package
11055 (name "genext2fs")
11056 (version "1.5.0")
11057 (source (origin
11058 (method git-fetch)
11059 (uri (git-reference
11060 (url "https://github.com/bestouff/genext2fs")
11061 (commit "474111097321f03de9e009aa9f7d4a8948e310b2")))
11062 (file-name (git-file-name name version))
11063 (sha256
11064 (base32 "14lgvml5zz99845ja47jpf4iirjzfqv36ffzachh3hw2ggji9c7l"))))
11065 (build-system gnu-build-system)
11066 (native-inputs
11067 (list autoconf automake))
11068 (home-page "https://github.com/bestouff/genext2fs")
11069 (synopsis "Generate ext2 file system as a normal user")
11070 (description "This package provides a program to generate an ext2
11071file system as a normal (non-root) user. It does not require you to mount
11072the image file to copy files on it, nor does it require that you become
11073the superuser to make device nodes.")
11074 (license license:gpl2)))
11075
11076(define-public fakeroot
11077 (package
11078 (name "fakeroot")
11079 (version "1.38")
11080 (source
11081 (origin
11082 ;; There are no tags in the repository, so take this snapshot.
11083 (method url-fetch)
11084 (uri (string-append "https://deb.debian.org/debian/pool/main/f/"
11085 "fakeroot/fakeroot_" version ".orig.tar.gz"))
11086 (file-name (string-append name "-" version ".tar.gz"))
11087 (sha256
11088 (base32 "00p07xi1j61i4bbxymydihff8frw9bs0g0fr6rpm88q94wclcl1p"))
11089 (modules '((guix build utils)
11090 (ice-9 ftw)))
11091 (snippet
11092 `(begin
11093 ;; Delete pregenerated man page translations, but not the originals.
11094 (with-directory-excursion "doc"
11095 (for-each (lambda (language)
11096 (for-each delete-file
11097 (find-files language "\\.[0-9]$")))
11098 (scandir "."
11099 (lambda (file)
11100 (and (not (string-prefix? "." file))
11101 (eq? 'directory
11102 (stat:type (lstat file))))))))))))
11103 (build-system gnu-build-system)
11104 (arguments
11105 `(#:configure-flags
11106 (list "--disable-static")
11107 #:phases
11108 (modify-phases %standard-phases
11109 (add-after 'unpack 'patch-Makefile.am
11110 (lambda _
11111 (substitute* "Makefile.am"
11112 (("/bin/sh") (which "sh")))))
11113 (add-after 'unpack 'patch-script
11114 (lambda* (#:key inputs #:allow-other-keys)
11115 (substitute* "scripts/fakeroot.in"
11116 (("getopt")
11117 (string-append (assoc-ref inputs "util-linux")
11118 "/bin/getopt"))
11119 (("sed")
11120 (string-append (assoc-ref inputs "sed")
11121 "/bin/sed"))
11122 (("cat|cut" command)
11123 (string-append (assoc-ref inputs "coreutils")
11124 "/bin/" command)) )))
11125 (replace 'bootstrap
11126 (lambda _
11127 ;; The "preroll" script takes care of Autoconf and also
11128 ;; prepares the translated manuals.
11129 (invoke "sh" "./preroll")))
11130 (add-before 'configure 'setenv
11131 (lambda _
11132 (setenv "LIBS" "-lacl")))
11133 (add-before 'check 'prepare-check
11134 (lambda _
11135 (setenv "SHELL" (which "bash"))
11136 (setenv "VERBOSE" "1")
11137 (substitute* "test/t.touchinstall"
11138 ;; We don't have the name of the root user, so use ID=0.
11139 (("grep root") "grep \"\\<0\\>\""))
11140 (substitute* "test/tartest"
11141 ;; We don't have the name of the root group, so use ID=0.
11142 (("ROOTGROUP=root") "ROOTGROUP=0")
11143 ;; We don't have the name of the daemon user, so use IDs.
11144 (("daemon:sys") "1:3")
11145 (("daemon:") "1:"))
11146 ;; We don't have an /etc/passwd entry for "root" - use numeric IDs.
11147 (substitute* "test/compare-tar"
11148 (("tar -tvf") "tar --numeric-owner -tvf")))))))
11149 (native-inputs
11150 (list autoconf-2.71 automake gettext-minimal libtool po4a
11151 perl sharutils xz)) ; for tests
11152 (inputs
11153 (list acl libcap util-linux sed coreutils))
11154 (synopsis "Run commands in an environment with fake root privileges")
11155 (description
11156 "@command{fakeroot} runs a command in an environment where it appears to
11157have root privileges for file manipulation. This is useful for allowing users
11158to create archives (@file{tar}, @file{ar}, @file{deb}, etc.) with files in
11159them with root permissions and/or ownership.
11160
11161Without fakeroot, one would have to have root privileges to create the
11162constituent files of the archives with the correct permissions and ownership,
11163and then pack them up, or one would have to construct the archives directly,
11164without using the archiver.")
11165 (home-page "http://freshmeat.sourceforge.net/projects/fakeroot")
11166 (license license:gpl3+)))
11167
11168(define-public fakechroot
11169 ;; XXX: Build from the change submitted at
11170 ;; <https://github.com/dex4er/fakechroot/pull/85> to allow compilation
11171 ;; against glibc 2.33. Switch back to the official repository on the next
11172 ;; release.
11173 (let ((commit "e7c1f3a446e594a4d0cce5f5d499c9439ce1d5c5")
11174 (revision "0"))
11175 (package
11176 (name "fakechroot")
11177 (version (git-version "2.20.1" revision commit))
11178 (source (origin
11179 (method git-fetch)
11180 (uri (git-reference
11181 (url "https://github.com/lipnitsk/fakechroot")
11182 (commit commit)))
11183 (file-name (git-file-name name version))
11184 (sha256
11185 (base32
11186 "0gac6a6djx3nf343vd33sr5qqngz8ss3aij54zl8x9wb47pc11kb"))))
11187 (build-system gnu-build-system)
11188 (arguments
11189 ;; XXX: The tests heavily assume they run on an FHS system so for now
11190 ;; skip them.
11191 '(#:tests? #f
11192 #:configure-flags '("--disable-static")))
11193 (native-inputs (list autoconf automake libtool perl))
11194 (synopsis "Emulate @code{chroot} by overriding file system calls")
11195 (description
11196 "@command{fakechroot} runs a command in an environment were is additional
11197possibility to use @code{chroot} command without root privileges. This is
11198useful for allowing users to create own chrooted environment with possibility
11199to install another packages without need for root privileges.
11200
11201It works by providing @file{libfakechroot.so}, a shared library meant to be
11202set as @code{LD_PRELOAD} to override the C library file system functions.")
11203 (home-page "https://github.com/dex4er/fakechroot/")
11204 (license license:lgpl2.1+))))
11205
11206(define-public falcosecurity-libs
11207 (package
11208 (name "falcosecurity-libs")
11209 (version "0.20.0")
11210 (source (origin
11211 (method git-fetch)
11212 (uri (git-reference
11213 (url "https://github.com/falcosecurity/libs/")
11214 (commit version)))
11215 (file-name (git-file-name name version))
11216 (sha256
11217 (base32
11218 "041ir9wk44v7isidwl7fzxrjvs85j637wcr7xirasd8ysxa0r4qv"))
11219 (patches
11220 (search-patches
11221 "falcosecurity-libs-bpf-probes-fix.patch"
11222 "falcosecurity-libs-shared-build.patch"))))
11223 (build-system cmake-build-system)
11224 (arguments
11225 (list
11226 #:configure-flags
11227 #~(list "-DUSE_BUNDLED_DEPS=OFF"
11228 "-DBUILD_DRIVER=OFF"
11229 "-DENABLE_DKMS=OFF"
11230 "-DBUILD_LIBSCAP_MODERN_BPF=ON"
11231 "-DSCAP_FILES_SUITE_ENABLE=OFF" ;attempts to download scap files
11232 "-DBUILD_SHARED_LIBS=ON"
11233 #$(string-append "-DFALCOSECURITY_LIBS_VERSION=" version))
11234 ;; Only the libsinsp test suite is run, as the one for libscap requires
11235 ;; elevated privileges.
11236 #:modules '((guix build cmake-build-system)
11237 ((guix build gnu-build-system) #:prefix gnu:)
11238 (guix build utils))
11239 #:phases
11240 #~(modify-phases %standard-phases
11241 (add-after 'unpack 'disable-problematic-tests
11242 (lambda _
11243 (substitute* "userspace/libsinsp/test/user.ut.cpp"
11244 ;; The 'system_lookup' test assumes a root user
11245 ;; exists in the build environment.
11246 (("TEST_F\\(usergroup_manager_test, system_lookup)")
11247 "TEST_F(usergroup_manager_test, DISABLED_system_lookup)"))))
11248 (replace 'check
11249 (lambda* (#:rest args)
11250 (apply (assoc-ref gnu:%standard-phases 'check)
11251 #:test-target "run-unit-test-libsinsp" args)))
11252 (add-after 'install 'delete-src
11253 (lambda _
11254 (delete-file-recursively
11255 (string-append #$output "/src")))))))
11256 (native-inputs
11257 (list bpftool
11258 clang-18 ;avoid stack limit exceeded build error
11259 googletest
11260 pkg-config
11261 valijson)) ;header-only library
11262 (inputs
11263 (list elfutils))
11264 (propagated-inputs
11265 ;; The following inputs are in the 'Requires' field of libscap.pc,
11266 ;; libsinp.pc or libpman.pc.
11267 (list c-ares
11268 grpc
11269 jsoncpp
11270 libbpf
11271 libelf
11272 openssl
11273 protobuf
11274 uthash ;included in libscap headers
11275 zlib
11276 ;; These are in the 'Requires.private' field of libscap.pc and
11277 ;; libsinp.pc. They are required because the headers are installed
11278 ;; to a non-standard directory, and thus need to be found via the
11279 ;; 'Cflags' field, which in turn mandates that both the pkg-config
11280 ;; modules listed in the 'Requires' and 'Requires.private' be
11281 ;; available.
11282 curl
11283 re2
11284 onetbb))
11285 (home-page "https://github.com/falcosecurity/libs/")
11286 (synopsis "Falco security libraries")
11287 (description "The Falco security libraries include @code{libsinsp} and
11288@code{libscap}. @code{libscap} manages the data capture process, while
11289@code{libsinsp} is a system inspection library that enriches events from
11290@code{libscap} with machine state. @code{libsinsp} also performs events
11291filtering with rule evaluation through its internal rule engine. These
11292libraries are used by the @command{sysdig} command-line utility.")
11293 (license license:asl2.0)))
11294
11295(define-public inputattach
11296 (package
11297 (name "inputattach")
11298 (version "0.42.0")
11299 (source (origin
11300 (method git-fetch)
11301 (uri (git-reference
11302 (url "https://github.com/linuxwacom/input-wacom")
11303 (commit (string-append "input-wacom-" version))))
11304 (file-name (git-file-name name version))
11305 (sha256
11306 (base32 "04lnn7v0rm4ppbya140im5d4igcl6c1nrqpgbsr0i8wkral0nv7j"))))
11307 (build-system gnu-build-system)
11308 (arguments
11309 `(#:phases
11310 (modify-phases %standard-phases
11311 (delete 'bootstrap)
11312 (delete 'configure)
11313 (replace 'build
11314 (lambda* (#:key inputs #:allow-other-keys)
11315 (with-directory-excursion "inputattach"
11316 (invoke "gcc" "-O2" "-o" "inputattach"
11317 "inputattach.c"))))
11318 (delete 'check)
11319 (replace 'install
11320 (lambda* (#:key outputs #:allow-other-keys)
11321 (let ((target-dir (string-append
11322 (assoc-ref outputs "out")
11323 "/bin/")))
11324 (mkdir-p target-dir)
11325 (copy-file "inputattach/inputattach"
11326 (string-append target-dir
11327 "inputattach"))
11328 #t))))))
11329 (home-page "https://linuxwacom.github.io/")
11330 (synopsis "Dispatch input peripherals events to a device file")
11331 (description "inputattach dispatches input events from several device
11332types and interfaces and translates so that the X server can use them.")
11333 (license license:gpl2+)))
11334
11335(define-public keyd
11336 (package
11337 (name "keyd")
11338 (version "2.6.0")
11339 (source
11340 (origin
11341 (method git-fetch)
11342 (uri (git-reference
11343 (url "https://github.com/rvaiya/keyd")
11344 (commit (string-append "v" version))))
11345 (sha256
11346 (base32
11347 "14rgrg8d1ys1cqq46mgi34yqg9jd1q3yw1acw5r5jpwwk0da7g4p"))))
11348 (arguments
11349 (list #:tests? #f ; tests require root
11350 #:make-flags
11351 #~(list (string-append "CC=" #$(cc-for-target))
11352 "PREFIX="
11353 (string-append "DESTDIR=" #$output))
11354 #:phases
11355 '(modify-phases
11356 %standard-phases
11357 (delete 'configure)))) ; no autoconf
11358 (build-system gnu-build-system)
11359 (inputs (list linux-libre-headers))
11360 (synopsis "Key remapping daemon for Linux")
11361 (description
11362 "Keyd is a keyboard remapping utility with intuitive ini configuration
11363file format. Keyd has several features, many of which are traditionally only
11364found in custom keyboard firmware like QMK.")
11365 (home-page "https://github.com/rvaiya/keyd")
11366 (license license:expat)))
11367
11368(define-public pipewire
11369 (package
11370 (name "pipewire")
11371 (version "1.6.8")
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 "1yc70gi4a98q7kbghp08nyp3wvlik120v2w25a14b93gpgwbl55k"))))
11381 (build-system meson-build-system)
11382 (arguments
11383 (list
11384 #:configure-flags
11385 #~(list (string-append "-Dudevrulesdir=" #$output "/lib/udev/rules.d")
11386 "-Dman=enabled"
11387 "-Drlimits-install=false"
11388 "-Dsession-managers=[]"
11389 "-Dsysconfdir=/etc"
11390 "-Dlibsystemd=disabled"
11391
11392 ;; XXX: link with -Wl,--no-as-needed so that libgcc_s.so.1 does not get dropped
11393 ;; Otherwise test_loop will fail with:
11394 ;; libgcc_s.so.1 must be installed for pthread_cancel to work
11395 "-Db_asneeded=false")))
11396 (native-inputs
11397 (list `(,glib "bin")
11398 pkg-config
11399 doxygen
11400 python
11401 python-docutils))
11402 (inputs (list alsa-lib
11403 avahi
11404 bluez
11405 dbus
11406 eudev
11407 ffmpeg
11408 gst-plugins-base
11409 gstreamer
11410 jack-2
11411 ldacbt
11412 libcamera-minimal
11413 libdrm
11414 libfdk
11415 libfreeaptx
11416 libsndfile
11417 libusb
11418 openssl ; raop sink
11419 libva
11420 pulseaudio
11421 readline ; for pw-cli
11422 sbc
11423 vulkan-headers
11424 vulkan-loader
11425 webrtc-audio-processing))
11426 (home-page "https://pipewire.org/")
11427 (synopsis "Server and user space API to deal with multimedia pipelines")
11428 (description
11429 "PipeWire is a project that aims to greatly improve handling of audio and
11430video under Linux. It aims to support the usecases currently handled by both
11431PulseAudio and Jack and at the same time provide same level of powerful handling
11432of Video input and output. It also introduces a security model that makes
11433interacting with audio and video devices from containerized applications easy,
11434with supporting Flatpak applications being the primary goal. Alongside Wayland
11435and Flatpak we expect PipeWire to provide a core building block for the future
11436of Linux application development.")
11437 (license license:lgpl2.0+)))
11438
11439(define-public pipewire-minimal
11440 ;; Used as libpipewire to reduce closure size and avoid dependency cycles.
11441 (hidden-package
11442 (package
11443 (inherit pipewire)
11444 (name "pipewire-minimal")
11445 (arguments
11446 (list
11447 #:configure-flags
11448 #~(list "-Dsession-managers=[]"
11449 "-Ddbus=disabled"
11450 "-Dflatpak=disabled"
11451 ;; XXX: Otherwise test_loop will fail with:
11452 ;; libgcc_s.so.1 must be installed for pthread_cancel to work
11453 "-Db_asneeded=false")))
11454 (native-inputs '())
11455 (inputs '()))))
11456
11457(define-public pipewire-minimal-1.4
11458 (package
11459 (inherit pipewire-minimal)
11460 (name "pipewire")
11461 (version "1.4.10")
11462 (source (origin
11463 (method git-fetch)
11464 (uri (git-reference
11465 (url "https://gitlab.freedesktop.org/pipewire/pipewire")
11466 (commit version)))
11467 (file-name (git-file-name name version))
11468 (sha256
11469 (base32
11470 "14rsdbcsyyhjh7hvbq3d84f6s0fllvq6vpg39cxcd7l8fn4zc2zw"))))))
11471
11472(define-public wireplumber
11473 (package
11474 (name "wireplumber")
11475 (version "0.5.15")
11476 (source
11477 (origin
11478 (method git-fetch)
11479 (uri (git-reference
11480 (url
11481 "https://gitlab.freedesktop.org/pipewire/wireplumber.git")
11482 (commit version)))
11483 (file-name (git-file-name name version))
11484 (sha256
11485 (base32 "1a7fzfdxipjaq0fb695jbpipnlr67yl273x1gd9mmpbnqmgnphnv"))))
11486 (build-system meson-build-system)
11487 (arguments
11488 `(#:configure-flags '("-Dsystemd=disabled"
11489 "-Dsystem-lua=true")))
11490 (native-inputs
11491 (list `(,glib "bin")
11492 pkg-config python-minimal))
11493 (inputs (list dbus elogind glib lua pipewire))
11494 (home-page "https://gitlab.freedesktop.org/pipewire/wireplumber")
11495 (synopsis "Session / policy manager implementation for PipeWire")
11496 (description "WirePlumber is a modular session / policy manager for
11497PipeWire and a GObject-based high-level library that wraps PipeWire's API,
11498providing convenience for writing the daemon's modules as well as external
11499tools for managing PipeWire.")
11500 (license license:expat)))
11501
11502(define-public wireplumber-minimal
11503 (let ((base wireplumber))
11504 (package
11505 (inherit base)
11506 (name "wireplumber-minimal")
11507 (arguments
11508 (substitute-keyword-arguments arguments
11509 ((#:configure-flags flags ''())
11510 #~(cons "-Delogind=disabled" #$flags))))
11511 (inputs
11512 (modify-inputs inputs
11513 (delete "elogind"))))))
11514
11515(define-public ell
11516 (package
11517 (name "ell")
11518 (version "0.83")
11519 (source (origin
11520 (method git-fetch)
11521 (uri (git-reference
11522 (url "https://git.kernel.org/pub/scm/libs/ell/ell.git")
11523 (commit version)))
11524 (file-name (git-file-name name version))
11525 (sha256
11526 (base32
11527 "1ywq84jgvf7f86srqwpq31w2kzdp875fx039x5g4lx486plgf526"))
11528 (modules '((guix build utils)))
11529 (snippet
11530 #~(begin
11531 (substitute* "Makefile.am"
11532 ;; requires hwdb.bin
11533 (("unit/test-hwdb.*") ""))))))
11534 (build-system gnu-build-system)
11535 (arguments
11536 ;; Tests launch dbus-daemon instances that all try to bind to
11537 ;; "/tmp/ell-test-bus". Thus, we need to run them sequentially.
11538 '(#:parallel-tests? #f))
11539 (inputs
11540 (list dbus))
11541 (native-inputs
11542 (list autoconf automake libtool pkg-config procps))
11543 (home-page "https://01.org/ell")
11544 (synopsis "Embedded Linux Library")
11545 (description "The Embedded Linux* Library (ELL) provides core, low-level
11546functionality for system daemons. It typically has no dependencies other than
11547the Linux kernel, C standard library, and libdl (for dynamic linking). While
11548ELL is designed to be efficient and compact enough for use on embedded Linux
11549platforms, it is not limited to resource-constrained systems.")
11550 (license license:lgpl2.1+)))
11551
11552(define-public kexec-tools
11553 (package
11554 (name "kexec-tools")
11555 (version "2.0.31")
11556 (source (origin
11557 (method url-fetch)
11558 (uri (string-append "mirror://kernel.org/linux/utils/kernel"
11559 "/kexec/kexec-tools-" version ".tar.xz"))
11560 (sha256
11561 (base32
11562 "0c9cj9xvcm81gcwnkvvh9vh82v59kdz5llmblc2wkqb6vh6kb3wa"))))
11563 (build-system gnu-build-system)
11564 (arguments
11565 ;; There are no automated tests.
11566 '(#:tests? #f))
11567 ;; This variant of binutils is used for the 64 bit support needed to
11568 ;; assemble the `purgatory/arch/i386/compat_x86_64.S' program on i686-linux.
11569 (native-inputs (list (make-ld-wrapper "ld-wrapper"
11570 #:binutils binutils)
11571 binutils))
11572 (home-page "https://projects.horms.net/projects/kexec/")
11573 (synopsis "Tools for booting directly into different kernels")
11574 (description "This package provides the @code{kexec} program and ancillary
11575utilities. Using @code{kexec}, it is possible to boot directly into a new
11576kernel from the context of an already-running kernel, bypassing the normal
11577system boot process.")
11578 (supported-systems (delete "riscv64-linux" %supported-systems))
11579 (license license:gpl2)))
11580
11581(define-public cachefilesd
11582 (package
11583 (name "cachefilesd")
11584 (version "0.10.10")
11585 (source (origin
11586 (method url-fetch)
11587 (uri (string-append
11588 "https://git.kernel.org/pub/scm/linux/kernel/git/dhowells"
11589 "/cachefilesd.git/snapshot/cachefilesd-"
11590 version ".tar.gz"))
11591 (sha256
11592 (base32
11593 "0g40ljjnn3wzh9gp6il21c95f977298qrrkrxfnwfl3k3asfmnbi"))))
11594 (build-system gnu-build-system)
11595 (outputs '("out"))
11596 (arguments
11597 `(#:tests? #f ; there are no tests
11598 #:make-flags
11599 (let ((prefix-dir (lambda (var dir)
11600 (string-append var "=" %output "/" dir))))
11601 (list (string-append "CC=" ,(cc-for-target))
11602 (prefix-dir "SBINDIR" "sbin/")
11603 (prefix-dir "ETCDIR" "etc/")
11604 (prefix-dir "MANDIR" "share/man/")))
11605 #:phases (modify-phases %standard-phases (delete 'configure))))
11606 (home-page "https://people.redhat.com/~dhowells/cachefs/")
11607 (synopsis "CacheFiles userspace management daemon")
11608 (description "@code{cachefilesd} is a userspace daemon that manages the
11609cache data store that is used by network file systems such as @code{AFS} and
11610@code{NFS} to cache data locally on disk. The content of the cache is
11611persistent over reboots.")
11612 (license license:gpl2+)))
11613
11614(define-public libbpf
11615 (package
11616 (name "libbpf")
11617 (version "1.7.0")
11618 (source
11619 (origin
11620 (method git-fetch)
11621 (uri (git-reference
11622 (url "https://github.com/libbpf/libbpf")
11623 (commit (string-append "v" version))))
11624 (file-name (git-file-name name version))
11625 (sha256
11626 (base32
11627 "1r1ysy8xpdz2nqs0svk4772fbykqh414mqivwylbj5r9v1nf8r02"))))
11628 (build-system gnu-build-system)
11629 (arguments
11630 (list
11631 #:tests? #f ;self-tests run in QEMU
11632 #:make-flags
11633 #~(list (string-append "PREFIX=" #$output)
11634 (string-append "LIBDIR=$(PREFIX)/lib")
11635 (string-append "CC=" #$(cc-for-target)))
11636 #:phases
11637 #~(modify-phases %standard-phases
11638 (delete 'configure)
11639 (add-before 'build 'pre-build
11640 (lambda _
11641 (chdir "src")))
11642 (replace 'install
11643 (lambda* (#:key make-flags #:allow-other-keys #:rest args)
11644 (apply (assoc-ref %standard-phases 'install)
11645 (append args
11646 (list #:make-flags
11647 (append (list "install"
11648 ;; Also install the kernel
11649 ;; user API (uAPI) headers.
11650 "install_uapi_headers")
11651 make-flags)))))))))
11652 (native-inputs (list pkg-config))
11653 (propagated-inputs (list elfutils zlib)) ;in Requires.private of libbpf.pc
11654 (home-page "https://github.com/libbpf/libbpf")
11655 (synopsis "BPF CO-RE (Compile Once – Run Everywhere)")
11656 (description
11657 "Libbpf supports building BPF CO-RE-enabled applications, which, in
11658contrast to BCC, do not require the Clang/LLVM runtime or linux kernel
11659headers.")
11660 (license (list license:lgpl2.1 license:bsd-2))))
11661
11662(define-public libbpf-0.8
11663 (package
11664 (inherit libbpf)
11665 (name "libbpf")
11666 (version "0.8.1")
11667 (source
11668 (origin
11669 (method git-fetch)
11670 (uri (git-reference
11671 (url "https://github.com/libbpf/libbpf")
11672 (commit (string-append "v" version))))
11673 (file-name (git-file-name name version))
11674 (sha256
11675 (base32
11676 "1zzpkk4x3f20483dzw43b3ml03d63vvkmqf4j8y3b61b67wm59bm"))))
11677 (arguments
11678 (list
11679 #:tests? #f ;self-tests run in QEMU
11680 #:make-flags
11681 #~(list (string-append "PREFIX=" #$output)
11682 (string-append "LIBDIR=$(PREFIX)/lib")
11683 (string-append "CC=" #$(cc-for-target)))
11684 #:phases #~(modify-phases %standard-phases
11685 (delete 'configure)
11686 (add-before 'build 'pre-build
11687 (lambda _
11688 (chdir "src"))))))
11689 (native-inputs (list pkg-config))
11690 (propagated-inputs (list elfutils zlib)))) ;in Requires.private of libbpf.pc
11691
11692(define-public bcc
11693 (package
11694 (name "bcc")
11695 (version "0.30.0")
11696 (source
11697 (origin
11698 (method git-fetch)
11699 (uri (git-reference
11700 (url "https://github.com/iovisor/bcc")
11701 (commit (string-append "v" version))))
11702 (file-name (git-file-name name version))
11703 (sha256
11704 (base32
11705 "0b5la0yn6x6ll73drnrm5v5yibbrzkvl86hqivkrmnpgy8cqn0cy"))))
11706 (build-system cmake-build-system)
11707 (native-inputs
11708 (list bison
11709 flex
11710 (@ (gnu packages compression) zip)))
11711 (inputs
11712 (list bash-minimal ;for wrap-program
11713 clang-15
11714 elfutils
11715 luajit
11716 libbpf
11717 python-setuptools
11718 python-wrapper))
11719 (arguments
11720 (list
11721 ;; Tests all require root permissions and a "standard" file hierarchy.
11722 #:tests? #f
11723 #:configure-flags #~(list (string-append "-DREVISION=" #$version)
11724 "-DCMAKE_USE_LIBBPF_PACKAGE=ON")
11725 #:phases
11726 #~(modify-phases %standard-phases
11727 (add-after 'unpack 'substitute-libbc
11728 (lambda _
11729 (substitute* "src/python/bcc/libbcc.py"
11730 (("(libbcc\\.so.*)\\b" _ libbcc)
11731 (string-append #$output "/lib/" libbcc)))))
11732 (add-after 'install 'wrap-tools
11733 (lambda _
11734 (use-modules (ice-9 textual-ports))
11735 (let* ((out #$output)
11736 (lib (string-append out "/lib"))
11737 (tools (string-append out "/share/bcc/tools"))
11738 (python-executable?
11739 (lambda (filename _)
11740 (call-with-input-file filename
11741 (lambda (port)
11742 (string-contains (get-line port)
11743 "/bin/python"))))))
11744 (for-each (lambda (python-executable)
11745 (format #t "Wrapping: ~A.~%" python-executable)
11746 (wrap-program python-executable
11747 `("GUIX_PYTHONPATH" ":" prefix
11748 (,(string-append lib
11749 "/python"
11750 #$(version-major+minor
11751 (package-version python))
11752 "/site-packages")))))
11753 (find-files tools python-executable?))))))))
11754 (home-page "https://github.com/iovisor/bcc")
11755 (synopsis "Tools for BPF on Linux")
11756 (description
11757 "BCC is a toolkit for creating efficient kernel tracing and manipulation
11758programs, and includes several useful tools and examples. It makes use of
11759extended BPF (Berkeley Packet Filters), formally known as eBPF, a new feature
11760that was first added to Linux 3.15. Much of what BCC uses requires Linux 4.1
11761and above.")
11762 (license license:asl2.0)))
11763
11764(define-public bpftool
11765 (package
11766 (name "bpftool")
11767 (version (package-version linux-libre))
11768 (source (package-source linux-libre))
11769 (build-system gnu-build-system)
11770 (arguments
11771 `(#:tests? #f ;This package has no tests.
11772 #:phases (modify-phases %standard-phases
11773 (delete 'configure)
11774 (replace 'build
11775 (lambda* (#:key inputs #:allow-other-keys)
11776 (invoke "make" "-C" "tools/bpf/bpftool"
11777 ,(string-append "CC=" (cc-for-target)))))
11778 (replace 'install
11779 (lambda* (#:key outputs #:allow-other-keys)
11780 (let* ((out (assoc-ref outputs "out")))
11781 (mkdir-p (string-append out "/sbin"))
11782 (mkdir-p (string-append out
11783 "/share/bash-completion/completions"))
11784 (invoke "make"
11785 (string-append "prefix=" out)
11786 (string-append
11787 "bash_compdir=" out
11788 "/share/bash-completion/completions")
11789 "-C" "tools/bpf/bpftool"
11790 "install")))))))
11791 (inputs (list elfutils ;provides libelf
11792 libcap openssl readline zlib))
11793 (native-inputs (list bison python))
11794 ;; This tool does not have a proper web page.
11795 (home-page
11796 "https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/tree/tools/bpf/bpftool")
11797 (synopsis "Tool for inspection and manipulation of eBPF programs and maps")
11798 (description "@command{bpftool} allows for inspection and simple
11799modification of BPF objects on the system.")
11800 (license (package-license linux-libre))))
11801
11802(define-public bpftrace
11803 (package
11804 (name "bpftrace")
11805 (version "0.21.2")
11806 (source
11807 (origin
11808 (method git-fetch)
11809 (uri (git-reference
11810 (url "https://github.com/bpftrace/bpftrace")
11811 (commit (string-append "v" version))))
11812 (file-name (git-file-name name version))
11813 (sha256
11814 (base32 "0icbhf1wk523a7lcmwqa67zc6hl6h02p5mfg26cizva447kbwsgz"))))
11815 (build-system cmake-build-system)
11816 (arguments
11817 (list
11818 #:test-exclude "(runtime_tests|tools-parsing-test)"
11819 #:phases
11820 #~(modify-phases %standard-phases
11821 ;; This patch also fixes broken compilation due to improper detection
11822 ;; of bfd features. This is taken from following upstream PR:
11823 ;; https://github.com/bpftrace/bpftrace/pull/3332
11824 (add-after 'unpack 'patch-paths-and-bfd-defs
11825 (lambda _
11826 (substitute* '("cmake/FindLibBfd.cmake"
11827 "src/CMakeLists.txt")
11828 (("LIBSFRAME_FOUND")
11829 "LIBSFRAME_LIBRARIES")
11830 (("LIBZSTD_FOUND")
11831 "LIBZSTD_LIBRARIES"))
11832 (with-directory-excursion "tests"
11833 (substitute* (find-files ".")
11834 (("/bin/sh")
11835 (which "sh")))
11836 (substitute* '("child.cpp"
11837 "runtime/call"
11838 "procmon.cpp")
11839 (("/bin/ls")
11840 (which "ls"))))))
11841 (add-after 'unpack 'fix-paths
11842 (lambda* (#:key inputs outputs #:allow-other-keys)
11843 (substitute* '("tests/child.cpp")
11844 (("/bin/sleep")
11845 (search-input-file inputs "bin/sleep")))))
11846 (add-before 'check 'set-test-filter
11847 (lambda _
11848 (setenv "GTEST_FILTER"
11849 (string-join
11850 (list ; "-" disables all following tests
11851 "-ast.probe_name_uprobe"
11852 "bpftrace.add_probes_uprobe_wildcard_file"
11853 "bpftrace.add_probes_uprobe_wildcard_file_uprobe_multi"
11854 "bpftrace.add_probes_usdt_wildcard"
11855 "Parser.multiple_attach_points_kprobe"
11856 "Parser.uretprobe_offset"
11857 "semantic_analyser.builtin_functions"
11858 "semantic_analyser.call_func"
11859 "semantic_analyser.call_uaddr")
11860 ":")))))))
11861 (native-inputs (list bison coreutils dwarves flex googletest xxd))
11862 (inputs (list bcc clang-15 elfutils libbpf libiberty cereal))
11863 (home-page "https://github.com/bpftrace/bpftrace")
11864 (synopsis "High-level tracing language for Linux eBPF")
11865 (description
11866 "bpftrace is a high-level tracing language for Linux enhanced Berkeley
11867Packet Filter (eBPF) available in recent Linux kernels (4.x). bpftrace uses
11868LLVM as a backend to compile scripts to BPF-bytecode and makes use of BCC for
11869interacting with the Linux BPF system, as well as existing Linux tracing
11870capabilities: kernel dynamic tracing (kprobes), user-level dynamic
11871tracing (uprobes), and tracepoints. The bpftrace language is inspired by awk
11872and C, and predecessor tracers such as DTrace and SystemTap. bpftrace was
11873created by Alastair Robertson.")
11874 (license license:asl2.0)))
11875
11876(define-public ttyebus-linux-module
11877 (let ((revision "0")
11878 (commit "fe4332a2281cf79804ef4d8516aa848ca1c58d1f"))
11879 (package
11880 (name "ttyebus-linux-module")
11881 (version (git-version "1.5" revision commit))
11882 (source
11883 (origin
11884 (method git-fetch)
11885 (uri (git-reference
11886 (url "https://github.com/eBUS/ttyebus")
11887 (commit "fe4332a2281cf79804ef4d8516aa848ca1c58d1f")))
11888 (file-name (git-file-name name version))
11889 (sha256
11890 (base32
11891 "1i66xjs9vln5cca6wx7aiiw7jihrlsk9hjdqyczp36fvm1b1bani"))))
11892 (supported-systems '("armhf-linux" "aarch64-linux"))
11893 (build-system linux-module-build-system)
11894 (arguments
11895 `(#:tests? #f))
11896 (home-page "https://github.com/eBUS/ttyebus")
11897 (synopsis "Low-latency Raspberry Pi UART driver")
11898 (description "This package provides a Linux kernel module that will
11899provide a serial device @code{/dev/ttyebus} with almost no latency upon
11900receiving. It is dedicated to the PL011 UART of the Raspberry Pi.")
11901 (license license:gpl3+))))
11902
11903(define-public ipset
11904 (package
11905 (name "ipset")
11906 (version "7.17")
11907 (source
11908 (origin
11909 (method url-fetch)
11910 (uri (string-append "https://ipset.netfilter.org/"
11911 "ipset-" version ".tar.bz2"))
11912 (sha256
11913 (base32 "1n34mkrdha9rggd0fizjx6baqkiqqd1yfhb5ml663mlx93zwjjdy"))))
11914 (build-system gnu-build-system)
11915 (inputs
11916 (list libmnl))
11917 (native-inputs
11918 (list pkg-config))
11919 (arguments
11920 `(#:configure-flags '("--disable-static"
11921 "--with-kmod=no")))
11922 (home-page "https://ipset.netfilter.org/")
11923 (synopsis "Administration tool for IP sets")
11924 (description "IP sets are a framework inside the Linux 2.4.x and 2.6.x kernel which
11925can be administered by the ipset utility. Depending on the type,
11926currently an IP set may store IP addresses, (TCP/UDP) port numbers or
11927IP addresses with MAC addresses in a way which ensures lightning speed
11928when matching an entry against a set.
11929
11930If you want to
11931@itemize @bullet
11932@item store multiple IP addresses or port numbers and match against the entire
11933collection using a single iptables rule.
11934@item dynamically update iptables rules against IP addresses or ports without
11935performance penalty.
11936@item express complex IP address and ports based rulesets with a single
11937iptables rule and benefit from the speed of IP sets.
11938@end itemize\n
11939then IP sets may be the proper tool for you.")
11940 (license license:gpl2+)))
11941
11942(define-public liburing
11943 (package
11944 (name "liburing")
11945 (version "2.15")
11946 (source (origin
11947 (method git-fetch)
11948 (uri (git-reference
11949 (url "https://github.com/axboe/liburing")
11950 (commit (string-append "liburing-" version))))
11951 (file-name (git-file-name name version))
11952 (sha256
11953 (base32
11954 "1vq47c15fv60992qla7y9s3b52v958zkbfpr0hscji1n6bj6w4x0"))))
11955 (build-system gnu-build-system)
11956 (arguments
11957 `(;; Tests are dependent on kernel version and features
11958 #:tests? #f
11959 #:phases
11960 (modify-phases %standard-phases
11961 (replace 'configure
11962 ;; configure fails if it is followed by SHELL, CONFIG_SHELL,
11963 ;; --enable-fast-install, and --build
11964 (lambda* (#:key outputs #:allow-other-keys)
11965 (let ((out (assoc-ref outputs "out")))
11966 (setenv "SHELL" (which "sh"))
11967 (setenv "CONFIG_SHELL" (which "sh"))
11968 (invoke "./configure" (string-append "--prefix=" out))))))))
11969 (home-page "https://github.com/axboe/liburing")
11970 (synopsis "Interface to the Linux kernel @code{io_uring} interface")
11971 (description "This is the io_uring library, liburing. liburing provides
11972helpers to setup and teardown io_uring instances, and also a simplified
11973interface for applications that don't need (or want) to deal with the full
11974kernel side implementation.")
11975 (license license:expat)))
11976
11977(define-public erofs-utils
11978 (package
11979 (name "erofs-utils")
11980 (version "1.8.10")
11981 (source
11982 (origin
11983 (method git-fetch)
11984 (uri (git-reference
11985 (url "https://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs-utils.git")
11986 (commit (string-append "v" version))))
11987 (file-name (git-file-name name version))
11988 (sha256
11989 (base32 "1qlig9q1fdjl0zn7206dbv7w5ssjg4az4hg7y3vk69ly0zbmwkil"))))
11990 (build-system gnu-build-system)
11991 (inputs
11992 (list lz4
11993 `(,util-linux "lib")
11994 zlib))
11995 (native-inputs
11996 (list autoconf automake libtool pkg-config))
11997 (home-page "https://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs-utils.git/")
11998 (synopsis "User-space tools for the EROFS file system")
11999 (description
12000 "@acronym{EROFS, The Enhanced Read-Only File System} is a compressed,
12001read-only file system optimized for resource-scarce devices. This package
12002provides user-space tools for creating EROFS file systems.")
12003 (license license:gpl2+)))
12004
12005(define-public rasdaemon
12006 (package
12007 (name "rasdaemon")
12008 (version "0.8.4")
12009 (source
12010 (origin
12011 (method git-fetch)
12012 (uri (git-reference
12013 (url "https://github.com/mchehab/rasdaemon")
12014 (commit (string-append "v" version))))
12015 (file-name (git-file-name name version))
12016 (sha256
12017 (base32 "1930g35igfdw5bzcd6diy59rm1q4yirpjgqznfqfsichnmk04kmf"))))
12018 (native-inputs (list autoconf automake libtool pkg-config))
12019 (inputs
12020 (list bash-minimal
12021 dmidecode
12022 kmod
12023 libtraceevent
12024 pciutils
12025 perl
12026 perl-dbd-sqlite
12027 sqlite))
12028 (arguments
12029 (list
12030 #:configure-flags
12031 #~(list "--enable-all"
12032 ;; Don't install unused /etc/sysconfig/rasdaemon environment file.
12033 "--with-sysconfdefdir=."
12034 "--localstatedir=/var")
12035 #:phases
12036 #~(modify-phases %standard-phases
12037 (add-after 'unpack 'rename-README
12038 (lambda _
12039 ;; Required by autoreconf
12040 (rename-file "README.md" "README")))
12041 (add-before 'configure 'munge-autotools
12042 (lambda _
12043 ;; For some reason upstream forces sysconfdir=/etc. This results
12044 ;; in EPERM during the install phase. Removing the offending
12045 ;; line lets sysconfdir correctly pick up DESTDIR.
12046 (substitute* "configure.ac"
12047 (("^test .* sysconfdir=/etc\n$") ""))))
12048 (add-after 'install 'wrap-rasdaemon
12049 (lambda* (#:key inputs #:allow-other-keys)
12050 (let ((path (map dirname
12051 (list (search-input-file inputs "/sbin/dmidecode")
12052 (search-input-file inputs "/bin/modprobe")))))
12053 (wrap-program (string-append #$output "/sbin/ras-mc-ctl")
12054 `("PATH" ":" prefix ,path)
12055 `("PERL5LIB" ":" prefix ,(string-split (getenv "PERL5LIB") #\:)))))))))
12056 (build-system gnu-build-system)
12057 (home-page "https://github.com/mchehab/rasdaemon")
12058 (synopsis "Platform Reliability, Availability, and Serviceability tools")
12059 (description
12060 "The @code{rasdaemon} daemon monitors platform @acronym{RAS, Reliability
12061Availability and Serviceability} reports from Linux kernel trace events.
12062These trace events are logged in @file{/sys/kernel/debug/tracing} and reported
12063through standard log mechanisms like syslog.")
12064 (license license:gpl2)))
12065
12066(define-public renameat2
12067 ;; This is a Gist, with no release or tags.
12068 (let ((revision "0")
12069 (commit "5c5193f20142511a5fc7069a539f4e5aba0ea470"))
12070 (package
12071 (name "renameat2")
12072 (version (git-version "0.0.0" revision commit))
12073 (source (origin
12074 (method url-fetch)
12075 (uri (string-append "https://gist.githubusercontent.com/"
12076 "eatnumber1/f97ac7dad7b1f5a9721f/raw/"
12077 commit "/renameat2.c"))
12078 (sha256
12079 (base32
12080 "07b4hsxqjm610sdkm4nxhp0gnl2s7gzlh4zdnja5ay40v4x24bb9"))))
12081 (build-system gnu-build-system)
12082 (arguments
12083 (list
12084 #:tests? #f ;no test suite
12085 #:phases #~(modify-phases %standard-phases
12086 (delete 'configure)
12087 (replace 'build
12088 (lambda _
12089 (invoke #$(cc-for-target) "renameat2.c"
12090 "-o" "renameat2")))
12091 (replace 'install
12092 (lambda _
12093 (install-file "renameat2"
12094 (string-append #$output "/bin")))))))
12095 (home-page "https://gist.github.com/eatnumber1/f97ac7dad7b1f5a9721f")
12096 (synopsis "Command to call the renameat2 Linux system call")
12097 (description "This package provides a @command{renameat2} command that
12098calls the Linux-specific @code{renameat2} system call.")
12099 (license license:expat))))
12100
12101(define-public libgpiod
12102 (package
12103 (name "libgpiod")
12104 (version "2.2.2")
12105 (source
12106 (origin
12107 (method git-fetch)
12108 (uri
12109 (git-reference
12110 (url "https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git")
12111 (commit (string-append "v" version))))
12112 (file-name (git-file-name name version))
12113 (sha256 (base32 "10yiwrw80x0057w825zxmdbd54w9lbyf49bgqk1cryqapglfzqri"))))
12114 (build-system gnu-build-system)
12115 (arguments
12116 (list #:configure-flags
12117 #~(list "--enable-tools=yes"
12118 "--enable-bindings-cxx")))
12119 (native-inputs
12120 (list automake
12121 autoconf-2.71
12122 libtool
12123 autoconf-archive
12124 pkg-config))
12125 (synopsis "Interact with the Linux GPIO character device")
12126 (description
12127 "This package provides a C library with C++ bindings and
12128command-line tools for interacting with GPIO devices that avoids the usage of
12129older system-wide @file{/sys} interface.")
12130 (home-page "https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/")
12131 (license (list license:lgpl2.1+ ;; libgpiod
12132 license:gpl2+ ;; gpio-tools
12133 license:lgpl3+)))) ;; C++ bindings
12134
12135(define-public python-libgpiod
12136 (package
12137 (name "python-libgpiod")
12138 (version "2.3.0")
12139 (source
12140 (origin
12141 (method git-fetch)
12142 (uri
12143 (git-reference
12144 (url "https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git")
12145 (commit (string-append "python-v" version))))
12146 (file-name (git-file-name name version))
12147 (sha256 (base32 "1lkd7lgpb28pqf7p6lrwl0ss7r5ryiddmdcisnz6ixy796qhr8kr"))))
12148 (build-system pyproject-build-system)
12149 (arguments
12150 (list
12151 #:tests? #f ; tests require root, see README.md
12152 #:phases
12153 #~(modify-phases %standard-phases
12154 (add-after 'unpack 'cd-to-python-bindings
12155 (lambda _
12156 (chdir "bindings/python"))))))
12157 (native-inputs
12158 (list python-setuptools
12159 python-wheel
12160 libgpiod))
12161 (synopsis "Interact with the Linux GPIO character device")
12162 (description
12163 "This package provides Python bindings for interacting with GPIO devices
12164that avoids the usage of older system-wide @file{/sys} interface.")
12165 (home-page "https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/")
12166 (license (list license:lgpl2.1+ ;; libgpiod
12167 license:gpl2+ ;; gpio-tools
12168 license:lgpl3+)))) ;; C++ bindings
12169
12170(define-public libtraceevent
12171 (package
12172 (name "libtraceevent")
12173 (version "1.9.0")
12174 (source
12175 (origin
12176 (method git-fetch)
12177 (uri (git-reference
12178 (url "https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git")
12179 (commit (string-append name "-" version))))
12180 (file-name (git-file-name name version))
12181 (sha256
12182 (base32 "10fklw4znjhm8mlg6hwlipdyk7v3053lnrc5bpqifnsc8gwqbaz0"))))
12183 (build-system meson-build-system)
12184 (arguments
12185 (list
12186 #:configure-flags
12187 #~(list "-Ddoc=false")))
12188 (home-page "https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/")
12189 (synopsis "Linux kernel trace event library")
12190 (description
12191 "This library parses raw Linux kernel trace event formats.")
12192 (license (list license:gpl2
12193 license:lgpl2.1))))
12194
12195(define-public libtracefs
12196 (package
12197 (name "libtracefs")
12198 (version "1.8.3")
12199 (source
12200 (origin
12201 (method git-fetch)
12202 (uri (git-reference
12203 (url "https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git")
12204 (commit (string-append name "-" version))))
12205 (file-name (git-file-name name version))
12206 (sha256
12207 (base32 "1bc4mwf488nlja64zawjznvb6640vchjb25xa02v53x6qfb1mpmq"))))
12208 (build-system meson-build-system)
12209 (arguments
12210 (list
12211 #:configure-flags
12212 #~(list "-Ddoc=false")))
12213 (native-inputs
12214 (list bison
12215 flex
12216 pkg-config))
12217 (inputs (list libtraceevent))
12218 (home-page "https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git/")
12219 (synopsis "Linux kernel trace file system library")
12220 (description
12221 "This library provides APIs to access the Linux kernel's trace file
12222system.")
12223 (license (list license:gpl2
12224 license:lgpl2.1))))
12225
12226(define-public libtree
12227 (package
12228 (name "libtree")
12229 (version "3.1.1")
12230 (source
12231 (origin
12232 (method git-fetch)
12233 (uri (git-reference
12234 (url "https://github.com/haampie/libtree")
12235 (commit (string-append "v" version))))
12236 (file-name (git-file-name name version))
12237 (patches (search-patches "libtree-fix-check-non-x86.patch"))
12238 (sha256
12239 (base32 "1jbc60cslzcfxk9jwva51ncr1zl1nz0fkgfjdckgv81is11nswmb"))))
12240 (arguments
12241 (list #:make-flags
12242 ;; NOTE: Official documentation recommends to build libtree with
12243 ;; "-static" flag.
12244 #~(list (string-append "CC=" #$(cc-for-target))
12245 (string-append "PREFIX=" #$output))
12246 #:phases
12247 #~(modify-phases %standard-phases
12248 (add-after 'unpack 'fix-tests
12249 ;; XXX: '08_nodeflib' fails as 'libtree' returns a non-zero
12250 ;; code in one of the tests.
12251 ;;
12252 ;; See <https://github.com/haampie/libtree/issues/80>).
12253 (lambda _
12254 (substitute* "tests/08_nodeflib/Makefile"
12255 (("! ../../libtree -vvv exe_b")
12256 "../../libtree -vvv exe_b"))))
12257 (delete 'configure))))
12258 (build-system gnu-build-system)
12259 (home-page "https://github.com/haampie/libtree")
12260 (synopsis "Show output of @command{ldd} as a tree")
12261 (description
12262 "This tool turns @command{ldd} into a tree and explains how shared
12263libraries are found or why they cannot be located.")
12264 (license license:expat)))
12265
12266(define-public touchegg
12267 (package
12268 (name "touchegg")
12269 (version "2.0.18")
12270 (source
12271 (origin
12272 (method git-fetch)
12273 (uri (git-reference
12274 (url "https://github.com/JoseExposito/touchegg")
12275 (commit version)))
12276 (file-name (git-file-name name version))
12277 (sha256
12278 (base32 "0m8zgihij14b8dxrxxvpl8sdsx49mjlnxnm0fhgfxscy7n07kcpc"))))
12279 (build-system cmake-build-system)
12280 (arguments
12281 `(#:tests? #f ; No tests exist
12282 #:configure-flags
12283 (list "-DUSE_SYSTEMD=OFF"))) ; No systemd
12284 (native-inputs
12285 (list
12286 pkg-config))
12287 (inputs
12288 (list
12289 cairo
12290 gtk+
12291 libgudev
12292 libinput
12293 libxrandr
12294 libxtst
12295 pugixml))
12296 (home-page "https://github.com/JoseExposito/touchegg")
12297 (synopsis "Multitouch gesture recognizer")
12298 (description
12299 "Touchégg is an application that runs in the background and transform the
12300gestures you make on your touchpad or touchscreen into visible actions in your
12301desktop.")
12302 (license license:gpl3+)))
12303
12304(define-public evtest
12305 (package
12306 (name "evtest")
12307 (version "1.36")
12308 (source (origin
12309 (method git-fetch)
12310 (uri (git-reference
12311 (url "https://gitlab.freedesktop.org/libevdev/evtest")
12312 (commit (string-append "evtest-" version))))
12313 (file-name (git-file-name name version))
12314 (sha256
12315 (base32
12316 "0mwjvz0fwwcwm4fpw0m4x8bcxpnzjkiy7fpb438vf4i5g5q0dc1k"))))
12317 (build-system gnu-build-system)
12318 (arguments
12319 (list #:tests? #f ;No tests exist
12320 #:make-flags #~(list (string-append "CC="
12321 #$(cc-for-target))
12322 (string-append "PREFIX="
12323 #$output))
12324 #:phases #~(modify-phases %standard-phases
12325 (add-after 'unpack 'generate-doc
12326 (lambda _
12327 (invoke "asciidoc" "-d" "manpage"
12328 "-b" "docbook"
12329 "-o" "evtest.1.xml"
12330 "evtest.txt")
12331 (invoke "xsltproc" "--nonet"
12332 (string-append
12333 #$(this-package-native-input "docbook-xsl")
12334 "/xml/xsl/docbook-xsl-"
12335 #$(package-version
12336 (this-package-native-input "docbook-xsl"))
12337 "/manpages/docbook.xsl")
12338 "evtest.1.xml")))
12339 (replace 'bootstrap
12340 (lambda _
12341 (setenv "CONFIG_SHELL" (which "sh"))
12342 (invoke "autoreconf" "-fi"))))))
12343 (native-inputs (list autoconf
12344 automake
12345 bash-minimal
12346 xmlto
12347 docbook-xsl
12348 libxslt
12349 asciidoc))
12350 (home-page "https://gitlab.freedesktop.org/libevdev/evtest")
12351 (synopsis "Kernel evdev device information and monitor")
12352 (description
12353 "@code{evtest} is a tool to print @code{evdev} kernel events. It reads
12354directly from the kernel device and prints a device description and the events
12355with the value and the symbolic name.")
12356 (license license:gpl2+)))
12357
12358(define-public tp-smapi-module
12359 (package
12360 (name "tp-smapi-module")
12361 (version "0.44")
12362 (source (origin
12363 (method git-fetch)
12364 (uri (git-reference
12365 (url "https://github.com/linux-thinkpad/tp_smapi")
12366 (commit (string-append "tp-smapi/" version))))
12367 (file-name (git-file-name name version))
12368 (sha256
12369 (base32
12370 "0kzbks07bh5jbi1n311zp9cbp1xxyzi7nys8wq1k0k5ig81h9w6k"))))
12371 (build-system linux-module-build-system)
12372 (arguments
12373 `(#:tests? #f)) ;there are none.
12374 (home-page "https://github.com/linux-thinkpad/tp_smapi")
12375 (synopsis
12376 "Linux Kernel module exposing features of ThinkPad hardware")
12377 (description
12378 "This package provides a Linux Kernel module that controls
12379battery charging of specific ThinkPad laptops. It also includes an improved
12380version of the HDAPS driver. The underlying hardware interfaces are
12381@acronym{SMAPI, System Management Application Program Interface} and direct
12382access to the embedded controller.")
12383 (license license:gpl2+)))
12384
12385(define-public modprobed-db
12386 (package
12387 (name "modprobed-db")
12388 (version "2.48")
12389 (source (origin
12390 (method git-fetch)
12391 (uri (git-reference
12392 (url "https://github.com/graysky2/modprobed-db")
12393 (commit (string-append "v" version))))
12394 (file-name (git-file-name name version))
12395 (sha256
12396 (base32
12397 "0jscinga32jjvy3vwl4s1pyd5fjgqhmmk010k665nhil302hzjdc"))))
12398 (build-system gnu-build-system)
12399 (arguments
12400 (list #:tests? #f ;no tests
12401 #:make-flags
12402 #~(list (string-append "PREFIX=" #$output)
12403 "INITDIR_SYSTEMD=no-thanks")
12404 #:phases
12405 #~(modify-phases %standard-phases
12406 (delete 'configure)
12407 (add-after 'install 'fix-path
12408 (lambda* (#:key inputs #:allow-other-keys)
12409 (substitute* (string-append #$output "/bin/modprobed-db")
12410 (("/usr") #$output)
12411 (((string-append "(" (string-join (list "awk"
12412 "cp"
12413 "cut"
12414 "getent"
12415 "grep"
12416 "logname"
12417 "md5sum"
12418 "mkdir"
12419 "mv"
12420 "sed"
12421 "sort"
12422 "uniq"
12423 "wc")
12424 "|") ")") m)
12425 (search-input-file inputs (string-append "/bin/" m)))
12426 (("modprobe ")
12427 (string-append
12428 (search-input-file inputs "/bin/modprobe") " "))))))))
12429 (inputs (list coreutils kmod gawk glibc grep sed))
12430 (home-page "https://wiki.archlinux.org/title/Modprobed-db")
12431 (synopsis "Keep track of Linux modules that have been probed")
12432 (description
12433 "Modprobed-db is a useful utility for users wishing to build a minimal
12434kernel via a @code{make localmodconfig}. In a nutshell, this @command{make}
12435target creates a config based on the current config and a list of modules you
12436define (that @command{modprobed-db} keeps for you). It then disables any
12437module option that is not needed thus not building extraneous modules. This
12438results in a system-specific, streamlined kernel package and footprint as well
12439as reduced compilation times.
12440
12441Modprobed-db simply logs every module ever probed on the target system to a
12442text-based database (@file{$XDG_CONFIG_HOME/modprobed-db}), which can be read
12443directly by @code{make localmodconfig} as described above.")
12444 (license license:expat)))
12445
12446(define-public kernel-hardening-checker
12447 (package
12448 (name "kernel-hardening-checker")
12449 (version "0.6.17.1")
12450 (source (origin
12451 (method git-fetch)
12452 (uri (git-reference
12453 (url "https://github.com/a13xp0p0v/kernel-hardening-checker")
12454 (commit (string-append "v" version))))
12455 (file-name (git-file-name name version))
12456 (sha256
12457 (base32
12458 "04r9bbayhs1ik84908q148k9djawy69zarxw0vc31dfbf64mni62"))))
12459 (build-system pyproject-build-system)
12460 (arguments
12461 (list #:tests? #f)) ;no active tests, runtime only, see GitHub Actions
12462 (native-inputs
12463 (list python-setuptools))
12464 (home-page "https://github.com/a13xp0p0v/kernel-hardening-checker")
12465 (synopsis
12466 "Tool for checking the security hardening options of the Linux kernel")
12467 (description
12468 "@code{kernel-hardening-checker} is a tool for checking the security
12469hardening options of the Linux kernel. Provided preferences are based on
12470suggestions from various sources, including:
12471
12472@itemize
12473@item KSPP recommended settings
12474@item CLIP OS kernel configuration
12475@item Last public grsecurity patch (options which they disable)
12476@item SECURITY_LOCKDOWN_LSM patchset
12477@item Direct feedback from the Linux kernel maintainers
12478@end itemize\n
12479This tool supports checking Kconfig options and kernel cmdline parameters.")
12480 (license license:gpl3)))
12481
12482(define-public firejail
12483 (package
12484 (name "firejail")
12485 (version "0.9.78")
12486 (source (origin
12487 (method git-fetch)
12488 (uri (git-reference
12489 (url "https://github.com/netblue30/firejail")
12490 (commit version)))
12491 (file-name (git-file-name name version))
12492 (sha256
12493 (base32
12494 "18bsnwyg7aidm74qckrp437gr0zy9bpq1b1wr6mfnj61v74fwwxs"))))
12495 (arguments
12496 (list #:phases
12497 #~(modify-phases %standard-phases
12498 (replace 'check
12499 (lambda* (#:key tests? #:allow-other-keys)
12500 (when tests?
12501 (with-directory-excursion "test"
12502 (invoke "make"))))))))
12503 (build-system gnu-build-system)
12504 (inputs
12505 (list apparmor xdg-dbus-proxy))
12506 (synopsis "Linux namespaces sandbox program")
12507 (description
12508 "Firejail is a SUID sandbox program that reduces the risk of security
12509breaches by restricting the running environment of untrusted applications
12510using Linux namespaces, seccomp-bpf and Linux capabilities. The software
12511includes sandbox profiles for a number of common Linux programs. Firejail
12512should be added to the list of setuid programs in the system configuration to
12513work properly.")
12514 (home-page "https://github.com/netblue30/firejail")
12515 (supported-systems
12516 (filter (cut string-suffix? "-linux" <>) %supported-systems))
12517 (license license:gpl2+)))
12518
12519(define-public firejail-disable-sandbox-check
12520 (package/inherit
12521 firejail
12522 (name "firejail-disable-sandbox-check")
12523 (arguments
12524 (substitute-keyword-arguments arguments
12525 ((#:configure-flags flags #~'())
12526 #~(append #$flags
12527 (list "--disable-sandbox-check")))))
12528 (description
12529 (string-append (package-description firejail)
12530 " Builded with @code{--disable-sandbox-check}, which is
12531 only intended for development."))))
12532
12533(define-public edac-utils
12534 (package
12535 (name "edac-utils")
12536 (version "0.18")
12537 (source (origin
12538 (method git-fetch)
12539 (uri (git-reference
12540 (url "https://github.com/grondo/edac-utils.git")
12541 (commit version)))
12542 (file-name (string-append name "-" version "-checkout"))
12543 (sha256
12544 (base32
12545 "04j686m58wsnyy5di7rz0sw9jahlm4ziwxjmgs31pjb87vzw3xgp"))))
12546 (build-system gnu-build-system)
12547 (native-inputs
12548 (list perl))
12549 (inputs
12550 (list sysfsutils))
12551 (synopsis "Memory error detection and correction userspace helpers")
12552 (description "This package provides userspace helpers for memory
12553error detection and correction (EDAC).")
12554 (home-page "https://github.com/grondo/edac-utils")
12555 (license license:gpl2+)))
12556
12557(define-public spectre-meltdown-checker
12558 (package
12559 (name "spectre-meltdown-checker")
12560 (version "0.46")
12561 (source (origin
12562 (method git-fetch)
12563 (uri (git-reference
12564 (url "https://github.com/speed47/spectre-meltdown-checker")
12565 (commit (string-append "v" version))))
12566 (file-name (git-file-name name version))
12567 (patches
12568 (search-patches
12569 "spectre-meltdown-checker-externalize-fwdb.patch"))
12570 ;; Remove builtin firmware database.
12571 (modules '((guix build utils)))
12572 (snippet '(substitute* "spectre-meltdown-checker.sh"
12573 (("^# [AI],.*") "")))
12574 (sha256
12575 (base32
12576 "0j42p6dayb7k87kf8sqimxlaswis3qh0569a15zccyknv9vf129k"))))
12577 (build-system copy-build-system)
12578 (arguments
12579 (list
12580 #:install-plan
12581 #~'(("spectre-meltdown-checker.sh" "bin/spectre-meltdown-checker"))
12582 #:phases
12583 #~(modify-phases %standard-phases
12584 (add-after 'unpack 'fixpath
12585 (lambda* (#:key inputs #:allow-other-keys)
12586 (define* (find-command inputs cmd #:optional (bin "bin"))
12587 (search-input-file inputs (string-append bin "/" cmd)))
12588 (substitute* "spectre-meltdown-checker.sh"
12589 ;; ${opt_arch_prefix}CMD
12590 (("\\$\\{opt_arch_prefix\\}\\<(nm|objdump|readelf|strings)\\>"
12591 all cmd)
12592 (find-command inputs cmd))
12593
12594 ;; Commands safe to substitute directly.
12595 (("\\<(awk|(base|dir)name|bunzip2|g(un)?zip|lz4)\\>" all cmd)
12596 (find-command inputs cmd))
12597 (("\\<(lzop|mktemp|modprobe|pgrep|rmmod|umount)\\>" all cmd)
12598 (find-command inputs cmd))
12599 (("\\<(unlzma|unxz|unzstd|uuencode)\\>" all cmd)
12600 (find-command inputs cmd))
12601
12602 ;; Commands which should only be substituted based on their
12603 ;; surroundings: First up, dd.
12604 (("\\<(dd)\\> if=" all cmd)
12605 (string-append
12606 (find-command inputs cmd)
12607 " if="))
12608
12609 ;; Another special case: sysctl is in sbin.
12610 (("(if |\\$\\( *)\\<(sysctl)\\>" all pre cmd)
12611 (string-append pre (find-command inputs cmd "sbin")))
12612
12613 ;; Meow
12614 (("cat (<<EOF|\"\\$)" all what)
12615 (string-append (find-command inputs "cat") " " what))
12616 (("'cat'")
12617 (string-append "'" (find-command inputs "cat") "'"))
12618 (("\"cat\"")
12619 (string-append "\"" (find-command inputs "cat") "\""))
12620
12621 ;; ${COMMAND} -
12622 ;; ${COMMAND} ^
12623 (("\\<(base64|cut|grep|head|id|mount)\\> ([-^])" all cmd suffix)
12624 (string-append (find-command inputs cmd) " " suffix))
12625 (("\\<(od|perl|rm|uname|xargs)\\> ([-^])" all cmd suffix)
12626 (string-append (find-command inputs cmd) " " suffix))
12627
12628 ;; ${COMMAND} |
12629 (("\\<(dmesg)\\> \\|" all cmd)
12630 (string-append (find-command inputs cmd) " |"))
12631 ;; | ${COMMAND}
12632 (("\\| \\<(grep|sed|sort|stat|tr)\\>" all cmd)
12633 (string-append "| " (find-command inputs cmd)))
12634
12635 ;; Command in sub-shell, i.e. $($COMMAND ...)
12636 (("\\$\\( *(\\<cat|find|grep|mount|nproc|stat|tr\\>)"
12637 all cmd)
12638 (string-append "$(" (find-command inputs cmd)))
12639
12640 ;; command -v
12641 (("command -v \"*\\<(base64|nproc|perl|printf)\\>\"*" all cmd)
12642 (string-append "command -v " (find-command inputs cmd)))))))))
12643 (inputs (list kmod lz4 lzop perl procps sharutils util-linux zstd))
12644 (home-page "https://github.com/speed47/spectre-meltdown-checker")
12645 (synopsis "CPU vulnerability / mitigation checker")
12646 (description
12647 "This package provides a shell script to assess your system's resilience
12648against the several transient execution CVEs that were published since early
126492018, and gives guidance as to how to mitigate them.")
12650 (license license:gpl3)))
12651
12652(define-public csmith
12653 (package
12654 (name "csmith")
12655 (version "2.3.0")
12656 (source (origin
12657 (method git-fetch)
12658 (uri (git-reference
12659 (url "https://github.com/csmith-project/csmith")
12660 (commit (string-append "csmith-" version))))
12661 (file-name (git-file-name name version))
12662 (sha256
12663 (base32
12664 "0nhrsnv6cny14xz68qb1h30fbwc05adkisk51p3x63mydm60ddl3"))))
12665 (build-system gnu-build-system)
12666 (native-inputs
12667 (list autoconf automake libtool m4 perl))
12668 (arguments
12669 (list
12670 #:tests? #f ;no test suite
12671 ;; Do not install headers under 'include/csmith-VERSION' but in
12672 ;; 'include/csmith'.
12673 #:phases
12674 `(modify-phases %standard-phases
12675 (add-after 'unpack 'patch-includedir
12676 (lambda _
12677 (substitute* "runtime/Makefile.am"
12678 (("\\$\\(includedir\\)/\\$\\(PACKAGE\\)-\\$\\(VERSION\\)")
12679 "$(includedir)/$(PACKAGE)"))))
12680 (add-before 'bootstrap 'force-bootstrap
12681 (lambda _
12682 (delete-file "configure"))))))
12683 (home-page "https://github.com/csmith-project/csmith")
12684 (synopsis "Random generator of C programs")
12685 (description "The primary purpose of Csmith is to find compiler bugs with
12686random programs using differential testing.")
12687 (license license:bsd-4)))
12688
12689(define-public ipvsadm
12690 (package
12691 (name "ipvsadm")
12692 (version "1.31")
12693 (source
12694 (origin
12695 (method url-fetch)
12696 (uri (string-append "https://kernel.org/pub/linux/utils/kernel"
12697 "/ipvsadm/ipvsadm-" version ".tar.xz"))
12698 (sha256
12699 (base32 "1nyzpv1hx75k9lh0vfxfhc0p2fpqaqb38xpvs8sn88m1nljmw2hs"))))
12700 (build-system gnu-build-system)
12701 (native-inputs (list linux-libre-headers pkg-config which))
12702 (inputs (list libnl popt))
12703 (arguments
12704 (list #:tests? #f
12705 #:parallel-build? #f ;build fails randomly with '-j'
12706 #:make-flags
12707 #~(list (string-join
12708 (list "CFLAGS="
12709 (string-append "-I"
12710 #$(this-package-input "libnl")
12711 "/include/libnl3")
12712 (string-append "-L" #$(this-package-input "libnl")
12713 "/lib")
12714 "-fPIC")
12715 " ")
12716 (string-append "CC=" #$(cc-for-target))
12717 (string-append "SBIN=" #$output "/sbin")
12718 (string-append "INIT=" #$output "/etc/init.d")
12719 (string-append "MANDIR=" #$output "/share/man"))
12720 #:phases #~(modify-phases %standard-phases
12721 (delete 'configure))))
12722 (home-page "http://www.linuxvirtualserver.org/software/ipvs.html")
12723 (synopsis "IP virtual server administration utility")
12724 (description "@code{ipvsadm(8)} is used to set up, maintain or inspect the
12725virtual server table in the Linux kernel. The Linux Virtual Server can be used
12726to build scalable network services based on a cluster of two or more nodes.")
12727 (license license:gpl2+)))
12728
12729(define-public ryzenadj
12730 (package
12731 (name "ryzenadj")
12732 (version "0.17.0")
12733 (source
12734 (origin
12735 (method git-fetch)
12736 (uri (git-reference
12737 (url "https://github.com/flygoat/ryzenadj")
12738 (commit (string-append "v" version))))
12739 (file-name (git-file-name name version))
12740 (sha256
12741 (base32 "0dpznl4h1f5syq5464a0h9grqlvlp0qmjxr59nq3gp363gr5vjfv"))
12742 (modules '((guix build utils)))
12743 (snippet
12744 '(begin
12745 (delete-file-recursively "win32")))))
12746 (build-system cmake-build-system)
12747 (inputs (list pciutils))
12748 (arguments
12749 (list
12750 #:tests? #f ;No test suite
12751 #:build-type "Release"))
12752 (home-page "https://github.com/flygoat/ryzenadj")
12753 (synopsis "Power management tool for AMD Ryzen APUs")
12754 (description
12755 "@command{ryzenadj} is an utility to adjust power management settings for
12756AMD Ryzen mobile processors. You will need to ensure it can access /dev/mem,
12757for instance by using the \"iomem=relaxed\" kernel argument.")
12758 (license license:lgpl3)))
12759
12760(define-public ryzen-smu
12761 (package
12762 (name "ryzen-smu")
12763 (version "0.1.5")
12764 (source (origin
12765 (method git-fetch)
12766 (uri (git-reference
12767 (url "https://gitlab.com/leogx9r/ryzen_smu.git")
12768 (commit (string-append "v" version))))
12769 (file-name (git-file-name name version))
12770 (sha256
12771 (base32
12772 "010la2a8zp7rljlg5ssc9ragzva4ca05gvzlicjagl508659d2wz"))))
12773 (build-system linux-module-build-system)
12774 (arguments
12775 `(#:tests? #f)) ; no tests
12776 (synopsis "System Management Unit driver for AMD Ryzen processors")
12777 (description "This package provides a way to access the
12778System Management Unit for certain AMD Ryzen processors.
12779This includes access to the System Management Network.")
12780 (home-page "https://gitlab.com/leogx9r/ryzen_smu")
12781 (license license:gpl2)))
12782
12783(define-public hid-wiimote-plus
12784 (package
12785 (name "hid-wiimote-plus")
12786 (version "1.0.0")
12787 (source
12788 (origin
12789 (method git-fetch)
12790 (uri (git-reference
12791 (url "https://github.com/dkosmari/hid-wiimote-plus")
12792 (commit (string-append "v" version))))
12793 (file-name (git-file-name name version))
12794 (sha256
12795 (base32 "0vly8z9876yiaxx77ca9lbf9hfv5xichkkxxczjhbs2qwr819k1k"))))
12796 (build-system linux-module-build-system)
12797 (arguments
12798 (list #:tests? #f)) ; No tests.
12799 (synopsis "WiiMote HID kernel module")
12800 (description "This package provides a WiiMote driver that follows the
12801Linux input convention. Specifically, that allows you to use the D-pad
12802as a gamepad.")
12803 (home-page "https://github.com/dkosmari/hid-wiimote-plus")
12804 (license license:gpl2+)))
12805
12806(define-public python-evemu
12807 (package
12808 (name "python-evemu")
12809 (version "2.7.0")
12810 (source (origin
12811 (method git-fetch)
12812 (uri (git-reference
12813 (url "https://gitlab.freedesktop.org/libevdev/evemu")
12814 (commit (string-append "v" version))))
12815 (file-name (git-file-name name version))
12816 (sha256
12817 (base32
12818 "1sxf6v2wnajj9srlkfjfymjmmp4dlq73gzjcjmaw015a3c0xl029"))))
12819 (build-system gnu-build-system)
12820 (arguments
12821 (list #:tests? #f ; would open device files
12822 #:phases
12823 #~(modify-phases %standard-phases
12824 (add-after 'unpack 'patch
12825 (lambda* (#:key inputs #:allow-other-keys)
12826 (substitute* "python/evemu/base.py"
12827 (("\"libevdev.so\"")
12828 (string-append "\"" (assoc-ref inputs "libevdev")
12829 "/lib/libevdev.so\""))))))))
12830 (native-inputs
12831 (list asciidoc autoconf automake libtool docbook-xsl pkg-config
12832 python-wrapper xmlto))
12833 (inputs
12834 (list libevdev))
12835 (synopsis "Record and replay input device events")
12836 (description "This package provides a way to record and replay device
12837descriptions and events, making it possible to emulate input devices
12838through the Linux kernel's input system. Emulated devices are for most
12839practical purposes indistinguishable from real devices.
12840
12841It provides a command line program and also a Python library.")
12842 (home-page "https://www.freedesktop.org/wiki/Evemu/")
12843 (license license:gpl3)))
12844
12845(define-public dualsensectl
12846 (package
12847 (name "dualsensectl")
12848 (version "0.7")
12849 (source (origin
12850 (method git-fetch)
12851 (uri (git-reference
12852 (url "https://github.com/nowrep/dualsensectl.git")
12853 (commit (string-append "v" version))))
12854 (file-name (git-file-name name version))
12855 (sha256
12856 (base32
12857 "05snsp5r3hc2yc1nf0w4aam1my4h0lkxnmy7k4glxvasd9jwahzw"))))
12858 (build-system meson-build-system)
12859 (native-inputs
12860 (list pkg-config))
12861 (inputs
12862 (list eudev dbus hidapi))
12863 (synopsis "Linux tool for controlling PS5 DualSense controller")
12864 (description "This package provides a Linux tool for controlling a PS5
12865DualSense controller. It has to be already connected via USB or connected
12866via Bluetooth.")
12867 (home-page "https://github.com/nowrep/dualsensectl")
12868 (license license:gpl2)))