projects/guix·blob version-1.4.0 · refs

9758 lines · 403.7 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2012-2021, 2021-2022 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, 2016, 2017, 2018, 2020, 2022 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-2022 Nicolas Goaziou <[email protected]>
15;;; Copyright © 2016, 2018, 2019, 2020, 2021, 2022 Ricardo Wurmus <[email protected]>
16;;; Copyright © 2016 David Craven <[email protected]>
17;;; Copyright © 2016 John Darrington <[email protected]>
18;;; Copyright © 2016-2022 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 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, 2020, 2021, 2022 Maxim Cournoyer <[email protected]>
37;;; Copyright © 2019 Stefan Stefanović <[email protected]>
38;;; Copyright © 2019-2022 Brice Waegeneire <[email protected]>
39;;; Copyright © 2019 Kei Kebreau <[email protected]>
40;;; Copyright © 2020, 2021 Oleg Pykhalov <[email protected]>
41;;; Copyright © 2020 Pierre Neidhardt <[email protected]>
42;;; Copyright © 2020 Chris Marusich <[email protected]>
43;;; Copyright © 2020 Vincent Legoll <[email protected]>
44;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <[email protected]>
45;;; Copyright © 2020 Morgan Smith <[email protected]>
46;;; Copyright © 2020 John Soo <[email protected]>
47;;; Copyright © 2020, 2022 Michael Rohleder <[email protected]>
48;;; Copyright © 2020 Anders Thuné <[email protected]>
49;;; Copyright © 2020, 2021 Greg Hogan <[email protected]>
50;;; Copyright © 2020 Zhu Zihao <[email protected]>
51;;; Copyright © 2020 David Dashyan <[email protected]>
52;;; Copyright © 2020 pukkamustard <[email protected]>
53;;; Copyright © 2021 Solene Rapenne <[email protected]>
54;;; Copyright © 2021 B. Wilson <[email protected]>
55;;; Copyright © 2021 Ivan Gankevich <[email protected]>
56;;; Copyright © 2021 Maxime Devos <[email protected]>
57;;; Copyright © 2021 Guillaume Le Vaillant <[email protected]>
58;;; Copyright © 2021 Sarah Morgensen <[email protected]>
59;;; Copyright © 2021 Felix Gruber <[email protected]>
60;;; Copyright © 2021 Josselin Poiret <[email protected]>
61;;; Copyright © 2021 Olivier Dion <[email protected]>
62;;; Copyright © 2021 Solene Rapenne <[email protected]>
63;;; Copyright © 2021, 2022 Petr Hodina <[email protected]>
64;;; Copyright © 2022 Artyom V. Poptsov <[email protected]>
65;;; Copyright © 2022 Rene Saavedra <[email protected]>
66;;; Copyright © 2022 muradm <[email protected]>
67;;; Copyright © 2022 Denis 'GNUtoo' Carikli <[email protected]>
68;;; Copyright © 2022 Hunter Jozwiak <[email protected]>
69;;; Copyright © 2022 Hilton Chain <[email protected]>
70;;;
71;;; This file is part of GNU Guix.
72;;;
73;;; GNU Guix is free software; you can redistribute it and/or modify it
74;;; under the terms of the GNU General Public License as published by
75;;; the Free Software Foundation; either version 3 of the License, or (at
76;;; your option) any later version.
77;;;
78;;; GNU Guix is distributed in the hope that it will be useful, but
79;;; WITHOUT ANY WARRANTY; without even the implied warranty of
80;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
81;;; GNU General Public License for more details.
82;;;
83;;; You should have received a copy of the GNU General Public License
84;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
85
86(define-module (gnu packages linux)
87 #:use-module (gnu packages)
88 #:use-module (gnu packages acl)
89 #:use-module (gnu packages admin)
90 #:use-module (gnu packages algebra)
91 #:use-module (gnu packages audio)
92 #:use-module (gnu packages autotools)
93 #:use-module (gnu packages avahi)
94 #:use-module (gnu packages backup)
95 #:use-module (gnu packages base)
96 #:use-module (gnu packages bash)
97 #:use-module (gnu packages bison)
98 #:use-module (gnu packages boost)
99 #:use-module (gnu packages calendar)
100 #:use-module (gnu packages check)
101 #:use-module (gnu packages cpio)
102 #:use-module (gnu packages crypto)
103 #:use-module (gnu packages cryptsetup)
104 #:use-module (gnu packages compression)
105 #:use-module (gnu packages databases)
106 #:use-module (gnu packages datastructures)
107 #:use-module (gnu packages dbm)
108 #:use-module (gnu packages docbook)
109 #:use-module (gnu packages documentation)
110 #:use-module (gnu packages elf)
111 #:use-module (gnu packages file)
112 #:use-module (gnu packages flex)
113 #:use-module (gnu packages fontutils)
114 #:use-module (gnu packages freedesktop)
115 #:use-module (gnu packages gawk)
116 #:use-module (gnu packages gcc)
117 #:use-module (gnu packages gettext)
118 #:use-module (gnu packages glib)
119 #:use-module (gnu packages gnome)
120 #:use-module (gnu packages gnupg)
121 #:use-module (gnu packages golang)
122 #:use-module (gnu packages gperf)
123 #:use-module (gnu packages graphviz)
124 #:use-module (gnu packages gstreamer)
125 #:use-module (gnu packages gtk)
126 #:use-module (gnu packages haskell-apps)
127 #:use-module (gnu packages haskell-xyz)
128 #:use-module (gnu packages libunwind)
129 #:use-module (gnu packages libusb)
130 #:use-module (gnu packages llvm)
131 #:use-module (gnu packages lua)
132 #:use-module (gnu packages man)
133 #:use-module (gnu packages maths)
134 #:use-module (gnu packages multiprecision)
135 #:use-module (gnu packages ncurses)
136 #:use-module (gnu packages netpbm)
137 #:use-module (gnu packages networking)
138 #:use-module (gnu packages ninja)
139 #:use-module (gnu packages nss)
140 #:use-module (gnu packages onc-rpc)
141 #:use-module (gnu packages perl)
142 #:use-module (gnu packages pciutils)
143 #:use-module (gnu packages pkg-config)
144 #:use-module (gnu packages popt)
145 #:use-module (gnu packages pulseaudio)
146 #:use-module (gnu packages python)
147 #:use-module (gnu packages python-xyz)
148 #:use-module (gnu packages readline)
149 #:use-module (gnu packages rrdtool)
150 #:use-module (gnu packages samba)
151 #:use-module (gnu packages sdl)
152 #:use-module (gnu packages serialization)
153 #:use-module (gnu packages slang)
154 #:use-module (gnu packages sqlite)
155 #:use-module (gnu packages texinfo)
156 #:use-module (gnu packages textutils)
157 #:use-module (gnu packages tls)
158 #:use-module (gnu packages valgrind)
159 #:use-module (gnu packages video)
160 #:use-module (gnu packages vulkan)
161 #:use-module (gnu packages web)
162 #:use-module (gnu packages xiph)
163 #:use-module (gnu packages xml)
164 #:use-module (gnu packages xdisorg)
165 #:use-module (gnu packages xorg)
166 #:use-module (gnu packages groff)
167 #:use-module (gnu packages selinux)
168 #:use-module (gnu packages sphinx)
169 #:use-module (gnu packages swig)
170 #:use-module (guix platform)
171 #:use-module (guix build-system cmake)
172 #:use-module (guix build-system copy)
173 #:use-module (guix build-system gnu)
174 #:use-module (guix build-system go)
175 #:use-module (guix build-system meson)
176 #:use-module (guix build-system python)
177 #:use-module (guix build-system trivial)
178 #:use-module (guix build-system linux-module)
179 #:use-module (guix download)
180 #:use-module (guix git-download)
181 #:use-module ((guix licenses) #:prefix license:)
182 #:use-module (guix packages)
183 #:use-module (guix gexp)
184 #:use-module (guix store)
185 #:use-module (guix monads)
186 #:use-module (guix utils)
187 #:use-module (guix deprecation) ;for libcap/next
188 #:use-module (srfi srfi-1)
189 #:use-module (srfi srfi-2)
190 #:use-module (srfi srfi-26)
191 #:use-module (ice-9 match)
192 #:use-module (ice-9 regex))
193
194(define-public (system->defconfig system)
195 "Some systems (notably powerpc-linux) require a special target for kernel
196defconfig. Return the appropriate make target if applicable, otherwise return
197\"defconfig\"."
198 (cond ((string-prefix? "powerpc-" system) "pmac32_defconfig")
199 ((string-prefix? "powerpc64-" system) "ppc64_defconfig")
200 ((string-prefix? "powerpc64le-" system) "ppc64_defconfig")
201 (else "defconfig")))
202
203
204;;;
205;;; Kernel source code deblobbing.
206;;;
207
208(define (linux-libre-deblob-scripts version gnu-revision
209 deblob-hash
210 deblob-check-hash)
211 (list (version-major+minor version)
212 (origin
213 (method url-fetch)
214 (uri (string-append "https://linux-libre.fsfla.org"
215 "/pub/linux-libre/releases/" version "-" gnu-revision "/"
216 "deblob-" (version-major+minor version)))
217 (file-name (string-append "linux-libre-deblob-"
218 version "-" gnu-revision))
219 (sha256 deblob-hash))
220 (origin
221 (method url-fetch)
222 (uri (string-append "https://linux-libre.fsfla.org"
223 "/pub/linux-libre/releases/" version "-" gnu-revision "/"
224 "deblob-check"))
225 (file-name (string-append "linux-libre-deblob-check-" version "-" gnu-revision))
226 (sha256 deblob-check-hash))))
227
228;; XXXX: Workaround 'snippet' limitations
229(define computed-origin-method (@@ (guix packages) computed-origin-method))
230
231(define (make-linux-libre-source version
232 upstream-source
233 deblob-scripts)
234 "Return a 'computed' origin that generates a Linux-libre tarball from the
235corresponding UPSTREAM-SOURCE (an origin), using the given DEBLOB-SCRIPTS."
236 (match deblob-scripts
237 ((deblob-version (? origin? deblob) (? origin? deblob-check))
238 (unless (string=? deblob-version (version-major+minor version))
239 ;; The deblob script cannot be expected to work properly on a
240 ;; different version (major+minor) of Linux, even if no errors
241 ;; are signaled during execution.
242 (error "deblob major+minor version mismatch"))
243 (origin
244 (method computed-origin-method)
245 (file-name (string-append "linux-libre-" version "-guix.tar.xz"))
246 (sha256 #f)
247 (uri
248 (delay
249 (with-imported-modules '((guix build utils))
250 #~(begin
251 (use-modules (guix build utils)
252 (srfi srfi-1)
253 (ice-9 match)
254 (ice-9 ftw))
255
256 (setvbuf (current-output-port) 'line)
257
258 (let ((dir (string-append "linux-" #$version)))
259
260 (mkdir "/tmp/bin")
261 (set-path-environment-variable
262 "PATH" '("bin")
263 (list "/tmp"
264 #+(canonical-package bash)
265 #+(canonical-package coreutils)
266 #+(canonical-package diffutils)
267 #+(canonical-package findutils)
268 #+(canonical-package patch)
269 #+(canonical-package xz)
270 #+(canonical-package sed)
271 #+(canonical-package grep)
272 #+(canonical-package bzip2)
273 #+(canonical-package gzip)
274 #+(canonical-package tar)
275 #+(canonical-package gawk)
276 #+python-wrapper))
277
278 (with-directory-excursion "/tmp/bin"
279
280 (copy-file #+deblob "deblob")
281 (chmod "deblob" #o755)
282 (substitute* "deblob"
283 (("/bin/sh") (which "sh")))
284
285 (copy-file #+deblob-check "deblob-check")
286 (chmod "deblob-check" #o755)
287 (substitute* "deblob-check"
288 (("/bin/sh") (which "sh"))
289 (("/bin/sed") (which "sed"))
290 (("/usr/bin/python") (which "python"))))
291
292 (if (file-is-directory? #+upstream-source)
293 (begin
294 (format #t "Copying upstream linux source...~%")
295 (invoke "cp" "--archive" #+upstream-source dir)
296 (invoke "chmod" "--recursive" "u+w" dir))
297 (begin
298 (format #t "Unpacking upstream linux tarball...~%")
299 (invoke "tar" "xf" #$upstream-source)
300 (match (scandir "."
301 (lambda (name)
302 (and (not (member name '("." "..")))
303 (file-is-directory? name))))
304 ((unpacked-dir)
305 (unless (string=? dir unpacked-dir)
306 (rename-file unpacked-dir dir)))
307 (dirs
308 (error "multiple directories found" dirs)))))
309
310 (with-directory-excursion dir
311 (format #t "Running deblob script...~%")
312 (invoke "/tmp/bin/deblob"))
313
314 (format #t "~%Packing new Linux-libre tarball...~%")
315 (invoke "tar" "cvfa" #$output
316 ;; Avoid non-determinism in the archive.
317 "--mtime=@0"
318 "--owner=root:0"
319 "--group=root:0"
320 "--sort=name"
321 "--hard-dereference"
322 dir)
323
324 (format #t "~%Scanning the generated tarball for blobs...~%")
325 (invoke "/tmp/bin/deblob-check" "--use-awk" "--list-blobs"
326 #$output))))))))))
327
328
329;;;
330;;; Kernel sources.
331;;;
332
333(define (linux-libre-urls version gnu-revision)
334 "Return a list of URLs for Linux-Libre VERSION."
335 (list (string-append
336 "https://linux-libre.fsfla.org/pub/linux-libre/releases/"
337 version "-" gnu-revision "/linux-libre-" version "-" gnu-revision ".tar.xz")
338
339 ;; XXX: Work around <http://bugs.gnu.org/14851>.
340 (string-append
341 "ftp://alpha.gnu.org/gnu/guix/mirror/linux-libre-"
342 version "-" gnu-revision ".tar.xz")
343
344 ;; Maybe this URL will become valid eventually.
345 (string-append
346 "mirror://gnu/linux-libre/" version "-" gnu-revision "/linux-libre-"
347 version "-" gnu-revision ".tar.xz")))
348
349(define (%upstream-linux-source version hash)
350 (origin
351 (method url-fetch)
352 (uri (string-append "mirror://kernel.org"
353 "/linux/kernel/v" (version-major version) ".x/"
354 "linux-" version ".tar.xz"))
355 (sha256 hash)))
356
357;; The current "stable" kernels. That is, the most recently released major
358;; versions that are still supported upstream.
359
360(define-public linux-libre-6.0-version "6.0.10")
361(define-public linux-libre-6.0-gnu-revision "gnu")
362(define deblob-scripts-6.0
363 (linux-libre-deblob-scripts
364 linux-libre-6.0-version
365 linux-libre-6.0-gnu-revision
366 (base32 "0iwbjrgiwch5v1xpnm9wk9zqw2v6lxja0k8yj2x0amxc9ma68176")
367 (base32 "06iqxkg5hakzvmz6gcz878k1sr553zbng2j1b2whgfg7zmhxkb34")))
368(define-public linux-libre-6.0-pristine-source
369 (let ((version linux-libre-6.0-version)
370 (hash (base32 "1l0xak4w7c16cg8lhracy8r18zzdl0x5s654w6ivyw6dhk6pzr9r")))
371 (make-linux-libre-source version
372 (%upstream-linux-source version hash)
373 deblob-scripts-6.0)))
374
375;; The "longterm" kernels — the older releases with long-term upstream support.
376;; Here are the support timelines:
377;; <https://www.kernel.org/category/releases.html>
378(define-public linux-libre-5.15-version "5.15.80")
379(define-public linux-libre-5.15-gnu-revision "gnu")
380(define deblob-scripts-5.15
381 (linux-libre-deblob-scripts
382 linux-libre-5.15-version
383 linux-libre-5.15-gnu-revision
384 (base32 "0vj60bra81fmbx3lz924czbhxs4dmvd4d584g9mcs80b7c4q52kg")
385 (base32 "0h8a48dvgxyj3v08lp99kh5pfa93r4rks78cj0j1rwz1516xk8h3")))
386(define-public linux-libre-5.15-pristine-source
387 (let ((version linux-libre-5.15-version)
388 (hash (base32 "0kgxznd3sfbmnygjvp9dzhzg5chxlaxk6kldxmh1y0njcrj1lciv")))
389 (make-linux-libre-source version
390 (%upstream-linux-source version hash)
391 deblob-scripts-5.15)))
392
393(define-public linux-libre-5.10-version "5.10.156")
394(define-public linux-libre-5.10-gnu-revision "gnu1")
395(define deblob-scripts-5.10
396 (linux-libre-deblob-scripts
397 linux-libre-5.10-version
398 linux-libre-5.10-gnu-revision
399 (base32 "0mw7qn77y9c6wrnw4rjvf75cpm1w6n1aqqhf8cnghcb97p2yxxrf")
400 (base32 "1m9l554w6a72mq0kf7ggm44z247m2yz6zhafwqxh96qpjpcaabpj")))
401(define-public linux-libre-5.10-pristine-source
402 (let ((version linux-libre-5.10-version)
403 (hash (base32 "08srjps110zi4ivzh0z2jf78ddyfj2wivdliffb2f03jr9j9k7k7")))
404 (make-linux-libre-source version
405 (%upstream-linux-source version hash)
406 deblob-scripts-5.10)))
407
408(define-public linux-libre-5.4-version "5.4.225")
409(define-public linux-libre-5.4-gnu-revision "gnu1")
410(define deblob-scripts-5.4
411 (linux-libre-deblob-scripts
412 linux-libre-5.4-version
413 linux-libre-5.4-gnu-revision
414 (base32 "1nlgk8ajb5wl3aa96h9a0pb9j5a5wmrbpk63varn557x1d00r7wj")
415 (base32 "1bgblfkcnrabnr9hpdl07qgps57h6bq4v5pjrxs798vq43db66va")))
416(define-public linux-libre-5.4-pristine-source
417 (let ((version linux-libre-5.4-version)
418 (hash (base32 "1ak0qlxzfylgvkldh2whq4mzynh1rymhnnc1yif9a5s3f7v9dxar")))
419 (make-linux-libre-source version
420 (%upstream-linux-source version hash)
421 deblob-scripts-5.4)))
422
423(define-public linux-libre-4.19-version "4.19.267")
424(define-public linux-libre-4.19-gnu-revision "gnu1")
425(define deblob-scripts-4.19
426 (linux-libre-deblob-scripts
427 linux-libre-4.19-version
428 linux-libre-4.19-gnu-revision
429 (base32 "06pqv050bkii0hc2v7ymny5264w1bca8db0dp1pw9mfmjg865am5")
430 (base32 "0g1yhzxm3ixfll6n630v7lddcyvf888sg114nimh0lkvzd180s99")))
431(define-public linux-libre-4.19-pristine-source
432 (let ((version linux-libre-4.19-version)
433 (hash (base32 "035yxx13jz5f5ig2r6ybzgivm8vjafgnvjws0jfzha4w6klf7r9l")))
434 (make-linux-libre-source version
435 (%upstream-linux-source version hash)
436 deblob-scripts-4.19)))
437
438(define-public linux-libre-4.14-version "4.14.300")
439(define-public linux-libre-4.14-gnu-revision "gnu1")
440(define deblob-scripts-4.14
441 (linux-libre-deblob-scripts
442 linux-libre-4.14-version
443 linux-libre-4.14-gnu-revision
444 (base32 "02rxvr0gmxb3zfsyyzdmzgfq04gkdkv1cc38md0xfl0mxzdzdfyk")
445 (base32 "00i91lx938nqlgy63hiricqd0fnbbf26vgya9c5lb7m1f4x324im")))
446(define-public linux-libre-4.14-pristine-source
447 (let ((version linux-libre-4.14-version)
448 (hash (base32 "047vmh09icm45g7mnmdvyj9cam7747bcpah1s7n9dm5i2j2f906y")))
449 (make-linux-libre-source version
450 (%upstream-linux-source version hash)
451 deblob-scripts-4.14)))
452
453(define-public linux-libre-4.9-version "4.9.334")
454(define-public linux-libre-4.9-gnu-revision "gnu1")
455(define deblob-scripts-4.9
456 (linux-libre-deblob-scripts
457 linux-libre-4.9-version
458 linux-libre-4.9-gnu-revision
459 (base32 "0nai5m4rbh37qaj1xf2qj7656l2gacfh0847q5d07y22b048fq5n")
460 (base32 "0bib3641dbcqdkx3anna3caxnsg3nw9cnmhcklq0s93g3m57041h")))
461(define-public linux-libre-4.9-pristine-source
462 (let ((version linux-libre-4.9-version)
463 (hash (base32 "0sjh492mfic6llgwb957nj7gd7c0dvqnk97ngq8d50sjsyjznyk9")))
464 (make-linux-libre-source version
465 (%upstream-linux-source version hash)
466 deblob-scripts-4.9)))
467
468(define %boot-logo-patch
469 ;; Linux-Libre boot logo featuring Freedo and a gnu.
470 (origin
471 (method url-fetch)
472 (uri (string-append "http://www.fsfla.org/svn/fsfla/software/linux-libre/"
473 "lemote/gnewsense/branches/3.16/100gnu+freedo.patch"))
474 (sha256
475 (base32
476 "1hk9swxxc80bmn2zd2qr5ccrjrk28xkypwhl4z0qx4hbivj7qm06"))))
477
478(define %linux-libre-arm-export-__sync_icache_dcache-patch
479 (origin
480 (method url-fetch)
481 (uri (string-append
482 "https://salsa.debian.org/kernel-team/linux"
483 "/raw/34a7d9011fcfcfa38b68282fd2b1a8797e6834f0"
484 "/debian/patches/bugfix/arm/"
485 "arm-mm-export-__sync_icache_dcache-for-xen-privcmd.patch"))
486 (file-name "linux-libre-arm-export-__sync_icache_dcache.patch")
487 (sha256
488 (base32 "1ifnfhpakzffn4b8n7x7w5cps9mzjxlkcfz9zqak2vaw8nzvl39f"))))
489
490(define (source-with-patches source patches)
491 (origin
492 (inherit source)
493 (patches (append (origin-patches source)
494 patches))))
495
496(define-public linux-libre-6.0-source
497 (source-with-patches linux-libre-6.0-pristine-source
498 (list %boot-logo-patch
499 %linux-libre-arm-export-__sync_icache_dcache-patch
500 (search-patch "linux-libre-infodocs-target.patch"))))
501
502(define-public linux-libre-5.15-source
503 (source-with-patches linux-libre-5.15-pristine-source
504 (list %boot-logo-patch
505 %linux-libre-arm-export-__sync_icache_dcache-patch
506 (search-patch "linux-libre-infodocs-target.patch"))))
507
508(define-public linux-libre-5.10-source
509 (source-with-patches linux-libre-5.10-pristine-source
510 (list %boot-logo-patch
511 %linux-libre-arm-export-__sync_icache_dcache-patch
512 (search-patch "linux-libre-infodocs-target.patch"))))
513
514(define-public linux-libre-5.4-source
515 (source-with-patches linux-libre-5.4-pristine-source
516 (list %boot-logo-patch
517 %linux-libre-arm-export-__sync_icache_dcache-patch
518 ;; Pinebook Pro patch from linux-next,
519 ;; can be dropped for linux-libre 5.7
520 (search-patch
521 "linux-libre-support-for-Pinebook-Pro.patch"))))
522
523(define-public linux-libre-4.19-source
524 (source-with-patches linux-libre-4.19-pristine-source
525 (list %boot-logo-patch
526 %linux-libre-arm-export-__sync_icache_dcache-patch)))
527
528(define-public linux-libre-4.14-source
529 (source-with-patches linux-libre-4.14-pristine-source
530 (list %boot-logo-patch)))
531
532(define-public linux-libre-4.9-source
533 (source-with-patches linux-libre-4.9-pristine-source
534 (list %boot-logo-patch)))
535
536
537;;;
538;;; Kernel headers.
539;;;
540
541(define (make-linux-libre-headers version gnu-revision hash-string)
542 (make-linux-libre-headers* version gnu-revision
543 (origin
544 (method url-fetch)
545 (uri (linux-libre-urls version gnu-revision))
546 (sha256 (base32 hash-string)))))
547
548(define (make-linux-libre-headers* version gnu-revision source)
549 (package
550 (name "linux-libre-headers")
551 (version version)
552 (source source)
553 (build-system gnu-build-system)
554 (native-inputs `(("perl" ,perl)
555 ,@(if (version>=? version "4.16")
556 `(("flex" ,flex)
557 ("bison" ,bison))
558 '())))
559 (arguments
560 `(#:modules ((guix build gnu-build-system)
561 (guix build utils)
562 (srfi srfi-1)
563 (ice-9 match))
564 #:phases
565 (modify-phases %standard-phases
566 (delete 'configure)
567 (replace 'build
568 (lambda _
569 (let ((arch ,(platform-linux-architecture
570 (lookup-platform-by-target-or-system
571 (or (%current-target-system)
572 (%current-system)))))
573 (defconfig ,(system->defconfig
574 (or (%current-target-system)
575 (%current-system))))
576 (make-target ,(if (version>=? version "5.3")
577 "headers"
578 "headers_check")))
579 (setenv "ARCH" arch)
580 (format #t "`ARCH' set to `~a'~%" (getenv "ARCH"))
581 (invoke "make" defconfig)
582 (invoke "make" "mrproper" make-target))))
583 (replace 'install
584 (lambda* (#:key outputs #:allow-other-keys)
585 (let ((out (assoc-ref outputs "out")))
586
587 ;; Mimic the quiet_cmd_headers_install target to avoid a
588 ;; dependency on rsync.
589 (for-each (lambda (file)
590 (let ((destination (string-append
591 out "/include/"
592 ;; Drop the 'usr/include' prefix.
593 (match (string-split file #\/)
594 ((_ _ path ...)
595 (string-join path "/"))))))
596 (format #t "`~a' -> `~a'~%" file destination)
597 (install-file file (dirname destination))))
598 (find-files "usr/include" "\\.h$"))
599
600 (mkdir (string-append out "/include/config"))
601 (call-with-output-file
602 (string-append out
603 "/include/config/kernel.release")
604 (lambda (p)
605 (format p "~a-default~%" ,version)))))))
606 #:allowed-references ()
607 #:tests? #f))
608 (home-page "https://www.gnu.org/software/linux-libre/")
609 (synopsis "GNU Linux-Libre kernel headers")
610 (description "Headers of the Linux-Libre kernel.")
611 (license license:gpl2)))
612
613(define-public linux-libre-headers-6.0
614 (make-linux-libre-headers* linux-libre-6.0-version
615 linux-libre-6.0-gnu-revision
616 linux-libre-6.0-source))
617
618(define-public linux-libre-headers-5.15
619 (make-linux-libre-headers* linux-libre-5.15-version
620 linux-libre-5.15-gnu-revision
621 linux-libre-5.15-source))
622
623(define-public linux-libre-headers-5.10
624 (make-linux-libre-headers* linux-libre-5.10-version
625 linux-libre-5.10-gnu-revision
626 linux-libre-5.10-source))
627
628(define-public linux-libre-headers-5.4
629 (make-linux-libre-headers* linux-libre-5.4-version
630 linux-libre-5.4-gnu-revision
631 linux-libre-5.4-source))
632
633(define-public linux-libre-headers-4.19
634 (make-linux-libre-headers* linux-libre-4.19-version
635 linux-libre-4.19-gnu-revision
636 linux-libre-4.19-source))
637
638(define-public linux-libre-headers-4.14
639 (make-linux-libre-headers* linux-libre-4.14-version
640 linux-libre-4.14-gnu-revision
641 linux-libre-4.14-source))
642
643(define-public linux-libre-headers-4.9
644 (make-linux-libre-headers* linux-libre-4.9-version
645 linux-libre-4.9-gnu-revision
646 linux-libre-4.9-source))
647
648;; The following package is used in the early bootstrap, and thus must be kept
649;; stable and with minimal build requirements.
650(define-public linux-libre-headers-5.10.35
651 (make-linux-libre-headers "5.10.35" "gnu"
652 "0q2rnchad55d49f3rajrkazz0fcjv1irwrdb1hwjnl01fzm2gjk3"))
653
654(define-public linux-libre-headers linux-libre-headers-5.10.35)
655
656
657;;;
658;;; Kernel configurations.
659;;;
660
661(define* (kernel-config arch #:key variant)
662 "Return the absolute file name of the Linux-Libre build configuration file
663for ARCH and optionally VARIANT, or #f if there is no such configuration."
664 (let* ((name (string-append (if variant (string-append variant "-") "")
665 (if (string=? "i386" arch) "i686" arch) ".conf"))
666 (file (string-append "linux-libre/" name)))
667 (search-auxiliary-file file)))
668
669(define %default-extra-linux-options
670 `(;; Make the kernel config available at /proc/config.gz
671 ("CONFIG_IKCONFIG" . #t)
672 ("CONFIG_IKCONFIG_PROC" . #t)
673 ;; Some very mild hardening.
674 ("CONFIG_SECURITY_DMESG_RESTRICT" . #t)
675 ;; All kernels should have NAMESPACES options enabled
676 ("CONFIG_NAMESPACES" . #t)
677 ("CONFIG_UTS_NS" . #t)
678 ("CONFIG_IPC_NS" . #t)
679 ("CONFIG_USER_NS" . #t)
680 ("CONFIG_PID_NS" . #t)
681 ("CONFIG_NET_NS" . #t)
682 ;; Various options needed for elogind service:
683 ;; https://issues.guix.gnu.org/43078
684 ("CONFIG_CGROUP_FREEZER" . #t)
685 ("CONFIG_BLK_CGROUP" . #t)
686 ("CONFIG_CGROUP_WRITEBACK" . #t)
687 ("CONFIG_CGROUP_SCHED" . #t)
688 ("CONFIG_CGROUP_PIDS" . #t)
689 ("CONFIG_CGROUP_FREEZER" . #t)
690 ("CONFIG_CGROUP_DEVICE" . #t)
691 ("CONFIG_CGROUP_CPUACCT" . #t)
692 ("CONFIG_CGROUP_PERF" . #t)
693 ("CONFIG_SOCK_CGROUP_DATA" . #t)
694 ("CONFIG_BLK_CGROUP_IOCOST" . #t)
695 ("CONFIG_CGROUP_NET_PRIO" . #t)
696 ("CONFIG_CGROUP_NET_CLASSID" . #t)
697 ("CONFIG_MEMCG" . #t)
698 ("CONFIG_MEMCG_SWAP" . #t)
699 ("CONFIG_MEMCG_KMEM" . #t)
700 ("CONFIG_CPUSETS" . #t)
701 ("CONFIG_PROC_PID_CPUSET" . #t)
702 ;; Allow disk encryption by default
703 ("CONFIG_DM_CRYPT" . m)
704 ;; Support zram on all kernel configs
705 ("CONFIG_ZSWAP" . #t)
706 ("CONFIG_ZSMALLOC" . #t)
707 ("CONFIG_ZRAM" . m)
708 ;; Accessibility support.
709 ("CONFIG_ACCESSIBILITY" . #t)
710 ("CONFIG_A11Y_BRAILLE_CONSOLE" . #t)
711 ("CONFIG_SPEAKUP" . m)
712 ("CONFIG_SPEAKUP_SYNTH_SOFT" . m)
713 ;; Modules required for initrd:
714 ("CONFIG_NET_9P" . m)
715 ("CONFIG_NET_9P_VIRTIO" . m)
716 ("CONFIG_VIRTIO_BLK" . m)
717 ("CONFIG_VIRTIO_NET" . m)
718 ("CONFIG_VIRTIO_PCI" . m)
719 ("CONFIG_VIRTIO_BALLOON" . m)
720 ("CONFIG_VIRTIO_MMIO" . m)
721 ("CONFIG_FUSE_FS" . m)
722 ("CONFIG_CIFS" . m)
723 ("CONFIG_9P_FS" . m)))
724
725;; See https://github.com/iovisor/bcc/blob/master/INSTALL.md#kernel-configuration
726(define %bpf-extra-linux-options
727 `(;; Needed for probes
728 ("CONFIG_UPROBE_EVENTS" . #t)
729 ("CONFIG_KPROBE_EVENTS" . #t)
730 ;; kheaders module also helpful for tracing
731 ("CONFIG_IKHEADERS" . #t)
732 ("CONFIG_BPF" . #t)
733 ("CONFIG_BPF_SYSCALL" . #t)
734 ("CONFIG_BPF_JIT_ALWAYS_ON" . #t)
735 ;; optional, for tc filters
736 ("CONFIG_NET_CLS_BPF" . m)
737 ;; optional, for tc actions
738 ("CONFIG_NET_ACT_BPF" . m)
739 ("CONFIG_BPF_JIT" . #t)
740 ;; for Linux kernel versions 4.1 through 4.6
741 ;; ("CONFIG_HAVE_BPF_JIT" . y)
742 ;; for Linux kernel versions 4.7 and later
743 ("CONFIG_HAVE_EBPF_JIT" . #t)
744 ;; optional, for kprobes
745 ("CONFIG_BPF_EVENTS" . #t)
746 ;; kheaders module
747 ("CONFIG_IKHEADERS" . #t)))
748
749(define (config->string options)
750 (string-join (map (match-lambda
751 ((option . 'm)
752 (string-append option "=m"))
753 ((option . #t)
754 (string-append option "=y"))
755 ((option . #f)
756 (string-append option "=n"))
757 ((option . string)
758 (string-append option "=\"" string "\"")))
759 options)
760 "\n"))
761
762
763;;;
764;;; Kernel package utilities.
765;;;
766
767(define (doc-supported? version)
768 ;; Versions older than 5.10 have different enough build scripts that the
769 ;; infodocs patch doesn't apply.
770 (version>=? version "5.10"))
771
772(define* (make-linux-libre version gnu-revision hash-string supported-systems
773 #:key
774 (extra-version #f)
775 ;; A function that takes an arch and a variant.
776 ;; See kernel-config for an example.
777 (configuration-file #f)
778 (defconfig "defconfig")
779 (extra-options %default-extra-linux-options)
780 (build-doc? (doc-supported? version))
781 (patches
782 `(,%boot-logo-patch
783 ,@(if build-doc?
784 (list (search-patch
785 "linux-libre-infodocs-target.patch"))
786 '()))))
787 (make-linux-libre* version gnu-revision
788 (origin
789 (method url-fetch)
790 (uri (linux-libre-urls version gnu-revision))
791 (sha256 (base32 hash-string))
792 (patches patches))
793 supported-systems
794 #:extra-version extra-version
795 #:configuration-file configuration-file
796 #:defconfig defconfig
797 #:extra-options extra-options
798 #:build-doc? build-doc?))
799
800(define* (make-linux-libre* version gnu-revision source supported-systems
801 #:key
802 (extra-version #f)
803 ;; A function that takes an arch and a variant.
804 ;; See kernel-config for an example.
805 (configuration-file #f)
806 (defconfig "defconfig")
807 (extra-options %default-extra-linux-options)
808 (build-doc? (doc-supported? version)))
809 (when (and build-doc? (not (doc-supported? version)))
810 (error "unsupported 'build-doc?' for kernels <5.10"))
811 (package
812 (name (if extra-version
813 (string-append "linux-libre-" extra-version)
814 "linux-libre"))
815 (version version)
816 (source source)
817 (supported-systems supported-systems)
818 (build-system gnu-build-system)
819 (arguments
820 (list
821 #:modules '((guix build gnu-build-system)
822 (guix build utils)
823 (srfi srfi-1)
824 (srfi srfi-26)
825 (ice-9 ftw)
826 (ice-9 match))
827 #:tests? #f
828 #:phases
829 #~(modify-phases %standard-phases
830 (add-after 'unpack 'patch-/bin/pwd
831 (lambda _
832 (substitute* (find-files
833 "." "^Makefile(\\.include)?$")
834 (("/bin/pwd") "pwd"))))
835 #$@(if build-doc?
836 #~((add-before 'configure 'build-doc
837 (lambda _
838 (substitute* "Documentation/Makefile"
839 ;; Remove problematic environment check script.
840 ((".*scripts/sphinx-pre-install.*") ""))
841 (invoke "make" "infodocs")))
842 (add-after 'build-doc 'install-doc
843 (lambda _
844 (with-directory-excursion "Documentation/output"
845 (invoke "make" "-C" "texinfo" "install-info"
846 (string-append "infodir=" #$output
847 "/share/info"))))))
848 #~())
849 (replace 'configure
850 (lambda* (#:key inputs target #:allow-other-keys)
851 ;; Avoid introducing timestamps.
852 (setenv "KCONFIG_NOTIMESTAMP" "1")
853 (setenv "KBUILD_BUILD_TIMESTAMP" (getenv "SOURCE_DATE_EPOCH"))
854
855 ;; Other variables useful for reproducibility.
856 (setenv "KBUILD_BUILD_USER" "guix")
857 (setenv "KBUILD_BUILD_HOST" "guix")
858
859 ;; Set ARCH and CROSS_COMPILE.
860 (let ((arch #$(platform-linux-architecture
861 (lookup-platform-by-target-or-system
862 (or (%current-target-system)
863 (%current-system))))))
864 (setenv "ARCH" arch)
865 (format #t "`ARCH' set to `~a'~%" (getenv "ARCH"))
866
867 (when target
868 (setenv "CROSS_COMPILE" (string-append target "-"))
869 (format #t "`CROSS_COMPILE' set to `~a'~%"
870 (getenv "CROSS_COMPILE"))))
871
872 (setenv "EXTRAVERSION"
873 #$(and extra-version
874 (string-append "-" extra-version)))
875
876 (let ((config (assoc-ref inputs "kconfig")))
877
878 ;; Use a custom kernel configuration file or a default
879 ;; configuration file.
880 (if config
881 (begin
882 (copy-file config ".config")
883 (chmod ".config" #o666))
884 (invoke "make" #$defconfig))
885
886 ;; Appending works even when the option wasn't in the
887 ;; file. The last one prevails if duplicated.
888 (let ((port (open-file ".config" "a"))
889 (extra-configuration #$(config->string extra-options)))
890 (display extra-configuration port)
891 (close-port port))
892
893 (invoke "make" "oldconfig"))))
894 (replace 'install
895 (lambda* (#:key inputs native-inputs #:allow-other-keys)
896 (let ((moddir (string-append #$output "/lib/modules"))
897 (dtbdir (string-append #$output "/lib/dtbs")))
898 ;; Install kernel image, kernel configuration and link map.
899 (for-each (lambda (file) (install-file file #$output))
900 (find-files "." "^(\\.config|bzImage|zImage|Image\
901|vmlinuz|System\\.map|Module\\.symvers)$"))
902 ;; Install device tree files
903 (unless (null? (find-files "." "\\.dtb$"))
904 (mkdir-p dtbdir)
905 (invoke "make" (string-append "INSTALL_DTBS_PATH=" dtbdir)
906 "dtbs_install"))
907 ;; Install kernel modules
908 (mkdir-p moddir)
909 (invoke "make"
910 ;; Disable depmod because the Guix system's
911 ;; module directory is an union of potentially
912 ;; multiple packages. It is not possible to use
913 ;; depmod to usefully calculate a dependency
914 ;; graph while building only one of them.
915 "DEPMOD=true"
916 (string-append "MODULE_DIR=" moddir)
917 (string-append "INSTALL_PATH=" #$output)
918 (string-append "INSTALL_MOD_PATH=" #$output)
919 "INSTALL_MOD_STRIP=1"
920 "modules_install")
921 (let* ((versions (filter (lambda (name)
922 (not (string-prefix? "." name)))
923 (scandir moddir)))
924 (version (match versions
925 ((x) x))))
926 ;; There are symlinks to the build and source directory.
927 ;; Both will point to target /tmp/guix-build* and thus
928 ;; not be useful in a profile. Delete the symlinks.
929 (false-if-file-not-found
930 (delete-file
931 (string-append moddir "/" version "/build")))
932 (false-if-file-not-found
933 (delete-file
934 (string-append moddir "/" version "/source"))))))))))
935 (native-inputs
936 `(("perl" ,perl)
937 ("bc" ,bc)
938 ("openssl" ,openssl)
939 ("elfutils" ,elfutils) ;needed to enable CONFIG_STACK_VALIDATION
940 ("flex" ,flex)
941 ("bison" ,bison)
942
943 ;; These are needed to compile the GCC plugins.
944 ("gmp" ,gmp)
945 ("mpfr" ,mpfr)
946 ("mpc" ,mpc)
947
948 ;; For generating the documentation.
949 ,@(if build-doc?
950 ;; TODO: remove fontconfig after the 5.10 kernel is dropped.
951 ;; Also replace python-wrapper by python at that time.
952 `(("fontconfig" ,fontconfig)
953 ("graphviz" ,graphviz)
954 ("python" ,python-wrapper)
955 ("python-sphinx" ,python-sphinx)
956 ("texinfo" ,texinfo)
957 ("which" ,which))
958 '())
959
960 ,@(match (let ((arch (platform-linux-architecture
961 (lookup-platform-by-target-or-system
962 (or (%current-target-system)
963 (%current-system))))))
964 (and configuration-file arch
965 (configuration-file
966 arch
967 #:variant (version-major+minor version))))
968 (#f ;no config for this platform
969 '())
970 ((? string? config)
971 `(("kconfig" ,config))))))
972 (home-page "https://www.gnu.org/software/linux-libre/")
973 (synopsis "100% free redistribution of a cleaned Linux kernel")
974 (description "GNU Linux-Libre is a free (as in freedom) variant of the
975Linux kernel. It has been modified to remove all non-free binary blobs.")
976 (license license:gpl2)
977 (properties '((max-silent-time . 3600))))) ;don't timeout on blob scan.
978
979
980;;;
981;;; Generic kernel packages.
982;;;
983
984(define-public linux-libre-6.0
985 (make-linux-libre* linux-libre-6.0-version
986 linux-libre-6.0-gnu-revision
987 linux-libre-6.0-source
988 '("x86_64-linux" "i686-linux" "armhf-linux"
989 "aarch64-linux" "powerpc64le-linux" "riscv64-linux")
990 #:configuration-file kernel-config))
991
992(define-public linux-libre-version linux-libre-6.0-version)
993(define-public linux-libre-gnu-revision linux-libre-6.0-gnu-revision)
994(define-public linux-libre-pristine-source linux-libre-6.0-pristine-source)
995(define-public linux-libre-source linux-libre-6.0-source)
996(define-public linux-libre linux-libre-6.0)
997
998(define-public linux-libre-5.15
999 (make-linux-libre* linux-libre-5.15-version
1000 linux-libre-5.15-gnu-revision
1001 linux-libre-5.15-source
1002 '("x86_64-linux" "i686-linux" "armhf-linux"
1003 "aarch64-linux" "powerpc64le-linux" "riscv64-linux")
1004 #:configuration-file kernel-config))
1005
1006(define-public linux-libre-5.10
1007 (make-linux-libre* linux-libre-5.10-version
1008 linux-libre-5.10-gnu-revision
1009 linux-libre-5.10-source
1010 '("x86_64-linux" "i686-linux" "armhf-linux"
1011 "aarch64-linux" "powerpc64le-linux" "riscv64-linux")
1012 #:configuration-file kernel-config))
1013
1014(define-public linux-libre-5.4
1015 (make-linux-libre* linux-libre-5.4-version
1016 linux-libre-5.4-gnu-revision
1017 linux-libre-5.4-source
1018 '("x86_64-linux" "i686-linux" "armhf-linux"
1019 "aarch64-linux" "powerpc64le-linux" "riscv64-linux")
1020 #:configuration-file kernel-config))
1021
1022(define-public linux-libre-4.19
1023 (make-linux-libre* linux-libre-4.19-version
1024 linux-libre-4.19-gnu-revision
1025 linux-libre-4.19-source
1026 '("x86_64-linux" "i686-linux" "armhf-linux"
1027 "aarch64-linux" "powerpc64le-linux")
1028 #:configuration-file kernel-config))
1029
1030(define-public linux-libre-4.14
1031 (make-linux-libre* linux-libre-4.14-version
1032 linux-libre-4.14-gnu-revision
1033 linux-libre-4.14-source
1034 '("x86_64-linux" "i686-linux" "armhf-linux"
1035 "powerpc64le-linux")
1036 #:configuration-file kernel-config))
1037
1038(define-public linux-libre-4.9
1039 (make-linux-libre* linux-libre-4.9-version
1040 linux-libre-4.9-gnu-revision
1041 linux-libre-4.9-source
1042 '("x86_64-linux" "i686-linux" "powerpc64le-linux")
1043 #:configuration-file kernel-config))
1044
1045;; Linux-Libre-LTS points to the *newest* released long-term support version of
1046;; Linux-Libre.
1047;; Reference: https://jxself.org/linux-libre/
1048
1049(define-public linux-libre-lts-version linux-libre-5.15-version)
1050(define-public linux-libre-lts-gnu-revision linux-libre-5.15-gnu-revision)
1051(define-public linux-libre-lts-pristine-source linux-libre-5.15-pristine-source)
1052(define-public linux-libre-lts-source linux-libre-5.15-source)
1053(define-public linux-libre-lts linux-libre-5.15)
1054
1055
1056;;;
1057;;; Specialized kernel variants.
1058;;;
1059
1060(define-public linux-libre-arm-generic
1061 (make-linux-libre* linux-libre-version
1062 linux-libre-gnu-revision
1063 linux-libre-source
1064 '("armhf-linux")
1065 #:defconfig "multi_v7_defconfig"
1066 #:extra-version "arm-generic"
1067 #:extra-options
1068 (append
1069 `(;; needed to fix the RTC on rockchip platforms
1070 ("CONFIG_RTC_DRV_RK808" . #t))
1071 %default-extra-linux-options)))
1072
1073(define-public linux-libre-arm-generic-5.10
1074 (make-linux-libre* linux-libre-5.10-version
1075 linux-libre-5.10-gnu-revision
1076 linux-libre-5.10-source
1077 '("armhf-linux")
1078 #:defconfig "multi_v7_defconfig"
1079 #:extra-version "arm-generic"
1080 #:extra-options
1081 (append
1082 `(;; needed to fix the RTC on rockchip platforms
1083 ("CONFIG_RTC_DRV_RK808" . #t))
1084 %default-extra-linux-options)))
1085
1086(define-public linux-libre-arm-generic-5.4
1087 (make-linux-libre* linux-libre-5.4-version
1088 linux-libre-5.4-gnu-revision
1089 linux-libre-5.4-source
1090 '("armhf-linux")
1091 #:defconfig "multi_v7_defconfig"
1092 #:extra-version "arm-generic"
1093 #:extra-options
1094 (append
1095 `(;; needed to fix the RTC on rockchip platforms
1096 ("CONFIG_RTC_DRV_RK808" . #t))
1097 %default-extra-linux-options)))
1098
1099(define-public linux-libre-arm-generic-4.19
1100 (make-linux-libre* linux-libre-4.19-version
1101 linux-libre-4.19-gnu-revision
1102 linux-libre-4.19-source
1103 '("armhf-linux")
1104 #:defconfig "multi_v7_defconfig"
1105 #:extra-version "arm-generic"))
1106
1107(define-public linux-libre-arm-generic-4.14
1108 (make-linux-libre* linux-libre-4.14-version
1109 linux-libre-4.14-gnu-revision
1110 linux-libre-4.14-source
1111 '("armhf-linux")
1112 #:defconfig "multi_v7_defconfig"
1113 #:extra-version "arm-generic"))
1114
1115(define-public linux-libre-arm-omap2plus
1116 (make-linux-libre* linux-libre-version
1117 linux-libre-gnu-revision
1118 linux-libre-source
1119 '("armhf-linux")
1120 #:defconfig "omap2plus_defconfig"
1121 #:extra-version "arm-omap2plus"))
1122
1123(define-public linux-libre-arm-omap2plus-4.19
1124 (make-linux-libre* linux-libre-4.19-version
1125 linux-libre-4.19-gnu-revision
1126 linux-libre-4.19-source
1127 '("armhf-linux")
1128 #:defconfig "omap2plus_defconfig"
1129 #:extra-version "arm-omap2plus"))
1130
1131(define-public linux-libre-arm-omap2plus-4.14
1132 (make-linux-libre* linux-libre-4.14-version
1133 linux-libre-4.14-gnu-revision
1134 linux-libre-4.14-source
1135 '("armhf-linux")
1136 #:defconfig "omap2plus_defconfig"
1137 #:extra-version "arm-omap2plus"))
1138
1139(define-public linux-libre-arm64-generic
1140 (make-linux-libre* linux-libre-version
1141 linux-libre-gnu-revision
1142 linux-libre-source
1143 '("aarch64-linux")
1144 #:defconfig "defconfig"
1145 #:extra-version "arm64-generic"
1146 #:extra-options
1147 (append
1148 `(;; needed to fix the RTC on rockchip platforms
1149 ("CONFIG_RTC_DRV_RK808" . #t)
1150 ;; Pinebook display, battery, charger and usb
1151 ("CONFIG_DRM_ANALOGIX_ANX6345" . m)
1152 ("CONFIG_CHARGER_AXP20X" . m)
1153 ("CONFIG_INPUT_AXP20X_PEK" . m)
1154 ("CONFIG_CHARGER_AXP20X" . m)
1155 ("CONFIG_BATTERY_AXP20X" . m)
1156 ("CONFIG_PINCTRL_AXP209" . m)
1157 ("CONFIG_AXP20X_POWER" . m)
1158 ("CONFIG_AXP20X_ADC" . m)
1159 ;; Pinebook PRO battery and sound support
1160 ("CONFIG_BATTERY_CW2015" . m)
1161 ("CONFIG_CHARGER_GPIO" . m)
1162 ("CONFIG_SND_SOC_ES8316" . m))
1163 %default-extra-linux-options)))
1164
1165(define-public linux-libre-arm64-generic-5.10
1166 (make-linux-libre* linux-libre-5.10-version
1167 linux-libre-5.10-gnu-revision
1168 linux-libre-5.10-source
1169 '("aarch64-linux")
1170 #:defconfig "defconfig"
1171 #:extra-version "arm64-generic"
1172 #:extra-options
1173 (append
1174 `(;; needed to fix the RTC on rockchip platforms
1175 ("CONFIG_RTC_DRV_RK808" . #t)
1176 ;; Pinebook display, battery, charger and usb
1177 ("CONFIG_DRM_ANALOGIX_ANX6345" . m)
1178 ("CONFIG_CHARGER_AXP20X" . m)
1179 ("CONFIG_INPUT_AXP20X_PEK" . m)
1180 ("CONFIG_CHARGER_AXP20X" . m)
1181 ("CONFIG_BATTERY_AXP20X" . m)
1182 ("CONFIG_PINCTRL_AXP209" . m)
1183 ("CONFIG_AXP20X_POWER" . m)
1184 ("CONFIG_AXP20X_ADC" . m)
1185 ;; Pinebook PRO battery and sound support
1186 ("CONFIG_BATTERY_CW2015" . m)
1187 ("CONFIG_CHARGER_GPIO" . m)
1188 ("CONFIG_SND_SOC_ES8316" . m))
1189 %default-extra-linux-options)))
1190
1191(define-public linux-libre-arm64-generic-5.4
1192 (make-linux-libre* linux-libre-5.4-version
1193 linux-libre-5.4-gnu-revision
1194 linux-libre-5.4-source
1195 '("aarch64-linux")
1196 #:defconfig "defconfig"
1197 #:extra-version "arm64-generic"
1198 #:extra-options
1199 (append
1200 `(;; needed to fix the RTC on rockchip platforms
1201 ("CONFIG_RTC_DRV_RK808" . #t))
1202 %default-extra-linux-options)))
1203
1204(define-public linux-libre-riscv64-generic
1205 (make-linux-libre* linux-libre-version
1206 linux-libre-gnu-revision
1207 linux-libre-source
1208 '("riscv64-linux")
1209 #:extra-version "riscv64-generic"))
1210
1211(define-public linux-libre-mips64el-fuloong2e
1212 (make-linux-libre* linux-libre-version
1213 linux-libre-gnu-revision
1214 linux-libre-source
1215 '("mips64el-linux")
1216 #:defconfig "fuloong2e_defconfig"
1217 #:extra-version "mips64el-fuloong2e"
1218 #:extra-options
1219 (append
1220 `(("CONFIG_OVERLAY_FS" . m))
1221 %default-extra-linux-options)))
1222
1223(define-public linux-libre-with-bpf
1224 (let ((base-linux-libre
1225 (make-linux-libre*
1226 linux-libre-6.0-version
1227 linux-libre-6.0-gnu-revision
1228 linux-libre-6.0-source
1229 '("x86_64-linux" "i686-linux" "armhf-linux"
1230 "aarch64-linux" "powerpc64le-linux" "riscv64-linux")
1231 #:extra-version "bpf"
1232 #:configuration-file kernel-config
1233 #:extra-options
1234 (append %bpf-extra-linux-options
1235 %default-extra-linux-options))))
1236 (package
1237 (inherit base-linux-libre)
1238 (inputs (modify-inputs (package-inputs base-linux-libre)
1239 (prepend cpio))))))
1240
1241
1242
1243;;;
1244;;; Linux kernel modules.
1245;;;
1246
1247(define-public acpi-call-linux-module
1248 (package
1249 (name "acpi-call-linux-module")
1250 (version "1.2.2")
1251 (source
1252 (origin
1253 (method git-fetch)
1254 (uri (git-reference
1255 (url "https://github.com/nix-community/acpi_call")
1256 (commit (string-append "v" version))))
1257 (file-name (git-file-name name version))
1258 (sha256
1259 (base32 "09ljx0jl987753r2kjqj5kxms95bijw0xn14kf82ryn38ck5c8cf"))))
1260 (build-system linux-module-build-system)
1261 (arguments
1262 (list #:tests? #f ; no tests
1263 #:phases
1264 #~(modify-phases %standard-phases
1265 (add-before 'install 'patch-shebangs-harder
1266 ;; The (only) shebangs in examples/ don't justify a reference.
1267 ;; However, do substitute a slightly more portable one.
1268 (lambda _
1269 (substitute* (find-files "examples" ".")
1270 (("^(#! *)/[^ ]*/" _ shebang)
1271 (string-append shebang "/usr/bin/env ")))))
1272 (add-after 'install 'install-documentation
1273 (lambda _
1274 (let* ((doc (string-append #$output "/share/doc/"
1275 #$name "-" #$version)))
1276 (for-each (lambda (file)
1277 (let ((target (string-append doc "/" file)))
1278 (mkdir-p (dirname target))
1279 (copy-recursively file target)))
1280 (list "README.md" "examples"))))))))
1281 (home-page "https://github.com/nix-community/acpi_call")
1282 (synopsis "Linux kernel module to perform ACPI method calls")
1283 (description
1284 "This simple Linux kernel module allows calls from user space to any
1285@acronym{ACPI, Advanced Configuration and Power Interface} method provided by
1286your computer's firmware, by writing to @file{/proc/acpi/call}. You can pass
1287any number of parameters of types @code{ACPI_INTEGER}, @code{ACPI_STRING},
1288and @code{ACPI_BUFFER}.
1289
1290It grants direct and undocumented access to your hardware that may cause damage
1291and should be used with caution, especially on untested models.")
1292 (license license:gpl3+))) ; see README.md (no licence headers)
1293
1294(define-public corefreq
1295 (package
1296 (name "corefreq")
1297 (version "1.90.1")
1298 (source
1299 (origin
1300 (method git-fetch)
1301 (uri (git-reference
1302 (url "https://github.com/cyring/CoreFreq")
1303 (commit version)))
1304 (file-name (git-file-name name version))
1305 (sha256
1306 (base32 "1fpmrqjwxvjbs23r73agjs322fbi4v1013cncbfyk6lcjghxab76"))))
1307 (build-system linux-module-build-system)
1308 (outputs (list "out" "linux-module"))
1309 (arguments
1310 (list #:imported-modules `((guix build gnu-build-system)
1311 ,@%linux-module-build-system-modules)
1312 #:modules `((guix build linux-module-build-system)
1313 ((guix build gnu-build-system) #:prefix gnu:)
1314 (guix build utils))
1315 #:make-flags
1316 #~(list (string-append "CC=" #$(cc-for-target))
1317 "OPTIM_LVL=3"
1318 (string-append "PREFIX=" #$output))
1319 #:tests? #f ; no test suite
1320 #:phases
1321 #~(modify-phases %standard-phases
1322 (add-after 'unpack 'untangle-module-targets
1323 ;; Having to build everything in one pass would complicate the
1324 ;; definition. Let each build system handle what it's good at.
1325 (lambda _
1326 (substitute* "Makefile"
1327 ((".*MAKE.*KERNELDIR.*") ""))))
1328 (add-after 'build 'gnu:build
1329 (assoc-ref gnu:%standard-phases 'build))
1330 (add-after 'install 'gnu:install
1331 (assoc-ref gnu:%standard-phases 'install))
1332 (add-after 'install 'separate-module
1333 (lambda* (#:key outputs #:allow-other-keys)
1334 ;; Adding INSTALL_MOD_PATH= to #:make-flags would still create an
1335 ;; empty <out>/lib/modules directory, so just do it all by hand.
1336 (let* ((out (assoc-ref outputs "out"))
1337 (module (assoc-ref outputs "linux-module")))
1338 (mkdir-p (string-append module "/lib"))
1339 (rename-file (string-append out "/lib/modules")
1340 (string-append module "/lib/modules")))))
1341 (add-after 'install 'install-README
1342 ;; There is no proper documentation. Provide something.
1343 (lambda* (#:key outputs #:allow-other-keys)
1344 (let* ((out (assoc-ref outputs "out"))
1345 (doc (string-append out "/share/doc/"
1346 #$name "-" #$version)))
1347 (install-file "README.md" doc)))))))
1348 (home-page "https://github.com/cyring/CoreFreq")
1349 (synopsis
1350 "Measure performance data & tweak low-level settings on x86-64 CPUs")
1351 (description
1352 "CoreFreq is a CPU monitor that reports low-level processor settings and
1353performance data with notably high precision by using a loadable Linux kernel
1354module. Unlike most similar tools, it can be used to modify some settings if
1355supported by the hardware and at your own risk. It's designed for 64-bit x86
1356Intel processors (Atom, Core2, Nehalem, SandyBridge, and newer) and compatible
1357architectures like AMD@tie{}Zen and Hygon@tie{}Dhyana.
1358
1359Supported processor features include:
1360@enumerate
1361@item time spent in C-states, including C1/C3 Auto- and UnDemotion;
1362@item core temperatures, voltage, and tweaking thermal limits;
1363@item core frequencies, ratios, and base clock rate;
1364@item enabling, disabling, and testing SpeedStep (EIST), Turbo Boost, and
1365Hyper-Threading or SMT;
1366@item enabling or disabling data cache prefetching;
1367@item kernel assembly code to keep as near as possible readings of performance
1368counters such as the @acronym{TSC, Time Stamp Counter}, @acronym{UCC, Unhalted
1369Core Cycles}, and @acronym{URC, Unhalted Reference Cycles};
1370@item the number of instructions per cycle or second (IPS, IPC, and CPI);
1371@item memory controller geometry and RAM timings;
1372@item running processes' CPU affinity.
1373@end enumerate
1374
1375This package provides the @command{corefreqd} data collection daemon, the
1376@command{corefreq-cli} client to visualise and control it in real time, and the
1377@code{corefreqk} kernel module in its own separate output. Read the included
1378@file{README.md} before loading it.")
1379 (supported-systems (list "x86_64-linux"))
1380 (license license:gpl2)))
1381
1382(define-public librem-ec-acpi-linux-module
1383 (package
1384 (name "librem-ec-acpi-linux-module")
1385 (version "0.9.1")
1386 (source
1387 (origin
1388 (method git-fetch)
1389 (uri (git-reference
1390 (url "https://source.puri.sm/nicole.faerber/librem-ec-acpi-dkms")
1391 (commit (string-append "v" version))))
1392 (file-name (git-file-name name version))
1393 (sha256
1394 (base32 "1qnbfj60i8nn2ahgj2zp5ixd79bb0wl1ld36x3igws2f3c0f5pfi"))))
1395 (build-system linux-module-build-system)
1396 (arguments
1397 (list #:tests? #f)) ; no test suite
1398 (home-page "https://source.puri.sm/nicole.faerber/librem-ec-acpi-dkms")
1399 (synopsis "Linux kernel module to control the Librem Embedded Controller")
1400 (description
1401 "This is the Linux kernel @acronym{ACPI, Advanced Configuration and Power
1402Interface} platform driver for the @acronym{EC, Embedded Controller} firmware
1403on Purism Librem laptop computers. It allows user-space control over the
1404battery charging thresholds, keyboard backlight, fans and thermal monitors,
1405and the notification, WiFi, and Bluetooth LED.")
1406 (license license:gpl2)))
1407
1408(define-public ec
1409 (package
1410 (name "ec")
1411 (version (package-version linux-libre))
1412 (source (package-source linux-libre))
1413 (build-system gnu-build-system)
1414 (arguments
1415 (list #:make-flags #~(list (string-append "sbindir="
1416 #$output "/sbin")
1417 "INSTALL=install" "STRIPCMD=true")
1418 #:phases #~(modify-phases %standard-phases
1419 (add-after 'unpack 'enter-subdirectory
1420 (lambda _
1421 (chdir "tools/power/acpi/tools/ec")))
1422 (delete 'configure)) ;no configure script
1423 #:tests? #f)) ;no tests
1424 (home-page (package-home-page linux-libre))
1425 (synopsis
1426 "Utility for reading or writing @acronym{EC, Embedded Controller} registers")
1427 (description
1428 "This utility can read or write specific registers or all the available
1429registers of the @acronym{EC, Embedded Controller} supported by the
1430@code{ec_sys} Linux driver.")
1431 (license license:gpl2)))
1432
1433(define-public lkrg
1434 (package
1435 (name "lkrg")
1436 (version "0.9.3")
1437 (source (origin
1438 (method git-fetch)
1439 (uri (git-reference
1440 (url "https://github.com/lkrg-org/lkrg")
1441 (commit (string-append "v" version))))
1442 (file-name (git-file-name name version))
1443 (sha256
1444 (base32
1445 "0yirb7n4mqv8cn0gziz1m7ymq00dhhy79j59jdgrx00b8rj57cfw"))))
1446 (build-system linux-module-build-system)
1447 (arguments
1448 (list #:linux linux-libre
1449 #:tests? #f
1450 #:make-flags #~(list (string-append "CC="
1451 #$(cc-for-target))
1452 (string-append "SYSSRC="
1453 (assoc-ref %build-inputs
1454 "linux-module-builder")
1455 "/lib/modules/build"))))
1456 (inputs (list bash-minimal))
1457 (home-page "https://lkrg.org/")
1458 (synopsis "Linux Kernel Runtime Guard")
1459 (description
1460 "This package performs runtime integrity checking of the Linux kernel and
1461detection of security vulnerability exploits against the kernel.")
1462 (license license:gpl2)))
1463
1464(define-public vhba-module
1465 (package
1466 (name "vhba-module")
1467 (version "20211218")
1468 (source
1469 (origin
1470 (method url-fetch)
1471 (uri (string-append
1472 "http://downloads.sourceforge.net/cdemu/vhba-module/vhba-module-"
1473 version ".tar.xz"))
1474 (sha256
1475 (base32 "1dkprnnya0i8121p7ip4g8cww99drk7fzbwcxx65x02jqk0siibj"))))
1476 (build-system linux-module-build-system)
1477 (arguments
1478 (list #:tests? #f)) ; no test suite
1479 (home-page "https://cdemu.sourceforge.io/")
1480 (synopsis "Linux kernel module that emulates SCSI devices")
1481 (description
1482 "The @acronym{VHBA, Virtual SCSI Host Bus Adapter} module is the link
1483between the CDemu user-space daemon and the kernel Linux. It acts as a
1484low-level SCSI driver that emulates a virtual SCSI adapter which can have
1485multiple virtual devices attached to it. Its typical use with CDEmu is to
1486emulate optical devices such as DVD and CD-ROM drives.")
1487 (license license:gpl2+)))
1488
1489(define-public bbswitch-module
1490 ;; Use "develop" branch since stable release does not build on Linux >= 5.6.
1491 ;; See https://github.com/Bumblebee-Project/bbswitch/issues/205.
1492 (let ((commit "19f60204596a6463b162fc7ca11f4946f5c20cea"))
1493 (package
1494 (name "bbswitch-module")
1495 (version (git-version "0.8" "2" commit))
1496 (source (origin
1497 (method git-fetch)
1498 (uri (git-reference
1499 ;; Use fork until
1500 ;; https://github.com/Bumblebee-Project/bbswitch/pull/219
1501 ;; is merged.
1502 (url "https://github.com/madchic/bbswitch")
1503 (commit commit)))
1504 (file-name (git-file-name name version))
1505 (sha256
1506 (base32
1507 "1pv41y02c9xg9k1bg4i4ll3w7hxxzdr651i08f092b9q5hr57mqn"))))
1508 (build-system linux-module-build-system)
1509 (arguments
1510 (list #:tests? #f)) ; no test suite
1511 (home-page "https://github.com/Bumblebee-Project/bbswitch")
1512 (synopsis "Kernel module that disables discrete Nvidia graphics cards")
1513 (description "The bbswitch module provides a way to toggle the Nvidia
1514graphics card on Optimus laptops.")
1515 (license license:gpl2))))
1516
1517(define-public ddcci-driver-linux
1518 (package
1519 (name "ddcci-driver-linux")
1520 (version "0.4.2")
1521 (source
1522 (origin
1523 (method git-fetch)
1524 (uri
1525 (git-reference
1526 (url "https://gitlab.com/ddcci-driver-linux/ddcci-driver-linux.git")
1527 (commit (string-append "v" version))))
1528 (file-name (git-file-name name version))
1529 (sha256
1530 (base32 "1lww3mnqhxqzj0qbxzbwbq93v9zw49myp7p9ib873a5izbq8nadi"))))
1531 (build-system linux-module-build-system)
1532 (arguments
1533 (list #:tests? #f ; no tests
1534 #:phases
1535 #~(modify-phases %standard-phases
1536 (replace 'build
1537 (lambda args
1538 (for-each
1539 (lambda (module)
1540 (with-directory-excursion module
1541 (apply (assoc-ref %standard-phases 'build) args)))
1542 '("ddcci" "ddcci-backlight"))))
1543 (replace 'install
1544 (lambda args
1545 (for-each
1546 (lambda (module)
1547 (with-directory-excursion module
1548 (apply (assoc-ref %standard-phases 'install) args)))
1549 '("ddcci" "ddcci-backlight")))))))
1550 (home-page "https://gitlab.com/ddcci-driver-linux/ddcci-driver-linux")
1551 (synopsis "Pair of Linux kernel drivers for DDC/CI monitors")
1552 (description "This package provides two Linux kernel drivers, ddcci and
1553ddcci-backlight, that allows the control of DDC/CI monitors through the sysfs
1554interface. The ddcci module creates a character device for each DDC/CI
1555monitors in @file{/dev/bus/ddcci/[I²C busnumber]}. While the ddcci-backlight
1556module allows the control of the backlight level or luminance property when
1557supported under @file{/sys/class/backlight/}.")
1558 (license license:gpl2+)))
1559
1560(define-public v4l2loopback-linux-module
1561 (package
1562 (name "v4l2loopback-linux-module")
1563 (version "0.12.7")
1564 (source (origin
1565 (method git-fetch)
1566 (uri (git-reference
1567 (url "https://github.com/umlaeute/v4l2loopback")
1568 (commit (string-append "v" version))))
1569 (file-name (git-file-name name version))
1570 (sha256
1571 (base32
1572 "1yghxl7gjr1zxi3a1kiz6d7yh68z64xayzm925zan4jqhrwv1h68"))))
1573 (build-system linux-module-build-system)
1574 (arguments
1575 (list #:tests? #f)) ; no test suite
1576 (home-page "https://github.com/umlaeute/v4l2loopback")
1577 (synopsis "Linux kernel module to create virtual V4L2 video devices")
1578 (description
1579 "This Linux module creates virtual video devices. @acronym{V4L2, Video
1580for Linux 2} applications will treat these as ordinary video devices but read
1581video data generated by another application, instead of a hardware device such
1582as a capture card.
1583
1584This lets you apply nifty effects to your Jitsi video, for example, but also
1585allows some more serious things like adding streaming capabilities to an
1586application by hooking GStreamer into the loopback device.")
1587 (license license:gpl2+)))
1588
1589(define-public xpadneo
1590 (package
1591 (name "xpadneo")
1592 (version "0.9.1")
1593 (source (origin
1594 (method git-fetch)
1595 (uri (git-reference
1596 (url "https://github.com/atar-axis/xpadneo")
1597 (commit (string-append "v" version))))
1598 (file-name (git-file-name name version))
1599 (sha256
1600 (base32
1601 "0xr0zx134s56h4ij6c3fh8ki0h58h61minbfxcl3sgpgxkh14ism"))))
1602 (build-system linux-module-build-system)
1603 (arguments
1604 (list #:tests? #f ; no `check' target
1605 #:source-directory "hid-xpadneo/src"
1606 #:phases
1607 #~(modify-phases %standard-phases
1608 (add-after 'install 'post-install
1609 (lambda _
1610 (copy-recursively "hid-xpadneo/etc-modprobe.d"
1611 (string-append #$output "/etc/modprobe.d"))
1612 ;; udev-service-type takes its rules from /lib rather than
1613 ;; /etc, so copy it there instead
1614 (copy-recursively "hid-xpadneo/etc-udev-rules.d"
1615 (string-append #$output
1616 "/lib/udev/rules.d")))))))
1617 (home-page "https://atar-axis.github.io/xpadneo/")
1618 (synopsis "Xbox One Wireless Controller driver for the kernel Linux")
1619 (description
1620 "This package provides a driver for the XBox One S Wireless controller
1621and some newer models when connected via Bluetooth. In addition to the included
1622Linux kernel module, it also contains a modprobe configuration and udev rules,
1623which need to be installed separately.")
1624 (license license:gpl3+)))
1625
1626
1627;;;
1628;;; Pluggable authentication modules (PAM).
1629;;;
1630
1631(define-public linux-pam
1632 (package
1633 (name "linux-pam")
1634 (version "1.5.1")
1635 (source
1636 (origin
1637 (method url-fetch)
1638 (uri (string-append
1639 "https://github.com/linux-pam/linux-pam/releases/download/v"
1640 version "/Linux-PAM-" version ".tar.xz"))
1641 (sha256
1642 (base32
1643 "1z4jayf69qyyxln1gl6ch4qxfd66ib1g42garnrv2d8i1drl0790"))
1644 (patches (search-patches "linux-pam-no-setfsuid.patch"))))
1645
1646 (build-system gnu-build-system)
1647 (native-inputs
1648 (list flex
1649 ;; TODO: optional dependencies
1650 ;; ("libxcrypt" ,libxcrypt)
1651 ;; ("cracklib" ,cracklib)
1652 ))
1653 (arguments
1654 `(;; Most users, such as `shadow', expect the headers to be under
1655 ;; `security'.
1656 #:configure-flags (list (string-append "--includedir="
1657 (assoc-ref %outputs "out")
1658 "/include/security")
1659
1660 ;; XXX: <rpc/rpc.h> is missing from glibc when
1661 ;; cross-compiling, so we have to disable NIS
1662 ;; support altogether.
1663 ,@(if (%current-target-system)
1664 '("--disable-nis")
1665 '()))
1666
1667 ;; XXX: Tests won't run in chroot, presumably because /etc/pam.d
1668 ;; isn't available.
1669 #:tests? #f))
1670 (home-page "http://www.linux-pam.org/")
1671 (synopsis "Pluggable authentication modules for Linux")
1672 (description
1673 "A *Free* project to implement OSF's RFC 86.0.
1674Pluggable authentication modules are small shared object files that can
1675be used through the PAM API to perform tasks, like authenticating a user
1676at login. Local and dynamic reconfiguration are its key features.")
1677 (license license:bsd-3)))
1678
1679(define-public python-pamela
1680 (package
1681 (name "python-pamela")
1682 (version "1.0.0")
1683 (source
1684 (origin
1685 ;; Tests not distributed in pypi release.
1686 (method git-fetch)
1687 (uri (git-reference
1688 (url "https://github.com/minrk/pamela")
1689 (commit version)))
1690 (file-name (git-file-name name version))
1691 (sha256
1692 (base32
1693 "0cg3w6np1fbjpvzhv54xg567hpf38szwp2d4gvzb9r736nxbv0vr"))))
1694 (build-system python-build-system)
1695 (arguments
1696 '(#:tests? #f ; Test suite isn't designed to be run inside a container.
1697 #:phases
1698 (modify-phases %standard-phases
1699 (add-after 'unpack 'hardcode-pam.so
1700 (lambda* (#:key inputs #:allow-other-keys)
1701 (let ((pam (assoc-ref inputs "linux-pam")))
1702 (substitute* "pamela.py"
1703 (("find_library\\(\"pam\")")
1704 (string-append "'" pam "/lib/libpam.so'")))
1705 #t)))
1706 (replace 'check
1707 (lambda* (#:key tests? #:allow-other-keys)
1708 (if tests?
1709 (if (file-exists? "test_pamela.py")
1710 (invoke "py.test" "--assert=plain" "test_pamela.py")
1711 (invoke "python" "-m" "pamela" "-a" "`whoami`"))
1712 #t))))))
1713 (inputs
1714 (list linux-pam))
1715 (native-inputs
1716 (list python-pytest))
1717 (home-page "https://github.com/minrk/pamela")
1718 (synopsis "PAM interface using ctypes")
1719 (description "This package provides a PAM interface using @code{ctypes}.")
1720 (license license:expat)))
1721
1722(define-public pam-gnupg
1723 (package
1724 (name "pam-gnupg")
1725 (version "0.3")
1726 (source (origin
1727 (method git-fetch)
1728 (uri (git-reference
1729 (url "https://github.com/cruegge/pam-gnupg")
1730 (commit (string-append "v" version))))
1731 (file-name (git-file-name name version))
1732 (sha256
1733 (base32
1734 "1bf91gi6zmfzzmczxm7pajxdlgnikasvg5xsd3j0a368rcr7lf9l"))))
1735 (build-system gnu-build-system)
1736 (inputs
1737 (list gnupg linux-pam))
1738 (native-inputs
1739 (list autoconf automake libtool))
1740 (arguments
1741 `(#:tests? #f ;no tests suite
1742 #:configure-flags
1743 (list (string-append "--with-moduledir="
1744 (assoc-ref %outputs "out") "/lib/security"))))
1745
1746 (home-page "https://github.com/cruegge/pam-gnupg")
1747 (synopsis "Unlock GnuPG keys on login")
1748 (description "This package provides a PAM module that hands over your
1749login password to @code{gpg-agent}. This can be useful if you are using a
1750GnuPG-based password manager like @code{pass}.")
1751 (license license:gpl3+)))
1752
1753
1754;;;
1755;;; Miscellaneous.
1756;;;
1757
1758(define-public powercap
1759 (package
1760 (name "powercap")
1761 (version "0.5.0")
1762 (source
1763 (origin
1764 (method git-fetch)
1765 (uri (git-reference
1766 (url "https://github.com/powercap/powercap")
1767 (commit (string-append "v" version))))
1768 (file-name (git-file-name name version))
1769 (sha256
1770 (base32 "1vs84fmhdc3w1541vp0f5ydvdsbg0amjdv2g2f8xdvaw01nakxsn"))))
1771 (build-system cmake-build-system)
1772 (arguments
1773 (list #:configure-flags
1774 #~(list "-DBUILD_SHARED_LIBS=ON")))
1775 (home-page "https://github.com/powercap/powercap")
1776 (synopsis "Utilities for accessing the powercap Linux kernel feature")
1777 (description "This package contains utilities for accessing the powercap
1778Linux kernel feature through sysfs. It includes an implementation for working
1779with Intel @acronym{RAPL, Running Average Power Limit}.
1780It provides the commands @code{powercap-info} and @code{powercap-set}.")
1781 (license license:bsd-3)))
1782
1783(define-public powerstat
1784 (package
1785 (name "powerstat")
1786 (version "0.02.27")
1787 (source
1788 (origin
1789 (method git-fetch)
1790 (uri (git-reference
1791 (url "https://github.com/ColinIanKing/powerstat")
1792 (commit (string-append "V" version))))
1793 (file-name (git-file-name name version))
1794 (sha256
1795 (base32 "1ik5yv2bhz2hvyga4h1m28rf0xpi20zpqm4swhvskyf1g6qf381z"))))
1796 (build-system gnu-build-system)
1797 (arguments
1798 `(#:make-flags
1799 (list (string-append "CC=" ,(cc-for-target))
1800 (string-append "prefix=" (assoc-ref %outputs "out")))
1801 #:tests? #f ; no test suite
1802 #:phases
1803 (modify-phases %standard-phases
1804 (delete 'configure)))) ; no configure script
1805 (home-page "https://kernel.ubuntu.com/~cking/powerstat/")
1806 (synopsis "Measure system power consumption")
1807 (description
1808 "Powerstat measures and reports your computer's power consumption in real
1809time. On mobile PCs, it uses ACPI battery information to measure the power
1810drain of the entire system.
1811
1812Powerstat can also report @acronym{RAPL, Running Average Power Limit} power
1813domain measurements. These are available only on some hardware such as Intel
1814Sandybridge and newer, and cover only part of the machine's components such as
1815CPU, DRAM, and graphics. However, they provide accurate and immediate readings
1816and don't require a battery at all.
1817
1818The output is like @command{vmstat} but also shows power consumption statistics:
1819at the end of a run, @command{powerstat} will calculate the average, standard
1820deviation, and minimum and maximum values. It can show a nice histogram too.")
1821 (license license:gpl2)))
1822
1823(define-public psmisc
1824 (package
1825 (name "psmisc")
1826 (version "23.5")
1827 (source
1828 (origin
1829 (method url-fetch)
1830 (uri (string-append "mirror://sourceforge/psmisc/psmisc/psmisc-"
1831 version ".tar.xz"))
1832 (sha256
1833 (base32 "12z5786dnf37n8wvv73wdcqp3nvsqzhwdk3ajna0mag4yz1fqdyw"))))
1834 (build-system gnu-build-system)
1835 (arguments
1836 `(,@(if (%current-target-system)
1837 '(#:configure-flags
1838 (list
1839 "ac_cv_func_malloc_0_nonnull=yes"
1840 "ac_cv_func_realloc_0_nonnull=yes"))
1841 '())))
1842 (inputs (list ncurses))
1843 (home-page "https://gitlab.com/psmisc/psmisc")
1844 (synopsis "Small utilities that use the proc file system")
1845 (description
1846 "This PSmisc package is a set of some small useful utilities that
1847use the proc file system. We're not about changing the world, but
1848providing the system administrator with some help in common tasks.")
1849 (license license:gpl2+)))
1850
1851(define-public util-linux
1852 (package
1853 (name "util-linux")
1854 (replacement util-linux/fixed)
1855 (version "2.37.2")
1856 (source (origin
1857 (method url-fetch)
1858 (uri (string-append "mirror://kernel.org/linux/utils/"
1859 "util-linux/v" (version-major+minor version) "/"
1860 "util-linux-" version ".tar.xz"))
1861 (sha256
1862 (base32
1863 "1ng9517c37mdp858425a4zyybma7dh7jrpd6z1z61yz7mb0n81va"))
1864 (patches (search-patches "util-linux-tests.patch"))
1865 (modules '((guix build utils)))
1866 (snippet
1867 ;; We take 'nologin' from Shadow, the 'logger' program from
1868 ;; GNU Inetutils and 'kill' from GNU Coreutils.
1869 '(begin
1870 (substitute* "configure"
1871 (("build_nologin=yes") "build_nologin=no")
1872 (("build_logger=yes") "build_logger=no")
1873 (("build_kill=yes") "build_kill=no"))
1874 #t))))
1875 (build-system gnu-build-system)
1876 (outputs '("out" ;6.4 MiB executables and documentation
1877 "lib" ;8.8 MiB shared libraries, headers and locales
1878 "static")) ;2.9 MiB static .a libraries
1879 (arguments
1880 `(#:configure-flags (list "--disable-use-tty-group"
1881 (string-append
1882 "--enable-fs-paths-default="
1883 "/run/setuid-programs"
1884 ":/run/current-system/profile/sbin")
1885 ;; Don't try to chown root:root mount and umount
1886 "--disable-makeinstall-chown"
1887 "--localstatedir=/var"
1888 (string-append "--localedir="
1889 (assoc-ref %outputs "lib")
1890 "/share/locale")
1891 ;; Install completions where our
1892 ;; bash-completion package expects them.
1893 (string-append "--with-bashcompletiondir="
1894 (assoc-ref %outputs "out")
1895 "/etc/bash_completion.d"))
1896
1897 ;; FIXME: For now we cannot reliably run tests on GNU/Hurd:
1898 ;; <https://bugs.gnu.org/47791>.
1899 #:tests? ,(and (not (%current-target-system))
1900 (not (string-suffix? "-gnu" (%current-system))))
1901
1902 #:phases (modify-phases %standard-phases
1903 (add-before 'configure 'patch-build-scripts
1904 (lambda* (#:key outputs #:allow-other-keys)
1905 (substitute* "configure"
1906 ;; The build system assumes that we want to install
1907 ;; libraries below $exec_prefix when $libdir does not
1908 ;; match any of the "usual" locations. Fix that.
1909 (("usrlib_execdir='\\$\\{exec_prefix\\}'\\$libdir")
1910 "usrlib_execdir=$libdir"))))
1911 (add-before 'build 'set-umount-file-name
1912 (lambda* (#:key outputs #:allow-other-keys)
1913 ;; Tell 'eject' the right file name of 'umount'.
1914 (let ((out (assoc-ref outputs "out")))
1915 (substitute* "sys-utils/eject.c"
1916 (("\"/bin/umount\"")
1917 (string-append "\"" out "/bin/umount\""))))))
1918 (add-before 'check 'pre-check
1919 (lambda* (#:key native-inputs inputs #:allow-other-keys)
1920 (let ((services (search-input-file (or native-inputs inputs)
1921 "etc/services")))
1922 ;; Change the test to refer to the right file.
1923 (substitute* "tests/ts/misc/mcookie"
1924 (("/etc/services")
1925 services))
1926
1927 ;; The C.UTF-8 locale does not exist in our libc.
1928 (substitute* "tests/ts/column/invalid-multibyte"
1929 (("C\\.UTF-8") "en_US.utf8")))))
1930 (add-before 'check 'disable-setarch-test
1931 (lambda _
1932 ;; The setarch tests are unreliable in QEMU's user-mode
1933 ;; emulation, which is our primary method of building
1934 ;; ARMv7 packages. See
1935 ;; <https://github.com/karelzak/util-linux/issues/601>.
1936 (substitute* "tests/ts/misc/setarch"
1937 (("ts_init_subtest.*" all)
1938 (string-append
1939 all "\n"
1940 "ts_skip \"setarch tests are unreliable under QEMU\"")))))
1941 (add-before 'check 'disable-lsns-test
1942 (lambda _
1943 ;; The lsns tests can fail due to ioctl(_, NS_GET_USERNS)
1944 ;; returning ENOTTY, indicating this kernel does not
1945 ;; support user namespaces. Curiously, this test can fail
1946 ;; on i686 even if the same test passes on x86_64 on the
1947 ;; same machine. See <https://issues.guix.gnu.org/49933>.
1948 (delete-file "tests/ts/lsns/ioctl_ns")))
1949 (add-after 'install 'move-static-libraries
1950 (lambda* (#:key outputs #:allow-other-keys)
1951 (let ((lib (assoc-ref outputs "lib"))
1952 (static (assoc-ref outputs "static")))
1953
1954 ;; Move static libraries to the "static" output.
1955 (mkdir-p (string-append static "/lib"))
1956 (with-directory-excursion lib
1957 (for-each (lambda (file)
1958 (rename-file file
1959 (string-append static "/"
1960 file)))
1961 (find-files "lib" "\\.a$"))
1962
1963 ;; Remove references to the static library from the '.la'
1964 ;; files so that Libtool does the right thing when both
1965 ;; the shared and static library is available.
1966 (substitute* (find-files "lib" "\\.la$")
1967 (("old_library=.*") "old_library=''\n"))))))
1968 (add-after 'install 'adjust-pkg-config-files
1969 (lambda* (#:key outputs #:allow-other-keys)
1970 (let ((lib (assoc-ref outputs "lib")))
1971 ;; Drop the unused "prefix=" and "exec_prefix=" variables from
1972 ;; the pkg-config files to avoid a cyclic reference on "out".
1973 (substitute* (find-files (string-append lib "/lib/pkgconfig")
1974 "\\.pc$")
1975 (("^(exec_)?prefix=.*") ""))))))))
1976 (inputs
1977 (list file ;for libmagic
1978 ncurses
1979 zlib))
1980 (native-inputs
1981 (list net-base ;for tests
1982 perl))
1983 (home-page "https://www.kernel.org/pub/linux/utils/util-linux/")
1984 (synopsis "Collection of utilities for the Linux kernel")
1985 (description "Util-linux is a diverse collection of Linux kernel
1986utilities. It provides dmesg and includes tools for working with file systems,
1987block devices, UUIDs, TTYs, and many other tools.")
1988
1989 (properties '((upstream-name . "util-linux")))
1990 ;; Note that util-linux doesn't use the same license for all the
1991 ;; code. GPLv2+ is the default license for a code without an
1992 ;; explicitly defined license.
1993 (license (list license:gpl3+ license:gpl2+ license:gpl2 license:lgpl2.0+
1994 license:bsd-4 license:public-domain))))
1995
1996;; util-linux optionally supports udev, which allows lsblk to read file system
1997;; metadata without special privileges. Add it as a separate package to avoid
1998;; a circular dependency, and to keep the size small.
1999(define-public util-linux+udev
2000 (package/inherit
2001 util-linux
2002 (name "util-linux-with-udev")
2003 (inputs
2004 (modify-inputs (package-inputs util-linux)
2005 (prepend eudev)))))
2006
2007;; This is mostly equivalent to the upstream release version v2.37.3, except
2008;; that the upstream tarball was generated improperly, which breaks the build.
2009;; There will not be a v2.37.3-fixed release or anything like that to fix it:
2010;; https://github.com/util-linux/util-linux/issues/1577
2011(define-public util-linux/fixed
2012 (hidden-package
2013 (package
2014 (inherit util-linux)
2015 (source (origin
2016 (inherit (package-source util-linux))
2017 (patches (append (search-patches "util-linux-CVE-2021-3995.patch"
2018 "util-linux-CVE-2021-3996.patch")
2019 (origin-patches (package-source util-linux)))))))))
2020
2021
2022(define-public ddate
2023 (package
2024 (name "ddate")
2025 (version "0.2.2")
2026 (source (origin
2027 (method git-fetch)
2028 (uri (git-reference
2029 (url "https://github.com/bo0ts/ddate")
2030 (commit (string-append "v" version))))
2031 (file-name (git-file-name name version))
2032 (sha256
2033 (base32 "1qchxnxvghbma6gp1g78wnjxsri0b72ha9axyk31cplssl7yn73f"))))
2034 (build-system cmake-build-system)
2035 (arguments '(#:tests? #f))
2036 (home-page "https://github.com/bo0ts/ddate")
2037 (synopsis "PERPETUAL DATE CONVERTER FROM GREGORIAN TO POEE CALENDAR")
2038 (description
2039 "ddate displays the Discordian date and holidays of a given date.
2040The Discordian calendar was made popular by the \"Illuminatus!\" trilogy
2041by Robert Shea and Robert Anton Wilson.")
2042 (license license:public-domain)))
2043
2044(define-public fbset
2045 (package
2046 (name "fbset")
2047 (version "2.1")
2048 (source
2049 (origin
2050 (method url-fetch)
2051 (uri (string-append "http://users.telenet.be/geertu/Linux/fbdev/fbset-"
2052 version ".tar.gz"))
2053 (sha256
2054 (base32 "080wnisi0jq7dp0jcwdp83rq8q8s3kw41vc712516xbv4jq4mzs0"))))
2055 (build-system gnu-build-system)
2056 (arguments
2057 '(#:modules ((guix build gnu-build-system)
2058 (guix build utils)
2059 (srfi srfi-26))
2060 #:phases
2061 (modify-phases %standard-phases
2062 (delete 'configure) ; no configure script
2063 (add-before 'install 'pre-install
2064 (lambda* (#:key outputs #:allow-other-keys)
2065 (let ((out (assoc-ref outputs "out")))
2066 (substitute* "Makefile"
2067 (("mknod ") "true ")
2068 ;; The Makefile doesn't honour PREFIX or similar.
2069 (("/usr") out))
2070 (mkdir out)
2071 (with-directory-excursion out
2072 (for-each mkdir-p (list "sbin"
2073 "man/man5"
2074 "man/man8")))
2075 #t)))
2076 (add-after 'install 'install-fb.modes
2077 (lambda* (#:key outputs #:allow-other-keys)
2078 (let* ((out (assoc-ref outputs "out"))
2079 (etc (string-append out "/etc")))
2080 (for-each (cut install-file <> etc)
2081 (find-files "etc" "^fb\\.modes"))
2082 (symlink "fb.modes.ATI"
2083 (string-append etc "/fb.modes"))
2084 #t))))
2085 ;; Parallel building races to create modes.tab.c.
2086 #:parallel-build? #f
2087 #:tests? #f)) ; no test suite
2088 (native-inputs
2089 (list bison flex))
2090 (home-page "http://users.telenet.be/geertu/Linux/fbdev/")
2091 (synopsis "Show and modify Linux frame buffer settings")
2092 (description
2093 "The kernel Linux's @dfn{frame buffers} provide a simple interface to
2094different kinds of graphic displays. The @command{fbset} utility can query and
2095change various device settings such as depth, virtual resolution, and timing
2096parameters.")
2097 (license license:gpl2)))
2098
2099(define-public procps
2100 (package
2101 (name "procps")
2102 (version "3.3.16")
2103 (source (origin
2104 (method url-fetch)
2105 (uri (string-append "mirror://sourceforge/procps-ng/Production/"
2106 "procps-ng-" version ".tar.xz"))
2107 (sha256
2108 (base32
2109 "1br0g93ysqhlv13i1k4lfbimsgxnpy5rgs4lxfc9rkzdbpbaqplj"))))
2110 (build-system gnu-build-system)
2111 (arguments
2112 `(#:modules ((guix build utils)
2113 (guix build gnu-build-system)
2114 (srfi srfi-1)
2115 (srfi srfi-26))
2116 ,@(if (%current-target-system)
2117 '(#:configure-flags
2118 (list
2119 "ac_cv_func_malloc_0_nonnull=yes"
2120 "ac_cv_func_realloc_0_nonnull=yes"))
2121 '())
2122 #:phases
2123 (modify-phases %standard-phases
2124 (add-after
2125 'install 'post-install
2126 ;; Remove commands and man pages redudant with
2127 ;; Coreutils.
2128 (lambda* (#:key outputs #:allow-other-keys)
2129 (let* ((out (assoc-ref outputs "out"))
2130 (dup (append-map (cut find-files out <>)
2131 '("^kill" "^uptime"))))
2132 (for-each delete-file dup)
2133 #t))))))
2134 (inputs (list ncurses))
2135 (home-page "https://gitlab.com/procps-ng/procps/")
2136 (synopsis "Utilities that give information about processes")
2137 (description
2138 "Procps is the package that has a bunch of small useful utilities
2139that give information about processes using the Linux /proc file system.
2140The package includes the programs free, pgrep, pidof, pkill, pmap, ps, pwdx,
2141slabtop, tload, top, vmstat, w, watch and sysctl.")
2142 (properties '((upstream-name . "procps-ng")))
2143 (license license:gpl2)))
2144
2145(define-public usbutils
2146 (package
2147 (name "usbutils")
2148 (version "014")
2149 (source
2150 (origin
2151 (method url-fetch)
2152 (uri (string-append "mirror://kernel.org/linux/utils/usb/usbutils/"
2153 "usbutils-" version ".tar.xz"))
2154 (sha256
2155 (base32 "0sgwfvr1b5w3ai1c0rmvzhk67y9vh7bq490rcxxj4q05svx9q1rs"))))
2156 (build-system gnu-build-system)
2157 (outputs (list "out" "python"))
2158 (arguments
2159 `(#:phases
2160 (modify-phases %standard-phases
2161 (add-before 'bootstrap 'patch-bootstrap-scripts
2162 (lambda _
2163 (substitute* "usbhid-dump/bootstrap"
2164 (("/bin/sh") (which "sh")))))
2165 (add-after 'install 'separate-python-output
2166 ;; Separating one Python script shaves more than 106 MiB from :out.
2167 (lambda* (#:key outputs #:allow-other-keys)
2168 (let ((out (assoc-ref outputs "out"))
2169 (out:python (assoc-ref outputs "python")))
2170 (for-each (lambda (file)
2171 (let ((old (string-append out "/" file))
2172 (new (string-append out:python "/" file)))
2173 (mkdir-p (dirname new))
2174 (rename-file old new)))
2175 (list "bin/lsusb.py"))))))))
2176 (inputs
2177 (list eudev libusb python))
2178 (native-inputs
2179 (list autoconf automake libtool pkg-config))
2180 (home-page "http://www.linux-usb.org/")
2181 (synopsis
2182 "Tools for working with USB devices, such as lsusb")
2183 (description
2184 "Tools for working with USB devices, such as lsusb.")
2185 (license license:gpl2+)))
2186
2187(define-public usbip-utils
2188 (package
2189 (name "usbip-utils")
2190 (version (package-version linux-libre))
2191 (source (package-source linux-libre))
2192 (build-system gnu-build-system)
2193 (arguments
2194 '(#:configure-flags '("--disable-static")
2195 #:phases (modify-phases %standard-phases
2196 (add-after 'unpack 'enter-subdirectory
2197 (lambda _
2198 (chdir "tools/usb/usbip")
2199 #t)))))
2200 (native-inputs
2201 `(("automake" ,automake)
2202 ("autoreconf" ,autoconf)
2203 ("libtool" ,libtool)))
2204 (inputs (list eudev))
2205 (home-page (package-home-page linux-libre))
2206 (synopsis "Utilities for sharing USB devices over IP networks")
2207 (description
2208 "The USB/IP protocol enables to pass USB device from a server to
2209a client over the network. The server is a machine which shares an
2210USB device and the client is a machine which uses USB device provided by
2211a server over the network. The USB device may be either physical device
2212connected to a server or software entity created on a server using USB
2213gadget subsystem. The usbip-utils are userspace tools to used to handle
2214connection and management on both side. The client needs the @file{vhci-hcd}
2215Linux kernel module and the server needs the @file{usbip_host} Linux kernel
2216module.")
2217 (license license:gpl2)))
2218
2219(define-public e2fsprogs
2220 (package
2221 (name "e2fsprogs")
2222 (version "1.46.4")
2223 (source (origin
2224 (method url-fetch)
2225 (uri (string-append
2226 "mirror://kernel.org/linux/kernel/people/tytso/"
2227 "e2fsprogs/v" version "/"
2228 "e2fsprogs-" version ".tar.xz"))
2229 (sha256
2230 (base32
2231 "04wp77fg842dhribgn0xvbd77idh0n7a839ga4bwy78v7i9l445i"))))
2232 (build-system gnu-build-system)
2233 (inputs (list `(,util-linux "lib")))
2234 (native-inputs (list pkg-config
2235 texinfo ;for the libext2fs Info manual
2236 ;; For tests.
2237 perl
2238 procps))
2239 (arguments
2240 '(;; util-linux is the preferred source for some of the libraries and
2241 ;; commands, so disable them (see, e.g.,
2242 ;; <http://git.buildroot.net/buildroot/commit/?id=e1ffc2f791b33633>.)
2243 #:configure-flags (list "--disable-libblkid"
2244 "--disable-libuuid" "--disable-uuidd"
2245 "--disable-fsck"
2246
2247 ;; Use symlinks instead of hard links for
2248 ;; 'fsck.extN' etc. This makes the resulting nar
2249 ;; smaller and is preserved across copies.
2250 "--enable-symlink-install"
2251
2252 (string-append "LDFLAGS=-Wl,-rpath="
2253 (assoc-ref %outputs "out")
2254 "/lib")
2255
2256 ;; Install libext2fs et al.
2257 "--enable-elf-shlibs")
2258
2259 #:phases
2260 (modify-phases %standard-phases
2261 (add-before 'configure 'patch-shells
2262 (lambda _
2263 (substitute* "configure"
2264 (("/bin/sh (.*)parse-types.sh" _ dir)
2265 (string-append (which "sh") " " dir
2266 "parse-types.sh")))
2267 (substitute* "MCONFIG.in"
2268 (("INSTALL_SYMLINK = /bin/sh")
2269 "INSTALL_SYMLINK = sh"))
2270 (substitute* (find-files "." "^Makefile.in$")
2271 (("#!/bin/sh")
2272 (string-append "#!" (which "sh"))))))
2273 (add-after 'install 'install-libs
2274 (lambda* (#:key outputs #:allow-other-keys)
2275 (let* ((out (assoc-ref outputs "out"))
2276 (lib (string-append out "/lib")))
2277 (invoke "make" "install-libs")
2278
2279 ;; Make the .a writable so that 'strip' works.
2280 ;; Failing to do that, due to debug symbols, we
2281 ;; retain a reference to the final
2282 ;; linux-libre-headers, which refer to the
2283 ;; bootstrap binaries.
2284 (let ((archives (find-files lib "\\.a$")))
2285 (for-each (lambda (file)
2286 (chmod file #o666))
2287 archives))))))))
2288 (home-page "http://e2fsprogs.sourceforge.net/")
2289 (synopsis "Creating and checking ext2/ext3/ext4 file systems")
2290 (description
2291 "This package provides tools for manipulating ext2/ext3/ext4 file systems.")
2292 (license (list license:gpl2 ;programs
2293 license:lgpl2.0 ;libext2fs
2294 license:x11)))) ;libuuid
2295
2296(define e2fsprogs/static
2297 (static-package
2298 (package (inherit e2fsprogs)
2299 (arguments
2300 ;; Do not build shared libraries.
2301 (substitute-keyword-arguments (package-arguments e2fsprogs)
2302 ((#:configure-flags _)
2303 '(list "--disable-blkid"))
2304 ((#:make-flags _)
2305 '(list)))))))
2306
2307(define-public e2fsck/static
2308 (package
2309 (name "e2fsck-static")
2310 (version (package-version e2fsprogs))
2311 (build-system trivial-build-system)
2312 (source #f)
2313 (inputs
2314 (list e2fsprogs/static))
2315 (arguments
2316 `(#:modules ((guix build utils))
2317 #:builder
2318 (begin
2319 (use-modules (guix build utils)
2320 (ice-9 ftw)
2321 (srfi srfi-26))
2322
2323 (let ((e2fsck (search-input-file %build-inputs "/sbin/e2fsck"))
2324 (bin (string-append (assoc-ref %outputs "out") "/sbin")))
2325 (mkdir-p bin)
2326 (with-directory-excursion bin
2327 (copy-file e2fsck "e2fsck")
2328 (remove-store-references "e2fsck")
2329 (chmod "e2fsck" #o555))
2330 #t))))
2331 (home-page (package-home-page e2fsprogs))
2332 (synopsis "Statically-linked e2fsck command from e2fsprogs")
2333 (description "This package provides statically-linked e2fsck command taken
2334from the e2fsprogs package. It is meant to be used in initrds.")
2335 (license (package-license e2fsprogs))))
2336
2337(define-public extundelete
2338 (package
2339 (name "extundelete")
2340 (version "0.2.4")
2341 (source
2342 (origin
2343 (method url-fetch)
2344 (uri (string-append "mirror://sourceforge/extundelete/"
2345 "extundelete/" version "/extundelete-"
2346 version ".tar.bz2"))
2347 (sha256
2348 (base32
2349 "1x0r7ylxlp9lbj3d7sqf6j2a222dwy2nfpff05jd6mkh4ihxvyd1"))
2350 (patches (search-patches "extundelete-e2fsprogs-1.44.patch"))))
2351 (build-system gnu-build-system)
2352 (inputs (list e2fsprogs))
2353 (home-page "http://extundelete.sourceforge.net/")
2354 (synopsis "Recover deleted files from ext2/3/4 partitions")
2355 (description
2356 "Extundelete is a set of tools that can recover deleted files from an
2357ext3 or ext4 partition.")
2358 (license license:gpl2)))
2359
2360(define-public zerofree
2361 (package
2362 (name "zerofree")
2363 (version "1.1.1")
2364 (home-page "https://frippery.org/uml/")
2365 (source (origin
2366 (method url-fetch)
2367 (uri (string-append home-page name "-" version
2368 ".tgz"))
2369 (sha256
2370 (base32
2371 "0rrqfa5z103ws89vi8kfvbks1cfs74ix6n1wb6vs582vnmhwhswm"))))
2372 (build-system gnu-build-system)
2373 (arguments
2374 '(#:phases
2375 (modify-phases %standard-phases
2376 (delete 'configure) ; no configure script
2377 (replace 'install
2378 ;; The Makefile lacks an ‘install’ target.
2379 (lambda* (#:key outputs #:allow-other-keys)
2380 (let* ((out (assoc-ref outputs "out"))
2381 (bin (string-append out "/bin")))
2382 (chmod "zerofree" #o555)
2383 (install-file "zerofree" bin)
2384 #t))))
2385 #:tests? #f)) ; no tests
2386 (inputs `(("libext2fs" ,e2fsprogs)))
2387 (synopsis "Zero non-allocated regions in ext2/ext3/ext4 file systems")
2388 (description
2389 "Zerofree finds the unallocated blocks with non-zero value content in an
2390ext2, ext3, or ext4 file system and fills them with zeroes (or another value).
2391This is a simple way to make disk images more compressible.
2392Zerofree requires the file system to be unmounted or mounted read-only.")
2393 (license license:gpl2)))
2394
2395(define-public strace
2396 (package
2397 (name "strace")
2398 (version "5.18")
2399 (home-page "https://strace.io")
2400 (source (origin
2401 (method url-fetch)
2402 (uri (string-append home-page "/files/" version
2403 "/strace-" version ".tar.xz"))
2404 (sha256
2405 (base32
2406 "11qi7pdm0ldycsg9qhsa50icm219mmvy16yw1ih3s9f9kakkwab0"))
2407 (patches (search-patches "strace-readlink-tests.patch"))))
2408 (build-system gnu-build-system)
2409 (arguments
2410 '(#:phases
2411 (modify-phases %standard-phases
2412 (add-after 'unpack 'patch-/bin/sh
2413 (lambda _
2414 (substitute* "src/strace.c"
2415 (("/bin/sh") (which "sh")))))
2416 (add-after 'unpack 'disable-failing-tests
2417 (lambda _
2418 (substitute* "tests/Makefile.in"
2419 ;; XXX: These hang forever even if the test time-out is
2420 ;; extended.
2421 (("^\tstrace-DD?D?\\.test \\\\.*") "")
2422 (("^\tpidns-cache.test \\\\.*") "")
2423 (("^\t.*--pidns-translation.test \\\\.*") "")
2424 ;; This one fails with an encoding error.
2425 (("^\t.*net-yy-unix.test \\\\.*") "")))))
2426 ;; Don't fail if the architecture doesn't support different
2427 ;; personalities.
2428 #:configure-flags '("--enable-mpers=check")
2429 ;; See <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=32459>.
2430 #:parallel-tests? #f)) ; undeterministic failures
2431 (native-inputs (list perl))
2432 (synopsis "System call tracer for Linux")
2433 (description
2434 "strace is a system call tracer, i.e. a debugging tool which prints out a
2435trace of all the system calls made by a another process/program.")
2436 (properties
2437 '((release-monitoring-url . "https://github.com/strace/strace/releases")))
2438 (license license:lgpl2.1+)))
2439
2440(define-public ltrace
2441 (package
2442 (name "ltrace")
2443 (version "0.7.3")
2444 (source (origin
2445 (method url-fetch)
2446 (uri (string-append "http://www.ltrace.org/ltrace_" version
2447 ".orig.tar.bz2"))
2448 (sha256
2449 (base32
2450 "00wmbdghqbz6x95m1mcdd3wd46l6hgcr4wggdp049dbifh3qqvqf"))))
2451 (build-system gnu-build-system)
2452 (inputs `(("libelf" ,elfutils)))
2453 (arguments
2454 ;; Compilation uses -Werror by default, but it fails.
2455 '(#:configure-flags '("--disable-werror")))
2456 (home-page "https://www.ltrace.org/")
2457 (synopsis "Library call tracer for Linux")
2458 (description
2459 "ltrace intercepts and records dynamic library calls which are called by
2460an executed process and the signals received by that process. It can also
2461intercept and print the system calls executed by the program.")
2462 (license license:gpl2+)))
2463
2464(define-public alsa-ucm-conf
2465 (package
2466 (name "alsa-ucm-conf")
2467 (version "1.2.4")
2468 (source (origin
2469 (method url-fetch)
2470 (uri (string-append
2471 "ftp://ftp.alsa-project.org/pub/lib/" name "-"
2472 version ".tar.bz2"))
2473 (sha256
2474 (base32
2475 "0h6kzi1cfdqyxp4pwpqh5wb89c8s9wrgix315bvamffwfxf56frc"))))
2476 (build-system copy-build-system)
2477 (arguments
2478 '(#:install-plan
2479 '(("ucm" "share/alsa/ucm")
2480 ("ucm2" "share/alsa/ucm2"))))
2481 (home-page "https://www.alsa-project.org/wiki/Main_Page")
2482 (synopsis "The Advanced Linux Sound Architecture Use Case Manager")
2483 (description
2484 "This package contains Advanced Linux Sound Architecture Use Case Manager
2485configuration of audio input/output names and routing for specific audio
2486hardware.")
2487 (license license:bsd-3)))
2488
2489(define-public alsa-topology-conf
2490 (package
2491 (name "alsa-topology-conf")
2492 (version "1.2.4")
2493 (source (origin
2494 (method url-fetch)
2495 (uri (string-append
2496 "ftp://ftp.alsa-project.org/pub/lib/" name "-"
2497 version ".tar.bz2"))
2498 (sha256
2499 (base32
2500 "01zdg6q4s6d01k39z96wi4vbhrfw1i2g4yi5dijwfk6a5vjfdq2m"))))
2501 (build-system copy-build-system)
2502 (arguments
2503 '(#:install-plan
2504 '(("topology" "share/alsa/topology"))))
2505 (home-page "https://www.alsa-project.org/wiki/Main_Page")
2506 (synopsis "The Advanced Linux Sound Architecture libraries")
2507 (description
2508 "This package contains Advanced Linux Sound Architecture topology
2509configuration files that can be used for specific audio hardware.")
2510 (license license:bsd-3)))
2511
2512(define-public alsa-lib
2513 (package
2514 (name "alsa-lib")
2515 (version "1.2.4")
2516 (source (origin
2517 (method url-fetch)
2518 (uri (string-append
2519 "ftp://ftp.alsa-project.org/pub/lib/alsa-lib-"
2520 version ".tar.bz2"))
2521 (sha256
2522 (base32
2523 "1xq8d48wfy59qw4x7383j32n8j5njndw5hcgnmlg9pvclphlnmgp"))))
2524 (build-system gnu-build-system)
2525 (arguments
2526 '(#:configure-flags (list (string-append "LDFLAGS=-Wl,-rpath="
2527 (assoc-ref %outputs "out")
2528 "/lib"))
2529 #:phases
2530 (modify-phases %standard-phases
2531 (add-before 'install 'pre-install
2532 (lambda* (#:key inputs outputs #:allow-other-keys)
2533 (let* ((ucm
2534 (string-append (assoc-ref inputs "alsa-ucm-conf")))
2535 (topology
2536 (string-append (assoc-ref inputs "alsa-topology-conf")))
2537 (alsa
2538 (string-append (assoc-ref outputs "out") "/share/alsa"))
2539 (ucm-share
2540 (string-append ucm "/share/alsa/ucm"))
2541 (ucm2-share
2542 (string-append ucm "/share/alsa/ucm2"))
2543 (topology-share
2544 (string-append topology "/share/alsa/topology")))
2545 (mkdir-p alsa)
2546 (symlink ucm-share (string-append alsa "/ucm"))
2547 (symlink ucm2-share (string-append alsa "/ucm2"))
2548 (symlink topology-share (string-append alsa "/topology")))
2549 #t)))))
2550 (inputs
2551 (list alsa-ucm-conf alsa-topology-conf))
2552 (home-page "https://www.alsa-project.org/wiki/Main_Page")
2553 (synopsis "The Advanced Linux Sound Architecture libraries")
2554 (description
2555 "The Advanced Linux Sound Architecture (ALSA) provides audio and
2556MIDI functionality to the Linux-based operating system.")
2557 (license license:lgpl2.1+)))
2558
2559(define-public alsa-utils
2560 (package
2561 (name "alsa-utils")
2562 (version "1.2.4")
2563 (source (origin
2564 (method url-fetch)
2565 (uri (string-append "ftp://ftp.alsa-project.org/pub/utils/"
2566 name "-" version ".tar.bz2"))
2567 (sha256
2568 (base32
2569 "09m4dnn4kplawprd2bl15nwa0b4r1brab3x44ga7f1fyk7aw5zwq"))))
2570 (build-system gnu-build-system)
2571 (arguments
2572 ;; XXX: Disable man page creation until we have DocBook.
2573 '(#:configure-flags (list "--disable-xmlto"
2574
2575 ;; The udev rule is responsible for restoring
2576 ;; the volume.
2577 (string-append "--with-udev-rules-dir="
2578 (assoc-ref %outputs "out")
2579 "/lib/udev/rules.d"))
2580 #:phases
2581 (modify-phases %standard-phases
2582 (add-before 'check 'disable-broken-test
2583 (lambda _
2584 ;; XXX: The 1.1.8 release tarball is missing a header that's
2585 ;; required for this test to work. Fixed in 1.1.9.
2586 (substitute* "axfer/test/Makefile"
2587 ((".*container-test.*") ""))
2588 #t))
2589 (add-before
2590 'install 'pre-install
2591 (lambda _
2592 ;; Don't try to mkdir /var/lib/alsa.
2593 (substitute* "Makefile"
2594 (("\\$\\(MKDIR_P\\) .*ASOUND_STATE_DIR.*")
2595 "true\n"))
2596 #t)))))
2597 (native-inputs
2598 `(("gettext" ,gettext-minimal)))
2599 (inputs
2600 (list libsamplerate ncurses alsa-lib xmlto))
2601 (home-page "http://www.alsa-project.org/")
2602 (synopsis "Utilities for the Advanced Linux Sound Architecture (ALSA)")
2603 (description
2604 "The Advanced Linux Sound Architecture (ALSA) provides audio and
2605MIDI functionality to the Linux-based operating system.")
2606
2607 ;; This is mostly GPLv2+ but a few files such as 'alsactl.c' are
2608 ;; GPLv2-only.
2609 (license license:gpl2)))
2610
2611(define-public alsa-plugins
2612 (package
2613 (name "alsa-plugins")
2614 (version "1.2.2")
2615 (source (origin
2616 (method url-fetch)
2617 (uri (string-append "ftp://ftp.alsa-project.org/pub/plugins/"
2618 name "-" version ".tar.bz2"))
2619 (sha256
2620 (base32
2621 "0z9k3ssbfk2ky2w13avgyf202j1drsz9sv3834bp33cj1i2hc3qw"))))
2622 (build-system gnu-build-system)
2623 ;; TODO: Split libavcodec and speex if possible. It looks like they can not
2624 ;; be split, there are references to both in files.
2625 ;; TODO: Remove OSS related plugins, they add support to run native
2626 ;; ALSA applications on OSS however we do not offer OSS and OSS is
2627 ;; obsolete.
2628 (outputs '("out" "pulseaudio" "jack"))
2629 (native-search-paths
2630 (list (search-path-specification
2631 (variable "ALSA_PLUGIN_DIR")
2632 (files '("lib/alsa-lib"))
2633 (separator #f))))
2634 (arguments
2635 `(#:configure-flags '(;; Do not install a "local" configuration targeted
2636 ;; for /etc/alsa. On Guix System plugins are loaded from
2637 ;; the ALSA service, and other distributions likely
2638 ;; won't use these files.
2639 "--with-alsalconfdir=/tmp/noop")
2640 #:phases
2641 (modify-phases %standard-phases
2642 (add-after 'install 'split
2643 (lambda* (#:key inputs outputs #:allow-other-keys)
2644 ;; Distribute the binaries to the various outputs.
2645 (let* ((out (assoc-ref outputs "out"))
2646 (jack (assoc-ref outputs "jack"))
2647 (jacklib (string-append jack "/lib/alsa-lib"))
2648 (pua (assoc-ref outputs "pulseaudio"))
2649 (pualib (string-append pua "/lib/alsa-lib")))
2650 ;; For jack.
2651 (mkdir-p jacklib)
2652 (for-each (lambda (file)
2653 (rename-file file (string-append jacklib "/" (basename file))))
2654 (find-files out ".*jack\\.(la|so)"))
2655 ;; For pulseaudio.
2656 (mkdir-p pualib)
2657 (for-each (lambda (file)
2658 (rename-file file (string-append pualib "/" (basename file))))
2659 (find-files out ".*pulse\\.(la|so)"))
2660 #t))))))
2661 (inputs
2662 (list alsa-lib
2663 jack-1
2664 speex ; libspeexdsp resampling plugin
2665 libsamplerate ; libsamplerate resampling plugin
2666 ffmpeg ; libavcodec resampling plugin, a52 plugin
2667 pulseaudio)) ; PulseAudio plugin
2668 (native-inputs
2669 (list pkg-config))
2670 (home-page "http://www.alsa-project.org/")
2671 (synopsis "Plugins for the Advanced Linux Sound Architecture (ALSA)")
2672 (description
2673 "The Advanced Linux Sound Architecture (ALSA) provides audio and
2674MIDI functionality to the Linux-based operating system. This package enhances ALSA
2675by providing additional plugins which include: upmixing, downmixing, jackd and
2676pulseaudio support for native alsa applications, format conversion (s16 to a52), and
2677external rate conversion.")
2678 (license (list license:gpl2+
2679 ;; `rate/rate_samplerate.c': LGPL v2.1 or later.
2680 license:lgpl2.1+))))
2681
2682(define-public iptables
2683 (package
2684 (name "iptables")
2685 (version "1.8.7")
2686 (source
2687 (origin
2688 (method url-fetch)
2689 (uri (list (string-append "mirror://netfilter.org/iptables/iptables-"
2690 version ".tar.bz2")
2691 (string-append "https://www.netfilter.org/projects/iptables/"
2692 "files/iptables-" version ".tar.bz2")))
2693 (sha256
2694 (base32 "1w6qx3sxzkv80shk21f63rq41c84irpx68k62m2cv629n1mwj2f1"))))
2695 (build-system gnu-build-system)
2696 (native-inputs
2697 (list pkg-config flex bison))
2698 (inputs
2699 (list libmnl libnftnl/fixed))
2700 (arguments
2701 (list #:tests? #f ; no test suite
2702 #:configure-flags ; add $libdir to the RUNPATH of executables
2703 ;; XXX TODO: Replace with simply #$OUTPUT on core-updates.
2704 #~(list (string-append "LDFLAGS=-Wl,-rpath="
2705 #$(if (%current-target-system)
2706 #~#$output
2707 #~%output) "/lib"))))
2708 (home-page "https://www.netfilter.org/projects/iptables/index.html")
2709 (synopsis "Programs to configure Linux IP packet filtering rules")
2710 (description
2711 "@command{iptables} is the user-space command line program used to
2712configure the Linux 2.4.x and later IPv4 packet filtering ruleset
2713(@dfn{firewall}), including @dfn{NAT} (Network Address Translation).
2714
2715This package also includes @command{ip6tables}, which is used to configure the
2716IPv6 packet filter.
2717
2718Both commands are targeted at system administrators.")
2719 (license license:gpl2+)))
2720
2721(define-public jitterentropy-rngd
2722 (package
2723 (name "jitterentropy-rngd")
2724 (version "1.2.8")
2725 (source
2726 (origin
2727 (method git-fetch)
2728 (uri (git-reference
2729 (url "https://github.com/smuellerDD/jitterentropy-rngd")
2730 (commit (string-append "v" version))))
2731 (file-name (git-file-name name version))
2732 (sha256
2733 (base32 "13br8s6gqnfc844ps38ya5nny3pndsmskszv3dsp1cxcgvmscg1c"))))
2734 (build-system gnu-build-system)
2735 (arguments
2736 (list
2737 #:tests? #f ; no test suite
2738 #:make-flags
2739 #~(list (string-append "CC=" #$(cc-for-target))
2740 (string-append "PREFIX=" #$output)
2741 "UNITDIR=$(PREFIX)/lib/systemd/system")
2742 #:phases
2743 #~(modify-phases %standard-phases
2744 (delete 'configure)))) ; no ./configure script
2745 (home-page "https://www.chronox.de/jent.html")
2746 (synopsis "CPU jitter random number generator daemon")
2747 (description
2748 "This simple daemon feeds entropy from the CPU Jitter @acronym{RNG, random
2749number generator} core to the kernel Linux's entropy estimator. This prevents
2750the @file{/dev/random} device from blocking and should benefit users of the
2751preferred @file{/dev/urandom} and @code{getrandom()} interfaces too.
2752
2753The CPU Jitter RNG itself is part of the kernel and claims to provide good
2754entropy by collecting and magnifying differences in CPU execution time as
2755measured by the high-resolution timer built into modern CPUs. It requires no
2756additional hardware or external entropy source.
2757
2758The random bit stream generated by @command{jitterentropy-rngd} is not processed
2759by a cryptographically secure whitening function. Nonetheless, its authors
2760believe it to be a suitable source of cryptographically secure key material or
2761other cryptographically sensitive data.
2762
2763If you agree with them, start this daemon as early as possible to provide
2764properly seeded random numbers to services like SSH or those using TLS during
2765early boot when entropy may be low, especially in virtualised environments.")
2766 (license (list license:bsd-3 ; or
2767 license:gpl2+))))
2768
2769(define-public lsscsi
2770 (package
2771 (name "lsscsi")
2772 (version "0.32")
2773 (source (origin
2774 (method url-fetch)
2775 (uri (string-append
2776 "http://sg.danny.cz/scsi/lsscsi-" version ".tar.xz"))
2777 (sha256
2778 (base32
2779 "0jp458m2b3wckr18qkln69i01152qlwz33zm49103lq8fgx0n6d4"))))
2780 (build-system gnu-build-system)
2781 (synopsis "Lists information about SCSI or NVMe devices in Linux")
2782 (home-page "http://sg.danny.cz/scsi/lsscsi.html")
2783 (description
2784 "@command{lsscsi} lists SCSI logical units or SCSI targets. It can
2785also list NVMe namespaces or controllers and show the relationship between a
2786device's primary node name, its SCSI generic (sg) node name and its kernel
2787name.")
2788 (license license:gpl2)))
2789
2790(define-public ebtables
2791 (package
2792 (name "ebtables")
2793 (version "2.0.11")
2794 (source (origin
2795 (method url-fetch)
2796 (uri (string-append
2797 "mirror://netfilter.org/ebtables/ebtables-"
2798 version ".tar.gz"))
2799 (sha256
2800 (base32
2801 "0apxgmkhsk3vxn9q3libxn3dgrdljrxyy4mli2gk49m7hi3na7xp"))))
2802 (build-system gnu-build-system)
2803 (inputs
2804 (list perl iptables))
2805 (synopsis "Ethernet bridge frame table administration")
2806 (home-page "https://ebtables.netfilter.org/")
2807 (description
2808 "ebtables is an application program used to set up and maintain the
2809tables of rules (inside the Linux kernel) that inspect Ethernet frames. It is
2810analogous to the iptables application, but less complicated, due to the fact
2811that the Ethernet protocol is much simpler than the IP protocol.")
2812 (license license:gpl2+)))
2813
2814(define-public iproute
2815 (package
2816 (name "iproute2")
2817 (version "5.15.0")
2818 (source (origin
2819 (method url-fetch)
2820 (uri (string-append
2821 "mirror://kernel.org/linux/utils/net/iproute2/iproute2-"
2822 version ".tar.xz"))
2823 (sha256
2824 (base32
2825 "1zwin8sjnnwf2a9rjwzb3q8lkhcpy06s29sh05f5gxd7z6jy9qrq"))))
2826 (build-system gnu-build-system)
2827 (arguments
2828 `( ;; There is a test suite, but it wants network namespaces and sudo.
2829 #:tests? #f
2830 #:make-flags (let ((out (assoc-ref %outputs "out")))
2831 (list "DESTDIR="
2832 (string-append "CC=" ,(cc-for-target))
2833 "HOSTCC=gcc"
2834 (string-append "BASH_COMPDIR=" out
2835 "/etc/bash_completion.d")
2836 (string-append "LIBDIR=" out "/lib")
2837 (string-append "HDRDIR=" out "/include")
2838 (string-append "SBINDIR=" out "/sbin")
2839 (string-append "CONFDIR=" out "/etc")
2840 (string-append "DOCDIR=" out "/share/doc/"
2841 ,name "-" ,version)
2842 (string-append "MANDIR=" out "/share/man")))
2843 #:phases (modify-phases %standard-phases
2844 (add-before 'install 'pre-install
2845 (lambda _
2846 ;; Don't attempt to create /var/lib/arpd.
2847 (substitute* "Makefile"
2848 (("^.*ARPDDIR.*$") ""))
2849 #t))
2850 (add-after 'unpack 'patch-configure
2851 (lambda _
2852 (let ((target ,(%current-target-system)))
2853 (substitute* "configure"
2854 (("pkg-config")
2855 (if target
2856 (string-append target "-pkg-config")
2857 "pkg-config")))
2858 #t))))))
2859 (inputs
2860 `(("db4" ,bdb)
2861 ("iptables" ,iptables)
2862 ("libmnl" ,libmnl)))
2863 (native-inputs
2864 (list bison flex pkg-config))
2865 ;; For tests.
2866 ;; ("libmnl" ,libmnl)
2867 ;; ("util-linux" ,util-linux)
2868 (home-page
2869 "https://wiki.linuxfoundation.org/networking/iproute2")
2870 (synopsis
2871 "Utilities for controlling TCP/IP networking and traffic in Linux")
2872 (description
2873 "Iproute2 is a collection of utilities for controlling TCP/IP networking
2874and traffic with the Linux kernel. The most important of these are
2875@command{ip}, which configures IPv4 and IPv6, and @command{tc} for traffic
2876control.
2877
2878Most network configuration manuals still refer to ifconfig and route as the
2879primary network configuration tools, but ifconfig is known to behave
2880inadequately in modern network environments, and both should be deprecated.")
2881 (license license:gpl2+)))
2882
2883(define-public net-tools
2884 ;; XXX: This package is basically unmaintained, but it provides a few
2885 ;; commands not yet provided by Inetutils, such as 'route', so we have to
2886 ;; live with it.
2887 (let ((commit "479bb4a7e11a4084e2935c0a576388f92469225b")
2888 (revision "0"))
2889 (package
2890 (name "net-tools")
2891 (version (string-append "1.60-" revision "." (string-take commit 7)))
2892 (source (origin
2893 (method url-fetch)
2894 (uri (string-append "https://sourceforge.net/code-snapshots/git/"
2895 "n/ne/net-tools/code.git/net-tools-code-"
2896 commit ".zip"))
2897 (file-name (string-append name "-" version ".zip"))
2898 (sha256
2899 (base32
2900 "0hz9fda9d78spp774b6rr5xaxav7cm4h0qcpxf70rvdbrf6qx7vy"))))
2901 (home-page "http://net-tools.sourceforge.net/")
2902 (build-system gnu-build-system)
2903 (arguments
2904 `(#:modules ((guix build gnu-build-system)
2905 (guix build utils)
2906 (srfi srfi-1)
2907 (srfi srfi-26))
2908 #:phases
2909 (modify-phases %standard-phases
2910 (replace 'configure
2911 (lambda* (#:key outputs #:allow-other-keys)
2912 (let ((out (assoc-ref outputs "out")))
2913 (mkdir-p (string-append out "/bin"))
2914 (mkdir-p (string-append out "/sbin"))
2915
2916 ;; Pretend we have everything...
2917 (system "yes | make config")
2918
2919 ;; ... except for the things we don't have.
2920 ;; HAVE_AFDECnet requires libdnet, which we don't have.
2921 ;; HAVE_HWSTRIP and HAVE_HWTR require kernel headers
2922 ;; that have been removed.
2923 ;; XXX SELINUX and AFBLUETOOTH are removed for now, but we should
2924 ;; think about adding them later.
2925 (substitute* '("config.make" "config.h")
2926 (("^.*HAVE_(AFDECnet|HWSTRIP|HWTR|SELINUX|AFBLUETOOTH)[ =]1.*$")
2927 ""))
2928 #t)))
2929 (add-after 'install 'remove-redundant-commands
2930 (lambda* (#:key outputs #:allow-other-keys)
2931 ;; Remove commands and man pages redundant with Inetutils.
2932 (let* ((out (assoc-ref outputs "out"))
2933 (dup (append-map (cut find-files out <>)
2934 '("^hostname"
2935 "^(yp|nis|dns)?domainname"))))
2936 (for-each delete-file dup)
2937 #t))))
2938 ;; Binaries that depend on libnet-tools.a don't declare that
2939 ;; dependency, making it parallel-unsafe.
2940 #:parallel-build? #f
2941
2942 #:tests? #f ; no test suite
2943 #:make-flags (let ((out (assoc-ref %outputs "out")))
2944 (list ,(string-append "CC=" (cc-for-target))
2945 (string-append "BASEDIR=" out)
2946 (string-append "INSTALLNLSDIR=" out "/share/locale")
2947 (string-append "mandir=/share/man")))))
2948 (native-inputs `(("gettext" ,gettext-minimal)
2949 ("unzip" ,unzip)))
2950 (supported-systems (delete "i586-gnu" %supported-systems))
2951 (synopsis "Tools for controlling the network subsystem in Linux")
2952 (description
2953 "This package includes the important tools for controlling the network
2954subsystem of the Linux kernel. This includes arp, ifconfig, netstat, rarp and
2955route. Additionally, this package contains utilities relating to particular
2956network hardware types (plipconfig, slattach) and advanced aspects of IP
2957configuration (iptunnel, ipmaddr).")
2958 (license license:gpl2+))))
2959
2960(define-public libcap
2961 (package
2962 (name "libcap")
2963 (version "2.62")
2964 (source (origin
2965 (method url-fetch)
2966 (uri (string-append
2967 "mirror://kernel.org/linux/libs/security/linux-privs/"
2968 "libcap2/libcap-" version ".tar.xz"))
2969 (sha256
2970 (base32
2971 "18l3pngsbaahdjzz01rmzrjgcqny4zld685fkq96mq5yr6m5n30r"))))
2972 (build-system gnu-build-system)
2973 (arguments
2974 (list #:phases
2975 #~(modify-phases %standard-phases
2976 (delete 'configure))
2977 #:test-target "test"
2978 #:make-flags
2979 #~(list "lib=lib"
2980 (string-append "prefix=" #$output)
2981 (string-append "LDFLAGS=-Wl,-rpath=" #$output "/lib")
2982 "RAISE_SETFCAP=no"
2983 ;; Tell the makefile to use TARGET-gcc and friends
2984 ;; when cross-compiling.
2985 #$@(if (%current-target-system)
2986 `((string-append "CROSS_COMPILE="
2987 ,(%current-target-system) "-")
2988 "BUILD_CC=gcc")
2989 '()))))
2990 (native-inputs (list perl))
2991 (supported-systems (delete "i586-gnu" %supported-systems))
2992 (home-page "https://sites.google.com/site/fullycapable/")
2993 (synopsis "Library for working with POSIX capabilities")
2994 (description
2995 "Libcap2 provides a programming interface to POSIX capabilities on
2996Linux-based operating systems.")
2997
2998 ;; License is BSD-3 or GPLv2, at the user's choice.
2999 (license license:gpl2)))
3000
3001(define-public bridge-utils
3002 (package
3003 (name "bridge-utils")
3004 (version "1.7.1")
3005 (source
3006 (origin
3007 (method url-fetch)
3008 (uri (string-append "mirror://kernel.org/linux/utils/net/"
3009 "bridge-utils/bridge-utils-" version ".tar.xz"))
3010 (sha256
3011 (base32 "03p6cmhm6cqhnfsfa1wv7frhb361y12daf7gr1h5qh51y7j8n7d6"))))
3012 (build-system gnu-build-system)
3013
3014 ;; The tarball lacks all the generated files.
3015 (native-inputs (list autoconf automake))
3016 (arguments
3017 '(#:tests? #f)) ; no 'check' target
3018
3019 (home-page "https://wiki.linuxfoundation.org/networking/bridge")
3020 (synopsis "Manipulate Ethernet bridges")
3021 (description
3022 "Utilities for Linux's Ethernet bridging facilities. A bridge is a way
3023to connect two Ethernet segments together in a protocol independent way.
3024Packets are forwarded based on Ethernet address, rather than IP address (like
3025a router). Since forwarding is done at Layer 2, all protocols can go
3026transparently through a bridge.")
3027 (license license:gpl2+)))
3028
3029(define-public libnl
3030 (package
3031 (name "libnl")
3032 (version "3.5.0")
3033 (source (origin
3034 (method url-fetch)
3035 (uri (string-append
3036 "https://github.com/thom311/libnl/releases/download/"
3037 "libnl" (string-join (string-split version #\.) "_")
3038 "/libnl-" version ".tar.gz"))
3039 (sha256
3040 (base32
3041 "1yh5bqmkivd78x378x34gzb28lvykn6b9k3hgvvpdnj5jpn3689m"))))
3042 (build-system gnu-build-system)
3043 (native-inputs
3044 `(("bison" ,bison)
3045 ("flex" ,flex)
3046 ("pkg-config" ,pkg-config)
3047 ("swig" ,swig)
3048 ("libnl3-doc"
3049 ,(origin
3050 (method url-fetch)
3051 (uri (string-append
3052 "https://github.com/thom311/libnl/releases/download/libnl"
3053 (string-join (string-split version #\.) "_")
3054 "/libnl-doc-" version ".tar.gz"))
3055 (sha256
3056 (base32 "19p5y8q3cm5wqvamqc4s5syxnnkvzxy3gw8ivxk6fv9ybn8jm35h"))))))
3057 (outputs `("out" "doc"))
3058 (arguments
3059 `(#:phases
3060 (modify-phases %standard-phases
3061 (add-after 'install 'install-doc
3062 (lambda* (#:key inputs native-inputs outputs #:allow-other-keys)
3063 (let ((dest (string-append (assoc-ref outputs "doc")
3064 "/share/doc/libnl")))
3065 (mkdir-p dest)
3066 (invoke "tar" "xf" (assoc-ref
3067 (or native-inputs inputs)
3068 "libnl3-doc")
3069 "--strip-components=1" "-C" dest)))))))
3070 (home-page "https://www.infradead.org/~tgr/libnl/")
3071 (synopsis "NetLink protocol library suite")
3072 (description
3073 "The libnl suite is a collection of libraries providing APIs to netlink
3074protocol based Linux kernel interfaces. Netlink is an IPC mechanism primarily
3075between the kernel and user space processes. It was designed to be a more
3076flexible successor to ioctl to provide mainly networking related kernel
3077configuration and monitoring interfaces.")
3078
3079 ;; Most files are LGPLv2.1-only, but some are GPLv2-only (like
3080 ;; 'nl-addr-add.c'), so the result is GPLv2-only.
3081 (license license:gpl2)))
3082
3083;; libnl python extensions used to be outputs of libnl. However, as
3084;; cross-compiling python extensions is currently broken, create separate
3085;; packages for libnl python extensions.
3086(define (libnl-python-package python)
3087 (let ((name (string-append "libnl-" python)))
3088 (package
3089 (inherit libnl)
3090 (name name)
3091 (inputs `(,@(cond
3092 ((string=? python "python2")
3093 `(("python-2" ,python-2)))
3094 ((string=? python "python3")
3095 `(("python-3" ,python-3))))))
3096 (propagated-inputs (list libnl))
3097 (outputs '("out"))
3098 (arguments
3099 `(#:modules ((guix build gnu-build-system)
3100 (guix build utils)
3101 (srfi srfi-1))
3102 #:phases
3103 (modify-phases %standard-phases
3104 (replace 'install
3105 (lambda* (#:key inputs outputs #:allow-other-keys)
3106 (define (python-inst python)
3107 (invoke python "setup.py" "build")
3108 (invoke python "setup.py" "install"
3109 (string-append "--prefix="
3110 (assoc-ref %outputs "out")))
3111 (invoke python "setup.py" "clean"))
3112 (setenv "LDFLAGS" (format #f "-Wl,-rpath=~a/lib"
3113 (assoc-ref inputs "libnl")))
3114 (with-directory-excursion "./python" (python-inst ,python))
3115 #t))))))))
3116
3117(define-public libnl-python2 (libnl-python-package "python2"))
3118(define-public libnl-python3 (libnl-python-package "python3"))
3119
3120(define-public iw
3121 (package
3122 (name "iw")
3123 (version "5.19")
3124 (source (origin
3125 (method url-fetch)
3126 (uri (string-append
3127 "mirror://kernel.org/software/network/iw/iw-"
3128 version ".tar.xz"))
3129 (sha256
3130 (base32
3131 "0kjdrihc7ibnjdpjqkq8sv0kmmvavgsww78cpjgbnlyx8zlvnrzi"))))
3132 (build-system gnu-build-system)
3133 (native-inputs (list pkg-config))
3134 (inputs (list libnl))
3135 (arguments
3136 (list #:make-flags
3137 #~(list
3138 (string-append "CC=" #$(cc-for-target))
3139 (string-append "PKG_CONFIG=" #$(pkg-config-for-target))
3140 (string-append "PREFIX=" (assoc-ref %outputs "out")))
3141 #:phases
3142 #~(modify-phases %standard-phases
3143 (delete 'configure)))) ; no configure script
3144 (home-page "https://wireless.wiki.kernel.org/")
3145 (synopsis "Tool for configuring wireless devices")
3146 (description
3147 "iw is a new nl80211 based CLI configuration utility for wireless
3148devices. It replaces @code{iwconfig}, which is deprecated.")
3149 (license license:isc)))
3150
3151(define-public powertop
3152 (package
3153 (name "powertop")
3154 (version "2.14")
3155 (source
3156 (origin
3157 (method git-fetch)
3158 (uri (git-reference
3159 (url "https://github.com/fenrus75/powertop")
3160 (commit (string-append "v" version))))
3161 (file-name (git-file-name name version))
3162 (sha256
3163 (base32 "1zkr2y5nb1nr22nq8a3zli87iyfasfq6489p7h1k428pv8k45w4f"))))
3164 (build-system gnu-build-system)
3165 (arguments
3166 '(#:configure-flags
3167 (list "LDFLAGS=-pthread")
3168 #:phases
3169 (modify-phases %standard-phases
3170 ;; TODO: Patch some hardcoded "wlan0" in calibrate/calibrate.cpp to
3171 ;; allow calibrating the network interface in Guix System.
3172 (add-after 'unpack 'patch-absolute-file-names
3173 (lambda* (#:key inputs #:allow-other-keys)
3174 (let ((kmod (assoc-ref inputs "kmod")))
3175 (substitute* (find-files "src" "\\.cpp$")
3176 ;; Give the right 'modprobe' file name so that essential
3177 ;; modules such as msr.ko can be loaded.
3178 (("/sbin/modprobe") (string-append kmod "/bin/modprobe"))
3179 ;; These programs are only needed to calibrate, so using
3180 ;; relative file names avoids adding extra inputs. When they
3181 ;; are missing powertop gracefully handles it.
3182 (("/usr/bin/hcitool") "hcitool")
3183 (("/usr/bin/xset") "xset")
3184 (("/usr/sbin/hciconfig") "hciconfig"))
3185 #t))))))
3186 (inputs
3187 (list kmod libnl ncurses pciutils zlib))
3188 (native-inputs
3189 `(("autoconf" ,autoconf)
3190 ("automake" ,automake)
3191 ("gettext" ,gettext-minimal)
3192 ("libtool" ,libtool)
3193 ("pkg-config" ,pkg-config)))
3194 (home-page "https://01.org/powertop/")
3195 (synopsis "Analyze power consumption on Intel-based laptops")
3196 (description
3197 "PowerTOP is a Linux tool to diagnose issues with power consumption and
3198power management. In addition to being a diagnostic tool, PowerTOP also has
3199an interactive mode where the user can experiment various power management
3200settings for cases where the operating system has not enabled these
3201settings.")
3202 (license license:gpl2)))
3203
3204(define-public aumix
3205 (package
3206 (name "aumix")
3207 (version "2.9.1")
3208 (source (origin
3209 (method url-fetch)
3210 (uri (string-append
3211 "http://www.jpj.net/~trevor/aumix/releases/aumix-"
3212 version ".tar.bz2"))
3213 (sha256
3214 (base32
3215 "0a8fwyxnc5qdxff8sl2sfsbnvgh6pkij4yafiln0fxgg6bal7knj"))))
3216 (build-system gnu-build-system)
3217 (arguments
3218 ;; Allow compilation with GCC 10.
3219 '(#:configure-flags '("CFLAGS=-O2 -g -fcommon")))
3220 (inputs (list ncurses))
3221 (home-page "http://www.jpj.net/~trevor/aumix.html")
3222 (synopsis "Audio mixer for X and the console")
3223 (description
3224 "Aumix adjusts an audio mixer from X, the console, a terminal,
3225the command line or a script.")
3226 (license license:gpl2+)))
3227
3228(define-public iotop-python
3229 ;; The last release is from 2013 and gives a misleading CONFIG_TASK_DELAY_ACCT
3230 ;; error on ‘newer’ kernels.
3231 (let ((revision "0")
3232 (commit "a14256a3ff74eeee59493ac088561f1bafab85a7"))
3233 (package
3234 (name "iotop-python")
3235 (version (git-version "0.6" revision commit))
3236 (source
3237 (origin
3238 (method git-fetch)
3239 (uri (git-reference
3240 (url "https://repo.or.cz/iotop.git")
3241 (commit commit)))
3242 (file-name (git-file-name name version))
3243 (sha256
3244 (base32 "00h5p8fk1zi237q8mqds8apqbis9iw0yih1hl0pr63dsnyzmmrpw"))))
3245 (build-system python-build-system)
3246 (arguments
3247 '(#:phases
3248 (modify-phases %standard-phases
3249 (add-after 'unpack 'fix-build-with-python3
3250 (lambda _
3251 (substitute* "setup.py"
3252 (("itervalues") "values")))))
3253 ;; There are currently no checks in the package.
3254 #:tests? #f))
3255 (native-inputs (list python))
3256 (home-page "http://guichaz.free.fr/iotop/")
3257 (synopsis
3258 "Displays the IO activity of running processes")
3259 (description
3260 "Iotop is a Python program with a top like user interface to show the
3261processes currently causing I/O.")
3262 (license license:gpl2+))))
3263
3264(define-public iotop
3265 (package
3266 (name "iotop")
3267 (version "1.22")
3268 (source
3269 (origin
3270 (method git-fetch)
3271 (uri (git-reference
3272 (url "https://github.com/Tomas-M/iotop")
3273 (commit (string-append "v" version))))
3274 (file-name (git-file-name name version))
3275 (sha256
3276 (base32 "04a77qir35s1bwvd39qddx2kfizdbf5jxlnz8zmy1cnrigbwcy1h"))))
3277 (build-system gnu-build-system)
3278 (arguments
3279 (list #:make-flags
3280 #~(list (string-append "CC=" #$(cc-for-target))
3281 (string-append "PREFIX=" #$output))
3282 #:tests? #f ; no tests
3283 #:phases
3284 #~(modify-phases %standard-phases
3285 (delete 'configure)))) ; no configure script
3286 (native-inputs (list pkg-config))
3287 (inputs (list ncurses))
3288 (home-page "https://github.com/Tomas-M/iotop")
3289 (synopsis "Interactive @command{top}-like input/output activity monitor")
3290 (description
3291 "iotop identifies which processes and threads are most responsible for
3292@acronym{I/O, input/output} activity such as disc reads and writes. It sorts
3293them in a live, interactive table overview similar to that of the well-known
3294@command{top}.
3295
3296This information makes it much easier for an administrator to see which tasks
3297are blocking others and adjust their priority (using @command{ionice}) or stop
3298or kill them altogether.")
3299 (license license:gpl2+)))
3300
3301(define-public fuse
3302 (package
3303 (name "fuse")
3304 (version "2.9.9")
3305 (source (origin
3306 (method url-fetch)
3307 (uri (string-append "https://github.com/libfuse/libfuse/releases/"
3308 "download/fuse-" version
3309 "/fuse-" version ".tar.gz"))
3310 (sha256
3311 (base32
3312 "1ddlq6kzxilccgbvxjfx80jx6kamgw4sv49phks2zhlcc1frvrnh"))
3313 (patches (search-patches "fuse-overlapping-headers.patch"
3314 "fuse-glibc-2.34.patch"))))
3315 (build-system gnu-build-system)
3316 (native-inputs
3317 (list autoconf automake gettext-minimal libtool))
3318 (inputs
3319 (list bash-minimal util-linux))
3320 (arguments
3321 '(#:configure-flags (list (string-append "MOUNT_FUSE_PATH="
3322 (assoc-ref %outputs "out")
3323 "/sbin")
3324 (string-append "INIT_D_PATH="
3325 (assoc-ref %outputs "out")
3326 "/etc/init.d")
3327
3328 ;; The rule makes /dev/fuse 666.
3329 (string-append "UDEV_RULES_PATH="
3330 (assoc-ref %outputs "out")
3331 "/lib/udev/rules.d"))
3332 #:phases
3333 (modify-phases %standard-phases
3334 (add-before 'bootstrap 'force-bootstrap
3335 (lambda _
3336 ;; Force a bootstrap to make the patch changes effective.
3337 (delete-file "configure")))
3338 (add-before 'build 'set-file-names
3339 (lambda* (#:key inputs #:allow-other-keys)
3340 ;; libfuse calls out to mount(8) and umount(8). Make sure
3341 ;; it refers to the right ones.
3342 (substitute* '("lib/mount_util.c" "util/mount_util.c")
3343 (("/bin/(u?)mount" _ maybe-u)
3344 (search-input-file inputs
3345 (string-append "bin/"
3346 maybe-u "mount"))))
3347 (substitute* '("util/mount.fuse.c")
3348 (("/bin/sh")
3349 (search-input-file inputs "/bin/sh")))
3350
3351 ;; This hack leads libfuse to search for 'fusermount' in
3352 ;; $PATH, where it may find a setuid-root binary, instead of
3353 ;; trying solely $out/sbin/fusermount and failing because
3354 ;; it's not setuid.
3355 (substitute* "lib/Makefile"
3356 (("-DFUSERMOUNT_DIR=[[:graph:]]+")
3357 "-DFUSERMOUNT_DIR=\\\"/var/empty\\\"")))))))
3358 (supported-systems (delete "i586-gnu" %supported-systems))
3359 (home-page "https://github.com/libfuse/libfuse")
3360 (synopsis "Support file systems implemented in user space")
3361 (description
3362 "As a consequence of its monolithic design, file system code for Linux
3363normally goes into the kernel itself---which is not only a robustness issue,
3364but also an impediment to system extensibility. FUSE, for \"file systems in
3365user space\", is a kernel module and user-space library that tries to address
3366part of this problem by allowing users to run file system implementations as
3367user-space processes.")
3368 (license (list license:lgpl2.1 ;library
3369 license:gpl2+)))) ;command-line utilities
3370
3371(define-public fuse-3
3372 (package
3373 (inherit fuse)
3374 (name "fuse")
3375 (version "3.10.5")
3376 (source (origin
3377 (method url-fetch)
3378 (uri
3379 (string-append "https://github.com/libfuse/libfuse/releases/"
3380 "download/fuse-" version
3381 "/fuse-" version ".tar.xz"))
3382 (sha256
3383 (base32
3384 "0rlnnsiw614qcmgy8xz67044gqc1pbvvf2yxjv44lh27bm487qmj"))))
3385 (build-system meson-build-system)
3386 (arguments
3387 `(#:configure-flags
3388 ,#~(list
3389 (string-append "-Dudevrulesdir=" #$output "/udev/rules.d")
3390 "-Duseroot=false")
3391 #:tests? #f
3392 #:phases
3393 ,#~(modify-phases %standard-phases
3394 (add-after 'unpack 'set-file-names
3395 (lambda* (#:key inputs #:allow-other-keys)
3396 ;; libfuse calls out to mount(8) and umount(8). Make sure
3397 ;; it refers to the right ones.
3398 (substitute* '("lib/mount_util.c")
3399 (("/bin/(u?)mount" _ maybe-u)
3400 (search-input-file inputs
3401 (string-append "bin/"
3402 maybe-u "mount"))))
3403 (substitute* '("util/mount.fuse.c")
3404 (("/bin/sh")
3405 (search-input-file inputs "/bin/sh")))
3406
3407 ;; This hack leads libfuse to search for 'fusermount' in
3408 ;; $PATH, where it may find a setuid-root binary, instead of
3409 ;; trying solely $out/sbin/fusermount and failing because
3410 ;; it's not setuid.
3411 (substitute* "lib/meson.build"
3412 (("-DFUSERMOUNT_DIR=[[:graph:]]+")
3413 "-DFUSERMOUNT_DIR=\"/var/empty\"'"))))
3414 (add-after 'unpack 'fix-install
3415 (lambda* (#:key inputs #:allow-other-keys)
3416 (substitute* '("util/meson.build")
3417 (("install_helper.sh") "true"))
3418 (substitute* '("util/meson.build")
3419 (("fuseconf_path = .*")
3420 "fuseconf_path = '/etc/fuse.conf'"))))
3421 (add-before 'configure 'set-paths
3422 (lambda* (#:key inputs outputs #:allow-other-keys)
3423 (let ((dummy-init.d
3424 (string-append (getcwd) "/etc/init.d")))
3425 (setenv "MOUNT_FUSE_PATH"
3426 (string-append #$output "/sbin"))
3427 (setenv "UDEV_RULES_PATH"
3428 (string-append #$output
3429 "/lib/udev/rules.d"))))))))))
3430
3431(define-public unionfs-fuse
3432 (package
3433 (name "unionfs-fuse")
3434 (version "2.2")
3435 (source (origin
3436 (method git-fetch)
3437 (uri (git-reference
3438 (url "https://github.com/rpodgorny/unionfs-fuse")
3439 (commit (string-append "v" version))))
3440 (file-name (git-file-name name version))
3441 (sha256
3442 (base32
3443 "1yigh8z1q6iq6yjyq7kl7vpbpjnxjld32apvjaw2bl44pqqg56hh"))))
3444 (build-system cmake-build-system)
3445 (native-inputs
3446 (list python))
3447 (inputs (list fuse))
3448 (arguments
3449 ;; The tests were never actually run ("collected 0 items"), but in recent
3450 ;; versions of pytest that causes an error.
3451 '(#:tests? #f))
3452 (home-page "https://github.com/rpodgorny/unionfs-fuse")
3453 (synopsis "User-space union file system")
3454 (description
3455 "UnionFS-FUSE is a flexible union file system implementation in user
3456space, using the FUSE library. Mounting a union file system allows you to
3457\"aggregate\" the contents of several directories into a single mount point.
3458UnionFS-FUSE additionally supports copy-on-write.")
3459 (license license:bsd-3)))
3460
3461(define fuse-static
3462 (package (inherit fuse)
3463 (name "fuse-static")
3464 (source (origin (inherit (package-source fuse))
3465 (modules '((guix build utils)))
3466 (snippet
3467 '(begin
3468 ;; Normally libfuse invokes mount(8) so that /etc/mtab is
3469 ;; updated. Change calls to 'mtab_needs_update' to 0 so
3470 ;; that it doesn't do that, allowing us to remove the
3471 ;; dependency on util-linux (something that is useful in
3472 ;; initrds.)
3473 (substitute* '("lib/mount_util.c"
3474 "util/mount_util.c")
3475 (("mtab_needs_update[[:blank:]]*\\([a-z_]+\\)")
3476 "0")
3477 (("/bin/")
3478 ""))
3479 #t))))))
3480
3481(define-public unionfs-fuse/static
3482 (package (inherit unionfs-fuse)
3483 (synopsis "User-space union file system (statically linked)")
3484 (name (string-append (package-name unionfs-fuse) "-static"))
3485 (source (origin (inherit (package-source unionfs-fuse))
3486 (modules '((guix build utils)))
3487 (snippet
3488 '(begin
3489 ;; Add -ldl to the libraries, because libfuse.a needs that.
3490 (substitute* "src/CMakeLists.txt"
3491 (("target_link_libraries(.*)\\)" _ libs)
3492 (string-append "target_link_libraries"
3493 libs " dl)")))
3494 #t))))
3495 (arguments
3496 '(#:tests? #f
3497 #:configure-flags '("-DCMAKE_EXE_LINKER_FLAGS=-static")
3498 #:phases
3499 (modify-phases %standard-phases
3500 (add-after 'install 'post-install
3501 (lambda* (#:key outputs #:allow-other-keys)
3502 (let* ((out (assoc-ref outputs "out"))
3503 (exe (string-append out "/bin/unionfs")))
3504 ;; By default, 'unionfs' keeps references to
3505 ;; $glibc/share/locale and similar stuff. Remove them.
3506 (remove-store-references exe)
3507
3508 ;; 'unionfsctl' has references to glibc as well. Since
3509 ;; we don't need it, remove it.
3510 (delete-file (string-append out "/bin/unionfsctl"))
3511 #t))))))
3512 (inputs `(("fuse" ,fuse-static)))))
3513
3514(define-public sshfs
3515 (package
3516 (name "sshfs")
3517 (version "3.7.3")
3518 (source (origin
3519 (method url-fetch)
3520 (uri (string-append "https://github.com/libfuse/sshfs/releases/"
3521 "download/sshfs-" version "/sshfs-" version
3522 ".tar.xz"))
3523 (sha256
3524 (base32
3525 "169fkilv060afgp9h7hvsbkg02bd1y77kmx06x0s7q1cvmxww62j"))))
3526 (build-system meson-build-system)
3527 (arguments
3528 ;; XXX: tests are skipped: FUSE kernel module does not seem to be loaded
3529 '(#:tests? #f))
3530 (inputs
3531 (list fuse-3 glib))
3532 (native-inputs
3533 (list pkg-config
3534 ;; man page
3535 python-docutils))
3536 (home-page "https://github.com/libfuse/sshfs")
3537 (synopsis "Mount remote file systems over SSH")
3538 (description
3539 "This is a file system client based on the SSH File Transfer Protocol.
3540Since most SSH servers already support this protocol it is very easy to set
3541up: on the server side there's nothing to do; on the client side mounting the
3542file system is as easy as logging into the server with an SSH client.")
3543 (license license:gpl2+)))
3544
3545(define-public sshfs-fuse
3546 (package (inherit sshfs)
3547 (name "sshfs-fuse")
3548 (properties `((superseded . ,sshfs)))))
3549
3550(define-public archivemount
3551 (package
3552 (name "archivemount")
3553 (version "0.9.1")
3554 (source
3555 (origin
3556 (method url-fetch)
3557 (uri (string-append "https://www.cybernoia.de/software/archivemount/"
3558 "archivemount-" version ".tar.gz"))
3559 (sha256
3560 (base32 "1cy5b6qril9c3ry6fv7ir87s8iyy5vxxmbyx90dm86fbra0vjaf5"))))
3561 (build-system gnu-build-system)
3562 (inputs (list fuse libarchive))
3563 (native-inputs (list pkg-config))
3564 (home-page "https://www.cybernoia.de/software/archivemount.html")
3565 (synopsis "Tool for mounting archive files with FUSE")
3566 (description "archivemount is a FUSE-based file system for Unix variants,
3567including Linux. Its purpose is to mount archives (i.e. tar, tar.gz, etc.) to a
3568mount point where it can be read from or written to as with any other file
3569system. This makes accessing the contents of the archive, which may be
3570compressed, transparent to other programs, without decompressing them.")
3571 (license license:lgpl2.0+)))
3572
3573(define-public numactl
3574 (package
3575 (name "numactl")
3576 (version "2.0.16")
3577 (source (origin
3578 (method url-fetch)
3579 (uri (string-append
3580 "https://github.com/numactl/numactl/releases/download/v"
3581 version "/numactl-" version ".tar.gz"))
3582 (sha256
3583 (base32
3584 "1j67wx3383fwqbvhg4nwqf72vpdgimmrvkpn3b9s2xzr7a4jy90v"))))
3585 (build-system gnu-build-system)
3586 (arguments
3587 `(,@(if (target-riscv64?)
3588 `(#:make-flags (list "LDFLAGS=-latomic"))
3589 '())
3590 ;; There's a 'test' target, but it requires NUMA support in the kernel
3591 ;; to run, which we can't assume to have.
3592 #:tests? #f))
3593 (home-page "https://github.com/numactl/numactl")
3594 (synopsis "Tools for non-uniform memory access (NUMA) machines")
3595 (description
3596 "NUMA stands for Non-Uniform Memory Access, in other words a system whose
3597memory is not all in one place. The @command{numactl} program allows you to
3598run your application program on specific CPUs and memory nodes. It does this
3599by supplying a NUMA memory policy to the operating system before running your
3600program.
3601
3602The package contains other commands, such as @command{numastat},
3603@command{memhog}, and @command{numademo} which provides a quick overview of
3604NUMA performance on your system.")
3605 (license (list license:gpl2 ;programs
3606 license:lgpl2.1)))) ;library
3607
3608(define-public kbd-neo
3609 (package
3610 (name "kbd-neo")
3611 (version "2486")
3612 (source
3613 (origin
3614 (method url-fetch)
3615 (uri (string-append "https://svn.neo-layout.org/!svn/bc/"
3616 version "/linux/console/neo.map"))
3617 (file-name (string-append name "-" version ".map"))
3618 (sha256
3619 (base32
3620 "19mfrd31vzpsjiwc7pshxm0b0sz5dd17xrz6k079cy4im1vf0r4g"))))
3621 (build-system trivial-build-system)
3622 (arguments
3623 `(#:modules ((guix build utils))
3624 #:builder (begin
3625 (use-modules (guix build utils))
3626 (let ((out (string-append %output "/share/keymaps"))
3627 (source (assoc-ref %build-inputs "source")))
3628 (mkdir-p out)
3629 (copy-file source (string-append out "/neo.map"))
3630 #t))))
3631 (home-page "https://neo-layout.org")
3632 (synopsis "Neo2 console layout")
3633 (description
3634 "Kbd-neo provides the Neo2 keyboard layout for use with
3635@command{loadkeys(1)} from @code{kbd(4)}.")
3636 ;; The file is located in an svn directory, the entire content of
3637 ;; the directory is licensed as GPL3.
3638 (license license:gpl3+)))
3639
3640(define-public kbd
3641 (package
3642 (name "kbd")
3643 (version "2.5.1")
3644 (source (origin
3645 (method url-fetch)
3646 (uri (string-append "mirror://kernel.org/linux/utils/kbd/kbd-"
3647 version ".tar.xz"))
3648 (sha256
3649 (base32
3650 "10s608i4blprgy9nynlid0hglfdrrgln6wwjs9rhjf56hwilbpyc"))
3651 (modules '((guix build utils)))
3652 (snippet
3653 '(begin
3654 (substitute* '("src/unicode_start" "src/unicode_stop")
3655 ;; Assume the Coreutils are in $PATH.
3656 (("/usr/bin/tty")
3657 "tty"))))))
3658 (build-system gnu-build-system)
3659 (arguments
3660 '(#:phases
3661 (modify-phases %standard-phases
3662 (add-before 'build 'pre-build
3663 (lambda* (#:key inputs #:allow-other-keys)
3664 (let ((bzip2 (assoc-ref inputs "bzip2"))
3665 (gzip (assoc-ref inputs "gzip"))
3666 (xz (assoc-ref inputs "xz"))
3667 (zstd (assoc-ref inputs "zstd")))
3668 (substitute* "src/libkbdfile/kbdfile.c"
3669 (("bzip2") (string-append bzip2 "/bin/bzip2"))
3670 (("gzip") (string-append gzip "/bin/gzip"))
3671 (("xz -d") (string-append xz "/bin/xz -d"))
3672 (("zstd") (string-append zstd "/bin/zstd"))))))
3673 (add-after 'install 'post-install
3674 (lambda* (#:key outputs #:allow-other-keys)
3675 ;; Make sure these programs find their comrades.
3676 (let* ((out (assoc-ref outputs "out"))
3677 (bin (string-append out "/bin")))
3678 (for-each (lambda (prog)
3679 (wrap-program (string-append bin "/" prog)
3680 `("PATH" ":" prefix (,bin))))
3681 '("unicode_start" "unicode_stop"))))))))
3682 (native-inputs
3683 (list autoconf pkg-config))
3684 (inputs
3685 `(("bzip2" ,bzip2)
3686 ("gzip" ,gzip)
3687 ("pam" ,linux-pam)
3688 ("xz" ,xz)
3689 ("zstd" ,zstd)))
3690 (native-search-paths
3691 (list (search-path-specification
3692 (variable "LOADKEYS_KEYMAP_PATH")
3693 ;; Append ‘/**’ to recursively search all directories. One can then
3694 ;; run (for example) ‘loadkeys en-latin9’ instead of having to find
3695 ;; and type ‘i386/colemak/en-latin9’ on a mislabelled keyboard.
3696 (files (list "share/keymaps/**")))))
3697 (home-page "http://kbd-project.org/")
3698 (synopsis "Linux keyboard utilities and keyboard maps")
3699 (description
3700 "This package contains keytable files and keyboard utilities compatible
3701for systems using the Linux kernel. This includes commands such as
3702@code{loadkeys}, @code{setfont}, @code{kbdinfo}, and @code{chvt}.")
3703 (license license:gpl2+)))
3704
3705(define-public loadkeys-static
3706 (package
3707 (inherit kbd)
3708 (name "loadkeys-static")
3709 (arguments
3710 (substitute-keyword-arguments (package-arguments kbd)
3711 ((#:configure-flags flags ''())
3712 `(append '("LDFLAGS=-static" "--disable-shared" "--disable-nls"
3713 "--disable-vlock" ;so we don't need libpam
3714 "--disable-libkeymap")
3715 ,flags))
3716 ((#:make-flags flags ''())
3717 `(cons "LDFLAGS=-all-static -lrt -lpthread" ,flags))
3718 ((#:phases phases '%standard-phases)
3719 `(modify-phases ,phases
3720 (replace 'install
3721 (lambda* (#:key outputs #:allow-other-keys)
3722 (let ((out (assoc-ref outputs "out")))
3723 ;; The binary keeps references to gzip, among other things,
3724 ;; which we don't need in the initrd, so strip references.
3725 (remove-store-references "src/loadkeys")
3726
3727 (install-file "src/loadkeys"
3728 (string-append out "/bin")))))
3729 (delete 'post-install)))
3730 ((#:strip-flags _ '())
3731 ''("--strip-all"))
3732 ((#:allowed-references _ '())
3733 '())))
3734
3735 (synopsis "Statically-linked @command{loadkeys} program")
3736
3737 ;; This package is meant to be used internally in the initrd so don't
3738 ;; expose it.
3739 (properties '((hidden? . #t)))))
3740
3741(define-public inotify-tools
3742 (package
3743 (name "inotify-tools")
3744 (version "3.22.6.0")
3745 (source (origin
3746 (method git-fetch)
3747 (uri (git-reference
3748 (url "https://github.com/rvoicilas/inotify-tools")
3749 (commit version)))
3750 (file-name (git-file-name name version))
3751 (sha256
3752 (base32
3753 "1j9j8k5zjp8m4cl53zjncnll9z4dnvzr4ygmfcjk0ci81i59b18i"))))
3754 (build-system gnu-build-system)
3755 (native-inputs
3756 (list autoconf automake libtool))
3757 (arguments
3758 `(#:configure-flags
3759 (list "--disable-static")))
3760 (home-page "https://github.com/rvoicilas/inotify-tools/wiki")
3761 (synopsis "Monitor file accesses")
3762 (description
3763 "The inotify-tools packages provides a C library and command-line tools
3764to use Linux' inotify mechanism, which allows file accesses to be monitored.")
3765 (license license:gpl2+)))
3766
3767(define-public kmod
3768 (package
3769 (name "kmod")
3770 (version "29")
3771 (source (origin
3772 (method url-fetch)
3773 (uri
3774 (string-append "mirror://kernel.org/linux/utils/kernel/kmod/"
3775 "kmod-" version ".tar.xz"))
3776 (sha256
3777 (base32
3778 "0am54mi5rk72g5q7k6l6f36gw3r9vwgjmyna43ywcjhqmakyx00b"))
3779 (patches (search-patches "kmod-module-directory.patch"))))
3780 (build-system gnu-build-system)
3781 (native-inputs
3782 (list pkg-config
3783 ;; For tests.
3784 zstd))
3785 (inputs
3786 `(("xz" ,xz)
3787 ("zlib" ,zlib)
3788 ("zstd-lib" ,zstd "lib")))
3789 (arguments
3790 `(#:configure-flags '("--with-xz" "--with-zlib" "--with-zstd"
3791 "--disable-test-modules")
3792 #:phases
3793 (modify-phases %standard-phases
3794 (add-after 'unpack 'disable-tests
3795 (lambda _
3796 ;; XXX: These tests need '--sysconfdir=/etc' to pass.
3797 (substitute* "Makefile.in"
3798 (("testsuite/test-modprobe") "")
3799 (("testsuite/test-depmod") "")
3800 (("testsuite/test-blacklist") ""))
3801 #t))
3802 (add-after 'install 'install-modprobe&co
3803 (lambda* (#:key outputs #:allow-other-keys)
3804 (let* ((out (assoc-ref outputs "out"))
3805 (bin (string-append out "/bin")))
3806 (for-each (lambda (tool)
3807 (symlink "kmod"
3808 (string-append bin "/" tool)))
3809 '("insmod" "rmmod" "lsmod" "modprobe"
3810 "modinfo" "depmod"))
3811 #t))))))
3812 (supported-systems (delete "i586-gnu" %supported-systems))
3813 (home-page "https://www.kernel.org/")
3814 (synopsis "Kernel module tools")
3815 (description "Kmod is a set of tools to handle common tasks with Linux
3816kernel modules like insert, remove, list, check properties, resolve
3817dependencies and aliases.
3818
3819These tools are designed on top of libkmod, a library that is shipped with
3820kmod. The aim is to be compatible with tools, configurations and indices
3821from the module-init-tools project.")
3822 (license license:gpl2+))) ; library under lgpl2.1+
3823
3824(define-public earlyoom
3825 (package
3826 (name "earlyoom")
3827 (version "1.6.2")
3828 (source (origin
3829 (method git-fetch)
3830 (uri (git-reference
3831 (url "https://github.com/rfjakob/earlyoom")
3832 (commit (string-append "v" version))))
3833 (file-name (git-file-name name version))
3834 (sha256
3835 (base32
3836 "16iyn51xlrsbshc7p5xl2338yyfzknaqc538sa7mamgccqwgyvvq"))))
3837 (build-system gnu-build-system)
3838 (arguments
3839 (list
3840 #:phases
3841 #~(modify-phases %standard-phases
3842 (delete 'configure) ; no configure script
3843 (add-before 'check 'set-go-HOME
3844 (lambda _
3845 (setenv "HOME" (getcwd))))
3846 (add-before 'check 'disable-failing-test
3847 (lambda _
3848 ;; This test relies on writing to /proc/%d/oom_score_adj.
3849 (substitute* "testsuite_cli_test.go"
3850 (("TestI" match)
3851 (string-append "skipped" match))))))
3852 #:make-flags
3853 #~(list (string-append "CC=" #$(cc-for-target))
3854 (string-append "VERSION=v" #$version)
3855 (string-append "PREFIX=" #$output)
3856 (string-append "SYSCONFDIR=" #$output "/etc")
3857 "GO111MODULE=off")
3858 #:test-target "test"))
3859 (native-inputs
3860 (append
3861 ;; To generate the manpage.
3862 (if (or (target-x86-64?) (target-x86-32?))
3863 (list pandoc)
3864 '())
3865 (list
3866 ;; For the test suite.
3867 cppcheck
3868 go)))
3869 (home-page "https://github.com/rfjakob/earlyoom")
3870 (synopsis "Simple out of memory (OOM) daemon for the Linux kernel")
3871 (description "Early OOM is a minimalist out of memory (OOM) daemon that
3872runs in user space and provides a more responsive and configurable alternative
3873to the in-kernel OOM killer.")
3874 (license license:expat)))
3875
3876(define-public eudev
3877 ;; The post-systemd fork, maintained by Gentoo.
3878 (package
3879 (name "eudev")
3880 (version "3.2.11")
3881 (source (origin
3882 (method git-fetch)
3883 (uri (git-reference (url "https://github.com/gentoo/eudev")
3884 (commit (string-append "v" version))))
3885 (file-name (git-file-name name version))
3886 (sha256
3887 (base32
3888 "0dzaqwjnl55f69ird57wb6skahc6l7zs1slsrzqqfhww33icp6av"))
3889 (patches (search-patches "eudev-rules-directory.patch"))))
3890 (build-system gnu-build-system)
3891 (arguments
3892 `(#:phases
3893 (modify-phases %standard-phases
3894 (add-before 'bootstrap 'patch-file-names
3895 (lambda* (#:key inputs native-inputs #:allow-other-keys)
3896 (substitute* "man/make.sh"
3897 (("/usr/bin/xsltproc")
3898 (string-append (assoc-ref
3899 (or native-inputs inputs) "xsltproc")
3900 "/bin/xsltproc")))))
3901 (add-after 'install 'move-static-library
3902 (lambda* (#:key outputs #:allow-other-keys)
3903 (let* ((out (assoc-ref outputs "out"))
3904 (static (assoc-ref outputs "static"))
3905 (source (string-append out "/lib/libudev.a"))
3906 (target (string-append static "/lib/libudev.a")))
3907 (mkdir-p (dirname target))
3908 (link source target)
3909 (delete-file source)
3910 ;; Remove reference to the static library from the .la file
3911 ;; such that Libtool looks for it in the usual places.
3912 (substitute* (string-append out "/lib/libudev.la")
3913 (("old_library=.*")
3914 "old_library=''\n")))))
3915 (add-after 'install 'build-hwdb
3916 (lambda* (#:key outputs #:allow-other-keys)
3917 ;; Build OUT/etc/udev/hwdb.bin. This allows 'lsusb' and
3918 ;; similar tools to display product names.
3919 ;;
3920 ;; XXX: This can't be done when cross-compiling. Find another way
3921 ;; to generate hwdb.bin for cross-built systems.
3922 (let ((out (assoc-ref outputs "out")))
3923 ,@(if (%current-target-system)
3924 '(#t)
3925 '((invoke (string-append out "/bin/udevadm")
3926 "hwdb" "--update")))))))
3927 #:configure-flags (list "--enable-manpages")))
3928 (native-inputs
3929 `(("autoconf" ,autoconf)
3930 ("automake" ,automake)
3931 ("gperf" ,gperf)
3932 ("libtool" ,libtool)
3933 ("pkg-config" ,pkg-config)
3934 ;; For tests.
3935 ("perl" ,perl)
3936 ("python" ,python-wrapper)
3937 ;; For documentation.
3938 ("docbook-xml" ,docbook-xml-4.2)
3939 ("docbook-xsl" ,docbook-xsl)
3940 ("libxml2" ,libxml2) ;for $XML_CATALOG_FILES
3941 ("xsltproc" ,libxslt)))
3942 (inputs
3943 ;; When linked against libblkid, eudev can populate /dev/disk/by-label
3944 ;; and similar; it also installs the '60-persistent-storage.rules' file,
3945 ;; which contains the rules to do that.
3946 (list `(,util-linux "lib") ;for blkid
3947 kmod))
3948 (outputs '("out" "static"))
3949 (home-page "https://wiki.gentoo.org/wiki/Project:Eudev")
3950 (synopsis "Userspace device management")
3951 (description "Udev is a daemon which dynamically creates and removes
3952device nodes from /dev/, handles hotplug events and loads drivers at boot
3953time.")
3954 (license license:gpl2+)))
3955
3956(define-public python-evdev
3957 (package
3958 (name "python-evdev")
3959 (version "1.3.0")
3960 (source
3961 (origin
3962 (method url-fetch)
3963 (uri (pypi-uri "evdev" version))
3964 (sha256
3965 (base32 "0kb3636yaw9l8xi8s184w0r0n9ic5dw3b8hx048jf9fpzss4kimi"))))
3966 (build-system python-build-system)
3967 (arguments
3968 `(#:tests? #f ;no rule for tests
3969 #:phases
3970 (modify-phases %standard-phases
3971 (add-before 'build 'fix-hard-coded-directory
3972 (lambda* (#:key inputs #:allow-other-keys)
3973 (substitute* "setup.py"
3974 (("/usr/include/linux")
3975 (string-append
3976 (assoc-ref inputs "kernel-headers") "/include/linux")))
3977 #t)))))
3978 (home-page "https://github.com/gvalkov/python-evdev")
3979 (synopsis "Bindings to the Linux input handling subsystem")
3980 (description
3981 "Python-evdev provides bindings to the generic input event interface in
3982Linux. The @code{evdev} interface serves the purpose of passing events
3983generated in the kernel directly to userspace through character devices that
3984are typically located in @file{/dev/input/}.
3985
3986This package also comes with bindings to @code{uinput}, the userspace input
3987subsystem. @code{uinput} allows userspace programs to create and handle input
3988devices that can inject events directly into the input subsystem.")
3989 (license license:bsd-3)))
3990
3991(define-public interception-tools
3992 (package
3993 (name "interception-tools")
3994 (version "0.6.8")
3995 (home-page "https://gitlab.com/interception/linux/tools")
3996 (source (origin
3997 (method git-fetch)
3998 (uri (git-reference
3999 (url home-page)
4000 (commit (string-append "v" version))))
4001 (file-name (git-file-name name version))
4002 (sha256
4003 (base32
4004 "1sbidym6ld4c8cx2ww5i54zsv8v0kygv15zq1yimz44v4my605wf"))))
4005 (build-system cmake-build-system)
4006 (native-inputs
4007 (list pkg-config))
4008 (inputs
4009 (list boost libevdev eudev yaml-cpp))
4010 (arguments
4011 `(#:tests? #f)) ; no test suite
4012 (synopsis "Utilities for operating on input events of evdev devices")
4013 (description
4014 "Interception Tools provides a composable infrastructure on top of
4015@code{libudev} and @code{libevdev}. The following utilities are provided:
4016
4017@itemize
4018@item @command{udevmon} --- monitor input devices for launching tasks
4019@item @command{intercept} --- redirect device input events to stdout
4020@item @command{uinput} --- redirect device input events from stding to virtual device
4021@item @command{mux} --- mux streams of input events
4022@end itemize")
4023 ;; Dual-licensed under GPLv3+ or "something else" on request, per
4024 ;; 'README.md'.
4025 (license license:gpl3+)))
4026
4027(define-public interception-dual-function-keys
4028 (package
4029 (name "interception-dual-function-keys")
4030 (version "1.4.0")
4031 (home-page "https://gitlab.com/interception/linux/plugins/dual-function-keys")
4032 (source (origin
4033 (method git-fetch)
4034 (uri (git-reference
4035 (url home-page)
4036 (commit version)))
4037 (file-name (git-file-name name version))
4038 (sha256
4039 (base32
4040 "0s49vbg3j4rwh78i8rx8qr7myql09p7b3lhrjl0p7dd98xp6ann6"))))
4041 (build-system gnu-build-system)
4042 (inputs
4043 (list libevdev yaml-cpp))
4044 (arguments
4045 `(#:make-flags (list ,(string-append "CC=" (cc-for-target))
4046 ,(string-append "CXX=" (cxx-for-target))
4047 (string-append "PREFIX=" %output))
4048 #:phases
4049 (modify-phases %standard-phases
4050 (add-after 'unpack 'fix-libevdev-path
4051 (lambda* (#:key inputs #:allow-other-keys)
4052 (let ((libevdev (assoc-ref inputs "libevdev")))
4053 (substitute* "config.mk"
4054 (("/usr/include/libevdev-1.0")
4055 (string-append libevdev "/include/libevdev-1.0")))
4056 #t)))
4057 ;; No configure script
4058 (delete 'configure))
4059 ;; No tests are included.
4060 #:tests? #f))
4061 (synopsis "Tap for one key, hold for another")
4062 (description
4063 "Dual Function Keys is a plugin for @code{interception-tools} that allows
4064one to send arbitrary keycodes when a given key is tapped or held.")
4065 (license license:expat)))
4066
4067(define-public lvm2
4068 (package
4069 (name "lvm2")
4070 (version "2.03.11")
4071 (source (origin
4072 (method url-fetch)
4073 (uri (list (string-append "https://sourceware.org/ftp/lvm2/LVM2."
4074 version ".tgz")
4075 (string-append "ftp://sources.redhat.com/pub/lvm2/releases/LVM2."
4076 version ".tgz")))
4077 (sha256
4078 (base32
4079 "1m4xpda8vbyd89ca0w8nacvnl4j34yzsa625gn990fb5sh84ab44"))
4080 (modules '((guix build utils)))
4081 (snippet
4082 '(begin
4083 (use-modules (guix build utils))
4084
4085 ;; Honor sysconfdir.
4086 (substitute* "make.tmpl.in"
4087 (("^confdir = .*$")
4088 "confdir = @sysconfdir@\n")
4089 (("DEFAULT_SYS_DIR = @DEFAULT_SYS_DIR@")
4090 "DEFAULT_SYS_DIR = @sysconfdir@"))
4091 #t))
4092 (patches (search-patches "lvm2-static-link.patch"))))
4093 (build-system gnu-build-system)
4094 (native-inputs
4095 (list config
4096 pkg-config procps)) ;tests use 'pgrep'
4097 (inputs
4098 `(("libaio" ,libaio)
4099 ("udev" ,eudev)))
4100 (arguments
4101 `(#:phases
4102 (modify-phases %standard-phases
4103 (add-after 'unpack 'update-config
4104 (lambda* (#:key inputs native-inputs #:allow-other-keys)
4105 (install-file (search-input-file
4106 (or native-inputs inputs) "/bin/config.sub")
4107 "autoconf")
4108 (install-file (search-input-file
4109 (or native-inputs inputs) "/bin/config.guess")
4110 "autoconf")))
4111 (add-after 'configure 'set-makefile-shell
4112 (lambda _
4113 ;; Use 'sh', not 'bash', so that '. lib/utils.sh' works as
4114 ;; expected.
4115 (setenv "SHELL" (which "sh"))
4116
4117 ;; Replace /bin/sh with the right file name.
4118 (patch-makefile-SHELL "make.tmpl")
4119 #t)))
4120
4121 #:configure-flags (list (string-append "--sysconfdir="
4122 (assoc-ref %outputs "out")
4123 "/etc/lvm")
4124 "--enable-udev_sync"
4125 "--enable-udev_rules"
4126 "--enable-pkgconfig"
4127 "--enable-cmdlib"
4128 "--enable-dmeventd" ; Requires '--enable-cmdlib'.
4129
4130 ;; Make sure programs such as 'dmsetup' can
4131 ;; find libdevmapper.so.
4132 (string-append "LDFLAGS=-Wl,-rpath="
4133 (assoc-ref %outputs "out")
4134 "/lib,-rpath="
4135 (assoc-ref %outputs "out")
4136 "/lib/device-mapper")
4137 ;; This is needed when cross-compiling.
4138 ,@(if (%current-target-system)
4139 '("ac_cv_func_malloc_0_nonnull=yes"
4140 "ac_cv_func_realloc_0_nonnull=yes")
4141 '()))
4142
4143 ;; The tests use 'mknod', which requires root access.
4144 #:tests? #f))
4145 (supported-systems (delete "i586-gnu" %supported-systems))
4146 (home-page "https://sourceware.org/lvm2/")
4147 (synopsis "Logical volume management for Linux")
4148 (description
4149 "LVM2 is the logical volume management tool set for Linux-based systems.
4150This package includes the user-space libraries and tools, including the device
4151mapper. Kernel components are part of Linux-libre.")
4152
4153 ;; Libraries (liblvm2, libdevmapper) are LGPLv2.1.
4154 ;; Command-line tools are GPLv2.
4155 (license (list license:gpl2 license:lgpl2.1))))
4156
4157(define-public lvm2-static
4158 (package
4159 (inherit lvm2)
4160 (name "lvm2-static")
4161
4162 ;; Propagate udev because libdevmapper.a depends on libudev.
4163 (propagated-inputs `(("udev:static" ,eudev "static")))
4164
4165 (arguments
4166 (substitute-keyword-arguments (package-arguments lvm2)
4167 ((#:configure-flags flags '())
4168 ;; LVM2 doesn't use Libtool, hence the custom option.
4169 `(append '("--enable-static_link")
4170 ;; Building dmeventd statically is complicated due to a
4171 ;; requirement on libdevmapper.a, which is being phased out
4172 ;; in favor of libdevice-mapper.a, which in turn is is not
4173 ;; easily made available at dmeventd build time. Just ignore
4174 ;; it until the situation improves.
4175 (delete "--enable-dmeventd" ,flags)))
4176 ((#:phases phases)
4177 `(modify-phases ,phases
4178 (add-before 'configure 'adjust-Makefile
4179 (lambda _
4180 ;; These fixes are related to the upstream libdm->device_mapper
4181 ;; migration and will hopefully be fixed upstream in due time.
4182 (substitute* "tools/Makefile.in"
4183 ;; This variable is empty in a static configuration and causes
4184 ;; an erroneous GCC command line.
4185 (("-L\\$\\(interfacebuilddir\\)") "")
4186 ;; Remove obsolete reference to libdevmapper.a.
4187 (("-ldevmapper") ""))
4188 #t))))))
4189 (synopsis "Logical volume management for Linux (statically linked)")))
4190
4191(define-public thin-provisioning-tools
4192 (package
4193 (name "thin-provisioning-tools")
4194 (version "0.8.5")
4195 (source
4196 (origin
4197 (method git-fetch)
4198 (uri (git-reference
4199 (url "https://github.com/jthornber/thin-provisioning-tools")
4200 (commit (string-append "v" version))))
4201 (file-name (git-file-name name version))
4202 (sha256
4203 (base32 "01wl8c0cjbx1smbhj8dx6av5bnw5775m58gasc3vqwvsj0s9hq19"))))
4204 (build-system gnu-build-system)
4205 (arguments
4206 ;; Doesn't build with --enable-testing due to a function name collision
4207 ;; with glibc. Fixed upstream. TODO: Enable tests when 0.9.0 is released.
4208 `(#:tests? #f))
4209 (native-inputs
4210 `(("automake" ,automake)
4211 ("autoreconf" ,autoconf)))
4212 (inputs
4213 (list boost expat libaio))
4214 (synopsis "Tools for manipulating the metadata of device-mapper targets")
4215 (description "A suite of tools for manipulating the metadata of the
4216dm-thin, dm-cache and dm-era device-mapper targets.")
4217 (home-page "https://github.com/jthornber/thin-provisioning-tools")
4218 (license license:gpl3+)))
4219
4220(define-public watchdogd
4221 (package
4222 (name "watchdogd")
4223 (version "3.5")
4224 (source (origin
4225 (method git-fetch)
4226 (uri (git-reference
4227 (url "https://github.com/troglobit/watchdogd")
4228 (commit version)))
4229 (file-name (git-file-name name version))
4230 (sha256
4231 (base32
4232 "05f7igavzimfgbh39fflbkmpya12r854n03dkyimwashcqwchx8f"))))
4233 (build-system gnu-build-system)
4234 (native-inputs (list autoconf automake libtool pkg-config))
4235 (inputs (list libconfuse libite libuev))
4236 (synopsis "Advanced system & process supervisor for Linux")
4237 (description "This package provides an advanced monitor of critical system
4238resources, supervises the heartbeat of processes, records deadline
4239transgressions, and initiates a controlled reset if needed.")
4240 (home-page "https://troglobit.com/projects/watchdogd/")
4241 (license license:isc)))
4242
4243(define-public wireless-tools
4244 (package
4245 (name "wireless-tools")
4246 (version "30.pre9")
4247 (source
4248 (origin
4249 (method url-fetch)
4250 (uri (string-append "http://www.hpl.hp.com/personal/Jean_Tourrilhes/"
4251 "Linux/wireless_tools." version ".tar.gz"))
4252 (sha256
4253 (base32 "0qscyd44jmhs4k32ggp107hlym1pcyjzihiai48xs7xzib4wbndb"))
4254 (snippet
4255 #~(begin
4256 ;; Remove the older header files that are not free software.
4257 (for-each (lambda (n)
4258 (delete-file (format #f "wireless.~a.h" n)))
4259 '(10 11 12 13 14 15 16 17 18 19 20))))))
4260 (build-system gnu-build-system)
4261 (arguments
4262 (list #:make-flags
4263 #~(list (string-append "PREFIX=" #$output)
4264 (string-append "INSTALL_MAN=" #$output "/share/man")
4265 (string-append "LDFLAGS=-Wl,-rpath=" #$output "/lib")
4266 "BUILD_STATIC=")
4267 #:phases
4268 #~(modify-phases %standard-phases
4269 (replace 'configure
4270 (lambda* (#:key target #:allow-other-keys)
4271 (when target
4272 ;; Cross-compilation: use the cross tools.
4273 (substitute* (find-files "." "Makefile")
4274 (("CC = .*$")
4275 (string-append "CC = " target "-gcc\n"))
4276 (("AR = .*$")
4277 (string-append "AR = " target "-ar\n"))
4278 (("RANLIB = .*$")
4279 (string-append "RANLIB = " target "-ranlib\n")))))))
4280 #:tests? #f))
4281 (synopsis "Tools for manipulating Linux Wireless Extensions")
4282 (description "Wireless Tools are used to manipulate the now-deprecated
4283Linux Wireless Extensions; consider using @code{iw} instead. The Wireless
4284Extension was an interface allowing you to set Wireless LAN specific
4285parameters and get the specific stats. It is deprecated in favor the nl80211
4286interface.")
4287 (home-page "https://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html")
4288 ;; wireless.21.h and wireless.22.h are distributed under lgpl2.1+, the
4289 ;; other files are distributed under gpl2.
4290 (license (list license:gpl2 license:lgpl2.1+))))
4291
4292(define-public crda
4293 (package
4294 (name "crda")
4295 (version "3.18")
4296 (source (origin
4297 (method url-fetch)
4298 (uri (string-append "mirror://kernel.org/software/network/crda/"
4299 "crda-" version ".tar.xz"))
4300 (sha256
4301 (base32
4302 "1gydiqgb08d9gbx4l6gv98zg3pljc984m50hmn3ysxcbkxkvkz23"))
4303 (patches (search-patches "crda-optional-gcrypt.patch"))))
4304 (build-system gnu-build-system)
4305 (arguments
4306 `(#:phases (modify-phases %standard-phases
4307 (delete 'configure)
4308 (add-after 'unpack 'gzip-determinism
4309 (lambda _
4310 (substitute* "Makefile"
4311 (("gzip") "gzip --no-name"))
4312 #t))
4313 ,@(if (%current-target-system)
4314 '((add-after
4315 'unpack 'fix-pkg-config
4316 (lambda* (#:key target #:allow-other-keys)
4317 (substitute*
4318 "Makefile"
4319 (("pkg-config")
4320 (string-append target "-pkg-config")))
4321 #t)))
4322 '())
4323 (add-before
4324 'build 'no-werror-no-ldconfig
4325 (lambda _
4326 (substitute* "Makefile"
4327 (("-Werror") "")
4328 (("ldconfig") "true"))
4329 #t))
4330 (add-before
4331 'build 'set-regulator-db-file-name
4332 (lambda* (#:key native-inputs inputs #:allow-other-keys)
4333 ;; Tell CRDA where to find our database.
4334 (let ((regdb (assoc-ref (or native-inputs inputs)
4335 "wireless-regdb")))
4336 (substitute* "crda.c"
4337 (("\"/lib/crda/regulatory.bin\"")
4338 (string-append "\"" regdb
4339 "/lib/crda/regulatory.bin\"")))
4340 #t))))
4341 #:test-target "verify"
4342 #:make-flags (let ((out (assoc-ref %outputs "out"))
4343 (regdb (assoc-ref %build-inputs "wireless-regdb")))
4344 (list
4345 (string-append "CC=" ,(cc-for-target))
4346 "V=1"
4347
4348 ;; Disable signature-checking on 'regulatory.bin'.
4349 ;; The reason is that this simplifies maintenance
4350 ;; on our side (no need to manage a distro key
4351 ;; pair), and we can guarantee integrity of
4352 ;; 'regulatory.bin' by other means anyway, such as
4353 ;; 'guix gc --verify'. See
4354 ;; <https://wireless.wiki.kernel.org/en/developers/regulatory/wireless-regdb>
4355 ;; for a discssion.
4356 "USE_OPENSSL=0"
4357
4358 (string-append "PREFIX=" out)
4359 (string-append "SBINDIR=" out "/sbin/")
4360 (string-append "UDEV_RULE_DIR="
4361 out "/lib/udev/rules.d")
4362 (string-append "LDFLAGS=-Wl,-rpath="
4363 out "/lib -L.")
4364 (string-append "REG_BIN=" regdb
4365 "/lib/crda/regulatory.bin")
4366 "all_noverify"))))
4367 (native-inputs (list pkg-config wireless-regdb))
4368 (inputs (list libnl))
4369 (home-page
4370 "https://wireless.wiki.kernel.org/en/developers/Regulatory/CRDA")
4371 (synopsis "Central regulatory domain agent (CRDA) for WiFi")
4372 (description
4373 "The Central Regulatory Domain Agent (CRDA) acts as the udev helper for
4374communication between the kernel Linux and user space for regulatory
4375compliance.")
4376 (license license:copyleft-next)))
4377
4378(define-public wireless-regdb
4379 (package
4380 (name "wireless-regdb")
4381 (version "2020.11.20")
4382 (source (origin
4383 (method url-fetch)
4384 (uri (string-append
4385 "mirror://kernel.org/software/network/wireless-regdb/"
4386 "wireless-regdb-" version ".tar.xz"))
4387 (sha256
4388 (base32
4389 "0liagyi6ppf5w474qk9j4jz5gbvvn8mc8al1dq4b1xrgv28485ml"))
4390
4391 ;; We're building 'regulatory.bin' by ourselves.
4392 (snippet '(begin
4393 (delete-file "regulatory.bin")
4394 #t))))
4395 (build-system gnu-build-system)
4396 (arguments
4397 '(#:phases
4398 (modify-phases %standard-phases
4399 (add-after 'unpack 'gzip-determinism
4400 (lambda _
4401 (substitute* "Makefile"
4402 (("gzip") "gzip --no-name"))
4403 #t))
4404 (add-after 'unpack 'omit-signature
4405 (lambda _
4406 (substitute* "Makefile"
4407 ;; Signing requires a REGDB_PUBCERT and REGDB_PRIVKEY which we
4408 ;; don't provide (see below). Disable it.
4409 ((" regulatory\\.db\\.p7s") "")
4410 ;; regulatory.db is built as a dependency of regulatory.db.p7s,
4411 ;; but ‘make install’ depends only on the latter while installing
4412 ;; both (and failing). Depend on it explicitly.
4413 (("^install: " all) (string-append all "regulatory.db ")))
4414 #t))
4415 (delete 'configure)) ; no configure script
4416
4417 ;; The 'all' target of the makefile depends on $(REGDB_CHANGED), which
4418 ;; is computed and can be equal to 'maintainer-clean'; when that
4419 ;; happens, we can end up deleting the 'regulatory.bin' file that we
4420 ;; just built. Thus, build things sequentially.
4421 #:parallel-build? #f
4422
4423 #:tests? #f ; no tests
4424 #:make-flags
4425 (let ((out (assoc-ref %outputs "out")))
4426 (list (string-append "PREFIX=" out)
4427 (string-append "FIRMWARE_PATH=$(PREFIX)/lib/firmware")
4428
4429 ;; Leave this empty so that db2bin.py doesn't try to sign
4430 ;; ‘regulatory.bin’. This allows us to avoid managing a key
4431 ;; pair for the whole distribution.
4432 (string-append "REGDB_PRIVKEY=")
4433 ;; Don't generate a public key for the same reason. These are
4434 ;; used as Makefile targets and can't be the empty string.
4435 (string-append "REGDB_PUBCERT=/dev/null")
4436 (string-append "REGDB_PUBKEY=/dev/null")))))
4437 (native-inputs
4438 `(("python" ,python-wrapper)))
4439 (home-page
4440 "https://wireless.wiki.kernel.org/en/developers/regulatory/wireless-regdb")
4441 (synopsis "Wireless regulatory database")
4442 (description
4443 "This package contains the wireless regulatory database for the Central
4444Regulatory Database Agent (CRDA). The database contains information on
4445country-specific regulations for the wireless spectrum.")
4446 (license license:isc)))
4447
4448(define-public lm-sensors
4449 (package
4450 (name "lm-sensors")
4451 (version "3.6.0")
4452 (source
4453 (origin
4454 (method git-fetch)
4455 (uri (git-reference
4456 (url "https://github.com/groeck/lm-sensors")
4457 (commit (string-append "V" (string-join
4458 (string-split version #\.) "-")))))
4459 (file-name (git-file-name name version))
4460 (sha256
4461 (base32 "1ipf6wjx037sqyhy0r5jh4983h216anq9l68ckn2x5c3qc4wfmzn"))
4462 (patches (search-patches "lm-sensors-hwmon-attrs.patch"))))
4463 (build-system gnu-build-system)
4464 (inputs (list rrdtool perl kmod gnuplot))
4465 (native-inputs (list pkg-config flex bison which))
4466 (outputs '("lib" ; avoid perl in closure
4467 "out"))
4468 (arguments
4469 `(#:tests? #f ; no 'check' target
4470 #:make-flags (list (string-append "PREFIX=" %output)
4471 (string-append "ETCDIR=" (assoc-ref %outputs "lib") "/etc")
4472 (string-append "INCLUDEDIR="
4473 (assoc-ref %outputs "lib") "/include")
4474 (string-append "MANDIR=" %output "/share/man")
4475 (string-append "LIBDIR=" (assoc-ref %outputs "lib") "/lib"))
4476 #:phases
4477 (modify-phases %standard-phases
4478 (delete 'configure)
4479 (add-before 'build 'patch-exec-paths
4480 (lambda* (#:key inputs outputs #:allow-other-keys)
4481 (substitute* "prog/detect/sensors-detect"
4482 (("`uname")
4483 (string-append "`" (assoc-ref inputs "coreutils")
4484 "/bin/uname"))
4485 (("(`|\")modprobe" all open-quote)
4486 (string-append open-quote
4487 (assoc-ref inputs "kmod")
4488 "/bin/modprobe")))
4489 (substitute* '("prog/pwm/pwmconfig"
4490 "prog/pwm/fancontrol")
4491 (("gnuplot")
4492 (search-input-file inputs "/bin/gnuplot"))
4493 (("cat ")
4494 (string-append (search-input-file inputs "/bin/cat")
4495 " "))
4496 (("e?grep " match)
4497 (string-append (search-input-file inputs
4498 (string-append
4499 "/bin/"
4500 (string-trim-right match)))
4501 " "))
4502 (("sed -e")
4503 (string-append (search-input-file inputs "/bin/sed")
4504 " -e"))
4505 (("cut -d")
4506 (string-append (search-input-file inputs "/bin/cut")
4507 " -d"))
4508 (("sleep ")
4509 (string-append (search-input-file inputs "/bin/sleep")
4510 " "))
4511 (("readlink -f")
4512 (string-append (search-input-file inputs "/bin/readlink")
4513 " -f"))))))))
4514 (home-page "https://hwmon.wiki.kernel.org/lm_sensors")
4515 (synopsis "Utilities to read temperature/voltage/fan sensors")
4516 (description
4517 "Lm-sensors is a hardware health monitoring package for Linux. It allows
4518you to access information from temperature, voltage, and fan speed sensors.
4519It works with most newer systems.")
4520 (license license:gpl2+)))
4521
4522(define-public iucode-tool
4523 (package
4524 (name "iucode-tool")
4525 (version "2.3.1")
4526 (source (origin
4527 (method url-fetch)
4528 (uri (string-append "https://gitlab.com/iucode-tool/releases"
4529 "/raw/latest/iucode-tool_" version ".tar.xz"))
4530 (sha256
4531 (base32
4532 "159gvf6ljgg3g4vlhyy6pyr0wz11rcyhp985vc4az58d9px8xf0j"))))
4533 (build-system gnu-build-system)
4534 (home-page "https://gitlab.com/iucode-tool/iucode-tool/wikis/home")
4535 (synopsis "Manipulate Intel microcode bundles")
4536 (description
4537 "@command{iucode_tool} is a utility to work with microcode packages for
4538Intel processors. It can convert between formats, extract specific versions,
4539create a firmware image suitable for the Linux kernel, and more.")
4540 ;; cpuid.h is available for i686, x86_64, and ia64.
4541 (supported-systems '("i686-linux" "x86_64-linux"))
4542 (license license:gpl2+)))
4543
4544(define-public i2c-tools
4545 (package
4546 (name "i2c-tools")
4547 (version "4.3")
4548 (source (origin
4549 (method url-fetch)
4550 (uri (string-append
4551 "http://jdelvare.nerim.net/mirror/i2c-tools/i2c-tools-"
4552 version ".tar.xz"))
4553 (sha256
4554 (base32
4555 "1y0fphjd5ah2j886x8i175r7viq0hmx666hyca0wi4dzrm290qxk"))))
4556 (build-system gnu-build-system)
4557 (arguments
4558 `(#:tests? #f ; no 'check' target
4559 #:make-flags
4560 ,#~(list (string-append "PREFIX=" #$output)
4561 (string-append "LDFLAGS+=-Wl,-rpath=" #$output "/lib")
4562 (string-append "CC=" #$(cc-for-target)))
4563 ;; No configure script.
4564 #:phases (modify-phases %standard-phases (delete 'configure))))
4565 (inputs
4566 (list perl))
4567 (home-page "http://jdelvare.nerim.net/devel.html#i2ctools")
4568 (synopsis "I2C tools for Linux")
4569 (description
4570 "The i2c-tools package contains a heterogeneous set of I2C tools for
4571Linux: a bus probing tool, a chip dumper, register-level SMBus access helpers,
4572EEPROM decoding scripts, EEPROM programming tools, and a python module for
4573SMBus access.")
4574 (license license:gpl2+)))
4575
4576(define-public i2c-tools-3
4577 (package
4578 (inherit i2c-tools)
4579 (name "i2c-tools")
4580 (version "3.1.2")
4581 (source (origin
4582 (method url-fetch)
4583 (uri (string-append
4584 "http://jdelvare.nerim.net/mirror/i2c-tools/i2c-tools-"
4585 version ".tar.bz2"))
4586 (sha256
4587 (base32 "0hd4c1w8lnwc3j95h3vpd125170l1d4myspyrlpamqx6wbr6jpnv"))))
4588 (arguments
4589 (substitute-keyword-arguments (package-arguments i2c-tools)
4590 ((#:make-flags _)
4591 #~(list (string-append "prefix=" #$output)
4592 (string-append "CC=" #$(cc-for-target))))))))
4593
4594(define-public xsensors
4595 (package
4596 (name "xsensors")
4597 (version "0.70")
4598 (source (origin
4599 (method url-fetch)
4600 (uri (string-append
4601 "http://www.linuxhardware.org/xsensors/xsensors-"
4602 version ".tar.gz"))
4603 (sha256
4604 (base32
4605 "1siplsfgvcxamyqf44h71jx6jdfmvhfm7mh0y1q8ps4zs6pj2zwh"))))
4606 (build-system gnu-build-system)
4607 (inputs `(("lm-sensors" ,lm-sensors "lib")
4608 ("gtk" ,gtk+-2)))
4609 (native-inputs (list pkg-config))
4610 (arguments
4611 `(#:phases
4612 (modify-phases %standard-phases
4613 (add-before 'configure 'enable-deprecated
4614 (lambda _
4615 (substitute* "src/Makefile.in"
4616 (("-DGDK_DISABLE_DEPRECATED") "")
4617 (("-DGTK_DISABLE_DEPRECATED") ""))
4618 #t))
4619 (add-before 'configure 'remove-Werror
4620 (lambda _
4621 (substitute* '("configure" "src/Makefile.in")
4622 (("-Werror") ""))
4623 #t)))))
4624 (home-page "http://www.linuxhardware.org/xsensors/")
4625 (synopsis "Hardware health information viewer")
4626 (description
4627 "Xsensors reads data from the libsensors library regarding hardware
4628health such as temperature, voltage and fan speed and displays the information
4629in a digital read-out.")
4630 (license license:gpl2+)))
4631
4632(define-public perf
4633 (package
4634 (name "perf")
4635 (version (package-version linux-libre))
4636 (source (package-source linux-libre))
4637 (build-system gnu-build-system)
4638 (arguments
4639 '(#:phases
4640 (modify-phases %standard-phases
4641 (replace 'configure
4642 (lambda* (#:key inputs #:allow-other-keys)
4643 (setenv "SHELL_PATH" (which "bash"))
4644 (chdir "tools/perf")
4645
4646 ;; This file hard-codes file system layouts for specific distros
4647 ;; but not for ours; address that. With this change, one can run
4648 ;; "perf report --symfs=$HOME/.guix-profile" (without
4649 ;; "/lib/debug") and 'perf' should be able to find separate debug
4650 ;; info files.
4651 (substitute* "util/dso.c"
4652 (("/usr/lib/debug")
4653 "/lib/debug")))))
4654 #:make-flags (list (string-append "prefix="
4655 (assoc-ref %outputs "out"))
4656 "CC=gcc"
4657 "WERROR=0"
4658
4659 ;; By default, 'config/Makefile' uses lib64 on
4660 ;; x86_64. Work around that.
4661 "lib=lib")
4662 #:tests? #f)) ;no tests
4663 (native-inputs
4664 (list pkg-config
4665 bison
4666 flex
4667 ;; There are build scripts written in these languages.
4668 perl
4669 python-2
4670 python-3))
4671 (inputs
4672 (list slang ;for the interactive TUI
4673 ;; newt
4674 python-2 ;'perf' links against libpython
4675 elfutils
4676 libiberty ;used alongside BDF for symbol demangling
4677 libunwind ;better stack walking
4678 numactl ;for 'perf bench numa mem'
4679 ;; Documentation.
4680 libxml2 ;for $XML_CATALOG_FILES
4681 docbook-xsl
4682 xmlto
4683 asciidoc))
4684 (home-page "https://perf.wiki.kernel.org/")
4685 (synopsis "Linux profiling with performance counters")
4686 (description
4687 "perf is a tool suite for profiling using hardware performance counters,
4688with support in the Linux kernel. perf can instrument CPU performance
4689counters, tracepoints, kprobes, and uprobes (dynamic tracing). It is capable
4690of lightweight profiling. This package contains the user-land tools and in
4691particular the @code{perf} command.")
4692 (license (package-license linux-libre))))
4693
4694(define-public pflask
4695 (package
4696 (name "pflask")
4697 (version "0.2")
4698 (source (origin
4699 (method git-fetch)
4700 (uri (git-reference
4701 (url "https://github.com/ghedo/pflask")
4702 (commit (string-append "v" version))))
4703 (file-name (git-file-name name version))
4704 (sha256
4705 (base32
4706 "1jikjbhlxlqracnai3v9krzcgd2xwp0p4adw5n07yxc7b857damz"))))
4707 (build-system cmake-build-system)
4708 (arguments
4709 '(#:tests? #f)) ; no tests
4710 (home-page "https://ghedo.github.io/pflask/")
4711 (synopsis "Simple tool for creating Linux namespace containers")
4712 (description "pflask is a simple tool for creating Linux namespace
4713containers. It can be used for running a command or even booting an OS inside
4714an isolated container, created with the help of Linux namespaces. It is
4715similar in functionality to chroot, although pflask provides better isolation
4716thanks to the use of namespaces.")
4717 (license license:bsd-2)))
4718
4719(define-public singularity
4720 (package
4721 (name "singularity")
4722 (version "2.6.1")
4723 (source (origin
4724 (method url-fetch)
4725 (uri (string-append "https://github.com/singularityware/singularity/"
4726 "releases/download/" version
4727 "/singularity-" version ".tar.gz"))
4728 (sha256
4729 (base32
4730 "1whx0hqqi1326scgdxxxa1d94vn95mnq0drid6s8wdp84ni4d3gk"))
4731 (modules '((guix build utils)))
4732 (snippet
4733 '(begin
4734 ;; Do not create directories in /var.
4735 (substitute* "Makefile.in"
4736 (("\\$\\(MAKE\\) .*install-data-hook") ""))
4737
4738 ;; The original source overrides PATH so that it points to
4739 ;; /bin, /usr/local/bin, etc., which obviously doesn't work
4740 ;; on Guix System. Leave PATH unchanged so we refer to the
4741 ;; installed Coreutils, grep, etc.
4742 (substitute* "bin/singularity.in"
4743 (("^PATH=.*" all)
4744 (string-append "#" all "\n")))
4745
4746 (substitute* (find-files "libexec/cli" "\\.exec$")
4747 (("\\$SINGULARITY_libexecdir/singularity/bin/([a-z]+)-suid"
4748 _ program)
4749 (string-append "/run/setuid-programs/singularity-"
4750 program "-helper")))
4751
4752 ;; These squashfs mount options are apparently no longer
4753 ;; supported since Linux-libre 5.4.5.
4754 (substitute* "src/lib/image/squashfs/mount.c"
4755 (("\"errors=remount-ro\"")
4756 "NULL"))
4757 #t))))
4758 (build-system gnu-build-system)
4759 (arguments
4760 `(#:configure-flags '("--localstatedir=/var")
4761 #:phases
4762 (modify-phases %standard-phases
4763 (add-after 'unpack 'patch-references
4764 (lambda _
4765 (substitute* "libexec/cli/build.exec.in"
4766 (("-mksquashfs") (string-append "-" (which "mksquashfs"))))
4767 (substitute* (append
4768 (find-files "libexec" "functions")
4769 (find-files "libexec/bootstrap-scripts" ".*sh$")
4770 (find-files "libexec/cli" ".*exec$"))
4771 (("\\| grep ")
4772 (string-append "| " (which "grep") " "))
4773 (("egrep ")
4774 (string-append (which "egrep") " "))
4775 ((" sed ")
4776 (string-append " " (which "sed") " ")))
4777 #t))
4778 (add-after 'install 'set-PATH
4779 (lambda* (#:key inputs outputs #:allow-other-keys)
4780 ;; Have the 'singularity' and 'run-singularity' self-sufficient.
4781 (let ((out (assoc-ref outputs "out"))
4782 (coreutils (assoc-ref inputs "coreutils")))
4783 (wrap-program (string-append out "/bin/singularity")
4784 `("PATH" ":" = (,(string-append coreutils "/bin"))))
4785 (substitute* (string-append out "/bin/run-singularity")
4786 (("/usr/bin/env singularity")
4787 (string-append (which "env") " "
4788 out "/bin/singularity")))
4789 #t))))))
4790 (inputs
4791 `(("libarchive" ,libarchive)
4792 ("python" ,python-wrapper)
4793 ("zlib" ,zlib)
4794 ("squashfs-tools" ,squashfs-tools)))
4795 (home-page "https://singularity.lbl.gov/")
4796 (synopsis "Container platform")
4797 (description "Singularity is a container platform supporting a number of
4798container image formats. It can build SquashFS container images or import
4799existing Docker images. Singularity requires kernel support for container
4800isolation or root privileges.")
4801 (license license:bsd-3)))
4802
4803(define-public hdparm
4804 (package
4805 (name "hdparm")
4806 (version "9.65")
4807 (source (origin
4808 (method url-fetch)
4809 (uri (string-append "mirror://sourceforge/hdparm/hdparm/"
4810 "hdparm-" version ".tar.gz"))
4811 (sha256
4812 (base32
4813 "0jssagggg52ssl9kg99m88afghj7bm1854vyf4p96q6h23wjjjfi"))))
4814 (build-system gnu-build-system)
4815 (arguments
4816 (list #:make-flags
4817 #~(list (string-append "binprefix=" #$output)
4818 (string-append "manprefix=" #$output)
4819 (string-append "CC=" #$(cc-for-target))
4820 ;; Let Guix strip binaries and not break cross-compilation.
4821 "STRIP=true")
4822 #:phases
4823 #~(modify-phases %standard-phases
4824 (delete 'configure)) ; no configure script
4825 #:tests? #f)) ; no test suite
4826 (home-page "https://sourceforge.net/projects/hdparm/")
4827 (synopsis "View and tune ATA disk drive parameters")
4828 (description
4829 "@command{hdparm} is a command-line utility to control ATA controllers and
4830disk drives. It can increase performance and/or reliability by careful tuning
4831of hardware settings like power and acoustic management, DMA modes, and caching.
4832It can also display detailed device information, or be used as a simple
4833performance benchmarking tool.
4834
4835@command{hdparm} provides a command line interface to various Linux kernel
4836interfaces provided by the SATA/ATA/SAS @code{libata} subsystem, and the older
4837IDE driver subsystem. Many external USB drive enclosures with SCSI-ATA Command
4838Translation (@dfn{SAT}) are also supported.")
4839 (license (license:non-copyleft "file://LICENSE.TXT"))))
4840
4841(define-public nvme-cli
4842 (package
4843 (name "nvme-cli")
4844 (version "1.16")
4845 (home-page "https://github.com/linux-nvme/nvme-cli")
4846 (source (origin
4847 (method git-fetch)
4848 (uri (git-reference
4849 (url home-page)
4850 (commit (string-append "v" version))))
4851 (sha256
4852 (base32 "130x5cf6kkcnyg5qd35igii249ysfjnbxp1pxfwkickmqg3d007z"))
4853 (file-name (git-file-name name version))))
4854 (build-system gnu-build-system)
4855 (arguments
4856 (list #:make-flags
4857 #~(list (string-append "CC=" #$(cc-for-target)))
4858 #:phases
4859 #~(modify-phases %standard-phases
4860 (delete 'configure) ; no ./configure script
4861 (replace 'install
4862 (lambda _
4863 (invoke "make" "install-spec" "PREFIX="
4864 (string-append "DESTDIR=" #$output)))))
4865 ;; The tests require sysfs, which is not accessible from from the
4866 ;; build environment.
4867 #:tests? #f))
4868 (synopsis "NVM-Express user space tooling for Linux")
4869 (description "Nvme-cli is a utility to provide standards compliant tooling
4870for NVM-Express drives. It was made specifically for Linux as it relies on the
4871IOCTLs defined by the mainline kernel driver.")
4872 (license license:gpl2+)))
4873
4874(define-public rfkill
4875 (package
4876 (name "rfkill")
4877 (version "0.5")
4878 (source (origin
4879 (method url-fetch)
4880 (uri (string-append "mirror://kernel.org/software/network/"
4881 name "/" name "-" version ".tar.xz"))
4882 (sha256
4883 (base32
4884 "0snqj5h0y991lszbigbyyqb8swj0hxajc1vfqg2scfay44231bp0"))))
4885 (build-system gnu-build-system)
4886 (arguments
4887 `(#:make-flags (list "CC=gcc"
4888 (string-append "PREFIX=" %output))
4889 #:phases (modify-phases %standard-phases
4890 (delete 'configure))
4891 #:tests? #f))
4892 (home-page "https://wireless.wiki.kernel.org/en/users/Documentation/rfkill")
4893 (synopsis "Tool for enabling and disabling wireless devices")
4894 (description
4895 "rfkill is a simple tool for accessing the rfkill device interface,
4896which is used to enable and disable wireless networking devices, typically
4897WLAN, Bluetooth and mobile broadband.")
4898 (license (license:non-copyleft "file://COPYING"
4899 "See COPYING in the distribution."))
4900 ;; rfkill is part of util-linux as of 2.31.
4901 (properties `((superseded . ,util-linux)))))
4902
4903(define-public acpi
4904 (package
4905 (name "acpi")
4906 (version "1.7")
4907 (source (origin
4908 (method url-fetch)
4909 (uri (string-append "mirror://sourceforge/acpiclient/acpiclient/"
4910 version "/" name "-" version ".tar.gz"))
4911 (sha256
4912 (base32
4913 "01ahldvf0gc29dmbd5zi4rrnrw2i1ajnf30sx2vyaski3jv099fp"))))
4914 (build-system gnu-build-system)
4915 (home-page "http://acpiclient.sourceforge.net")
4916 (synopsis "Display information on ACPI devices")
4917 (description "@code{acpi} attempts to replicate the functionality of the
4918\"old\" @code{apm} command on ACPI systems, including battery and thermal
4919information. It does not support ACPI suspending, only displays information
4920about ACPI devices.")
4921 (license license:gpl2+)))
4922
4923(define-public acpid
4924 (package
4925 (name "acpid")
4926 (version "2.0.34")
4927 (source (origin
4928 (method url-fetch)
4929 (uri (string-append "mirror://sourceforge/acpid2/acpid-"
4930 version ".tar.xz"))
4931 (sha256
4932 (base32
4933 "0cxkdbd087kj9ikprvvjpk0ixzqbipf2rmj6qyp7r15wzj65q29d"))))
4934 (build-system gnu-build-system)
4935 (home-page "https://sourceforge.net/projects/acpid2/")
4936 (synopsis "Daemon for delivering ACPI events to user-space programs")
4937 (description
4938 "acpid is designed to notify user-space programs of Advanced
4939Configuration and Power Interface (ACPI) events. acpid should be started
4940during the system boot, and will run as a background process. When an ACPI
4941event is received from the kernel, acpid will examine the list of rules
4942specified in /etc/acpi/events and execute the rules that match the event.")
4943 (license license:gpl2+)))
4944
4945(define-public sysfsutils
4946 (package
4947 (name "sysfsutils")
4948 (version "2.1.0")
4949 (source
4950 (origin
4951 (method url-fetch)
4952 (uri
4953 (string-append
4954 "mirror://sourceforge/linux-diag/sysfsutils/" version "/sysfsutils-"
4955 version ".tar.gz"))
4956 (sha256
4957 (base32 "12i0ip11xbfcjzxz4r10cvz7mbzgq1hfcdn97w6zz7sm3wndwrg8"))))
4958 (build-system gnu-build-system)
4959 (home-page "http://linux-diag.sourceforge.net/Sysfsutils.html")
4960 (synopsis "System utilities based on Linux sysfs")
4961 (description
4962 "These are a set of utilities built upon sysfs, a virtual file system in
4963Linux kernel versions 2.5+ that exposes a system's device tree. The package
4964also contains the libsysfs library.")
4965 ;; The library is under lgpl2.1+ (all files say "or any later version").
4966 ;; The rest is mostly gpl2, with a few files indicating gpl2+.
4967 (license (list license:gpl2 license:gpl2+ license:lgpl2.1+))))
4968
4969(define-public cpufrequtils
4970 (let ((commit "a2f0c39d5f21596bb9f5223e895c0ff210b265d0")
4971 (revision "1"))
4972 (package
4973 (name "cpufrequtils")
4974 (version (git-version "008" revision commit ))
4975 (source
4976 (origin
4977 (method git-fetch)
4978 (uri
4979 (git-reference
4980 (url "https://git.kernel.org/pub/scm/linux/kernel/git/brodo/cpufrequtils.git")
4981 (commit commit)))
4982 (file-name (git-file-name name version))
4983 (sha256
4984 (base32 "01n2hp6v89cilqqvqvlcprphyhnljsjclh4h1zf3b1l7ypz29lbp"))))
4985 (build-system gnu-build-system)
4986 (arguments
4987 `(#:tests? #f ; no test suite
4988 #:make-flags
4989 (let ((out (assoc-ref %outputs "out")))
4990 (list "PROC=false" ; obsoleted by sysfs in Linux 2.6(!)
4991 (string-append "CC=" ,(cc-for-target))
4992 (string-append "LDFLAGS=-Wl,-rpath=" out "/lib")
4993 "INSTALL=install"
4994 (string-append "bindir=" out "/bin")
4995 (string-append "sbindir=" out "/sbin")
4996 (string-append "mandir=" out "/share/man")
4997 (string-append "includedir=" out "/include")
4998 (string-append "libdir=" out "/lib")
4999 (string-append "localedir=" out "/share/locale")
5000 (string-append "docdir=" out "/share/doc/" ,name)))
5001 #:phases
5002 (modify-phases %standard-phases
5003 (delete 'configure)))) ; no configure script
5004 (native-inputs
5005 `(("gettext" ,gettext-minimal)))
5006 (home-page
5007 "http://ftp.be.debian.org/pub/linux/utils/kernel/cpufreq/cpufrequtils.html")
5008 (synopsis "Utilities to get and set CPU frequency on Linux")
5009 (description
5010 "The cpufrequtils suite contains utilities to retrieve CPU frequency
5011information, and set the CPU frequency if supported, using the cpufreq
5012capabilities of the Linux kernel.")
5013 (license license:gpl2))))
5014
5015(define-public libite
5016 (package
5017 (name "libite")
5018 (version "2.5.2")
5019 (source
5020 (origin
5021 (method git-fetch)
5022 (uri (git-reference
5023 (url "https://github.com/troglobit/libite")
5024 (commit (string-append "v" version))))
5025 (file-name (git-file-name name version))
5026 (sha256
5027 (base32 "0i27ppb557kdc1hm7nf0f5r7sxvqma31pr57h79whl6qcp28gy4a"))))
5028 (build-system gnu-build-system)
5029 (arguments
5030 `(#:configure-flags
5031 (list "--disable-static")
5032 #:phases
5033 (modify-phases %standard-phases
5034 (add-after 'unpack 'fix-tests
5035 (lambda* (#:key inputs #:allow-other-keys)
5036 ;; replace paths to the executables
5037 (substitute* "test/which.c"
5038 (("/usr/bin/which")
5039 (search-input-file inputs "/bin/which"))
5040 (("ls\"")
5041 (string-append
5042 (search-input-file inputs "/bin/ls") "\"")))
5043 ;; create pidfile in /tmp instead of /var
5044 (substitute* "test/pidfile.c" (("/var/tmp") "/tmp")))))))
5045 (native-inputs (list autoconf automake libtool which))
5046 (synopsis "Library providing missing pieces in GNU libc")
5047 (description "This package provides many of the missing pieces in GNU
5048libc. Most notably the string functions: strlcpy(3), strlcat(3) and the *BSD
5049sys/queue.h and sys/tree.h API's.")
5050 (home-page "https://troglobit.com/projects/libite/")
5051 (license license:expat)))
5052
5053(define-public libuev
5054 (package
5055 (name "libuev")
5056 (version "2.4.0")
5057 (source
5058 (origin
5059 (method git-fetch)
5060 (uri (git-reference
5061 (url "https://github.com/troglobit/libuev")
5062 (commit (string-append "v" version))))
5063 (file-name (git-file-name name version))
5064 (sha256
5065 (base32
5066 "0ih82lxfdcq179kknzdl5c8vi1l0n5j7yh68y8f6kwsrm457paf7"))))
5067 (build-system gnu-build-system)
5068 (native-inputs (list autoconf automake libtool))
5069 (synopsis "Lightweight event loop library for epoll family APIs")
5070 (description "This package provides small event loop that wraps the
5071epoll family of APIs.")
5072 (home-page "https://troglobit.com/projects/libuev/")
5073 (license license:expat)))
5074
5075(define-public libraw1394
5076 (package
5077 (name "libraw1394")
5078 (version "2.1.2")
5079 (source (origin
5080 (method url-fetch)
5081 (uri (string-append
5082 "mirror://kernel.org/linux/libs/ieee1394/"
5083 name "-" version ".tar.xz"))
5084 (sha256
5085 (base32
5086 "0pm5b415j1qdzyw38wdv8h7ff4yx20831z1727mpsb6jc6bwdk03"))))
5087 (build-system gnu-build-system)
5088 (home-page "https://ieee1394.wiki.kernel.org/index.php/Main_Page")
5089 (synopsis "Interface library for the Linux IEEE1394 drivers")
5090 (description
5091 "Libraw1394 is the only supported interface to the kernel side raw1394 of
5092the Linux IEEE-1394 subsystem, which provides direct access to the connected
50931394 buses to user space. Through libraw1394/raw1394, applications can directly
5094send to and receive from other nodes without requiring a kernel driver for the
5095protocol in question.")
5096 (license license:lgpl2.1+)))
5097
5098(define-public libavc1394
5099 (package
5100 (name "libavc1394")
5101 (version "0.5.4")
5102 (source (origin
5103 (method url-fetch)
5104 (uri (string-append "mirror://sourceforge/libavc1394/libavc1394/"
5105 name "-" version ".tar.gz"))
5106 (sha256
5107 (base32
5108 "0lsv46jdqvdx5hx92v0z2cz3yh6212pz9gk0k3513sbaa04zzcbw"))))
5109 (build-system gnu-build-system)
5110 (native-inputs
5111 (list pkg-config))
5112 (propagated-inputs
5113 (list libraw1394)) ; required by libavc1394.pc
5114 (home-page "https://sourceforge.net/projects/libavc1394/")
5115 (synopsis "AV/C protocol library for IEEE 1394")
5116 (description
5117 "Libavc1394 is a programming interface to the AV/C specification from
5118the 1394 Trade Association. AV/C stands for Audio/Video Control.")
5119 (license license:lgpl2.1+)))
5120
5121(define-public libiec61883
5122 (package
5123 (name "libiec61883")
5124 (version "1.2.0")
5125 (source (origin
5126 (method url-fetch)
5127 (uri (string-append
5128 "mirror://kernel.org/linux/libs/ieee1394/"
5129 name "-" version ".tar.xz"))
5130 (sha256
5131 (base32
5132 "17ph458zya2l8dr2xwqnzy195qd9swrir31g78qkgb3g4xz2rq6i"))))
5133 (build-system gnu-build-system)
5134 (native-inputs
5135 (list pkg-config))
5136 (propagated-inputs
5137 (list libraw1394)) ; required by libiec61883.pc
5138 (home-page "https://ieee1394.wiki.kernel.org/index.php/Main_Page")
5139 (synopsis "Isochronous streaming media library for IEEE 1394")
5140 (description
5141 "The libiec61883 library provides a higher level API for streaming DV,
5142MPEG-2 and audio over Linux IEEE 1394.")
5143 (license license:lgpl2.1+)))
5144
5145(define-public mdadm
5146 (package
5147 (name "mdadm")
5148 (version "4.2")
5149 (source (origin
5150 (method url-fetch)
5151 (uri (string-append
5152 "mirror://kernel.org/linux/utils/raid/mdadm/mdadm-"
5153 version ".tar.xz"))
5154 (sha256
5155 (base32
5156 "07ghmibmbnkdy91ng87zdllzicm299l20dhs9m5bfjw6f1b22726"))))
5157 (build-system gnu-build-system)
5158 (arguments
5159 (list #:make-flags
5160 #~(list (string-append "CC=" #$(cc-for-target))
5161 "INSTALL=install"
5162 "CHECK_RUN_DIR=0"
5163 ;; TODO: tell it where to find 'sendmail'
5164 ;; (string-append "MAILCMD=" <???> "/sbin/sendmail")
5165 (string-append "BINDIR=" #$output "/sbin")
5166 (string-append "MANDIR=" #$output "/share/man")
5167 (string-append "UDEVDIR=" #$output "/lib/udev"))
5168 #:phases
5169 #~(modify-phases %standard-phases
5170 (add-before 'build 'patch-program-paths
5171 (lambda* (#:key native-inputs inputs #:allow-other-keys)
5172 (let ((coreutils (assoc-ref (or native-inputs inputs)
5173 "coreutils")))
5174 (substitute* "udev-md-raid-arrays.rules"
5175 (("/usr/bin/(readlink|basename)" all program)
5176 (string-append coreutils "/bin/" program))))))
5177 (add-before 'build 'remove-W-error
5178 (lambda _
5179 ;; We cannot build with -Werror on i686 due to a
5180 ;; 'sign-compare' warning in util.c.
5181 (substitute* "Makefile"
5182 (("-Werror") ""))))
5183 (delete 'configure))
5184 ;; Tests must be run as root.
5185 #:tests? #f))
5186 (inputs
5187 (list eudev))
5188 (supported-systems (delete "i586-gnu" %supported-systems))
5189 (home-page "http://neil.brown.name/blog/mdadm")
5190 (synopsis "Tool for managing Linux Software RAID arrays")
5191 (description
5192 "mdadm is a tool for managing Linux Software RAID arrays. It can create,
5193assemble, report on, and monitor arrays. It can also move spares between raid
5194arrays when needed.")
5195 (license license:gpl2+)))
5196
5197(define-public mdadm-static
5198 (package
5199 (inherit mdadm)
5200 (name "mdadm-static")
5201 (arguments
5202 (substitute-keyword-arguments (package-arguments mdadm)
5203 ((#:make-flags flags)
5204 #~(cons* "LDFLAGS = -static"
5205 "CXFLAGS = -DNO_LIBUDEV"
5206 #$flags))
5207 ((#:phases phases)
5208 #~(modify-phases #$phases
5209 (add-after 'install 'remove-cruft
5210 (lambda* (#:key outputs #:allow-other-keys)
5211 (let* ((out (assoc-ref outputs "out"))
5212 (precious? (lambda (file)
5213 (member file '("." ".." "sbin"))))
5214 (directories (scandir out (negate precious?))))
5215 (with-directory-excursion out
5216 (for-each delete-file-recursively directories)
5217 (remove-store-references "sbin/mdadm")
5218 (delete-file "sbin/mdmon")))))))
5219 ((#:modules modules %gnu-build-system-modules)
5220 `((ice-9 ftw) ,@modules))
5221 ((#:strip-flags _ '())
5222 ''("--strip-all")) ;strip a few extra KiB
5223 ((#:allowed-references _ '("out"))
5224 '("out")))) ;refer only self
5225 (synopsis "Statically-linked 'mdadm' command for use in an initrd")))
5226
5227(define-public multipath-tools
5228 (package
5229 (name "multipath-tools")
5230 (version "0.9.3")
5231 (home-page "https://github.com/opensvc/multipath-tools")
5232 (source (origin
5233 (method git-fetch)
5234 (uri (git-reference (url home-page) (commit version)))
5235 (file-name (git-file-name name version))
5236 (sha256
5237 (base32
5238 "0zcnr1135znizbnfqhqv3by9i2qwn5vg6kgmj6ma3yy1x1krx0d4"))
5239 (modules '((guix build utils)))
5240 (snippet
5241 '(begin
5242 ;; Drop bundled valgrind headers.
5243 (delete-file-recursively "third-party")
5244 (substitute* '("multipathd/main.c"
5245 "libmpathutil/debug.c")
5246 (("#include \"../third-party/")
5247 "#include \""))))))
5248 (build-system gnu-build-system)
5249 (arguments
5250 (list
5251 #:test-target "test"
5252 #:make-flags #~(list (string-append "CC=" #$(cc-for-target))
5253 (string-append "prefix=" #$output)
5254 ;; Install Udev rules below this directory, relative
5255 ;; to the prefix.
5256 "SYSTEMDPATH=lib")
5257 #:phases
5258 #~(modify-phases %standard-phases
5259 (add-after 'unpack 'patch-source
5260 (lambda* (#:key inputs #:allow-other-keys)
5261 (let ((libdevmapper.h
5262 (search-input-file inputs "include/libdevmapper.h"))
5263 (libudev.h
5264 (search-input-file inputs "include/libudev.h")))
5265 (substitute* "Makefile.inc"
5266 (("/bin/echo") "echo")
5267 (("\\$\\(prefix\\)/usr") "$(prefix)")
5268 (("configdir.*:= \\$\\(prefix\\)/etc/multipath/conf.d")
5269 "configdir := /etc/multipath/conf.d")
5270 ;; Do not save timestamp to avoid gzip "timestamp
5271 ;; out-of-range" warnings.
5272 (("gzip -9") "gzip -9n"))
5273 (substitute* '("kpartx/Makefile" "libmultipath/Makefile")
5274 (("/usr/include/libdevmapper.h") libdevmapper.h)
5275 (("/usr/include/libudev.h") libudev.h)))))
5276 (add-after 'unpack 'skip-failing-tests
5277 (lambda _
5278 ;; This test and the module's setup() test an arbitrary block
5279 ;; device node name, but the build environment has none.
5280 (substitute* "tests/devt.c"
5281 (("return get_one_devt.*") "return 0;\n")
5282 (("cmocka_unit_test\\(test_devt2devname_devt_good\\),") ""))
5283 ;; The above triggers -Werror=unused-function. Ignore it.
5284 (substitute* "tests/Makefile"
5285 (("CFLAGS \\+= " match)
5286 (string-append match "-Wno-error=unused-function ")))))
5287 (delete 'configure) ;no configure script
5288 (add-before 'build 'set-LDFLAGS
5289 (lambda _
5290 ;; Note: this cannot be passed as a make flag because that will
5291 ;; override the build system LDFLAGS.
5292 (setenv "LDFLAGS"
5293 (string-append "-Wl,-rpath=" #$output "/lib")))))))
5294
5295 (native-inputs
5296 (list perl pkg-config valgrind
5297 ;; For tests.
5298 cmocka))
5299 (inputs
5300 (list json-c
5301 libaio
5302 liburcu
5303 lvm2
5304 readline
5305 eudev))
5306 (synopsis "Access block devices through multiple paths")
5307 (description
5308 "This package provides the following binaries to drive the
5309Linux Device Mapper multipathing driver:
5310@enumerate
5311@item @command{multipath} - Device mapper target autoconfig.
5312@item @command{multipathd} - Multipath daemon.
5313@item @command{mpathpersist} - Manages SCSI persistent reservations on
5314@code{dm} multipath devices.
5315@item @command{kpartx} - Create device maps from partition tables.
5316@end enumerate")
5317 (license (list license:gpl2+ ;main distribution
5318 license:lgpl2.0+)))) ;libmpathcmd/mpath_cmd.h
5319
5320(define-public libaio
5321 (package
5322 (name "libaio")
5323 (version "0.3.112")
5324 (source (origin
5325 (method url-fetch)
5326 (uri (list
5327 (string-append "https://releases.pagure.org/libaio/"
5328 name "-" version ".tar.gz")))
5329 (sha256
5330 (base32
5331 "14mlqdapjqq1dhpkdgy5z83mvsaz36fcxca7a4z6hinmr7r6415b"))))
5332 (build-system gnu-build-system)
5333 (arguments
5334 (list #:make-flags
5335 #~(let ((target #$(%current-target-system)))
5336 ;; XXX TODO: Replace with simply #$OUTPUT on core-updates.
5337 (list (string-append "prefix=" #$(if (%current-target-system)
5338 #~#$output
5339 #~%output))
5340 (string-append
5341 "CC=" (if target
5342 (string-append (assoc-ref %build-inputs
5343 "cross-gcc")
5344 "/bin/" target "-gcc")
5345 "gcc"))))
5346 #:test-target "partcheck" ; need root for a full 'check'
5347 #:phases
5348 #~(modify-phases %standard-phases
5349 (delete 'configure) ; no configure script
5350 ;; TODO: Make this phase unconditional on core-updates.
5351 #$@(if (target-riscv64?)
5352 '((add-before 'check 'patch-for-riscv-support
5353 (lambda _
5354 ;; Taken from the upstream repo:
5355 ;; https://pagure.io/libaio/c/f322f467c3cd2ac4d8d08a19bd281eabb65433b1?branch=master
5356 (substitute* "harness/cases/16.t"
5357 (("(elif defined\\(__aarch64__\\))" all)
5358 (string-append all " || defined(__riscv)"))
5359 (("(endif /* __aarch64__)" all)
5360 (string-append all " || __riscv "))))))
5361 '()))))
5362 (home-page "https://pagure.io/libaio")
5363 (synopsis "Linux-native asynchronous I/O access library")
5364 (description
5365 "This library enables userspace to use Linux kernel asynchronous I/O
5366system calls, important for the performance of databases and other advanced
5367applications.")
5368 (license license:lgpl2.1+)))
5369
5370(define-public blktrace
5371 ;; Take a newer commit to get the fix for CVE-2018-10689.
5372 (let ((commit "db4f6340e04716285ea56fe26d76381c3adabe58")
5373 (revision "1"))
5374 (package
5375 (name "blktrace")
5376 (version (git-version "1.2.0" revision commit))
5377 (home-page
5378 "https://git.kernel.org/pub/scm/linux/kernel/git/axboe/blktrace.git")
5379 (source (origin
5380 (method git-fetch)
5381 (uri (git-reference
5382 (url home-page)
5383 (commit commit)))
5384 (sha256
5385 (base32 "0ah7xn4qnx09k6bm39p69av7d0c8cl6863drv6a1nf914sq1kpgp"))
5386 (file-name (git-file-name name version))))
5387 (build-system gnu-build-system)
5388 (arguments
5389 `(#:make-flags
5390 (list ,(string-append "CC=" (cc-for-target))
5391 (string-append "prefix=" %output))
5392 #:tests? #f ; no tests
5393 #:phases
5394 (modify-phases %standard-phases
5395 (delete 'configure) ; no configure script
5396 (add-after 'unpack 'fix-gnuplot-path
5397 (lambda* (#:key inputs #:allow-other-keys)
5398 (let ((gnuplot (assoc-ref inputs "gnuplot")))
5399 (substitute* "btt/bno_plot.py"
5400 (("gnuplot %s")
5401 (string-append gnuplot "/bin/gnuplot %s")))
5402 #t))))))
5403 (inputs
5404 `(("libaio" ,libaio)
5405 ("gnuplot" ,gnuplot)
5406 ("python" ,python-wrapper))) ;for 'bno_plot.py'
5407 (synopsis "Block layer IO tracing mechanism")
5408 (description "Blktrace is a block layer IO tracing mechanism which provides
5409detailed information about request queue operations to user space. It extracts
5410event traces from the kernel (via the relaying through the debug file system).")
5411 (license license:gpl2))))
5412
5413(define-public sbc
5414 (package
5415 (name "sbc")
5416 (version "1.5")
5417 (source (origin
5418 (method url-fetch)
5419 (uri (string-append "mirror://kernel.org/linux/bluetooth/sbc-"
5420 version ".tar.xz"))
5421 (patches (search-patches "sbc-fix-build-non-x86.patch"))
5422 (sha256
5423 (base32
5424 "1liig5856crb331dps18mp0s13zbkv7yh007zqhq97m94fcddfhc"))))
5425 (build-system gnu-build-system)
5426 (inputs
5427 (list libsndfile))
5428 (native-inputs
5429 (list pkg-config))
5430 (home-page "https://www.kernel.org/pub/linux/bluetooth/")
5431 (synopsis "Bluetooth subband audio codec")
5432 (description
5433 "The SBC is a digital audio encoder and decoder used to transfer data to
5434Bluetooth audio output devices like headphones or loudspeakers.")
5435 (license license:gpl2+)))
5436
5437(define-public bluez
5438 (package
5439 (name "bluez")
5440 (version "5.64")
5441 (source (origin
5442 (method url-fetch)
5443 (uri (string-append
5444 "mirror://kernel.org/linux/bluetooth/bluez-"
5445 version ".tar.xz"))
5446 (sha256
5447 (base32
5448 "0d6yl7l5zrlx5w3y503k72m9xsydx6gi1c65icchq1xknrjpwhxf"))))
5449 (build-system gnu-build-system)
5450 (arguments
5451 (list
5452 #:configure-flags
5453 #~(list "--sysconfdir=/etc"
5454 "--localstatedir=/var"
5455 "--enable-library"
5456 "--disable-systemd"
5457 ;; TODO: is this needed? Not installed by default since 5.55.
5458 "--enable-hid2hci"
5459 ;; Install dbus/udev files to the correct location.
5460 (string-append "--with-dbusconfdir=" #$output "/etc")
5461 (string-append "--with-udevdir=" #$output "/lib/udev"))
5462 #:phases
5463 #~(modify-phases %standard-phases
5464 ;; Test unit/test-gatt fails unpredictably. Seems to be a timing
5465 ;; issue (discussion on upstream mailing list:
5466 ;; https://marc.info/?t=149578476300002&r=1&w=2)
5467 (add-before 'check 'skip-wonky-test
5468 (lambda _
5469 (substitute* "unit/test-gatt.c"
5470 (("tester_init\\(&argc, &argv\\);") "return 77;"))))
5471 (add-after 'install 'post-install
5472 (lambda* (#:key inputs outputs #:allow-other-keys)
5473 (let* ((out #$output)
5474 (servicedir (string-append out "/share/dbus-1/services"))
5475 (service "obexd/src/org.bluez.obex.service")
5476 (rule (string-append
5477 out "/lib/udev/rules.d/97-hid2hci.rules")))
5478 ;; Install the obex dbus service file.
5479 (substitute* service
5480 (("/bin/false")
5481 (string-append out "/libexec/bluetooth/obexd")))
5482 (install-file service servicedir)
5483 ;; Fix paths in the udev rule.
5484 (substitute* rule
5485 (("hid2hci --method")
5486 (string-append out "/lib/udev/hid2hci --method"))
5487 (("/sbin/udevadm")
5488 (search-input-file inputs "/bin/udevadm")))))))))
5489 (native-inputs
5490 (list pkg-config python-docutils gettext-minimal))
5491 (inputs
5492 (list glib dbus eudev libical readline))
5493 (home-page "http://www.bluez.org/")
5494 (synopsis "Linux Bluetooth protocol stack")
5495 (description
5496 "BlueZ provides support for the core Bluetooth layers and protocols. It
5497is flexible, efficient and uses a modular implementation.")
5498 (license license:gpl2+)))
5499
5500(define-public fuse-exfat
5501 (package
5502 (name "fuse-exfat")
5503 (version "1.3.0")
5504 (source (origin
5505 (method url-fetch)
5506 (uri (string-append
5507 "https://github.com/relan/exfat/releases/download/v"
5508 version "/" name "-" version ".tar.gz"))
5509 (sha256
5510 (base32
5511 "1lz00q8g4590mrdqmf13ba1s9zrqq645ymgm5p9y99ad0qv22r87"))))
5512 (build-system gnu-build-system)
5513 (native-inputs
5514 (list pkg-config))
5515 (inputs
5516 (list fuse))
5517 (home-page "https://github.com/relan/exfat")
5518 (synopsis "Mount exFAT file systems")
5519 (description
5520 "This package provides a FUSE-based file system that provides read and
5521write access to exFAT devices.")
5522 (license license:gpl2+)))
5523
5524(define-public fuseiso
5525 (package
5526 (name "fuseiso")
5527 (version "20070708")
5528 (source (origin
5529 (method url-fetch)
5530 (uri (string-append "mirror://sourceforge/fuseiso/fuseiso/"
5531 version "/fuseiso-" version ".tar.bz2"))
5532 (sha256
5533 (base32
5534 "127xql52dcdhmh7s5m9xc6q39jdlj3zhbjar1j821kb6gl3jw94b"))))
5535 (build-system gnu-build-system)
5536 (native-inputs
5537 (list pkg-config))
5538 (inputs
5539 (list fuse glib zlib))
5540 (home-page "https://sourceforge.net/projects/fuseiso/")
5541 (synopsis "Mount ISO file system images")
5542 (description
5543 "FuseISO is a FUSE module to mount ISO file system images (.iso, .nrg,
5544.bin, .mdf and .img files). It supports plain ISO9660 Level 1 and 2, Rock
5545Ridge, Joliet, and zisofs.")
5546 (license license:gpl2)))
5547
5548(define-public gpm
5549 (package
5550 (name "gpm")
5551 (version "1.20.7")
5552 (source (origin
5553 (method url-fetch)
5554 (uri (string-append
5555 "https://www.nico.schottelius.org/software/gpm/archives/"
5556 "gpm-" version ".tar.bz2"))
5557 (patches (search-patches "gpm-glibc-2.26.patch"))
5558 (sha256
5559 (base32
5560 "13d426a8h403ckpc8zyf7s2p5rql0lqbg2bv0454x0pvgbfbf4gh"))
5561 (modules '((guix build utils)))
5562 (snippet
5563 '(begin
5564 ;; Take a patch from upstream to fix building with -fno-common,
5565 ;; which is default in GCC 10:
5566 ;; https://github.com/telmich/gpm/pull/37
5567 (substitute* "src/headers/daemon.h"
5568 (("^time_t[[:blank:]]+last_selection_time;")
5569 "extern time_t last_selection_time;"))))))
5570 (build-system gnu-build-system)
5571 (arguments
5572 '(#:phases (modify-phases %standard-phases
5573 (replace 'bootstrap
5574 (lambda _
5575 ;; The tarball was not generated with 'make dist' so we
5576 ;; need to bootstrap things ourselves.
5577 (substitute* "autogen.sh"
5578 (("/bin/sh") (which "sh")))
5579 (invoke "./autogen.sh")
5580 (patch-makefile-SHELL "Makefile.include.in")
5581 #t)))
5582
5583 ;; Make sure programs find libgpm.so.
5584 #:configure-flags (list (string-append "LDFLAGS=-Wl,-rpath="
5585 (assoc-ref %outputs "out")
5586 "/lib"))))
5587 (native-inputs
5588 (list texinfo
5589 bison
5590 flex
5591 autoconf
5592 automake
5593 libtool))
5594 (home-page "https://www.nico.schottelius.org/software/gpm/")
5595 (synopsis "Mouse support for the Linux console")
5596 (description
5597 "The GPM (general-purpose mouse) daemon is a mouse server for
5598applications running on the Linux console. It allows users to select items
5599and copy/paste text in the console and in xterm.")
5600 (license license:gpl2+)))
5601
5602(define-public btrfs-progs
5603 (package
5604 (name "btrfs-progs")
5605 (version "6.0.2")
5606 (source (origin
5607 (method url-fetch)
5608 (uri (string-append "mirror://kernel.org/linux/kernel/"
5609 "people/kdave/btrfs-progs/"
5610 "btrfs-progs-v" version ".tar.xz"))
5611 (sha256
5612 (base32
5613 "063hmqwqlmp0llgqnfqgcj7slrv762kmbk6srhrgqifr94q8crb6"))))
5614 (build-system gnu-build-system)
5615 (outputs '("out"
5616 "static")) ; static versions of the binaries in "out"
5617 (arguments
5618 '(#:configure-flags
5619 ;; The ‘Python support’ was never actually installed by previous
5620 ;; versions of this package, but did prevent cross-compilation.
5621 (list "--disable-python")
5622 #:phases (modify-phases %standard-phases
5623 (add-after 'unpack 'patch-makefile
5624 (lambda* (#:key outputs #:allow-other-keys)
5625 (substitute* "Makefile"
5626 (("\\$\\(DESTDIR\\)\\$\\(udevruledir\\)")
5627 (string-append (assoc-ref outputs "out")
5628 "/lib/udev/rules.d")))))
5629 (add-after 'build 'build-static
5630 (lambda _ (invoke "make" "static")))
5631 (add-after 'install 'install-bash-completion
5632 (lambda* (#:key outputs #:allow-other-keys)
5633 (let* ((out (assoc-ref outputs "out"))
5634 (bashcomp (string-append out "/etc/bash_completion.d")))
5635 (mkdir-p bashcomp)
5636 (copy-file "btrfs-completion"
5637 (string-append bashcomp "/btrfs")))))
5638 (add-after 'install 'install-static
5639 (let ((staticbin (string-append (assoc-ref %outputs "static")
5640 "/bin")))
5641 (lambda _
5642 (invoke "make"
5643 (string-append "bindir=" staticbin)
5644 "install-static")))))
5645 #:tests? #f ; XXX: require the 'btrfs' kernel module.
5646 #:test-target "test"
5647 #:parallel-tests? #f)) ; tests fail when run in parallel
5648 (inputs `(("e2fsprogs" ,e2fsprogs) ; for btrfs-convert
5649 ("eudev" ,eudev)
5650 ("lzo" ,lzo)
5651 ("util-linux:lib" ,util-linux "lib") ;for libblkid and libuuid
5652 ("util-linux:static" ,util-linux "static") ;ditto
5653 ("zlib" ,zlib)
5654 ("zlib:static" ,zlib "static")
5655 ("zstd" ,zstd "lib")
5656 ("zstd:static" ,zstd "static")))
5657 (native-inputs `(("pkg-config" ,pkg-config)
5658 ;; For building documentation.
5659 ("python-sphinx" ,python-sphinx)
5660 ;; For tests.
5661 ("acl" ,acl)
5662 ("dmsetup" ,lvm2)
5663 ("grep" ,grep) ; need Perl regexp support
5664 ("libaio" ,libaio)
5665 ("liburing" ,liburing)
5666 ("util-linux" ,util-linux) ; for fallocate
5667 ("which" ,which)))
5668 (home-page "https://btrfs.wiki.kernel.org/index.php/Main_Page")
5669 (synopsis "Create and manage btrfs copy-on-write file systems")
5670 (description "Btrfs is a @acronym{CoW, copy-on-write} file system for Linux
5671aimed at implementing advanced features while focusing on fault tolerance,
5672repair and easy administration.")
5673 ;; GPL2+: crc32.c, radix-tree.c, raid6.c, rbtree.c.
5674 ;; GPL2: Everything else.
5675 (license (list license:gpl2 license:gpl2+))))
5676
5677(define-public btrfs-progs/static
5678 (package
5679 (name "btrfs-progs-static")
5680 (version (package-version btrfs-progs))
5681 (source #f)
5682 (build-system trivial-build-system)
5683 (inputs
5684 `(("btrfs-progs:static" ,btrfs-progs "static")))
5685 (arguments
5686 `(#:modules ((guix build utils))
5687 #:builder
5688 (begin
5689 (use-modules (guix build utils)
5690 (ice-9 ftw)
5691 (srfi srfi-26))
5692
5693 (let* ((btrfs (assoc-ref %build-inputs "btrfs-progs:static"))
5694 (out (assoc-ref %outputs "out"))
5695 (source (string-append btrfs "/bin/btrfs.static"))
5696 (target (string-append out "/bin/btrfs")))
5697 (mkdir-p (dirname target))
5698 (copy-file source target)
5699 (remove-store-references target)
5700 (chmod target #o555)
5701 #t))))
5702 (home-page (package-home-page btrfs-progs))
5703 (synopsis "Statically-linked btrfs command from btrfs-progs")
5704 (description "This package provides the statically-linked @command{btrfs}
5705from the btrfs-progs package. It is meant to be used in initrds.")
5706 (license (package-license btrfs-progs))))
5707
5708(define-public cramfs-tools
5709 (package
5710 (name "cramfs-tools")
5711 (home-page "https://github.com/npitre/cramfs-tools")
5712 (version "2.1")
5713 (source (origin
5714 (method git-fetch)
5715 (uri (git-reference
5716 (url home-page)
5717 (commit (string-append "v" version))))
5718 (sha256
5719 (base32 "183rfqqyzx52q0vxicdgf0p984idh3rqkvzfb93gjvyzfhc15c0p"))
5720 (file-name (git-file-name name version))))
5721 (build-system gnu-build-system)
5722 (arguments
5723 '(#:tests? #f ; No tests.
5724 #:phases
5725 (modify-phases %standard-phases
5726 (delete 'configure)
5727 (replace 'install
5728 (lambda* (#:key outputs #:allow-other-keys)
5729 (let ((out (assoc-ref outputs "out")))
5730 (install-file "mkcramfs" (string-append out "/sbin"))
5731 (install-file "cramfsck" (string-append out "/sbin")))
5732 #t)))))
5733 (inputs
5734 (list zlib))
5735 (synopsis "Tools to manage Cramfs file systems")
5736 (description "Cramfs is a Linux file system designed to be simple, small,
5737and to compress things well. It is used on a number of embedded systems and
5738small devices. This version has additional features such as uncompressed
5739blocks and random block placement.")
5740 (license license:gpl2+)))
5741
5742(define-public compsize
5743 (package
5744 (name "compsize")
5745 (version "1.5")
5746 (home-page "https://github.com/kilobyte/compsize")
5747 (source (origin
5748 (method git-fetch)
5749 (uri (git-reference
5750 (url home-page)
5751 (commit (string-append "v" version))))
5752 (sha256
5753 (base32 "0vqnrwgpv6pc1yjl0g4gl71xyl6v0xl3pyqjanjpwps73c53azir"))
5754 (file-name (git-file-name name version))))
5755 (build-system gnu-build-system)
5756 (inputs
5757 (list btrfs-progs))
5758 (arguments
5759 `(#:tests? #f ; No tests.
5760 #:make-flags
5761 (list (string-append "CC=" ,(cc-for-target)))
5762 #:phases
5763 (modify-phases %standard-phases
5764 (delete 'configure)
5765 (replace 'install
5766 (lambda* (#:key outputs #:allow-other-keys)
5767 (let ((out (assoc-ref outputs "out")))
5768 (install-file "compsize" (string-append out "/bin"))
5769 (install-file "compsize.8" (string-append out "/share/man/man8"))))))))
5770 (synopsis "Find compression type/ratio on Btrfs files")
5771 (description "@command{compsize} takes a list of files (given as
5772arguments) on a Btrfs file system and measures used compression types and
5773effective compression ratio, producing a report.
5774
5775A directory has no extents but has a (recursive) list of files. A non-regular
5776file is silently ignored.
5777
5778As it makes no sense to talk about compression ratio of a partial extent,
5779every referenced extent is counted whole, exactly once -- no matter if you use
5780only a few bytes of a 1GB extent or reflink it a thousand times. Thus, the
5781uncompressed size will not match the number given by @command{tar} or
5782@command{du}. On the other hand, the space used should be accurate (although
5783obviously it can be shared with files outside our set).")
5784 (license license:gpl2+)))
5785
5786(define-public f2fs-tools-1.7
5787 (package
5788 (name "f2fs-tools")
5789 (version "1.7.0")
5790 (source (origin
5791 (method url-fetch)
5792 (uri (string-append
5793 "https://git.kernel.org/cgit/linux/kernel/git/jaegeuk"
5794 "/f2fs-tools.git/snapshot/f2fs-tools-" version ".tar.gz"))
5795 (sha256
5796 (base32
5797 "1m6bn1ibq0p53m0n97il91xqgjgn2pzlz74lb5bfzassx7159m1k"))))
5798
5799 (build-system gnu-build-system)
5800 (arguments
5801 `(#:configure-flags '("CFLAGS=-fcommon")
5802 #:phases
5803 (modify-phases %standard-phases
5804 (add-after 'install 'install-headers
5805 (lambda* (#:key outputs #:allow-other-keys)
5806 (let* ((out (assoc-ref outputs "out"))
5807 (out-include (string-append out "/include")))
5808 (install-file "include/f2fs_fs.h" out-include)
5809 (install-file "mkfs/f2fs_format_utils.h" out-include)
5810 #t))))))
5811 (native-inputs
5812 (list autoconf automake libtool pkg-config))
5813 (inputs
5814 `(("libuuid" ,util-linux "lib")
5815 ("libselinux" ,libselinux)))
5816 (home-page "https://f2fs.wiki.kernel.org/")
5817 (synopsis "Userland tools for f2fs")
5818 (description
5819 "F2FS, the Flash-Friendly File System, is a modern file system
5820designed to be fast and durable on flash devices such as solid-state
5821disks and SD cards. This package provides the userland utilities.")
5822 ;; The formatting utility, libf2fs and include/f2fs_fs.h is dual
5823 ;; GPL2/LGPL2.1, everything else is GPL2 only. See 'COPYING'.
5824 (license (list license:gpl2 license:lgpl2.1))))
5825
5826(define-public f2fs-tools
5827 (package
5828 (inherit f2fs-tools-1.7)
5829 (name "f2fs-tools")
5830 (version "1.14.0")
5831 (source (origin
5832 (method url-fetch)
5833 (uri (string-append
5834 "https://git.kernel.org/cgit/linux/kernel/git/jaegeuk"
5835 "/f2fs-tools.git/snapshot/f2fs-tools-" version ".tar.gz"))
5836 (sha256
5837 (base32
5838 "1lab1446c78xsjwhpki7s85z4171m8p9279c8yhm4882wba674k1"))))
5839 (inputs
5840 `(("libuuid" ,util-linux "lib")))))
5841
5842(define-public f2fs-tools/static
5843 (static-package
5844 (package
5845 (inherit f2fs-tools)
5846 (name "f2fs-tools-static")
5847 (arguments
5848 `(#:configure-flags
5849 (let ((libuuid-static (assoc-ref %build-inputs "libuuid:static"))
5850 (libuuid (assoc-ref %build-inputs "libuuid")))
5851 (list
5852 (string-append "libuuid_CFLAGS=-I" libuuid "/include/uuid")
5853 (string-append "libuuid_LIBS=-L" libuuid-static "/lib -luuid")
5854 (string-append "libblkid_CFLAGS=-I" libuuid "/include/uuid "
5855 "-I" libuuid "/include/blkid")
5856 (string-append "libblkid_LIBS=-L" libuuid-static "/lib -lblkid")))
5857 #:disallowed-references (,util-linux)
5858 #:phases
5859 (modify-phases %standard-phases ; TODO: f2fs phases.
5860 (add-after 'unpack 'make-static
5861 (lambda _
5862 (define (append-to-file name body)
5863 (let ((file (open-file name "a")))
5864 (display body file)
5865 (close-port file)))
5866 (append-to-file "mkfs/Makefile.am" "\nmkfs_f2fs_LDFLAGS = -all-static\n")
5867 (append-to-file "fsck/Makefile.am" "\nfsck_f2fs_LDFLAGS = -all-static\n")
5868 (append-to-file "tools/Makefile.am" "\nf2fscrypt_LDFLAGS = -all-static -luuid\n")
5869 #t))
5870 (add-after 'install 'remove-store-references
5871 (lambda* (#:key outputs #:allow-other-keys)
5872 ;; Work around bug in our util-linux.
5873 ;; <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=41019>.
5874 (remove-store-references (string-append (assoc-ref outputs "out")
5875 "/sbin/mkfs.f2fs"))
5876 #t)))))
5877 (inputs
5878 `(("libuuid:static" ,util-linux "static")
5879 ("libuuid" ,util-linux "lib")))))) ; for include files
5880
5881(define-public f2fs-fsck/static
5882 (package
5883 (name "f2fs-fsck-static")
5884 (version (package-version f2fs-tools/static))
5885 (source #f)
5886 (build-system trivial-build-system)
5887 (arguments
5888 `(#:modules ((guix build utils))
5889 #:builder
5890 (begin
5891 (use-modules (guix build utils)
5892 (ice-9 ftw)
5893 (srfi srfi-26))
5894 (let* ((f2fs-tools (assoc-ref %build-inputs "f2fs-tools-static"))
5895 (fsck "fsck.f2fs")
5896 (out (assoc-ref %outputs "out"))
5897 (sbin (string-append out "/sbin")))
5898 (mkdir-p sbin)
5899 (with-directory-excursion sbin
5900 (install-file (string-append f2fs-tools "/sbin/" fsck)
5901 ".")
5902 (remove-store-references fsck)
5903 (chmod fsck #o555))
5904 #t))))
5905 (inputs
5906 (list f2fs-tools/static))
5907 (home-page (package-home-page f2fs-tools/static))
5908 (synopsis "Statically-linked fsck.f2fs command from f2fs-tools")
5909 (description "This package provides statically-linked fsck.f2fs command taken
5910from the f2fs-tools package. It is meant to be used in initrds.")
5911 (license (package-license f2fs-tools/static))))
5912
5913(define-public freefall
5914 (package
5915 (name "freefall")
5916 (version (package-version linux-libre))
5917 (source (package-source linux-libre))
5918 (build-system gnu-build-system)
5919 (arguments
5920 '(#:phases (modify-phases %standard-phases
5921 (add-after 'unpack 'enter-subdirectory
5922 (lambda _
5923 (chdir "tools/laptop/freefall")
5924 #t))
5925 (delete 'configure)
5926 (add-before 'build 'increase-timeout
5927 (lambda _
5928 ;; The default of 2 seconds is too low: it assumes an
5929 ;; open lid and AC power without actually checking.
5930 (substitute* "freefall.c"
5931 (("alarm\\(2\\)") "alarm(5)"))
5932 #t)))
5933 #:make-flags (list (string-append "PREFIX="
5934 (assoc-ref %outputs "out"))
5935 "CC=gcc")
5936 #:tests? #f)) ;no tests
5937 (home-page (package-home-page linux-libre))
5938 (synopsis "Free-fall protection for spinning laptop hard drives")
5939 (description
5940 "Prevents shock damage to the internal spinning hard drive(s) of some
5941HP and Dell laptops. When sudden movement is detected, all input/output
5942operations on the drive are suspended and its heads are parked on the ramp,
5943where they are less likely to cause damage to the spinning disc. Requires a
5944drive that supports the ATA/ATAPI-7 IDLE IMMEDIATE command with unload
5945feature, and a laptop with an accelerometer. It has no effect on SSDs.")
5946 (license license:gpl2)))
5947
5948
5949(define-public nbfc-linux
5950 (let ((version "0.1.7")
5951 (commit "4c2b75e4a875459e86a9892319889ff945e9cadf")
5952 (revision "0"))
5953 (package
5954 (name "nbfc-linux")
5955 (version (git-version version revision commit))
5956 (source (origin
5957 (method git-fetch)
5958 (uri (git-reference
5959 (url "https://github.com/nbfc-linux/nbfc-linux")
5960 (commit commit)))
5961 (file-name (git-file-name name version))
5962 (sha256
5963 (base32
5964 "0mmyfaigrh3fd5v11a8p38km4m02qzsfx8yh72g0z405bzhqn5jk"))))
5965 (build-system gnu-build-system)
5966 (arguments
5967 `(#:make-flags (list (string-append "CC="
5968 ,(cc-for-target))
5969 (string-append "PREFIX="
5970 (assoc-ref %outputs "out")))
5971 #:tests? #f
5972 #:phases (modify-phases %standard-phases
5973 (delete 'configure))))
5974 (native-inputs (list pkg-config))
5975 (propagated-inputs (list python dmidecode))
5976 (synopsis "NoteBook FanControl ported to Linux")
5977 (description
5978 "This package provides a C port of NoteBook FanControl (NBFC), a fan
5979control service for notebooks. It provides the same utilities with the same
5980interfaces as the original NBFC, although the implementation differs.")
5981 (home-page "https://github.com/nbfc-linux/nbfc-linux")
5982 (license license:gpl3+))))
5983
5984(define-public thinkfan
5985 (package
5986 (name "thinkfan")
5987 (version "1.3.1")
5988 (source
5989 (origin
5990 (method git-fetch)
5991 (uri (git-reference
5992 (url "https://github.com/vmatare/thinkfan")
5993 (commit version)))
5994 (file-name (git-file-name name version))
5995 (sha256
5996 (base32 "07l7cxbsyvy7awa1zk0zxng60749idvsx3535iginhkqxfzij4b9"))))
5997 (build-system cmake-build-system)
5998 (arguments
5999 (list
6000 #:modules '((guix build cmake-build-system)
6001 (guix build utils)
6002 (srfi srfi-26))
6003 #:tests? #f ; no test target
6004 #:configure-flags
6005 ;; Enable reading temperatures from hard disks via S.M.A.R.T.
6006 ;; Upstream ‘defaults to OFF because libatasmart seems to be horribly
6007 ;; inefficient’.
6008 #~(list "-DUSE_ATASMART:BOOL=ON")
6009 #:phases
6010 #~(modify-phases %standard-phases
6011 (add-after 'unpack 'create-init-scripts
6012 ;; CMakeLists.txt relies on build-time symptoms of OpenRC and
6013 ;; systemd to patch and install their service files. Fake their
6014 ;; presence rather than duplicating the build system below. Leave
6015 ;; things like ‘/bin/kill’ because they're not worth a dependency.
6016 ;; The sysvinit needs manual patching, but since upstream doesn't
6017 ;; even provide the option to install it: don't.
6018 (lambda _
6019 (substitute* "CMakeLists.txt"
6020 (("pkg_check_modules\\((OPENRC|SYSTEMD) .*" _ package)
6021 (format #f "option(~a_FOUND \"Faked\" ON)\n" package))
6022 ;; That was easy! Now we just need to fix the destinations.
6023 (("/etc" directory)
6024 (string-append #$output directory))))))))
6025 (native-inputs
6026 (list pkg-config))
6027 (inputs
6028 (list libatasmart yaml-cpp))
6029 (home-page "https://github.com/vmatare/thinkfan")
6030 (synopsis "Simple fan control program")
6031 (description
6032 "Thinkfan is a simple fan control program. It reads temperatures,
6033checks them against configured limits and switches to appropriate (also
6034pre-configured) fan level. It requires a working @code{thinkpad_acpi} or any
6035other @code{hwmon} driver that enables temperature reading and fan control
6036from userspace.")
6037 (license license:gpl3+)))
6038
6039(define-public tpacpi-bat
6040 (package
6041 (name "tpacpi-bat")
6042 (version "3.1")
6043 (source
6044 (origin
6045 (method git-fetch)
6046 (uri (git-reference
6047 (url "https://github.com/teleshoes/tpacpi-bat")
6048 (commit (string-append "v" version))))
6049 (file-name (git-file-name name version))
6050 (sha256
6051 (base32 "0wbaz34z99gqx721alh5vmpxpj2yxg3x9m8jqyivfi1wfpwc2nd5"))))
6052 (build-system gnu-build-system)
6053 (arguments
6054 `(#:tests? #f ; no test target
6055 #:phases
6056 (modify-phases %standard-phases
6057 (add-after 'unpack 'refer-to-inputs
6058 (lambda _
6059 (substitute* "tpacpi-bat"
6060 (("cat ")
6061 (format #f "~a " (which "cat")))
6062 ;; tpacpi-bat modprobes the acpi_call kernel module if it's not
6063 ;; loaded. That's the administrator's prerogative; disable it.
6064 (("system \"(modprobe .*)\"" _ match)
6065 (format #f "die \"Please run ‘~a’ first.\\n\"" match)))
6066 #t))
6067 (delete 'configure) ; nothing to configure
6068 (delete 'build) ; nothing to build
6069 (replace 'install
6070 (lambda* (#:key outputs #:allow-other-keys)
6071 (let* ((out (assoc-ref outputs "out"))
6072 (bin (string-append out "/bin"))
6073 (doc (string-append out "/share/doc/" ,name "-" ,version)))
6074 (install-file "tpacpi-bat" bin)
6075
6076 ;; There's no man page. Install other forms of documentation.
6077 (for-each (lambda (file)
6078 (let ((target (string-append doc "/" file)))
6079 (mkdir-p (dirname target))
6080 (copy-recursively file target)))
6081 (list "battery_asl" "examples" "README.md"))
6082 #t))))))
6083 (inputs
6084 (list perl))
6085 (home-page "https://github.com/teleshoes/tpacpi-bat")
6086 (synopsis "ThinkPad battery charge controller")
6087 (description
6088 "Tpacpi-bat is a command-line interface to control battery charging on
6089@uref{https://github.com/teleshoes/tpacpi-bat/wiki/Supported-Hardware, Lenovo
6090ThinkPad models released after 2011}, starting with the xx20 series. It can
6091query and set the thresholds at which one or both batteries will start and stop
6092charging, inhibit charging batteries for a set period of time, or force them to
6093discharge when they otherwise would not.
6094
6095This tool merely exposes ACPI calls provided by the @code{acpi_call} Linux
6096kernel module provided by the @code{acpi-call-linux-module} package, which must
6097be installed and loaded separately. Only the original vendor firmware is
6098supported.")
6099 (license license:gpl3+)))
6100
6101(define-public tmon
6102 (package
6103 (name "tmon")
6104 ;; Tmon's ‘VERSION = 1.0’ hasn't been touched since 2013; the code has.
6105 (version (package-version linux-libre))
6106 (source (package-source linux-libre))
6107 (build-system gnu-build-system)
6108 (arguments
6109 `(#:tests? #f ; no test suite
6110 #:make-flags
6111 (list (string-append "CC=" ,(cc-for-target))
6112 (string-append "INSTALL_ROOT=" (assoc-ref %outputs "out"))
6113 "BINDIR=bin")
6114 #:phases
6115 (modify-phases %standard-phases
6116 (add-after 'unpack 'enter-subdirectory
6117 (lambda _
6118 (chdir "tools/thermal/tmon")
6119 #t))
6120 (add-after 'install 'install-man-page
6121 (lambda* (#:key outputs #:allow-other-keys)
6122 (let* ((out (assoc-ref outputs "out"))
6123 (man8 (string-append out "/share/man/man8")))
6124 (install-file "tmon.8" man8)
6125 #t)))
6126 (delete 'configure)))) ; no configure script
6127 (inputs
6128 (list ncurses))
6129 (home-page (package-home-page linux-libre))
6130 (synopsis "Monitor and test the Linux thermal subsystem in real time")
6131 (description
6132 "Tmon is a tool to interact with the complex thermal subsystem of the
6133kernel Linux. It helps visualize thermal relationships and real-time thermal
6134data, tune and test cooling devices and sensors, and collect thermal data for
6135further analysis.
6136
6137As computers become smaller and more thermally constrained, more sensors are
6138added and new cooling capabilities introduced. Thermal relationships can change
6139dynamically. Their complexity grows exponentially among cooling devices, zones,
6140sensors, and trip points.
6141
6142Linux exposes this relationship through @file{/sys/class/thermal} with a matrix
6143of symbolic links, trip point bindings, and device instances. To traverse it
6144by hand is no trivial task: @command{tmon} aims to make it understandable.")
6145 (license (list license:gpl2 ; the man page
6146 license:gpl2+)))) ; the actual rest
6147
6148(define-public turbostat
6149 (package
6150 (name "turbostat")
6151 ;; XXX turbostat reports a version like ‘20.09.30’ but using it here would
6152 ;; make it harder to benefit from ‘free’ linux-libre package updates.
6153 (version (package-version linux-libre))
6154 (source (package-source linux-libre))
6155 (build-system gnu-build-system)
6156 (arguments
6157 `(#:tests? #f ; no test suite
6158 #:make-flags
6159 (list (string-append "CC=" ,(cc-for-target))
6160 (string-append "PREFIX=" (assoc-ref %outputs "out")))
6161 #:phases
6162 (modify-phases %standard-phases
6163 (add-after 'unpack 'enter-subdirectory
6164 (lambda _
6165 (chdir "tools/power/x86/turbostat")
6166 #t))
6167 (delete 'configure)))) ; no configure script
6168 (inputs
6169 (list libcap))
6170 (supported-systems '("i686-linux" "x86_64-linux"))
6171 (home-page (package-home-page linux-libre))
6172 (synopsis "Report x86 processor frequency and idle statistics")
6173 (description
6174 "Turbostat reports x86 processor topology, frequency, idle power state
6175statistics, temperature, and power consumption. Some information is unavailable
6176on older processors.
6177
6178It can be used to identify machines that are inefficient in terms of power usage
6179or idle time, report the rate of @acronym{SMI, system management interrupt}s
6180occurring on the system, or verify the effects of power management tuning.
6181
6182@command{turbostat} reads hardware counters but doesn't write to them, so it
6183won't interfere with the OS or other running processes---including multiple
6184invocations of itself.")
6185 (license license:gpl2)))
6186
6187(define-public ntfs-3g
6188 (package
6189 (name "ntfs-3g")
6190 (version "2022.10.3")
6191 (source (origin
6192 (method url-fetch)
6193 (uri (string-append "https://tuxera.com/opensource/"
6194 "ntfs-3g_ntfsprogs-" version ".tgz"))
6195 (sha256
6196 (base32
6197 "030pakw3h1z6p8phdbyb0hw0bb868znvrri96rg88jq7d3p3c3pj"))
6198 (modules '((guix build utils)))
6199 (snippet '(begin
6200 ;; Install under $prefix.
6201 (substitute* '("src/Makefile.in" "ntfsprogs/Makefile.in")
6202 (("/sbin")
6203 "@sbindir@"))))))
6204 (build-system gnu-build-system)
6205 (inputs (list util-linux ; libuuid
6206 fuse))
6207 (native-inputs (list pkg-config))
6208 (arguments
6209 '(#:configure-flags (list "--disable-static"
6210 "--disable-ldconfig" ;not necessary
6211 "--exec-prefix=${prefix}"
6212 "--with-fuse=external" ;use our own FUSE
6213 "--enable-mount-helper"
6214 "--enable-posix-acls"
6215 "--enable-xattr-mappings")
6216 #:phases
6217 (modify-phases %standard-phases
6218 ;; If users install ntfs-3g, they probably want to make it the
6219 ;; default driver as well, so we opt for sensible defaults and link
6220 ;; mount.ntfs to mount.ntfs-3g. (libmount tries to run mount.ntfs to
6221 ;; mount NTFS file systems.)
6222 (add-after 'install 'install-link
6223 (lambda* (#:key outputs #:allow-other-keys)
6224 (let* ((out (assoc-ref outputs "out"))
6225 (sbin (string-append out "/sbin")))
6226 (symlink "mount.ntfs-3g"
6227 (string-append sbin "/mount.ntfs"))))))))
6228 (home-page "https://www.tuxera.com/community/open-source-ntfs-3g/")
6229 (synopsis "Read-write access to NTFS file systems")
6230 (description
6231 "NTFS-3G provides read-write access to NTFS file systems, which are
6232commonly found on Microsoft Windows. It is implemented as a FUSE file system.
6233The package provides additional NTFS tools.")
6234 (properties
6235 '((release-monitoring-url . "https://github.com/tuxera/ntfs-3g/releases")
6236 (upstream-name . "ntfs-3g_ntfsprogs")))
6237 (license license:gpl2+)))
6238
6239(define-public ntfs-3g/static
6240 (static-package
6241 (package
6242 (inherit ntfs-3g)
6243 (name "ntfs-3g-static")
6244 (arguments
6245 (substitute-keyword-arguments (package-arguments ntfs-3g)
6246 ((#:configure-flags flags)
6247 `(append ,flags
6248 (list "--enable-really-static"
6249 ;; The FUSE driver isn't currently used by our initrd.
6250 "--disable-ntfs-3g")))
6251 ((#:phases phases)
6252 `(modify-phases ,phases
6253 (add-after 'unpack 'make-really-static-really-static
6254 (lambda _
6255 (substitute* "ntfsprogs/Makefile.in"
6256 ((" -static") " -all-static"))))
6257 (delete 'install-link))))))))
6258
6259(define-public ntfsfix/static
6260 (package
6261 (name "ntfsfix-static")
6262 (version (package-version ntfs-3g/static))
6263 (source #f)
6264 (build-system trivial-build-system)
6265 (arguments
6266 `(#:modules ((guix build utils))
6267 #:builder
6268 (begin
6269 (use-modules (guix build utils))
6270 (let* ((ntfs-3g (assoc-ref %build-inputs "ntfs-3g"))
6271 (out (assoc-ref %outputs "out"))
6272 (bin (string-append out "/bin")))
6273 (install-file (string-append ntfs-3g "/bin/ntfsfix") bin)
6274 (with-directory-excursion bin
6275 (remove-store-references "ntfsfix"))))))
6276 (inputs
6277 `(("ntfs-3g" ,ntfs-3g/static)))
6278 (home-page (package-home-page ntfs-3g/static))
6279 (synopsis "Statically linked @command{ntfsfix} from ntfs-3g")
6280 (description
6281 "This package provides a statically linked @command{ntfsfix} taken
6282from the ntfs-3g package. It is meant to be used in initrds.")
6283 (license (package-license ntfs-3g/static))))
6284
6285(define-public rdma-core
6286 (package
6287 (name "rdma-core")
6288 (version "33.1")
6289 (source (origin
6290 (method url-fetch)
6291 (uri (string-append "https://github.com/linux-rdma/rdma-core"
6292 "/releases/download/v" version "/rdma-core-"
6293 version ".tar.gz"))
6294 (sha256
6295 (base32
6296 "1rah0v9gq9rksqd2c17nmydsxcjz178n7m2y4ricwlf5pq1b2yfi"))))
6297 (build-system cmake-build-system)
6298 (arguments
6299 `(#:tests? #f ; no tests
6300 ;; Upstream uses the "ninja" build system and encourage distros
6301 ;; to do the same for consistency.
6302 #:configure-flags (list "-GNinja"
6303
6304 ,@(if (%current-target-system)
6305 `((string-append
6306 "-DPKG_CONFIG_EXECUTABLE="
6307 (search-input-file
6308 %build-inputs
6309 (string-append "/bin/"
6310 ,(pkg-config-for-target)))))
6311 '())
6312 (string-append "-DRST2MAN_EXECUTABLE="
6313 (assoc-ref %build-inputs
6314 "python-docutils")
6315 "/bin/rst2man.py"))
6316 #:phases
6317 (modify-phases %standard-phases
6318 (replace 'build
6319 (lambda _
6320 (invoke "ninja"
6321 "-j" (number->string (parallel-job-count)))))
6322 (replace 'install
6323 (lambda _
6324 (invoke "ninja" "install"))))))
6325 (native-inputs
6326 `(("ninja" ,ninja)
6327 ("pkg-config" ,pkg-config)
6328 ("python" ,python-wrapper)
6329 ("python-docutils" ,python-docutils))) ;for 'rst2man'
6330 (inputs
6331 `(("libnl" ,libnl)
6332 ("udev" ,eudev)))
6333 (home-page "https://github.com/linux-rdma/rdma-core")
6334 (synopsis "Utilities and libraries for working with RDMA devices")
6335 (description
6336 "This package provides userspace components for the InfiniBand
6337subsystem of the Linux kernel. Specifically it contains userspace
6338libraries for the following device nodes:
6339
6340@enumerate
6341@item @file{/dev/infiniband/uverbsX} (@code{libibverbs})
6342@item @file{/dev/infiniband/rdma_cm} (@code{librdmacm})
6343@item @file{/dev/infiniband/umadX} (@code{libibumad})
6344@end enumerate
6345
6346The following service daemons are also provided:
6347@enumerate
6348@item @code{srp_daemon} (for the @code{ib_srp} kernel module)
6349@item @code{iwpmd} (for iWARP kernel providers)
6350@item @code{ibacm} (for InfiniBand communication management assistant)
6351@end enumerate")
6352 ;; All library code is dual licensed under GPL2 and a custom MIT
6353 ;; variant. The package also includes some components covered by
6354 ;; other licenses. Consult COPYING.md for full details.
6355 (license
6356 (list license:gpl2
6357 (license:x11-style "See COPYING.BSD_MIT in the distribution")
6358 license:bsd-2 ; Files referring to COPYING.BSD_FB
6359 license:cc0 ; most files in ccan/
6360 license:bsd-3)))) ; providers/hfi1verbs are dual GPL2/BSD-3
6361
6362(define-public perftest
6363 (package
6364 (name "perftest")
6365 (version "4.4-0.4")
6366 (source
6367 (origin
6368 (method url-fetch)
6369 (uri (string-append "https://github.com/linux-rdma/perftest/releases/download/v"
6370 version "/perftest-" version ".g0927198.tar.gz"))
6371 (sha256
6372 (base32 "11ix4h0rrmqqyi84y55a9xnkvwsmwq0sywr46hvxzm4rqz4ma8vq"))))
6373 (build-system gnu-build-system)
6374 (arguments
6375 `(#:phases
6376 (modify-phases %standard-phases
6377 (add-after 'unpack 'patch-header-paths
6378 (lambda _
6379 (substitute* '("src/raw_ethernet_fs_rate.c"
6380 "src/raw_ethernet_resources.c"
6381 "src/raw_ethernet_resources.h"
6382 "src/raw_ethernet_send_burst_lat.c"
6383 "src/raw_ethernet_send_bw.c"
6384 "src/raw_ethernet_send_lat.c")
6385 (("/usr/include/netinet/ip.h") "netinet/ip.h"))
6386 #t)))))
6387 (inputs (list rdma-core))
6388 (home-page "https://github.com/linux-rdma/perftest/")
6389 (synopsis "Open Fabrics Enterprise Distribution (OFED) Performance Tests")
6390 (description "This is a collection of tests written over uverbs intended for
6391use as a performance micro-benchmark. The tests may be used for hardware or
6392software tuning as well as for functional testing.
6393
6394The collection contains a set of bandwidth and latency benchmark such as:
6395@enumerate
6396@item Send - @code{ib_send_bw} and @code{ib_send_lat}
6397@item RDMA Read - @code{ib_read_bw} and @code{ib_read_lat}
6398@item RDMA Write - @code{ib_write_bw} and @code{ib_wriet_lat}
6399@item RDMA Atomic - @code{ib_atomic_bw} and @code{ib_atomic_lat}
6400@item Native Ethernet (when working with MOFED2) - @code{raw_ethernet_bw}, @code{raw_ethernet_lat}
6401@end enumerate")
6402 (license license:gpl2)))
6403
6404(define-public rng-tools
6405 (package
6406 (name "rng-tools")
6407 (home-page "https://github.com/nhorman/rng-tools")
6408 (version "6.15")
6409 (source (origin
6410 (method git-fetch)
6411 (uri (git-reference (url home-page)
6412 (commit (string-append "v" version))))
6413 (file-name (git-file-name name version))
6414 (sha256
6415 (base32
6416 "0i00if7xknpm0dhkrm60rxzyyvq0vdibq7dvsd2ncm9pg098qvwj"))))
6417 (build-system gnu-build-system)
6418 (arguments
6419 `(;; Disable support for various hardware entropy sources as they need
6420 ;; dependencies that are not yet in Guix, and would significantly
6421 ;; increase closure size.
6422 #:configure-flags '("--without-nistbeacon"
6423 "--without-pkcs11"
6424 "--without-rtlsdr")
6425 #:phases
6426 (modify-phases %standard-phases
6427 (add-before 'check 'disable-failing-test
6428 (lambda _
6429 (substitute* "tests/Makefile"
6430 ;; This test requires a hwrng, rdrand, or tpm device.
6431 ;; Worse, it appears to fail if that isn't sufficiently random.
6432 (("\\brngtestjitter\\.sh\\b") " ")))))))
6433 (native-inputs
6434 (list autoconf automake pkg-config))
6435 (inputs
6436 (list sysfsutils openssl))
6437 (synopsis "Random number generator daemon")
6438 (description
6439 "Monitor a hardware random number generator, and supply entropy
6440from that to the system kernel's @file{/dev/random} machinery.")
6441 ;; The source package is offered under the GPL2+, but the files
6442 ;; 'rngd_rdrand.c' and 'rdrand_asm.S' are only available under the GPL2.
6443 (license (list license:gpl2 license:gpl2+))))
6444
6445(define-public cpupower
6446 (package
6447 (name "cpupower")
6448 (version (package-version linux-libre))
6449 (source (package-source linux-libre))
6450 (build-system gnu-build-system)
6451 (arguments
6452 (list #:make-flags
6453 #~(list (string-append "DESTDIR=" #$output)
6454 (string-append "LDFLAGS=-Wl,-rpath=" #$output "/lib")
6455 "libdir=/lib"
6456 "docdir=/share/doc/cpupower"
6457 "confdir=$(docdir)/examples"
6458 ;; The Makefile recommends the following changes
6459 "DEBUG=false"
6460 "[email protected]")
6461 #:tests? #f ; no tests
6462 #:phases
6463 #~(modify-phases %standard-phases
6464 (add-after 'unpack 'enter-subdirectory
6465 (lambda _
6466 (chdir "tools/power/cpupower")))
6467 (delete 'configure) ; no configure script
6468 (add-before 'build 'fix-makefiles
6469 (lambda _
6470 (substitute* "Makefile"
6471 (("/usr/") "/")
6472 (("/bin/(install|pwd)" _ command) command))
6473 (substitute* "bench/Makefile"
6474 (("\\$\\(CC\\) -o") "$(CC) $(LDFLAGS) -o")))))))
6475 (native-inputs (list gettext-minimal))
6476 (inputs (list pciutils))
6477 (home-page (package-home-page linux-libre))
6478 (synopsis "CPU frequency and voltage scaling tools for Linux")
6479 (description
6480 "cpupower is a set of user-space tools that use the cpufreq feature of the
6481Linux kernel to retrieve and control processor features related to power saving,
6482such as frequency and voltage scaling.")
6483 (license license:gpl2)))
6484
6485(define-public x86-energy-perf-policy
6486 (package
6487 (name "x86-energy-perf-policy")
6488 (version (package-version linux-libre))
6489 (source (package-source linux-libre))
6490 (build-system gnu-build-system)
6491 (arguments
6492 '(#:tests? #f
6493 #:phases
6494 (modify-phases %standard-phases
6495 (add-after 'unpack 'enter-subdirectory
6496 (lambda _
6497 (chdir "tools/power/x86/x86_energy_perf_policy")
6498 #t))
6499 (delete 'configure)
6500 (add-before 'build 'fix-makefile
6501 (lambda _
6502 (substitute* "Makefile" (("/usr") ""))
6503 #t)))
6504 #:make-flags
6505 (let ((out (assoc-ref %outputs "out")))
6506 (list (string-append "DESTDIR=" out)
6507 (string-append "LDFLAGS=-Wl,-rpath=" out "/lib")))))
6508 (supported-systems '("i686-linux" "x86_64-linux"))
6509 (home-page (package-home-page linux-libre))
6510 (synopsis "Display and update Intel-CPU energy-performance policy")
6511 (description
6512 "@command{x86_energy_perf_policy} displays and updates energy-performance
6513policy settings specific to Intel Architecture Processors. Settings are
6514accessed via Model Specific Register (MSR) updates, no matter if the Linux
6515cpufreq sub-system is enabled or not.")
6516 (license license:gpl2)))
6517
6518(define-public haveged
6519 (package
6520 (name "haveged")
6521 (version "1.9.18")
6522 (source
6523 (origin
6524 (method git-fetch)
6525 (uri (git-reference
6526 (url "https://github.com/jirka-h/haveged")
6527 (commit (string-append "v" version))))
6528 (file-name (git-file-name name version))
6529 (sha256
6530 (base32 "1y1p3qhjzhpgd20xz5ffms3w1bdvpk883y38ydwsmp9mc0kzy8kz"))))
6531 (build-system gnu-build-system)
6532 (arguments
6533 `(#:configure-flags
6534 (list "--disable-static")))
6535 (home-page "https://www.issihosts.com/haveged")
6536 (synopsis "Entropy source for the Linux random number generator")
6537 (description
6538 "haveged generates an unpredictable stream of random numbers for use by
6539Linux's @file{/dev/random} and @file{/dev/urandom} devices. The kernel's
6540standard mechanisms for filling the entropy pool may not be sufficient for
6541systems with high needs or limited user interaction, such as headless servers.
6542
6543@command{haveged} runs as a privileged daemon, harvesting randomness from the
6544indirect effects of hardware events on hidden processor state using the
6545@acronym{HAVEGE, HArdware Volatile Entropy Gathering and Expansion} algorithm.
6546It tunes itself to its environment and provides the same built-in test suite
6547for the output stream as used on certified hardware security devices.
6548
6549The quality of the randomness produced by this algorithm has not been proven.
6550It is recommended to run it together with another entropy source like rngd, and
6551not as a replacement for it.")
6552 (license (list (license:non-copyleft "file://nist/mconf.h")
6553 (license:non-copyleft "file://nist/packtest.c")
6554 license:public-domain ; nist/dfft.c
6555 license:gpl3+)))) ; everything else
6556
6557(define-public ecryptfs-utils
6558 (package
6559 (name "ecryptfs-utils")
6560 (version "111")
6561 (source
6562 (origin
6563 (method url-fetch)
6564 (uri (string-append "https://launchpad.net/ecryptfs/trunk/"
6565 version "/+download/ecryptfs-utils_"
6566 version ".orig.tar.gz"))
6567 (sha256
6568 (base32
6569 "0zwq19siiwf09h7lwa7n7mgmrr8cxifp45lmwgcfr8c1gviv6b0i"))))
6570 (build-system gnu-build-system)
6571 (arguments
6572 `(#:configure-flags (list "--disable-pywrap")
6573 #:phases
6574 (modify-phases %standard-phases
6575 (add-after 'patch-source-shebangs 'patch-hardcoded-paths
6576 (lambda* (#:key inputs outputs #:allow-other-keys)
6577 (let ((out (assoc-ref outputs "out"))
6578 (utils-linux (assoc-ref inputs "utils-linux"))
6579 (cryptsetup (assoc-ref inputs "cryptsetup"))
6580 (linux-pam (assoc-ref inputs "linux-pam"))
6581 (lvm2 (assoc-ref inputs "lvm2")))
6582 (substitute* '("src/utils/ecryptfs-mount-private"
6583 "src/utils/ecryptfs-umount-private"
6584 "src/utils/ecryptfs-setup-private"
6585 "src/utils/ecryptfs-setup-swap"
6586 "src/utils/mount.ecryptfs.c"
6587 "src/utils/umount.ecryptfs.c"
6588 "src/pam_ecryptfs/pam_ecryptfs.c"
6589 "src/desktop/ecryptfs-mount-private.desktop.in"
6590 "src/desktop/ecryptfs-setup-private.desktop.in")
6591 (("/bin/mount")
6592 (string-append utils-linux "/bin/mount"))
6593 (("/bin/umount")
6594 (string-append utils-linux "/bin/umount"))
6595 (("/sbin/mount.ecryptfs_private")
6596 (string-append out "/sbin/mount.ecryptfs_private"))
6597 (("/sbin/umount.ecryptfs_private")
6598 (string-append out "/sbin/umount.ecryptfs_private"))
6599 (("/usr/bin/ecryptfs-mount-private")
6600 (string-append out "/bin/ecryptfs-mount-private"))
6601 (("/usr/bin/ecryptfs-rewrite-file")
6602 (string-append out "/bin/ecryptfs-rewrite-file"))
6603 (("/usr/bin/ecryptfs-setup-private")
6604 (string-append out "/bin/ecryptfs-setup-private"))
6605 (("/sbin/cryptsetup")
6606 (string-append cryptsetup "/sbin/cryptsetup"))
6607 (("/sbin/unix_chkpwd")
6608 (string-append linux-pam "/sbin/unix_chkpwd"))
6609 (("/sbin/dmsetup")
6610 (string-append lvm2 "/sbin/dmsetup")))))))))
6611 (native-inputs
6612 (list intltool perl ; for pod2man
6613 pkg-config))
6614 (inputs
6615 `(("keyutils" ,keyutils)
6616 ("linux-pam" ,linux-pam)
6617 ("utils-linux" ,util-linux)
6618 ("cryptsetup" ,cryptsetup)
6619 ("lvm2" ,lvm2)
6620 ("nss" ,nss)))
6621 (home-page "https://ecryptfs.org/")
6622 (synopsis "eCryptfs cryptographic file system utilities")
6623 (description
6624 "eCryptfs is a POSIX-compliant stacked cryptographic file system for Linux.
6625Each file's cryptographic meta-data is stored inside the file itself, along
6626with the encrypted contents. This allows individual encrypted files to be
6627copied between hosts and still be decrypted with the proper key. eCryptfs is a
6628native Linux file system, and has been part of the Linux kernel since version
66292.6.19. This package contains the userland utilities to manage it.")
6630 ;; The files src/key_mod/ecryptfs_key_mod_{openssl,pkcs11_helper,tspi}.c
6631 ;; grant additional permission to link with OpenSSL.
6632 (license license:gpl2+)))
6633
6634(define-public libnfsidmap
6635 (package
6636 (name "libnfsidmap")
6637 (version "0.27")
6638 (source
6639 (origin
6640 (method url-fetch)
6641 (uri (string-append "https://fedorapeople.org/~steved/"
6642 name "/" version "/" name "-" version ".tar.bz2"))
6643 (sha256
6644 (base32 "0bg2bcii424mf1bnp3fssr8jszbvhdxl7wvifm1yf6g596v8b8i5"))))
6645 (build-system gnu-build-system)
6646 (arguments
6647 `(#:configure-flags (list
6648 (string-append "--with-pluginpath="
6649 (assoc-ref %outputs "out")
6650 "/lib/libnfsidmap"))))
6651 (native-inputs
6652 (list autoconf)) ; 0.27 still needs autoheader
6653 (home-page
6654 "http://www.citi.umich.edu/projects/nfsv4/crossrealm/libnfsidmap_config.html")
6655 (synopsis "NFSv4 support library for name/ID mapping")
6656 (description "Libnfsidmap is a library holding mulitiple methods of
6657mapping names to ids and visa versa, mainly for NFSv4. It provides an
6658extensible array of mapping functions, currently consisting of two choices:
6659the default @code{nsswitch} and the experimental @code{umich_ldap}.")
6660 (license (license:non-copyleft "file://COPYING"
6661 "See COPYING in the distribution."))))
6662
6663(define-public module-init-tools
6664 (package
6665 (name "module-init-tools")
6666 (version "3.16")
6667 (source (origin
6668 (method url-fetch)
6669 (uri (string-append
6670 "mirror://kernel.org/linux/utils/kernel/module-init-tools/"
6671 "module-init-tools-" version ".tar.bz2"))
6672 (sha256
6673 (base32
6674 "0jxnz9ahfic79rp93l5wxcbgh4pkv85mwnjlbv1gz3jawv5cvwp1"))
6675 (patches (search-patches "module-init-tools-moduledir.patch"))))
6676 (build-system gnu-build-system)
6677 (arguments
6678 ;; FIXME: The upstream tarball lacks man pages, and building them would
6679 ;; require DocBook & co. We used to use Gentoo's pre-built man pages,
6680 ;; but they vanished. In the meantime, fake it.
6681 '(#:phases
6682 (modify-phases %standard-phases
6683 (add-before 'configure 'fake-docbook
6684 (lambda _
6685 (substitute* "Makefile.in"
6686 (("^DOCBOOKTOMAN.*$")
6687 "DOCBOOKTOMAN = true\n"))
6688 #t)))))
6689 (home-page "https://www.kernel.org/pub/linux/utils/kernel/module-init-tools/")
6690 (synopsis "Tools for loading and managing Linux kernel modules")
6691 (description
6692 "Tools for loading and managing Linux kernel modules, such as
6693@code{modprobe}, @code{insmod}, @code{lsmod}, and more.")
6694 (license license:gpl2+)))
6695
6696(define-public mce-inject
6697 (let ((revision "0") ; no git tags :-/
6698 (commit "4cbe46321b4a81365ff3aafafe63967264dbfec5"))
6699 (package
6700 (name "mce-inject")
6701 (version (git-version "0.0.0" revision commit))
6702 (source
6703 (origin
6704 (method git-fetch)
6705 (uri (git-reference
6706 (url "https://git.kernel.org/pub/scm/utils/cpu/mce/mce-inject.git")
6707 (commit commit)))
6708 (file-name (git-file-name name version))
6709 (sha256
6710 (base32 "0gjapg2hrlxp8ssrnhvc19i3r1xpcnql7xv0zjgbv09zyha08g6z"))))
6711 (build-system gnu-build-system)
6712 (arguments
6713 ;; There is no test suite. There's a test/ directory, but it just holds
6714 ;; example text files you could feed to the programme to crash something.
6715 (list #:tests? #f
6716 #:make-flags
6717 #~(list (string-append "prefix=" #$output)
6718 (string-append "CC=" #$(cc-for-target)))
6719 #:phases
6720 #~(modify-phases %standard-phases
6721 (delete 'configure) ; no configure script
6722 (add-after 'install 'install-examples
6723 (lambda* (#:key outputs #:allow-other-keys)
6724 (let* ((out (assoc-ref outputs "out"))
6725 (doc (string-append out "/share/doc/" #$name))
6726 (dir (string-append doc "/examples")))
6727 (copy-recursively "test" dir )))))))
6728 (native-inputs
6729 (list bison flex))
6730 (supported-systems (list "i686-linux" "x86_64-linux"))
6731 (home-page
6732 "https://git.kernel.org/pub/scm/utils/cpu/mce/mce-inject.git/about/")
6733 (synopsis
6734 "Inject x86 @acronym{MCEs, machine-check exceptions} into Linux")
6735 (description
6736 "This simple tool injects fake @acronym{MCEs, machine-check exceptions}
6737into a running Linux kernel, to debug or test the kernel's @acronym{EDAC, error
6738detection and correction}-handling code specific to x86 and x86_64 platforms.
6739
6740Real MCEs are internal CPU errors. Handling them correctly can be important to
6741system stability and even prevent physical damage. In contrast, simulated MCEs
6742produced by @command{mce-inject} are purely synthetic: injection happens only at
6743the software level, inside the kernel, and is not visible to the platform
6744hardware or firmware.
6745
6746A convenient feature of @command{mce-inject} is that the input language used to
6747describe MCEs is similar to the format used in Linux panic messages, with a few
6748extensions. In general, you should be able to pipe in any logged MCE panic to
6749simulate that same MCE.
6750
6751The target kernel must have the @code{CONFIG_X86_MCE_INJECT} option enabled and
6752the @code{mce-inject} module loaded if it exists.")
6753 (license license:gpl2))))
6754
6755(define-public mcelog
6756 (package
6757 (name "mcelog")
6758 (version "189")
6759 (source
6760 (origin
6761 (method git-fetch)
6762 (uri (git-reference
6763 (url "https://git.kernel.org/pub/scm/utils/cpu/mce/mcelog.git")
6764 (commit (string-append "v" version))))
6765 (file-name (git-file-name name version))
6766 (sha256
6767 (base32 "0ml12xmmmljp22a89fw23c6gmba4dngavgnisv665w67kbnv5085"))
6768 (modules '((guix build utils)))
6769 (snippet
6770 `(begin
6771 ;; The checkout lacks a .git directory, breaking ‘git describe’.
6772 (substitute* "Makefile"
6773 (("\"unknown\"") (string-append "\"v" ,version "\"")))))))
6774 (build-system gnu-build-system)
6775 (arguments
6776 (list
6777 ;; The tests will only run as root on certain supported CPU models.
6778 #:tests? #f
6779 #:make-flags
6780 #~(list (string-append "CC=" #$(cc-for-target))
6781 (string-append "prefix=" #$output)
6782 (string-append "DOCDIR=" #$output "/share/doc/"
6783 #$name "-" #$version)
6784 "etcprefix=$(DOCDIR)/examples")
6785 #:phases
6786 #~(modify-phases %standard-phases
6787 (delete 'configure)))) ; no configure script
6788 (native-inputs
6789 (list python-wrapper)) ; to generate example mcelog.conf
6790 (supported-systems (list "i686-linux" "x86_64-linux"))
6791 (home-page "https://mcelog.org/")
6792 (synopsis "Machine check monitor for x86 Linux systems")
6793 (description
6794 "The mcelog daemon logs memory, I/O, CPU, and other hardware errors on x86
6795systems running the kernel Linux. It can also perform user-defined tasks, such
6796as bringing bad pages off-line, when configurable error thresholds are
6797exceeded.")
6798 (license license:gpl2)))
6799
6800(define-public mtd-utils
6801 (package
6802 (name "mtd-utils")
6803 (version "2.1.4")
6804 (source (origin
6805 (method url-fetch)
6806 (uri (string-append
6807 "ftp://ftp.infradead.org/pub/mtd-utils/"
6808 "mtd-utils-" version ".tar.bz2"))
6809 (sha256
6810 (base32
6811 "168vyzpfa0n66i8lcf626b9jczjr81rqbdk7735lfb18bp8i2rrc"))))
6812 (arguments
6813 (list #:configure-flags
6814 (if (%current-target-system) ; When cross-compiling.
6815 #~(list)
6816 #~(list "--enable-unit-tests"))
6817
6818 #:parallel-tests? #f)) ;tests may fail when running in parallel
6819 (native-inputs
6820 (list cmocka pkg-config))
6821 (inputs
6822 `(("acl" ,acl) ; extended attributes (xattr)
6823 ("libuuid" ,util-linux "lib")
6824 ("lzo" ,lzo)
6825 ("openssl" ,openssl) ; optional crypto support
6826 ("zlib" ,zlib)
6827 ("zstd" ,zstd "lib")))
6828 (build-system gnu-build-system)
6829 (synopsis "MTD Flash Storage Utilities")
6830 (description "This package provides utilities for testing, partitioning, etc
6831of flash storage.")
6832 (home-page "http://www.linux-mtd.infradead.org/")
6833 (license
6834 (list license:gpl2 ; Almost everything is gpl2 or gpl2+
6835 license:mpl1.1 ; All ftl* files
6836 license:expat)))) ; libiniparser
6837
6838(define-public libseccomp
6839 (package
6840 (name "libseccomp")
6841 (version "2.5.3")
6842 (source (origin
6843 (method url-fetch)
6844 (uri (string-append "https://github.com/seccomp/libseccomp/"
6845 "releases/download/v" version
6846 "/libseccomp-" version ".tar.gz"))
6847 (sha256
6848 (base32
6849 "0xhan73zn4p0n7s8vx6s47wjmidvk4x8r90vfbljairn6f3mq1jr"))))
6850 (build-system gnu-build-system)
6851 (arguments
6852 '(#:configure-flags '("--disable-static")
6853 #:phases (modify-phases %standard-phases
6854 (add-before 'check 'skip-load-test
6855 (lambda _
6856 ;; This test does a native system call and fails when
6857 ;; run under QEMU user-mode emulation. Just skip it.
6858 (delete-file "tests/52-basic-load.tests"))))))
6859 (native-inputs
6860 (list gperf which))
6861 (synopsis "Interface to Linux's seccomp syscall filtering mechanism")
6862 (description "The libseccomp library provides an easy to use, platform
6863independent, interface to the Linux Kernel's syscall filtering mechanism. The
6864libseccomp API is designed to abstract away the underlying BPF based syscall
6865filter language and present a more conventional function-call based filtering
6866interface that should be familiar to, and easily adopted by, application
6867developers.")
6868 (home-page "https://github.com/seccomp/libseccomp")
6869 (license license:lgpl2.1)))
6870
6871(define-public radeontop
6872 (package
6873 (name "radeontop")
6874 (version "1.4")
6875 (source
6876 (origin
6877 (method git-fetch)
6878 (uri (git-reference
6879 (url "https://github.com/clbr/radeontop")
6880 (commit (string-append "v" version))))
6881 (file-name (git-file-name name version))
6882 (sha256
6883 (base32 "0kwqddidr45s1blp0h8r8h1dd1p50l516yb6mb4s6zsc827xzgg3"))))
6884 (build-system gnu-build-system)
6885 (arguments
6886 `(#:phases (modify-phases %standard-phases
6887 ;; getver.sh uses ‘git --describe’, isn't worth an extra git
6888 ;; dependency, and doesn't even work on release(!) tarballs.
6889 (add-after 'unpack 'report-correct-version
6890 (lambda _
6891 (substitute* "getver.sh"
6892 (("ver=unknown")
6893 (string-append "ver=" ,version)))))
6894 (delete 'configure)) ; no configure script
6895 #:make-flags (list (string-append "CC=" ,(cc-for-target))
6896 (string-append "PREFIX=" %output))
6897 #:tests? #f)) ; no tests
6898 (native-inputs
6899 (list gettext-minimal pkg-config))
6900 (inputs
6901 (list libdrm libpciaccess libxcb ncurses))
6902 (home-page "https://github.com/clbr/radeontop/")
6903 (synopsis "Usage monitor for AMD Radeon graphics")
6904 (description "RadeonTop monitors resource consumption on supported AMD
6905Radeon Graphics Processing Units (GPUs), either in real time as bar graphs on
6906a terminal or saved to a file for further processing. It measures both the
6907activity of the GPU as a whole, which is also accurate during OpenCL
6908computations, as well as separate component statistics that are only meaningful
6909under OpenGL graphics workloads.")
6910 (license license:gpl3)))
6911
6912(define-public efivar
6913 (package
6914 (name "efivar")
6915 (version "38")
6916 (source (origin
6917 (method url-fetch)
6918 (uri (string-append "https://github.com/rhboot/" name
6919 "/releases/download/" version "/" name
6920 "-" version ".tar.bz2"))
6921 (sha256
6922 (base32
6923 "0jaka7b4lccswjqiv4liclkj6w78gildg7vd6dnw3wf595pfs67h"))
6924 (patches
6925 (search-patches "efivar-211.patch"))))
6926
6927 (build-system gnu-build-system)
6928 (arguments
6929 (list
6930 ;; Tests require a UEFI system and is not detected in the chroot.
6931 #:tests? #f
6932 #:make-flags
6933 #~(list (string-append "prefix=" #$output)
6934 (string-append "libdir=" #$output "/lib")
6935 (string-append "CC=" #$(cc-for-target))
6936 (string-append "LDFLAGS=-Wl,-rpath=" #$output "/lib"))
6937 #:phases
6938 #~(modify-phases %standard-phases
6939 (add-after 'unpack 'build-deterministically
6940 (lambda _
6941 (substitute* "src/include/defaults.mk"
6942 ;; Don't use -march=native.
6943 (("-march=native")
6944 ""))))
6945 (delete 'configure))))
6946 (native-inputs
6947 (list mandoc pkg-config))
6948 (inputs
6949 (list popt))
6950 (home-page "https://github.com/rhboot/efivar")
6951 (synopsis "Tool and library to manipulate EFI variables")
6952 (description "This package provides a library and a command line
6953interface to the variable facility of UEFI boot firmware.")
6954 (license license:lgpl2.1+)))
6955
6956(define-public efibootmgr
6957 (package
6958 (name "efibootmgr")
6959 (version "17")
6960 (source
6961 (origin
6962 (method git-fetch)
6963 (uri (git-reference
6964 (url "https://github.com/rhboot/efibootmgr")
6965 (commit version)))
6966 (file-name (git-file-name name version))
6967 (sha256
6968 (base32 "1niicijxg59rsmiw3rsjwy4bvi1n42dynvm01lnp9haixdzdpq03"))
6969 (patches (search-patches "efibootmgr-remove-extra-decl.patch"))
6970 (modules '((guix build utils)))
6971 (snippet
6972 '(begin
6973 ;; Cast the first argument to the correct type. Extracted
6974 ;; from upstream commit e8ce9fecebd15adb4.
6975 (substitute* '("src/efibootdump.c" "src/efibootmgr.c")
6976 (("efidp_format_device_path\\(text_path,")
6977 "efidp_format_device_path((unsigned char *)text_path,"))))))
6978 (build-system gnu-build-system)
6979 (arguments
6980 (list
6981 #:tests? #f ;no tests
6982 #:make-flags
6983 #~(append (list (string-append "prefix=" #$output)
6984 (string-append "libdir=" #$output "/lib")
6985 ;; EFIDIR denotes a subdirectory relative to the
6986 ;; EFI System Partition where the loader will be
6987 ;; installed (known as OS_VENDOR in the code).
6988 ;; GRUB overrides this, as such it's only used if
6989 ;; nothing else is specified on the command line.
6990 "EFIDIR=gnu")
6991 #$(if (%current-target-system)
6992 #~(list
6993 (string-append "CC=" #$(cc-for-target))
6994 (string-append "PKG_CONFIG=" #$(pkg-config-for-target))
6995 (string-append "EXTRAINCDIRS="
6996 #$(this-package-input "efivar") "/include"))
6997 #~'()))
6998 #:phases #~(modify-phases %standard-phases (delete 'configure))))
6999 (native-inputs
7000 (list pkg-config))
7001 (inputs
7002 (list efivar popt))
7003 (home-page "https://github.com/rhboot/efibootmgr")
7004 (synopsis "Modify the Extensible Firmware Interface (EFI) boot manager")
7005 (description
7006 "@code{efibootmgr} is a user-space application to modify the Intel
7007Extensible Firmware Interface (EFI) Boot Manager. This application can
7008create and destroy boot entries, change the boot order, change the next
7009running boot option, and more.")
7010 (license license:gpl2+)))
7011
7012(define-public sysstat
7013 (package
7014 (name "sysstat")
7015 (version "12.4.4")
7016 (source
7017 (origin
7018 (method url-fetch)
7019 (uri (string-append "http://pagesperso-orange.fr/sebastien.godard/"
7020 "sysstat-" version ".tar.xz"))
7021 (sha256
7022 (base32 "091xjip7l52dxal8dsfh5chksr4g9gclnssw3hjjxy84kr3yf4lm"))))
7023 (build-system gnu-build-system)
7024 (arguments
7025 `(#:tests? #f ; no test suite.
7026 ;; Without this flag, it tries to install the man pages with group 'root'
7027 ;; and fails because /etc/passwd lacks an entry for the root user.
7028 #:configure-flags
7029 (list "--disable-file-attr"
7030 (string-append "conf_dir=" (assoc-ref %outputs "out") "/etc"))
7031 #:phases
7032 (modify-phases %standard-phases
7033 ;; The build process tries to create '/var/lib/sa', so we skip that
7034 ;; instruction.
7035 (add-after 'build 'skip-touching-var
7036 (lambda _
7037 (substitute* "Makefile"
7038 (("mkdir -p \\$\\(DESTDIR\\)\\$\\(SA_DIR\\)")
7039 "")))))))
7040 (home-page "http://sebastien.godard.pagesperso-orange.fr/")
7041 (synopsis "Performance monitoring tools for Linux")
7042 (description "The sysstat utilities are a collection of performance
7043monitoring tools for Linux. These include @code{mpstat}, @code{iostat},
7044@code{tapestat}, @code{cifsiostat}, @code{pidstat}, @code{sar}, @code{sadc},
7045@code{sadf} and @code{sa}.")
7046 (license license:gpl2+)))
7047
7048(define-public acpilight
7049 (package
7050 (name "acpilight")
7051 (version "1.2")
7052 (source (origin
7053 (method git-fetch)
7054 (uri (git-reference
7055 (url "https://gitlab.com/wavexx/acpilight.git")
7056 (commit (string-append "v" version))))
7057 (file-name (git-file-name name version))
7058 (sha256
7059 (base32
7060 "1r0r3nx6x6vkpal6vci0zaa1n9dfacypldf6k8fxg7919vzxdn1w"))))
7061 (build-system gnu-build-system)
7062 (arguments
7063 (list #:tests? #f ; no tests
7064 #:make-flags
7065 #~(list (string-append "prefix=" #$output)
7066 (string-append "sysconfdir=" #$output "/etc"))
7067 #:phases
7068 #~(modify-phases %standard-phases
7069 (delete 'configure)
7070 (add-after 'unpack 'patch
7071 (lambda* (#:key inputs #:allow-other-keys)
7072 ;; Prevent reloading udev at build time
7073 (substitute* "Makefile"
7074 (("udevadm") "true"))
7075 (substitute* "90-backlight.rules"
7076 (("/bin")
7077 (string-append #$(this-package-input "coreutils")
7078 "/bin"))))))))
7079 (inputs (list coreutils python))
7080 (home-page "https://gitlab.com/wavexx/acpilight")
7081 (synopsis "Backward-compatibile xbacklight replacement")
7082 (description "acpilight is a backward-compatibile replacement for
7083xbacklight that uses the ACPI interface to set the display brightness. On
7084modern laptops acpilight can control both display and keyboard backlight
7085uniformly on either X11, the console or Wayland.")
7086 (license license:gpl3+)))
7087
7088(define-public light
7089 (package
7090 (name "light")
7091 (version "1.2.2")
7092 (source
7093 (origin
7094 (method git-fetch)
7095 (uri (git-reference
7096 (url "https://github.com/haikarainen/light")
7097 (commit (string-append "v" version))))
7098 (sha256
7099 (base32 "1a70zcf88ifsnwll486aicjnh48zisdf8f7vi34ihw61kdadsq9s"))
7100 (file-name (git-file-name name version))))
7101 (build-system gnu-build-system)
7102 (arguments
7103 `(#:configure-flags '("CFLAGS=-fcommon")
7104 #:phases
7105 (modify-phases %standard-phases
7106 (add-after 'unpack 'patch-udev-rules-absolute-path-bins
7107 (lambda* (#:key inputs #:allow-other-keys)
7108 (substitute* "90-backlight.rules"
7109 (("/bin/chgrp") (which "chgrp"))
7110 (("/bin/chmod") (which "chmod")))
7111 #t))
7112 (add-after 'install 'install-udev-rules
7113 (lambda* (#:key outputs #:allow-other-keys)
7114 (let ((out (assoc-ref outputs "out")))
7115 (install-file
7116 "90-backlight.rules" (string-append out "/lib/udev/rules.d"))
7117 #t))))))
7118 (native-inputs
7119 (list autoconf automake))
7120 (home-page "https://haikarainen.github.io/light/")
7121 (synopsis "GNU/Linux application to control backlights")
7122 (description
7123 "Light is a program to send commands to screen backlight controllers
7124under GNU/Linux. Features include:
7125
7126@itemize
7127@item It does not rely on X.
7128@item Light can automatically figure out the best controller to use, making
7129full use of underlying hardware.
7130@item It is possible to set a minimum brightness value, as some controllers
7131set the screen to be pitch black at a value of 0 (or higher).
7132@end itemize\n")
7133 (license license:gpl3+)))
7134
7135(define-public brightnessctl
7136 (package
7137 (name "brightnessctl")
7138 (version "0.5.1")
7139 (home-page "https://github.com/Hummer12007/brightnessctl")
7140 (source (origin
7141 (method git-fetch)
7142 (uri (git-reference (url home-page) (commit version)))
7143 (file-name (git-file-name name version))
7144 (sha256
7145 (base32
7146 "0immxc7almmpg80n3bdn834p3nrrz7bspl2syhb04s3lawa5y2lq"))
7147 (patches (search-patches "brightnessctl-elogind-support.patch"))))
7148 (build-system gnu-build-system)
7149 (arguments
7150 `(#:tests? #f ; no tests
7151 #:make-flags (list (string-append "CC=" ,(cc-for-target))
7152 (string-append "PREFIX=" %output)
7153 (string-append "UDEVDIR=" %output "/lib/udev/rules.d/")
7154 "ENABLE_SYSTEMD=1")
7155 #:phases
7156 (modify-phases %standard-phases
7157 (delete 'configure)
7158 (add-after 'unpack 'adjust-udev-rules
7159 (lambda _
7160 (substitute* "Makefile"
7161 (("INSTALL_UDEV_RULES=0") "INSTALL_UDEV_RULES=1"))
7162 (substitute* "90-brightnessctl.rules"
7163 (("/bin/") "/run/current-system/profile/bin/"))
7164 #t)))))
7165 (native-inputs
7166 (list pkg-config))
7167 (inputs
7168 (list elogind))
7169 (synopsis "Backlight and LED brightness control")
7170 (description
7171 "This program allows you read and control device brightness. Devices
7172include backlight and LEDs. It can also preserve current brightness before
7173applying the operation, such as on lid close.
7174
7175The appropriate permissions must be set on the backlight or LED control
7176interface in sysfs, which can be accomplished with the included udev rules.")
7177 (license license:expat)))
7178
7179(define-public tlp
7180 (package
7181 (name "tlp")
7182 (version "1.5.0")
7183 (source
7184 (origin
7185 (method git-fetch)
7186 (uri (git-reference
7187 (url "https://github.com/linrunner/TLP")
7188 (commit version)))
7189 (file-name (git-file-name name version))
7190 (sha256
7191 (base32 "0cssclk2brhwvn9dm7h5snm2svwy0c8cfr4z2cgkdkac2pfaaxw4"))))
7192 (native-inputs
7193 (list shellcheck))
7194 (inputs
7195 `(("bash" ,bash)
7196 ("dbus" ,dbus)
7197 ("ethtool" ,ethtool)
7198 ("eudev" ,eudev)
7199 ("grep" ,grep)
7200 ("hdparm" ,hdparm)
7201 ("inetutils" ,inetutils)
7202 ("iw" ,iw)
7203 ("kmod" ,kmod)
7204 ("pciutils" ,pciutils)
7205 ("perl" ,perl)
7206 ("rfkill" ,rfkill)
7207 ("sed" ,sed)
7208 ("usbutils" ,usbutils)
7209 ("util-linux" ,util-linux)
7210 ("wireless-tools" ,wireless-tools)
7211 ,@(if (let ((system (or (%current-target-system)
7212 (%current-system))))
7213 (or (string-prefix? "i686-" system)
7214 (string-prefix? "x86_64-" system)))
7215 `(("x86-energy-perf-policy" ,x86-energy-perf-policy))
7216 '())))
7217 (build-system gnu-build-system)
7218 (arguments
7219 ;; XXX: The full test suite is run with "checkall" but it requires
7220 ;; "checkbashisms" and "perlcritic", not yet packaged in Guix.
7221 `(#:test-target "shellcheck"
7222 #:modules ((guix build gnu-build-system)
7223 (guix build utils)
7224 (srfi srfi-1))
7225 #:phases
7226 (modify-phases %standard-phases
7227 (delete 'configure) ; no configure script
7228 (add-before 'build 'setenv
7229 (lambda* (#:key outputs #:allow-other-keys)
7230 (let ((out (assoc-ref outputs "out")))
7231 (setenv "TLP_WITH_SYSTEMD" "0")
7232 (setenv "TLP_NO_INIT" "1")
7233 (setenv "TLP_NO_PMUTILS" "1")
7234 (setenv "TLP_SBIN" (string-append out "/bin"))
7235 (setenv "TLP_BATD" (string-append out "/share/tlp/bat.d"))
7236 (setenv "TLP_BIN" (string-append out "/bin"))
7237 (setenv "TLP_TLIB" (string-append out "/share/tlp"))
7238 (setenv "TLP_FLIB" (string-append out "/share/tlp/func.d"))
7239 (setenv "TLP_ULIB" (string-append out "/lib/udev"))
7240 (setenv "TLP_CONFDEF"
7241 (string-append out "/share/tlp/defaults.conf"))
7242 (setenv "TLP_CONFDIR" (string-append out "/etc/tlp.d"))
7243 (setenv "TLP_CONFREN"
7244 (string-append out "/share/tlp/rename.conf"))
7245 (setenv "TLP_ELOD"
7246 (string-append out "/lib/elogind/system-sleep"))
7247 (setenv "TLP_SHCPL"
7248 (string-append out "/share/bash-completion/completions"))
7249 (setenv "TLP_MAN" (string-append out "/share/man"))
7250 (setenv "TLP_META" (string-append out "/share/metainfo")))))
7251 (add-before 'install 'fix-installation
7252 (lambda _
7253 ;; Stop the Makefile from trying to create system directories.
7254 (substitute* "Makefile"
7255 (("\\[ -f \\$\\(_CONFUSR\\) \\]") "#")
7256 (("install -d -m 755 \\$\\(_VAR\\)") "#"))))
7257 (replace 'install
7258 (lambda _ (invoke "make" "install-tlp" "install-man-tlp")))
7259 (add-after 'install 'wrap
7260 (lambda* (#:key inputs outputs #:allow-other-keys)
7261 (let* ((bin (string-append (assoc-ref outputs "out") "/bin"))
7262 (bin-files (find-files bin ".*")))
7263 (define (bin-directory input-name)
7264 (let ((p (assoc-ref inputs input-name)))
7265 (and p (string-append p "/bin"))))
7266 (define (sbin-directory input-name)
7267 (string-append (assoc-ref inputs input-name) "/sbin"))
7268 (for-each (lambda (program)
7269 (wrap-program program
7270 `("PATH" ":" prefix
7271 ,(append
7272 (filter-map bin-directory
7273 '("bash"
7274 "coreutils"
7275 "dbus"
7276 "eudev"
7277 "grep"
7278 "inetutils"
7279 "kmod"
7280 "perl"
7281 "sed"
7282 "usbutils"
7283 "util-linux"
7284 "x86-energy-perf-policy"))
7285 (filter-map sbin-directory
7286 '("ethtool"
7287 "hdparm"
7288 "iw"
7289 "pciutils"
7290 "rfkill"
7291 "wireless-tools"))))))
7292 bin-files)))))))
7293 (home-page "https://linrunner.de/en/tlp/tlp.html")
7294 (synopsis "Power management tool for Linux")
7295 (description "TLP is a power management tool for Linux. It comes with
7296a default configuration already optimized for battery life. Nevertheless,
7297TLP is customizable to fulfil system requirements. TLP settings are applied
7298every time the power supply source is changed.")
7299 ;; 'COPYING' is a custom version that says that one file is GPLv3+ and the
7300 ;; rest is GPLv2+.
7301 (license (list license:gpl2+ license:gpl3+))))
7302
7303(define-public tlpui
7304 (package
7305 (name "tlpui")
7306 (version "1.5.0-1")
7307 (source
7308 (origin
7309 (method git-fetch)
7310 (uri (git-reference
7311 (url "https://github.com/d4nj1/TLPUI")
7312 (commit (string-append "tlpui-" version))))
7313 (file-name (git-file-name name version))
7314 (sha256
7315 (base32 "16a6x733szsggn23ns7bj3gpvb80675plh96v4llrz0s8p3h47pg"))))
7316 (build-system python-build-system)
7317 (arguments
7318 (list
7319 #:phases
7320 #~(modify-phases %standard-phases
7321 (add-after 'unpack 'patch-setup.py
7322 ;; Install data_files to $out/share instead of /usr/share.
7323 (lambda _
7324 (substitute* "setup.py"
7325 (("/usr/") ""))))
7326 (add-after 'unpack 'use-tlp-input
7327 ;; Hard-code tlp-stat filename to avoid propagating "tlp".
7328 (lambda* (#:key inputs #:allow-other-keys)
7329 (let ((tlp-stat (search-input-file inputs "/bin/tlp-stat")))
7330 (with-directory-excursion "tlpui"
7331 (substitute* '("file.py" "settingshelper.py" "statui.py")
7332 (("which\\(\"tlp-stat\"\\)")
7333 (string-append "'" tlp-stat "'"))
7334 (("\"tlp-stat\"")
7335 (string-append "'" tlp-stat "'")))))))
7336 (add-before 'check 'fix-home-directory
7337 (lambda _
7338 ;; Tests fail with "Permission denied:
7339 ;; '/homeless-shelter'".
7340 (setenv "HOME" "/tmp")))
7341 ;; `sanity-check' phase errors out with the following
7342 ;; messages: "Unable to init server: Could not connect:
7343 ;; Connection refused" and "Error: cannot read user
7344 ;; configuration from /etc/tlp.conf or /etc/default/tlp".
7345 (delete 'sanity-check)
7346 (replace 'check
7347 (lambda* (#:key tests? #:allow-other-keys)
7348 (when tests?
7349 (invoke "python" "-m" "discover"))))
7350 (add-after 'install 'wrap-gi-python
7351 (lambda _
7352 (let ((gi-typelib-path (getenv "GI_TYPELIB_PATH")))
7353 (wrap-program (string-append #$output "/bin/tlpui")
7354 `("GI_TYPELIB_PATH" ":" prefix (,gi-typelib-path)))))))))
7355 (native-inputs
7356 (list `(,glib "bin") gobject-introspection python-discover))
7357 (inputs
7358 (list gtk+ python-pygobject tlp))
7359 (home-page "https://github.com/d4nj1/TLPUI")
7360 (synopsis "User interface for TLP written in Python")
7361 (description
7362 "The Python scripts in this project generate a GTK-UI to change
7363TLP configuration files easily. It aims to protect users from setting
7364bad configuration and to deliver a basic overview of all the valid
7365configuration values.")
7366 (license license:gpl2+)))
7367
7368(define-public lshw
7369 (package
7370 (name "lshw")
7371 (version "B.02.19.2")
7372 (source (origin
7373 (method url-fetch)
7374 (uri (string-append "https://www.ezix.org/software/"
7375 "files/lshw-" version
7376 ".tar.gz"))
7377 (sha256
7378 (base32
7379 "100gm1c6gb2hkfws22h0xhvv7nz38p49lxd1csikj8qlhyn4gcwv"))))
7380 (build-system gnu-build-system)
7381 (arguments
7382 `(#:phases (modify-phases %standard-phases (delete 'configure))
7383 #:tests? #f ; no tests
7384 #:make-flags
7385 (list (string-append "PREFIX=" (assoc-ref %outputs "out")))))
7386 (synopsis "List hardware information")
7387 (description
7388 "@command{lshw} (Hardware Lister) is a small tool to provide
7389detailed information on the hardware configuration of the machine.
7390It can report exact memory configuration, firmware version, mainboard
7391configuration, CPU version and speed, cache configuration, bus speed,
7392and more on DMI-capable x86 or EFI (IA-64) systems and on some PowerPC
7393machines (PowerMac G4 is known to work).")
7394 (home-page "https://www.ezix.org/project/wiki/HardwareLiSter")
7395 (license license:gpl2+)))
7396
7397(define-public libmnl
7398 (package
7399 (name "libmnl")
7400 (version "1.0.4")
7401 (source
7402 (origin
7403 (method url-fetch)
7404 (uri (string-append "mirror://netfilter.org/libmnl/"
7405 "libmnl-" version ".tar.bz2"))
7406 (sha256
7407 (base32
7408 "108zampspaalv44zn0ar9h386dlfixpd149bnxa5hsi8kxlqj7qp"))))
7409 (build-system gnu-build-system)
7410 (home-page "https://www.netfilter.org/projects/libmnl/")
7411 (synopsis "Netlink utility library")
7412 (description "Libmnl is a minimalistic user-space library oriented to
7413Netlink developers. There are a lot of common tasks in parsing, validating,
7414constructing of both the Netlink header and TLVs that are repetitive and easy to
7415get wrong. This library aims to provide simple helpers that allows you to
7416re-use code and to avoid re-inventing the wheel.")
7417 (license license:lgpl2.1+)))
7418
7419(define-public libnftnl
7420 (package
7421 (name "libnftnl")
7422 (version "1.2.3")
7423 (source
7424 (origin
7425 (method url-fetch)
7426 (uri (string-append "mirror://netfilter.org/libnftnl/"
7427 "libnftnl-" version ".tar.bz2"))
7428 (sha256
7429 (base32 "0m82bmh8i24hwxmz7rxwxjll4904ghd2b1x1p5h8algrg6dyl5p9"))))
7430 (build-system gnu-build-system)
7431 (native-inputs
7432 (list pkg-config))
7433 (inputs
7434 (list libmnl))
7435 (home-page "https://www.netfilter.org/projects/libnftnl/index.html")
7436 (synopsis "Netlink programming interface to the Linux nf_tables subsystem")
7437 (description "Libnftnl is a userspace library providing a low-level netlink
7438programming interface to the in-kernel nf_tables subsystem. The library
7439libnftnl has been previously known as libnftables. This library is currently
7440used by nftables.")
7441 (license license:gpl2+)))
7442
7443;; This is used in iptables, which contributes to rust. We're pinning this
7444;; variant to avoid accidental rebuilds of rust.
7445(define-public libnftnl/fixed
7446 (package (inherit libnftnl)
7447 (version "1.2.0")
7448 (source
7449 (origin
7450 (method url-fetch)
7451 (uri (string-append "mirror://netfilter.org/libnftnl/"
7452 "libnftnl-" version ".tar.bz2"))
7453 (sha256
7454 (base32 "1xblq1cbcxhr6qmjpy98i1qdza148idgz99vbhjc7s4vzvfizc4h"))))
7455 (build-system gnu-build-system)
7456 (native-inputs
7457 (list pkg-config))
7458 (inputs
7459 (list libmnl))))
7460
7461(define-public nftables
7462 (package
7463 (name "nftables")
7464 (version "1.0.5")
7465 (source
7466 (origin
7467 (method url-fetch)
7468 (uri (list (string-append "mirror://netfilter.org/nftables/nftables-"
7469 version ".tar.bz2")
7470 (string-append "https://www.nftables.org/projects/nftables"
7471 "/files/nftables-" version ".tar.bz2")))
7472 (sha256
7473 (base32 "02p59m773l2xqcb7ib7cprlpjfdnp792bahbs6c3dx1s74c4n6wd"))))
7474 (build-system gnu-build-system)
7475 (arguments `(#:configure-flags
7476 '("--disable-static"
7477 "--with-cli=readline"
7478 "--with-json")
7479 #:phases
7480 (modify-phases %standard-phases
7481 (add-before 'configure 'autoreconf
7482 (lambda _
7483 (invoke "autoreconf" "-fi"))))))
7484 (inputs (list gmp libmnl libnftnl readline jansson))
7485 (native-inputs (list pkg-config
7486 bison
7487 flex
7488 docbook2x
7489 autoconf
7490 automake
7491 libtool))
7492 (home-page "https://www.nftables.org")
7493 (synopsis "Userspace utility for Linux packet filtering")
7494 (description "nftables is the project that aims to replace the existing
7495{ip,ip6,arp,eb}tables framework. Basically, this project provides a new packet
7496filtering framework, a new userspace utility and also a compatibility layer for
7497{ip,ip6}tables. nftables is built upon the building blocks of the Netfilter
7498infrastructure such as the existing hooks, the connection tracking system, the
7499userspace queueing component and the logging subsystem.")
7500 (license license:gpl2)))
7501
7502(define-public libnetfilter-conntrack
7503 (package
7504 (name "libnetfilter-conntrack")
7505 (version "1.0.8")
7506 (source
7507 (origin
7508 (method url-fetch)
7509 (uri (string-append "https://netfilter.org/projects/"
7510 "libnetfilter_conntrack/files/"
7511 "libnetfilter_conntrack-"
7512 version ".tar.bz2"))
7513 (sha256
7514 (base32
7515 "1ky1mqgnplw2h9jf0kn0a69d94jkydhbiipng9l2hdcj13h3pl8c"))))
7516 (build-system gnu-build-system)
7517 (native-inputs (list pkg-config))
7518 (inputs (list libnfnetlink libmnl))
7519 (synopsis "Library for kernel connection tracking state table")
7520 (description "libnetfilter_conntrack is a userspace library providing a
7521programming interface (API) to the in-kernel connection tracking state table.
7522The library libnetfilter_conntrack has been previously known as
7523libnfnetlink_conntrack and libctnetlink. This library is currently used by
7524conntrack-tools among many other applications.")
7525 (home-page "https://netfilter.org/projects/libnetfilter_conntrack/index.html")
7526 (supported-systems (filter target-linux? %supported-systems))
7527 (properties '((upstream-name . "libnetfilter_conntrack")))
7528 (license license:gpl2+)))
7529
7530(define-public libnetfilter-cttimeout
7531 (package
7532 (name "libnetfilter-cttimeout")
7533 (version "1.0.0")
7534 (source
7535 (origin
7536 (method url-fetch)
7537 (uri (string-append "https://netfilter.org/projects/"
7538 "libnetfilter_cttimeout/files/"
7539 "libnetfilter_cttimeout-" version ".tar.bz2"))
7540 (sha256
7541 (base32
7542 "1fpyz1zlvcq80244knvyvy87909xjqlj02lmw8yblz2m9xsi5axf"))))
7543 (build-system gnu-build-system)
7544 (native-inputs (list pkg-config))
7545 (inputs (list libmnl))
7546 (synopsis "Library for kernel connection tracking timeout infrastructure")
7547 (description "libnetfilter_cttimeout is the userspace library that
7548provides the programming interface to the fine-grain connection tracking
7549timeout infrastructure. With this library, you can create, update and delete
7550timeout policies that can be attached to traffic flows. This library is used
7551by conntrack-tools.")
7552 (home-page "https://netfilter.org/projects/libnetfilter_cttimeout/index.html")
7553 (supported-systems (filter target-linux? %supported-systems))
7554 (properties '((upstream-name . "libnetfilter_cttimeout")))
7555 (license license:gpl2)))
7556
7557(define-public libnetfilter-cthelper
7558 (package
7559 (name "libnetfilter-cthelper")
7560 (version "1.0.0")
7561 (source
7562 (origin
7563 (method url-fetch)
7564 (uri (string-append "https://netfilter.org/projects/"
7565 "libnetfilter_cthelper/files/"
7566 "libnetfilter_cthelper-" version ".tar.bz2"))
7567 (sha256
7568 (base32
7569 "0gfgzkc1fjniqwk4jxds72c0lcgfhq2591hrvjrvd9nrqiqqwq87"))))
7570 (build-system gnu-build-system)
7571 (native-inputs (list pkg-config))
7572 (inputs (list libmnl))
7573 (synopsis "Library for user-space connection tracking helpers")
7574 (description "libnetfilter_cthelper is a userspace library that provides a
7575programming interface to user-space connection tracking helpers.
7576@enumerate
7577@item
7578register new user-space connection tracking helpers
7579@item
7580unregister user-space connection tracking helpers
7581@item
7582list existing registered user-space connection tracking helpers
7583@end enumerate")
7584 (home-page "https://netfilter.org/projects/libnetfilter_cthelper/index.html")
7585 (supported-systems (filter target-linux? %supported-systems))
7586 (properties '((upstream-name . "libnetfilter_cthelper")))
7587 (license license:gpl2+)))
7588
7589(define-public libnetfilter-queue
7590 (package
7591 (name "libnetfilter-queue")
7592 (version "1.0.5")
7593 (source
7594 (origin
7595 (method url-fetch)
7596 (uri (string-append "https://netfilter.org/projects/"
7597 "libnetfilter_queue/files/"
7598 "libnetfilter_queue-" version ".tar.bz2"))
7599 (sha256
7600 (base32
7601 "1xdra6i4p8jkv943ygjw646qx8df27f7p5852kc06vjx608krzzr"))))
7602 (build-system gnu-build-system)
7603 (native-inputs (list pkg-config))
7604 (inputs (list libmnl libnfnetlink))
7605 (synopsis "Library for kernel netfilter infrastructure and state")
7606 (description "libnetfilter_queue is a userspace library providing an API
7607to packets that have been queued by the kernel packet filter. It is is part
7608of a system that deprecates the old ip_queue/libipq mechanism.")
7609 (home-page "https://netfilter.org/projects/libnetfilter_queue/index.html")
7610 (supported-systems (filter target-linux? %supported-systems))
7611 (properties '((upstream-name . "libnetfilter_queue")))
7612 (license license:gpl2+)))
7613
7614(define-public conntrack-tools
7615 (package
7616 (name "conntrack-tools")
7617 (version "1.4.6")
7618 (source
7619 (origin
7620 (method url-fetch)
7621 (uri (string-append "https://netfilter.org/projects/"
7622 "conntrack-tools/files/"
7623 "conntrack-tools-" version ".tar.bz2"))
7624 (sha256
7625 (base32
7626 "0psx41bclqrh4514yzq03rvs3cq3scfpd1v4kkyxnic2hk65j22r"))))
7627 (build-system gnu-build-system)
7628 (native-inputs (list bison flex pkg-config))
7629 (inputs (list libtirpc
7630 libnetfilter-conntrack
7631 libnetfilter-cttimeout
7632 libnetfilter-cthelper
7633 libnetfilter-queue
7634 libnfnetlink
7635 libmnl))
7636 (synopsis "Set of tools targeting the conntrack kernel subsystem")
7637 (description "The tool conntrack provides a full featured interface that
7638is intended to replace the old @file{/proc/net/ip_conntrack} interface. Using
7639conntrack, you can view and manage the in-kernel connection tracking state
7640table from userspace. On the other hand, conntrackd covers the specific
7641aspects of stateful firewalls to enable highly available scenarios, and can be
7642used as statistics collector as well.
7643
7644Since 1.2.0, the conntrack-tools includes the @command{nfct} command line
7645utility. This utility only supports the nfnetlink_cttimeout by now. In the
7646long run, we expect that it will replace conntrack by providing a syntax
7647similar to nftables.")
7648 (home-page "https://netfilter.org/projects/conntrack-tools/index.html")
7649 (supported-systems (filter target-linux? %supported-systems))
7650 (license license:gpl2+)))
7651
7652(define-public libnetfilter-acct
7653 (package
7654 (name "libnetfilter-acct")
7655 (version "1.0.3")
7656 (source
7657 (origin
7658 (method url-fetch)
7659 (uri (string-append "https://netfilter.org/projects/"
7660 "libnetfilter_acct/files/"
7661 "libnetfilter_acct-" version ".tar.bz2"))
7662 (sha256
7663 (base32
7664 "06lsjndgfjsgfjr43px2n2wk3nr7whz6r405mks3887y7vpwwl22"))))
7665 (build-system gnu-build-system)
7666 (native-inputs (list pkg-config))
7667 (inputs (list libmnl))
7668 (synopsis "Library providing interface to extended accounting infrastructure")
7669 (description "libnetfilter_acct is the userspace library providing interface
7670to extended accounting infrastructure.
7671
7672@enumerate
7673@item
7674creating accounting objects
7675@item
7676retrieving accounting objects (and atomically set to zero)
7677@item
7678deleting accounting objects
7679@end enumerate
7680For the nfnetlink_acct subsystem.")
7681 (home-page "https://netfilter.org/projects/libnetfilter_acct/index.html")
7682 (supported-systems (filter target-linux? %supported-systems))
7683 (properties '((upstream-name . "libnetfilter_acct")))
7684 (license license:lgpl2.1+)))
7685
7686(define-public nfacct
7687 (package
7688 (name "nfacct")
7689 (version "1.0.2")
7690 (source
7691 (origin
7692 (method url-fetch)
7693 (uri (string-append "https://netfilter.org/projects/" name
7694 "/files/nfacct-" version ".tar.bz2"))
7695 (sha256
7696 (base32
7697 "0sdxbxjyapbqcp2ami5jd10vz4xbbdvx39f3wfy1iqsbflc25zzc"))))
7698 (build-system gnu-build-system)
7699 (native-inputs (list pkg-config))
7700 (inputs (list libmnl libnetfilter-acct))
7701 (synopsis "Command line tool to create/retrieve/delete accounting objects")
7702 (description "nfacct is the command line tool to create/retrieve/delete
7703accounting objects
7704@enumerate
7705@item
7706listing the objects of the nfacct table in plain text/XML
7707@item
7708atomically get and reset objects of the nfacct table
7709@item
7710adding new objects to the nfacct table
7711@item
7712deleting objects from the nfacct table
7713@end enumerate")
7714 (home-page "https://netfilter.org/projects/nfacct/index.html")
7715 (supported-systems (filter target-linux? %supported-systems))
7716 (license license:gpl2+)))
7717
7718(define-public libnetfilter-log
7719 (package
7720 (name "libnetfilter-log")
7721 (version "1.0.2")
7722 (source
7723 (origin
7724 (method url-fetch)
7725 (uri (string-append "https://netfilter.org/projects/"
7726 "libnetfilter_log/files/"
7727 "libnetfilter_log-" version ".tar.bz2"))
7728 (sha256
7729 (base32
7730 "1spy9xs41v76kid5ana8n126f3mvgq6fjibbfbj4kn0larbhix73"))))
7731 (build-system gnu-build-system)
7732 (native-inputs (list pkg-config))
7733 (inputs (list libnfnetlink libmnl))
7734 (synopsis "Library providing interface to packets logged by netfilter")
7735 (description "libnetfilter_log is a userspace library providing interface to
7736packets that have been logged by the kernel packet filter. It is is part of a
7737system that deprecates the old syslog/dmesg based packet logging. This library
7738has been previously known as libnfnetlink_log.
7739
7740@enumerate
7741@item
7742receiving to-be-logged packets from the kernel nfnetlink_log subsystem
7743@end enumerate")
7744 (home-page "https://netfilter.org/projects/libnetfilter_log/index.html")
7745 (supported-systems (filter target-linux? %supported-systems))
7746 (properties '((upstream-name . "libnetfilter_log")))
7747 (license license:gpl2+)))
7748
7749(define-public ulogd
7750 (package
7751 (name "ulogd")
7752 (version "2.0.7")
7753 (source
7754 (origin
7755 (method url-fetch)
7756 (uri (string-append "https://netfilter.org/projects/" name
7757 "/files/ulogd-" version ".tar.bz2"))
7758 (sha256
7759 (base32
7760 "0ax9959c4bapq78n13bbaibcf1gwjir3ngx8l2dh45lw9m4ha2lr"))))
7761 (build-system gnu-build-system)
7762 (outputs '("out"
7763 ;; additonal non-default output plugins
7764 "json" "pcap" "sqlite3" "pgsql" "mysql"))
7765 (native-inputs (list pkg-config))
7766 (inputs (list libnfnetlink
7767 libmnl
7768 libnetfilter-log
7769 libnetfilter-conntrack
7770 libnetfilter-acct
7771 sqlite
7772 libpcap
7773 jansson
7774 postgresql
7775 mysql
7776 zlib
7777 openssl))
7778 (arguments
7779 (list #:configure-flags
7780 #~(list (string-append "--with-pgsql="
7781 (assoc-ref %build-inputs "postgresql"))
7782 (string-append "--with-mysql="
7783 (assoc-ref %build-inputs "mysql")))
7784 #:phases
7785 #~(modify-phases %standard-phases
7786 (add-after 'install 'install-doc
7787 (lambda _
7788 (let ((out-etc (string-append #$output "/etc"))
7789 (ulogd.conf "ulogd.conf"))
7790 (mkdir-p out-etc)
7791 (copy-file ulogd.conf (string-append out-etc "/"
7792 ulogd.conf)))))
7793 (add-after 'install 'setup-plugin-outputs
7794 (lambda* (#:key outputs #:allow-other-keys)
7795 (with-directory-excursion
7796 (string-append #$output "/lib/ulogd/")
7797 (for-each
7798 (lambda (output-name)
7799 (let ((output-dir (string-append
7800 (assoc-ref outputs output-name)
7801 "/lib/ulogd/")))
7802 (mkdir-p output-dir)
7803 (for-each
7804 (lambda (plugin)
7805 (copy-file plugin (string-append output-dir plugin))
7806 (delete-file plugin))
7807 (find-files "."
7808 (string-append "ulogd_output_"
7809 (string-upcase output-name)
7810 ".*$")))))
7811 (list "json" "pcap" "sqlite3" "pgsql" "mysql"))))))))
7812 (synopsis "Logging daemon for netfilter and iptables")
7813 (description "ulogd is a userspace logging daemon for netfilter/iptables
7814related logging. This includes per-packet logging of security violations,
7815per-packet logging for accounting, per-flow logging and flexible user-defined
7816accounting.
7817
7818@enumerate
7819@item
7820Packet and flow-based traffic accounting
7821@item
7822Flexible user-defined traffic accounting via nfacct infrastructure
7823@item
7824SQL database back-end support: SQLite3, PostgreSQL, MySQL
7825@item
7826Text-based output formats: CSV, XML, Netfilter's LOG, Netfilter's conntrack
7827@end enumerate")
7828 (home-page "https://netfilter.org/projects/nfacct/index.html")
7829 (supported-systems (filter target-linux? %supported-systems))
7830 (license license:gpl2)))
7831
7832(define-public proot
7833 (package
7834 (name "proot")
7835 (version "5.3.0")
7836 (source
7837 (origin
7838 (method git-fetch)
7839 (uri (git-reference
7840 (url "https://github.com/proot-me/PRoot")
7841 (commit (string-append "v" version))))
7842 (file-name (git-file-name name version))
7843 (sha256
7844 (base32 "1r1ga3xbwq5kx4i8ihj1p6nmgaa14lfkwxzpsbdcmfh1jimpbmzk"))))
7845 (build-system gnu-build-system)
7846 ;; Many architectures are not supported (see:
7847 ;; https://github.com/proot-me/proot/blob/master/src/arch.h#L51).
7848 (supported-systems '("x86_64-linux" "i686-linux"
7849 "armhf-linux" "aarch64-linux" "i586-gnu"))
7850 (arguments
7851 ;; Disable the test suite on armhf-linux, as there are too many
7852 ;; failures to keep track of (see for example:
7853 ;; https://github.com/proot-me/proot/issues/286).
7854 `(#:tests? ,(not (or (%current-target-system)
7855 (string-prefix? "armhf"
7856 (or (%current-system)))))
7857 #:make-flags '("-C" "src")
7858 #:phases (modify-phases %standard-phases
7859 (add-after 'unpack 'patch-sources
7860 (lambda* (#:key inputs #:allow-other-keys)
7861 (substitute* (find-files "src" "\\.[ch]$")
7862 (("\"/bin/sh\"")
7863 (string-append "\"" (assoc-ref inputs "bash")
7864 "/bin/sh\"")))
7865
7866 (substitute* "src/GNUmakefile"
7867 (("/bin/echo") (which "echo"))
7868 (("^VERSION = .*")
7869 (string-append "VERSION := " ,version "\n")))
7870
7871 (substitute* (find-files "test" "\\.sh$")
7872 ;; Some of the tests try to "bind-mount" /bin/true.
7873 (("-b /bin/true:")
7874 (string-append "-b " (which "true") ":"))
7875 ;; Likewise for /bin.
7876 (("-b /bin:") "-b /gnu:")
7877 ;; Others try to run /bin/sh.
7878 (("/bin/sh") (which "sh"))
7879 ;; Others assume /etc/fstab exists.
7880 (("/etc/fstab") "/etc/passwd"))
7881 (substitute* "test/GNUmakefile"
7882 (("-b /bin:") "-b /gnu:"))
7883 (substitute* "test/test-c6b77b77.mk"
7884 (("/bin/bash") (which "bash"))
7885 (("/usr/bin/test") (which "test")))
7886 (substitute* "test/test-16573e73.c"
7887 (("/bin/([a-z-]+)" _ program)
7888 (which program)))
7889 (substitute* "test/test-5467b986.sh"
7890 (("-w /usr") "-w /gnu")
7891 (("-w usr") "-w gnu")
7892 (("/usr/share") "/gnu/store")
7893 (("share") "store"))
7894 (substitute* "test/test-092c5e26.sh"
7895 (("-q echo ")
7896 "-q $(which echo) "))
7897
7898 ;; The socket tests requires networking.
7899 (for-each delete-file
7900 (find-files "test" "test-socket.*\\.sh$"))))
7901 (delete 'configure)
7902 (add-after 'build 'build-manpage
7903 (lambda _
7904 (with-directory-excursion "doc"
7905 (invoke "make" "proot/man.1" "SUFFIX=.py"))))
7906 (replace 'check
7907 (lambda* (#:key tests? #:allow-other-keys)
7908 (when tests?
7909 (let ((n (parallel-job-count)))
7910 ;; Most of the tests expect "/bin" to be in $PATH so
7911 ;; they can run things that live in $ROOTFS/bin.
7912 (setenv "PATH"
7913 (string-append (getenv "PATH") ":/bin"))
7914 (invoke "make" "check" "-C" "test"
7915 ;;"V=1"
7916 "-j" (number->string n))))))
7917 (replace 'install
7918 (lambda* (#:key outputs #:allow-other-keys)
7919 ;; The 'install' rule does nearly nothing.
7920 (let* ((out (assoc-ref outputs "out"))
7921 (man1 (string-append out "/share/man/man1")))
7922 ;; TODO: 'make install-care' (does not even
7923 ;; build currently.)
7924 (invoke "make" "-C" "src" "install"
7925 (string-append "PREFIX=" out))
7926 (mkdir-p man1)
7927 (copy-file "doc/proot/man.1"
7928 (string-append man1 "/proot.1"))))))))
7929 (native-inputs (list which
7930 ;; For 'mcookie', used by some of the tests.
7931 util-linux
7932 coreutils
7933 pkg-config
7934 ;; For rst2man, used to generate the manual page.
7935 python-docutils))
7936 (inputs (list libarchive talloc))
7937 (home-page "https://github.com/proot-me/PRoot")
7938 (synopsis "Unprivileged chroot, bind mount, and binfmt_misc")
7939 (description
7940 "PRoot is a user-space implementation of @code{chroot}, @code{mount --bind},
7941and @code{binfmt_misc}. This means that users don't need any privileges or
7942setup to do things like using an arbitrary directory as the new root
7943file system, making files accessible somewhere else in the file system
7944hierarchy, or executing programs built for another CPU architecture
7945transparently through QEMU user-mode. Also, developers can use PRoot as a
7946generic process instrumentation engine thanks to its extension mechanism.
7947Technically PRoot relies on @code{ptrace}, an unprivileged system-call
7948available in the kernel Linux.")
7949 (license license:gpl2+)))
7950
7951(define-public proot-static
7952 (package
7953 (inherit proot)
7954 (name "proot-static")
7955 (synopsis
7956 "Unprivileged chroot, bind mount, and binfmt_misc (statically linked)")
7957 (inputs `(("talloc" ,talloc/static)))
7958 (arguments
7959 (substitute-keyword-arguments (package-arguments proot)
7960 ((#:make-flags flags)
7961 `(cons "LDFLAGS = -ltalloc -static -static-libgcc" ,flags))
7962 ((#:phases phases)
7963 `(modify-phases ,phases
7964 (add-after 'strip 'remove-store-references
7965 (lambda* (#:key outputs #:allow-other-keys)
7966 (let* ((out (assoc-ref outputs "out")))
7967 (with-directory-excursion out
7968 (remove-store-references "bin/proot")
7969 #t))))))
7970 ((#:allowed-references _ '("out"))
7971 '("out"))))))
7972
7973(define-public cpuid
7974 (package
7975 (name "cpuid")
7976 (version "20221003")
7977 (source (origin
7978 (method url-fetch)
7979 (uri (string-append "http://www.etallen.com/cpuid/cpuid-"
7980 version ".src.tar.gz"))
7981 (sha256
7982 (base32
7983 "01w318kxcksfbjwjnnc9ly12g0yp4vm6xjgfl8mmi0jndg0cbi33"))))
7984 (build-system gnu-build-system)
7985 (arguments
7986 (list #:make-flags
7987 #~(list (string-append "CC=" #$(cc-for-target)))
7988 #:tests? #f ; no tests
7989 #:phases
7990 #~(modify-phases %standard-phases
7991 (delete 'configure) ; no configure script
7992 (add-before 'install 'fix-makefile
7993 (lambda* (#:key outputs #:allow-other-keys)
7994 (substitute* "Makefile"
7995 (("\\$\\(BUILDROOT\\)/usr")
7996 (assoc-ref outputs "out"))))))))
7997 (inputs (list perl))
7998 (supported-systems '("i686-linux" "x86_64-linux"))
7999 (home-page "http://www.etallen.com/cpuid.html")
8000 (synopsis "Dump x86 CPUID processor information")
8001 (description "cpuid dumps detailed information about the CPU(s) gathered
8002from the CPUID instruction, and also determines the exact model of CPU(s). It
8003supports Intel, AMD, and VIA CPUs, as well as older Transmeta, Cyrix, UMC,
8004NexGen, Rise, and SiS CPUs.")
8005 (license license:gpl2+)))
8006
8007(define-public jmtpfs
8008 (package
8009 (name "jmtpfs")
8010 (version "0.5")
8011 (source
8012 (origin
8013 (method git-fetch)
8014 (uri (git-reference
8015 (url "https://github.com/JasonFerrara/jmtpfs")
8016 (commit (string-append "v" version))))
8017 (file-name (git-file-name name version))
8018 (sha256
8019 (base32
8020 "1pm68agkhrwgrplrfrnbwdcvx5lrivdmqw8pb5gdmm3xppnryji1"))))
8021 (build-system gnu-build-system)
8022 (inputs
8023 (list file fuse libmtp))
8024 (native-inputs
8025 (list pkg-config))
8026 (home-page "https://github.com/JasonFerrara/jmtpfs")
8027 (synopsis "Use a FUSE file system to access data over MTP")
8028 (description "jmtpfs uses FUSE (file system in userspace) to provide access
8029to data over the Media Transfer Protocol (MTP). Unprivileged users can mount
8030the MTP device as a file system.")
8031 (license license:gpl3)))
8032
8033(define-public procenv
8034 (package
8035 (name "procenv")
8036 (version "0.60")
8037 (source
8038 (origin
8039 (method git-fetch)
8040 (uri (git-reference
8041 (url "https://github.com/jamesodhunt/procenv")
8042 (commit version)))
8043 (file-name (git-file-name name version))
8044 (sha256
8045 (base32 "00d7q0h4qjc8lg435lq77lp2fx6ikm5piq90m81mr1dqqna1g6pz"))))
8046 (build-system gnu-build-system)
8047 (native-inputs
8048 (list pkg-config
8049 ;; For tests.
8050 check groff))
8051 (inputs
8052 (list expat libcap libselinux))
8053 (synopsis "Utility to show process environment")
8054 (description
8055 "Procenv is a command-line tool that displays as much detail about
8056itself and its environment as possible. It can be used as a test
8057tool, to understand the type of environment a process runs in, and for
8058comparing system environments.")
8059 (home-page "https://github.com/jamesodhunt/procenv/")
8060 (license license:gpl3+)))
8061
8062(define-public libfabric
8063 (package
8064 (name "libfabric")
8065 (version "1.11.2")
8066 (source
8067 (origin
8068 (method url-fetch)
8069 (uri
8070 (string-append "https://github.com/ofiwg/libfabric/releases/download/v"
8071 version "/libfabric-" version ".tar.bz2"))
8072 (sha256
8073 (base32 "1nnpfkwxhim2nqjkb1vwrb4wj4j3l6w6yvvy69fqam2snlhshazz"))))
8074 (build-system gnu-build-system)
8075 (inputs `(("rdma-core" ,rdma-core)
8076 ,@(match (%current-system)
8077 ((member (package-supported-systems psm))
8078 `(("psm" ,psm)))
8079 (_ `()))
8080 ("libnl" ,libnl)))
8081 (home-page "https://ofiwg.github.io/libfabric/")
8082 (synopsis "Open Fabric Interfaces")
8083 (description
8084 "OpenFabrics Interfaces (OFI) is a framework focused on exporting fabric
8085communication services to applications. OFI is best described as a collection
8086of libraries and applications used to export fabric services. The key
8087components of OFI are: application interfaces, provider libraries, kernel
8088services, daemons, and test applications.
8089
8090Libfabric is a core component of OFI. It is the library that defines and
8091exports the user-space API of OFI, and is typically the only software that
8092applications deal with directly. It works in conjunction with provider
8093libraries, which are often integrated directly into libfabric.")
8094 (license (list license:bsd-2 license:gpl2)))) ;dual
8095
8096(define-public psm
8097 (package
8098 (name "psm")
8099 (version "3.3.20170428")
8100 (home-page "https://github.com/intel/psm")
8101 (source
8102 (origin
8103 (method git-fetch)
8104 (uri (git-reference (url home-page)
8105 (commit "604758e76dc31e68d1de736ccf5ddf16cb22355b")))
8106 (file-name (string-append "psm-" version ".tar.gz"))
8107 (sha256
8108 (base32 "0nsb325dmhn5ia3d2cnksqr0gdvrrx2hmvlylfgvmaqdpq76zm85"))
8109 (patches (search-patches
8110 "psm-arch.patch" ; uname -p returns "unknown" on Debian 9
8111 "psm-ldflags.patch" ; build shared lib with LDFLAGS
8112 "psm-repro.patch" ; reproducibility
8113 "psm-disable-memory-stats.patch"))))
8114 (build-system gnu-build-system)
8115 (outputs '("out" "debug"))
8116 (inputs `(("libuuid" ,util-linux "lib")))
8117 (arguments
8118 '(#:make-flags `("PSM_USE_SYS_UUID=1" "CC=gcc" "WERROR="
8119 ,(string-append "INSTALL_PREFIX=" %output)
8120 ,(string-append "CFLAGS=-Wall -fpic -fPIC -D_GNU_SOURCE"
8121 " -funwind-tables -O3 -g3"
8122 " -DPSM_USE_SYS_UUID"
8123 " -Wno-strict-aliasing -DNVALGRIND"
8124 " -fcommon")
8125 ,(string-append "LDFLAGS=-Wl,-rpath=" %output "/lib"))
8126 #:tests? #f
8127 #:phases (modify-phases %standard-phases
8128 (delete 'configure)
8129 (add-after 'unpack 'patch-/usr/include
8130 (lambda _
8131 (substitute* "Makefile"
8132 (("\\$\\{DESTDIR}/usr/include")
8133 (string-append %output "/include")))
8134 (substitute* "Makefile"
8135 (("/lib64") "/lib"))
8136 #t))
8137 (add-after 'unpack 'patch-sysmacros
8138 (lambda _
8139 (substitute* "ipath/ipath_proto.c"
8140 (("#include <sys/poll.h>" m)
8141 (string-append m "\n"
8142 "#include <sys/sysmacros.h>")))
8143 #t)))))
8144 (synopsis "Intel Performance Scaled Messaging (PSM) Libraries")
8145 (description
8146 "The PSM Messaging API, or PSM API, is Intel's low-level user-level
8147communications interface for the True Scale family of products. PSM users are
8148enabled with mechanisms necessary to implement higher level communications
8149interfaces in parallel environments.")
8150 ;; Only Intel-compatable processors are supported.
8151 (supported-systems '("i686-linux" "x86_64-linux"))
8152 (license (list license:bsd-2 license:gpl2)))) ;dual
8153
8154(define-public snapscreenshot
8155 (package
8156 (name "snapscreenshot")
8157 (version "1.0.14.3")
8158 (source
8159 (origin
8160 (method url-fetch)
8161 (uri (string-append "http://bisqwit.iki.fi/src/arch/"
8162 name "-" version ".tar.bz2"))
8163 (sha256
8164 (base32 "0gzvqsbf6a2sbd1mqvj1lbm57i2bm5k0cr6ncr821d1f32gw03mk"))))
8165 (build-system gnu-build-system)
8166 (arguments
8167 `(#:make-flags
8168 (let ((out (assoc-ref %outputs "out")))
8169 (list (string-append "BINDIR=" out "/bin")
8170 (string-append "MANDIR=" out "/share/man")))
8171 #:tests? #f ; no test suite
8172 #:phases
8173 (modify-phases %standard-phases
8174 (delete 'configure) ; ./configure is a snarky no-op
8175 (add-before 'install 'fix-ownership
8176 ;; Install binaries owned by ‘root’ instead of the nonexistent ‘bin’.
8177 (lambda _
8178 (substitute* "depfun.mak"
8179 ((" -o bin -g bin ") " "))
8180 #t))
8181 (add-before 'install 'create-output-directories
8182 (lambda* (#:key outputs #:allow-other-keys)
8183 (let ((out (assoc-ref outputs "out")))
8184 (mkdir-p (string-append out "/share/man/man1"))
8185 #t))))))
8186 (home-page "https://bisqwit.iki.fi/source/snapscreenshot.html")
8187 (synopsis "Take screenshots of one or more Linux text consoles")
8188 (description
8189 "snapscreenshot saves a screenshot of one or more Linux text consoles as a
8190Targa (@dfn{.tga}) image. It can be used by anyone with read access to the
8191relevant @file{/dev/vcs*} file(s).")
8192 (license license:gpl2)))
8193
8194(define-public fbcat
8195 (package
8196 (name "fbcat")
8197 (version "0.5.2")
8198 (source
8199 (origin
8200 (method url-fetch)
8201 (uri (string-append "https://github.com/jwilk/fbcat/releases/download/"
8202 version "/" name "-" version ".tar.gz"))
8203 (sha256
8204 (base32 "07q6f0xj7b4gjvn69qfn0g04yd0ch8ndzyigcz8nnrhli0cvsbh6"))))
8205 (build-system gnu-build-system)
8206 (inputs
8207 ;; The ‘fbgrab’ wrapper can use one of several PPM-to-PNG converters. We
8208 ;; choose netpbm simply because it's the smallest. It still adds ~94 MiB
8209 ;; to an otherwise tiny package, so we put ‘fbgrab’ in its own output.
8210 `(("pnmtopng" ,netpbm)))
8211 (outputs (list "out" "fbgrab"))
8212 (arguments
8213 `(#:make-flags
8214 (list "CC=gcc"
8215 (string-append "PREFIX=" (assoc-ref %outputs "out")))
8216 #:tests? #f ; no tests
8217 #:phases
8218 (modify-phases %standard-phases
8219 (delete 'configure) ; no configure script
8220 (add-after 'build 'qualify-references
8221 (lambda* (#:key inputs outputs #:allow-other-keys)
8222 (let* ((pnmtopng (assoc-ref inputs "pnmtopng"))
8223 (out (assoc-ref outputs "out")))
8224 (substitute* "fbgrab"
8225 (("fbcat" all)
8226 (string-append out "/bin/" all))
8227 (("pnmtopng" all)
8228 (string-append pnmtopng "/bin/" all))))))
8229 (add-after 'install 'split-fbgrab-output
8230 (lambda* (#:key outputs #:allow-other-keys)
8231 (let* ((out (assoc-ref outputs "out"))
8232 (out:fbgrab (assoc-ref outputs "fbgrab")))
8233 (for-each (lambda (file)
8234 (let ((old (string-append out "/" file))
8235 (new (string-append out:fbgrab "/" file)))
8236 (mkdir-p (dirname new))
8237 (rename-file old new)))
8238 (list "bin/fbgrab"
8239 "share/man/man1/fbgrab.1"))))))))
8240 (home-page "https://jwilk.net/software/fbcat")
8241 (synopsis "Take a screenshot of the contents of the Linux framebuffer")
8242 (description
8243 "fbcat saves the contents of the Linux framebuffer (@file{/dev/fb*}), or
8244a dump therof. It supports a wide range of drivers and pixel formats.
8245@command{fbcat} can take screenshots of virtually any application that can be
8246made to write its output to the framebuffer, including (but not limited to)
8247text-mode or graphical applications that don't use a display server.
8248
8249Also included is @command{fbgrab}, a wrapper around @command{fbcat} that
8250emulates the behaviour of Gunnar Monell's older fbgrab utility.")
8251 (license license:gpl2)))
8252
8253(define-public libcgroup
8254 (package
8255 (name "libcgroup")
8256 (version "2.0.2")
8257 (home-page "https://github.com/libcgroup/libcgroup")
8258 (source
8259 (origin
8260 (method url-fetch)
8261 (uri (string-append home-page "/releases/download/v"
8262 version "/" name "-" version ".tar.gz"))
8263 (sha256
8264 (base32 "1y0c9ncsawamj77raiw6qkbm5cdsyvhjb2mvgma1kxmgw0r3pxlf"))))
8265 (build-system gnu-build-system)
8266 (arguments
8267 ;; Tests are virtualized with lxc, it is not very feasible
8268 ;; to make them executable under guix build. Also, note that
8269 ;; origin is using source tarball release which is prepared
8270 ;; after testing.
8271 `(#:tests? #f))
8272 (native-inputs
8273 (list bison flex))
8274 (inputs
8275 (list linux-pam))
8276 (synopsis "Control groups management tools")
8277 (description "Control groups is Linux kernel method for process resource
8278restriction, permission handling and more. This package provides userspace
8279interface to this kernel feature.")
8280 (license license:lgpl2.1)))
8281
8282(define-public mbpfan
8283 (package
8284 (name "mbpfan")
8285 (version "2.2.1")
8286 (source
8287 (origin
8288 (method git-fetch)
8289 (uri (git-reference
8290 (url "https://github.com/dgraziotin/mbpfan")
8291 (commit (string-append "v" version))))
8292 (file-name (git-file-name name version))
8293 (sha256
8294 (base32 "0gc9ypxi55vxs77nx8ihhh9zk7fr9v0m0zfm76q7x0bi6jz11mbr"))))
8295 (build-system gnu-build-system)
8296 (arguments
8297 `(#:tests? #f ; tests ask to be run as root
8298 #:make-flags (let ((out (assoc-ref %outputs "out")))
8299 (list (string-append "DESTDIR=" out)
8300 ,(string-append "CC=" (cc-for-target))))
8301 #:phases
8302 (modify-phases %standard-phases
8303 (add-after 'unpack 'patch-paths
8304 (lambda _
8305 (substitute* "Makefile"
8306 (("/usr") ""))
8307 #t))
8308 (delete 'configure)))) ; there's no configure phase
8309 (home-page "https://github.com/dgraziotin/mbpfan")
8310 (synopsis "Control fan speed on Macbooks")
8311 (description
8312 "mbpfan is a fan control daemon for Apple Macbooks. It uses input from
8313the @code{coretemp} module and sets the fan speed using the @code{applesmc}
8314module. It can be executed as a daemon or in the foreground with root
8315privileges.")
8316 (license license:gpl3+)))
8317
8318(define-public psm2
8319 (package
8320 (name "psm2")
8321 (version "11.2.185")
8322 (source (origin
8323 (method git-fetch)
8324 (uri (git-reference
8325 (url "https://github.com/intel/opa-psm2")
8326 (commit (string-append "PSM2_" version))))
8327 (file-name (git-file-name name version))
8328 (sha256
8329 (base32
8330 "062hg4r6gz7pla9df70nqs5i2a3mp1wszmp4l0g771fykhhrxsjg"))))
8331 (build-system gnu-build-system)
8332 (arguments
8333 '(#:make-flags
8334 `(,(string-append "LDFLAGS=-Wl,-rpath=" %output "/lib"))
8335 #:tests? #f
8336 #:phases (modify-phases %standard-phases
8337 (delete 'configure)
8338 (add-after 'unpack 'patch-Makefiles
8339 (lambda _
8340 (substitute* "Makefile"
8341 (("/lib64") "/lib")
8342 (("/usr") ""))
8343 (substitute* "compat/Makefile"
8344 (("/lib64") "/lib")
8345 (("/usr") ""))
8346 #t))
8347 (replace 'install
8348 (lambda _
8349 (setenv "DESTDIR" %output)
8350 (invoke "make" "install")
8351 #t)))))
8352 (inputs
8353 (list rdma-core numactl))
8354 (synopsis "Intel Performance Scaled Messaging 2 (PSM2) library")
8355 (description
8356 "This package is low-level user-level Intel's communications interface.
8357The PSM2 API is a high-performance vendor-specific protocol that provides a
8358low-level communications interface for the Intel Omni-Path family of
8359high-speed networking devices.")
8360 (home-page "https://github.com/intel/opa-psm2")
8361 ;; Only the x86_64 architecure is supported.
8362 (supported-systems '("x86_64-linux"))
8363 (license (list license:bsd-3 license:gpl2)))) ; dual
8364
8365(define-public libpfm4
8366 (package
8367 (name "libpfm4")
8368 (version "4.9.0")
8369 (source (origin
8370 (method url-fetch)
8371 (uri (string-append "mirror://sourceforge/perfmon2/"
8372 name "/libpfm-" version ".tar.gz"))
8373 (sha256
8374 (base32
8375 "1qp4g4n6dw42p2w5rkwzdb7ynk8h7g5vg01ybpmvxncgwa7bw3yv"))))
8376 (build-system gnu-build-system)
8377 (arguments
8378 '(#:modules ((guix build utils)
8379 (guix build gnu-build-system))
8380 #:phases (modify-phases %standard-phases
8381 (delete 'configure)
8382 (delete 'check)
8383 (replace 'build
8384 (lambda* (#:key inputs outputs #:allow-other-keys)
8385 (let* ((out (assoc-ref outputs "out")))
8386 (setenv "CC" "gcc")
8387 (setenv "CFLAGS" "-Wno-format-truncation")
8388 (invoke "make")
8389 #t)))
8390 (replace 'install
8391 (lambda* (#:key outputs #:allow-other-keys)
8392 (let* ((out (assoc-ref outputs "out")))
8393 (invoke "make"
8394 (string-append "PREFIX=" out)
8395 "install")
8396 #t))))))
8397 (synopsis "Performance event monitoring library")
8398 (description
8399 "This package provides a library called libpfm4, which is used to develop
8400monitoring tools exploiting the performance monitoring events such as those
8401provided by the Performance Monitoring Unit (PMU) of modern processors.
8402
8403Libpfm4 helps convert from an event name, expressed as a string, to the event
8404encoding that is either the raw event as documented by the hardware vendor or
8405the OS-specific encoding. In the latter case, the library is able to prepare
8406the OS-specific data structures needed by the kernel to setup the event.
8407
8408libpfm4 provides support for the @code{perf_events} interface, which was
8409introduced in Linux 2.6.31.")
8410 (home-page "http://perfmon2.sourceforge.net/")
8411 (license license:expat)))
8412
8413(define-public libnfnetlink
8414 (package
8415 (name "libnfnetlink")
8416 (version "1.0.2")
8417 (source (origin
8418 (method url-fetch)
8419 (uri (string-append
8420 "https://www.netfilter.org/projects/libnfnetlink/files/"
8421 "libnfnetlink-" version ".tar.bz2"))
8422 (sha256
8423 (base32
8424 "0xn3rcrzxr6g82kfxzs9bqn2zvl2kf2yda30drwb9vr6sk1wfr5h"))))
8425 (build-system gnu-build-system)
8426 (home-page "https://www.netfilter.org/projects/libnfnetlink/")
8427 (synopsis "Low-level netfilter netlink communication library")
8428 (description
8429 "@code{libnfnetlink} is the low-level library for netfilter related
8430kernel/userspace communication. It provides a generic messaging
8431infrastructure for in-kernel netfilter subsystems (such as nfnetlink_log,
8432nfnetlink_queue, nfnetlink_conntrack) and their respective users and/or
8433management tools in userspace.")
8434 (license license:gpl2)))
8435
8436(define-public go-netlink
8437 (package
8438 (name "go-netlink")
8439 (version "1.0.0")
8440 (source (origin
8441 (method git-fetch)
8442 (uri (git-reference
8443 (url "https://github.com/vishvananda/netlink")
8444 (commit (string-append "v" version))))
8445 (file-name (git-file-name name version))
8446 (sha256
8447 (base32
8448 "0hpzghf1a4cwawzhkiwdzin80h6hd09fskl77d5ppgc084yvj8x0"))))
8449 (build-system go-build-system)
8450 (arguments
8451 `(#:import-path "github.com/vishvananda/netlink"))
8452 (native-inputs
8453 (list go-golang-org-x-sys go-netns))
8454 (home-page "https://github.com/vishvananda/netlink")
8455 (synopsis "Simple netlink library for Go")
8456 (description "The netlink package provides a simple netlink library for
8457Go. Netlink is the interface a user-space program in Linux uses to
8458communicate with the kernel. It can be used to add and remove interfaces, set
8459IP addresses and routes, and configure IPsec.")
8460 (license license:asl2.0)))
8461
8462(define-public libinih
8463 (package
8464 (name "libinih")
8465 (version "56")
8466 (source (origin
8467 (method git-fetch)
8468 (uri (git-reference
8469 (url "https://github.com/benhoyt/inih")
8470 (commit (string-append "r" version))))
8471 (file-name (git-file-name name version))
8472 (sha256
8473 (base32
8474 "1fjqvf56yij15lgwj58dcmxlq5n98gzpbss0nnn1d2i5j7gf4kgf"))))
8475 (build-system meson-build-system)
8476 ;; Install static libraries for use by the initrd's xfsprogs/static.
8477 (outputs (list "out" "static"))
8478 (arguments
8479 `(#:configure-flags
8480 (list "-Ddistro_install=true"
8481 "-Ddefault_library=both")
8482 #:phases
8483 (modify-phases %standard-phases
8484 (add-after 'install 'separate-static
8485 (lambda* (#:key outputs #:allow-other-keys)
8486 (let ((out (assoc-ref outputs "out"))
8487 (static (assoc-ref outputs "static")))
8488 (with-directory-excursion out
8489 (for-each (lambda (source)
8490 (let ((target (string-append static "/" source)))
8491 (mkdir-p (dirname target))
8492 (rename-file source target)))
8493 (find-files "lib" "\\.a$")))))))))
8494 (home-page "https://github.com/benhoyt/inih")
8495 (synopsis "Simple .INI parser library for C")
8496 (description "The inih (INI Not Invented Here) library is a simple .INI file
8497parser written in C. It's only a couple of pages of code, and it was designed to
8498be small and simple, so it's good for embedded systems. It's also more or less
8499compatible with Python's ConfigParser style of .INI files, including RFC
8500822-style multi-line syntax and name: value entries.")
8501 (license license:bsd-3)))
8502
8503(define-public xfsprogs
8504 (package
8505 (name "xfsprogs")
8506 (version "6.0.0")
8507 (source (origin
8508 (method url-fetch)
8509 (uri (string-append
8510 "mirror://kernel.org/linux/utils/fs/xfs/xfsprogs/"
8511 "xfsprogs-" version ".tar.gz"))
8512 (sha256
8513 (base32
8514 "14hc61nfc73nqwhyasc4haj5g7046im1dwz61bx338f86mjj5n5y"))))
8515 (build-system gnu-build-system)
8516 (outputs (list "out" "python"))
8517 (arguments
8518 `(#:tests? #f ; kernel/user integration tests are in package "xfstests"
8519 #:configure-flags
8520 (list "--disable-static")
8521 #:make-flags
8522 (list "V=1")
8523 #:phases
8524 (modify-phases %standard-phases
8525 (add-after 'install 'separate-python-output
8526 (lambda* (#:key outputs #:allow-other-keys)
8527 (let ((out (assoc-ref outputs "out"))
8528 (python (assoc-ref outputs "python")))
8529 (for-each
8530 (lambda (script)
8531 (mkdir-p (string-append python (dirname script)))
8532 (rename-file (string-append out script)
8533 (string-append python script)))
8534 (list "/sbin/xfs_scrub_all")))))
8535 (add-after 'install 'install-headers
8536 (lambda* (#:key make-flags #:allow-other-keys)
8537 (apply invoke "make" "install-dev" make-flags))))))
8538 (native-inputs
8539 `(("gettext" ,gettext-minimal)))
8540 (inputs
8541 `(("libinih" ,libinih)
8542 ("liburcu" ,liburcu)
8543 ("libuuid" ,util-linux "lib")
8544 ("python" ,python-wrapper)))
8545 (home-page "https://xfs.wiki.kernel.org/")
8546 (synopsis "XFS file system tools")
8547 (description "This package provides commands to create and check XFS
8548file systems.")
8549 ;; The library "libhandle" and the headers in "xfslibs-dev" are
8550 ;; licensed under lgpl2.1. the other stuff is licensed under gpl2.
8551 (license (list license:gpl2 license:lgpl2.1))))
8552
8553(define-public xfsprogs-5.9
8554 (package
8555 (inherit xfsprogs)
8556 (name "xfsprogs")
8557 (version "5.9.0")
8558 (source (origin
8559 (method url-fetch)
8560 (uri (string-append
8561 "mirror://kernel.org/linux/utils/fs/xfs/xfsprogs/"
8562 "xfsprogs-" version ".tar.gz"))
8563 (sha256
8564 (base32
8565 "13xkn9jpmwp4fm9r68vhgznkmxhnv83n2b39mhy2qdaph90w2a1l"))))))
8566
8567(define-public xfsprogs/static
8568 (package
8569 (inherit xfsprogs)
8570 (name "xfsprogs-static")
8571 (outputs (list "out"))
8572 (arguments
8573 (substitute-keyword-arguments (package-arguments xfsprogs)
8574 ((#:configure-flags configure-flags '())
8575 `(append ,configure-flags
8576 (list "--enable-static")))
8577 ((#:make-flags make-flags ''())
8578 `(cons* "LLDFLAGS=-all-static" ,make-flags))
8579 ((#:phases _ ''())
8580 `(modify-phases %standard-phases
8581 (add-after 'install 'delete-useless-files
8582 (lambda* (#:key outputs #:allow-other-keys)
8583 (with-directory-excursion (assoc-ref outputs "out")
8584 (for-each delete-file-recursively
8585 (list "include" "lib")))))))))
8586 (inputs
8587 `(("libinih:static" ,libinih "static")
8588 ("util-linux:static" ,util-linux "static")
8589 ,@(remove (match-lambda
8590 ((label . _)
8591 (member label '("python"))))
8592 (package-inputs xfsprogs))))
8593 (synopsis "Statically linked XFS file system tools")))
8594
8595(define-public xfs_repair/static
8596 (package
8597 (name "xfs_repair-static")
8598 (version (package-version xfsprogs/static))
8599 (source #f)
8600 (build-system trivial-build-system)
8601 (arguments
8602 `(#:modules ((guix build utils))
8603 #:builder
8604 (begin
8605 (use-modules (guix build utils))
8606 (let* ((xfsprogs (assoc-ref %build-inputs "xfsprogs"))
8607 (out (assoc-ref %outputs "out"))
8608 (sbin (string-append out "/sbin")))
8609 (install-file (string-append xfsprogs "/sbin/xfs_repair") sbin)
8610 (with-directory-excursion sbin
8611 (remove-store-references "xfs_repair"))))))
8612 (inputs
8613 `(("xfsprogs" ,xfsprogs/static)))
8614 (home-page (package-home-page xfsprogs/static))
8615 (synopsis "Statically linked @command{xfs_repair} from xfsprogs")
8616 (description
8617 "This package provides a statically linked @command{xfs_repair} taken
8618from the xfsprogs package. It is meant to be used in initrds.")
8619 (license (package-license xfsprogs/static))))
8620
8621(define-public genext2fs
8622 (package
8623 (name "genext2fs")
8624 (version "1.5.0")
8625 (source (origin
8626 (method git-fetch)
8627 (uri (git-reference
8628 (url "https://github.com/bestouff/genext2fs")
8629 (commit "474111097321f03de9e009aa9f7d4a8948e310b2")))
8630 (file-name (git-file-name name version))
8631 (sha256
8632 (base32 "14lgvml5zz99845ja47jpf4iirjzfqv36ffzachh3hw2ggji9c7l"))))
8633 (build-system gnu-build-system)
8634 (native-inputs
8635 (list autoconf automake))
8636 (home-page "https://github.com/bestouff/genext2fs")
8637 (synopsis "Generate ext2 file system as a normal user")
8638 (description "This package provides a program to generate an ext2
8639file system as a normal (non-root) user. It does not require you to mount
8640the image file to copy files on it, nor does it require that you become
8641the superuser to make device nodes.")
8642 (license license:gpl2)))
8643
8644(define-public fakeroot
8645 (package
8646 (name "fakeroot")
8647 (version "1.28")
8648 (source
8649 (origin
8650 ;; There are no tags in the repository, so take this snapshot.
8651 (method url-fetch)
8652 (uri (string-append "https://deb.debian.org/debian/pool/main/f/"
8653 "fakeroot/fakeroot_" version ".orig.tar.gz"))
8654 (file-name (string-append name "-" version ".tar.gz"))
8655 (sha256
8656 (base32 "1hlh77b6m2cfm42lcav372mbjni5akbgs25yg4wgi1gndzihbm2n"))
8657 (modules '((guix build utils)
8658 (ice-9 ftw)))
8659 (snippet
8660 `(begin
8661 ;; Delete pregenerated man page translations, but not the originals.
8662 (with-directory-excursion "doc"
8663 (for-each (lambda (language)
8664 (for-each delete-file
8665 (find-files language "\\.[0-9]$")))
8666 (scandir "."
8667 (lambda (file)
8668 (and (not (string-prefix? "." file))
8669 (eq? 'directory
8670 (stat:type (lstat file))))))))))))
8671 (build-system gnu-build-system)
8672 (arguments
8673 `(#:configure-flags
8674 (list "--disable-static")
8675 #:phases
8676 (modify-phases %standard-phases
8677 (add-after 'unpack 'patch-Makefile.am
8678 (lambda _
8679 (substitute* "Makefile.am"
8680 (("/bin/sh") (which "sh")))))
8681 (add-after 'unpack 'patch-script
8682 (lambda* (#:key inputs #:allow-other-keys)
8683 (substitute* "scripts/fakeroot.in"
8684 (("getopt")
8685 (string-append (assoc-ref inputs "util-linux")
8686 "/bin/getopt"))
8687 (("sed")
8688 (string-append (assoc-ref inputs "sed")
8689 "/bin/sed"))
8690 (("cat|cut" command)
8691 (string-append (assoc-ref inputs "coreutils")
8692 "/bin/" command)) )))
8693 (replace 'bootstrap
8694 (lambda _
8695 ;; The "preroll" script takes care of Autoconf and also
8696 ;; prepares the translated manuals.
8697 (invoke "sh" "./preroll")))
8698 (add-before 'configure 'setenv
8699 (lambda _
8700 (setenv "LIBS" "-lacl")))
8701 (add-before 'check 'prepare-check
8702 (lambda _
8703 (setenv "SHELL" (which "bash"))
8704 (setenv "VERBOSE" "1")
8705 (substitute* "test/t.touchinstall"
8706 ;; We don't have the name of the root user, so use ID=0.
8707 (("grep root") "grep \"\\<0\\>\""))
8708 (substitute* "test/tartest"
8709 ;; We don't have the name of the root group, so use ID=0.
8710 (("ROOTGROUP=root") "ROOTGROUP=0")
8711 ;; We don't have the name of the daemon user, so use IDs.
8712 (("daemon:sys") "1:3")
8713 (("daemon:") "1:"))
8714 ;; We don't have an /etc/passwd entry for "root" - use numeric IDs.
8715 (substitute* "test/compare-tar"
8716 (("tar -tvf") "tar --numeric-owner -tvf")))))))
8717 (native-inputs
8718 `(;; For bootstrapping the package.
8719 ("autoconf" ,autoconf-2.71)
8720 ("automake" ,automake)
8721 ("libtool" ,libtool)
8722 ("gettext" ,gettext-minimal)
8723 ("po4a" ,po4a)
8724
8725 ;; For tests.
8726 ("sharutils" ,sharutils)
8727 ("xz" ,xz)))
8728 (inputs
8729 (list acl libcap util-linux sed coreutils))
8730 (synopsis "Run commands in an environment with fake root privileges")
8731 (description
8732 "@command{fakeroot} runs a command in an environment where it appears to
8733have root privileges for file manipulation. This is useful for allowing users
8734to create archives (@file{tar}, @file{ar}, @file{deb}, etc.) with files in
8735them with root permissions and/or ownership.
8736
8737Without fakeroot, one would have to have root privileges to create the
8738constituent files of the archives with the correct permissions and ownership,
8739and then pack them up, or one would have to construct the archives directly,
8740without using the archiver.")
8741 (home-page "http://freshmeat.sourceforge.net/projects/fakeroot")
8742 (license license:gpl3+)))
8743
8744(define-public fakechroot
8745 ;; XXX: Build from the change submitted at
8746 ;; <https://github.com/dex4er/fakechroot/pull/85> to allow compilation
8747 ;; against glibc 2.33. Switch back to the official repository on the next
8748 ;; release.
8749 (let ((commit "e7c1f3a446e594a4d0cce5f5d499c9439ce1d5c5")
8750 (revision "0"))
8751 (package
8752 (name "fakechroot")
8753 (version (git-version "2.20.1" revision commit))
8754 (source (origin
8755 (method git-fetch)
8756 (uri (git-reference
8757 (url "https://github.com/lipnitsk/fakechroot")
8758 (commit commit)))
8759 (file-name (git-file-name name version))
8760 (sha256
8761 (base32
8762 "0gac6a6djx3nf343vd33sr5qqngz8ss3aij54zl8x9wb47pc11kb"))))
8763 (build-system gnu-build-system)
8764 (arguments
8765 ;; XXX: The tests heavily assume they run on an FHS system so for now
8766 ;; skip them.
8767 '(#:tests? #f
8768 #:configure-flags '("--disable-static")))
8769 (native-inputs (list autoconf automake libtool perl))
8770 (synopsis "Emulate @code{chroot} by overriding file system calls")
8771 (description
8772 "@command{fakechroot} runs a command in an environment were is additional
8773possibility to use @code{chroot} command without root privileges. This is
8774useful for allowing users to create own chrooted environment with possibility
8775to install another packages without need for root privileges.
8776
8777It works by providing @file{libfakechroot.so}, a shared library meant to be
8778set as @code{LD_PRELOAD} to override the C library file system functions.")
8779 (home-page "https://github.com/dex4er/fakechroot/")
8780 (license license:lgpl2.1+))))
8781
8782(define-public inputattach
8783 (package
8784 (name "inputattach")
8785 (version "0.42.0")
8786 (source (origin
8787 (method git-fetch)
8788 (uri (git-reference
8789 (url "https://github.com/linuxwacom/input-wacom")
8790 (commit (string-append "input-wacom-" version))))
8791 (file-name (git-file-name name version))
8792 (sha256
8793 (base32 "04lnn7v0rm4ppbya140im5d4igcl6c1nrqpgbsr0i8wkral0nv7j"))))
8794 (build-system gnu-build-system)
8795 (arguments
8796 `(#:phases
8797 (modify-phases %standard-phases
8798 (delete 'bootstrap)
8799 (delete 'configure)
8800 (replace 'build
8801 (lambda* (#:key inputs #:allow-other-keys)
8802 (with-directory-excursion "inputattach"
8803 (invoke "gcc" "-O2" "-o" "inputattach"
8804 "inputattach.c"))))
8805 (delete 'check)
8806 (replace 'install
8807 (lambda* (#:key outputs #:allow-other-keys)
8808 (let ((target-dir (string-append
8809 (assoc-ref outputs "out")
8810 "/bin/")))
8811 (mkdir-p target-dir)
8812 (copy-file "inputattach/inputattach"
8813 (string-append target-dir
8814 "inputattach"))
8815 #t))))))
8816 (home-page "https://linuxwacom.github.io/")
8817 (synopsis "Dispatch input peripherals events to a device file")
8818 (description "inputattach dispatches input events from several device
8819types and interfaces and translates so that the X server can use them.")
8820 (license license:gpl2+)))
8821
8822(define-public pipewire
8823 (package
8824 (name "pipewire")
8825 (version "0.2.7")
8826 (source (origin
8827 (method git-fetch)
8828 (uri (git-reference
8829 (url "https://github.com/PipeWire/pipewire")
8830 (commit version)))
8831 (file-name (git-file-name name version))
8832 (sha256
8833 (base32
8834 "1q5wrqnhhs6r49p8yvkw1pl0cnsd4rndxy4h5lvdydwgf1civcwc"))
8835 (patches (search-patches "pipewire-0.2.7-fno-common.patch"))))
8836 (build-system meson-build-system)
8837 (arguments
8838 '(#:configure-flags '("-Dsystemd=false")))
8839 (native-inputs
8840 (list pkg-config))
8841 (inputs
8842 (list alsa-lib
8843 dbus
8844 eudev
8845 ffmpeg
8846 gstreamer
8847 gst-plugins-base
8848 libva
8849 sbc
8850 sdl2))
8851 (home-page "https://pipewire.org/")
8852 (synopsis "Server and user space API to deal with multimedia pipelines")
8853 (description
8854 "PipeWire is a project that aims to greatly improve handling of audio and
8855video under Linux. It aims to support the usecases currently handled by both
8856PulseAudio and Jack and at the same time provide same level of powerful handling
8857of Video input and output. It also introduces a security model that makes
8858interacting with audio and video devices from containerized applications easy,
8859with supporting Flatpak applications being the primary goal. Alongside Wayland
8860and Flatpak we expect PipeWire to provide a core building block for the future
8861of Linux application development.")
8862 (license license:lgpl2.0+)))
8863
8864(define-public pipewire-0.3
8865 (package
8866 (inherit pipewire)
8867 (name "pipewire")
8868 (version "0.3.56")
8869 (source (origin
8870 (method git-fetch)
8871 (uri (git-reference
8872 (url "https://github.com/PipeWire/pipewire")
8873 (commit version)))
8874 (file-name (git-file-name name version))
8875 (sha256
8876 (base32
8877 "066g4ri2k8pdflclvr2919f6x98gmqrqyj1xyiingw2nn2pwgcf1"))))
8878 (arguments
8879 (list
8880 #:configure-flags
8881 #~(list (string-append "-Dudevrulesdir=" #$output "/lib/udev/rules.d")
8882 "-Dsystemd=disabled"
8883 "-Dsession-managers=[]"
8884 "-Dman=enabled")))
8885 (native-inputs
8886 (modify-inputs (package-native-inputs pipewire)
8887 (prepend python-docutils)))
8888 (inputs (modify-inputs (package-inputs pipewire)
8889 (prepend avahi
8890 bluez
8891 jack-2
8892 ldacbt
8893 pulseaudio
8894 vulkan-loader
8895 vulkan-headers)))))
8896
8897(define-public wireplumber
8898 (package
8899 (name "wireplumber")
8900 (version "0.4.11")
8901 (source
8902 (origin
8903 (method git-fetch)
8904 (uri (git-reference
8905 (url
8906 "https://gitlab.freedesktop.org/pipewire/wireplumber.git")
8907 (commit version)))
8908 (file-name (git-file-name name version))
8909 (sha256
8910 (base32 "09pg5cki1xn9bwn3bcjdc54z7b4iqkk1dhn560qyjcglq8xg7nnw"))))
8911 (build-system meson-build-system)
8912 (arguments
8913 `(#:configure-flags '("-Dsystemd=disabled"
8914 "-Dsystem-lua=true")))
8915 (native-inputs
8916 (list `(,glib "bin")
8917 pkg-config))
8918 (inputs (list dbus elogind glib lua pipewire-0.3))
8919 (home-page "https://gitlab.freedesktop.org/pipewire/wireplumber")
8920 (synopsis "Session / policy manager implementation for PipeWire")
8921 (description "WirePlumber is a modular session / policy manager for
8922PipeWire and a GObject-based high-level library that wraps PipeWire's API,
8923providing convenience for writing the daemon's modules as well as external
8924tools for managing PipeWire.")
8925 (license license:expat)))
8926
8927(define-public ell
8928 (package
8929 (name "ell")
8930 (version "0.54")
8931 (source (origin
8932 (method git-fetch)
8933 (uri (git-reference
8934 (url "https://git.kernel.org/pub/scm/libs/ell/ell.git")
8935 (commit version)))
8936 (file-name (git-file-name name version))
8937 (sha256
8938 (base32
8939 "1vsv5ibiyli1cvk32l5avms6ngv6i0jxxqd5vw5kbfcp6ph94brs"))))
8940 (build-system gnu-build-system)
8941 (arguments
8942 ;; Tests launch dbus-daemon instances that all try to bind to
8943 ;; "/tmp/ell-test-bus". Thus, we need to run them sequentially.
8944 '(#:parallel-tests? #f))
8945 (inputs
8946 (list dbus))
8947 (native-inputs
8948 (list autoconf automake libtool pkg-config))
8949 (home-page "https://01.org/ell")
8950 (synopsis "Embedded Linux Library")
8951 (description "The Embedded Linux* Library (ELL) provides core, low-level
8952functionality for system daemons. It typically has no dependencies other than
8953the Linux kernel, C standard library, and libdl (for dynamic linking). While
8954ELL is designed to be efficient and compact enough for use on embedded Linux
8955platforms, it is not limited to resource-constrained systems.")
8956 (license license:lgpl2.1+)))
8957
8958(define-public kexec-tools
8959 (package
8960 (name "kexec-tools")
8961 (version "2.0.23")
8962 (source (origin
8963 (method url-fetch)
8964 (uri (string-append "mirror://kernel.org/linux/utils/kernel"
8965 "/kexec/kexec-tools-" version ".tar.xz"))
8966 (sha256
8967 (base32
8968 "06r44i91g1s9f7k5b9kmvb58j9vrqvysfh32pb70cnyrgmncsqxa"))))
8969 (build-system gnu-build-system)
8970 (arguments
8971 ;; There are no automated tests.
8972 '(#:tests? #f))
8973 ;; This variant of binutils is used for the 64 bit support needed to
8974 ;; assemble the `purgatory/arch/i386/compat_x86_64.S' program on i686-linux.
8975 (native-inputs (list (make-ld-wrapper "ld-wrapper"
8976 #:binutils binutils)
8977 binutils))
8978 (home-page "https://projects.horms.net/projects/kexec/")
8979 (synopsis "Tools for booting directly into different kernels")
8980 (description "This package provides the @code{kexec} program and ancillary
8981utilities. Using @code{kexec}, it is possible to boot directly into a new
8982kernel from the context of an already-running kernel, bypassing the normal
8983system boot process.")
8984 (supported-systems (delete "riscv64-linux" %supported-systems))
8985 (license license:gpl2)))
8986
8987(define-public cachefilesd
8988 (package
8989 (name "cachefilesd")
8990 (version "0.10.10")
8991 (source (origin
8992 (method url-fetch)
8993 (uri (string-append
8994 "https://git.kernel.org/pub/scm/linux/kernel/git/dhowells"
8995 "/cachefilesd.git/snapshot/cachefilesd-"
8996 version ".tar.gz"))
8997 (sha256
8998 (base32
8999 "0g40ljjnn3wzh9gp6il21c95f977298qrrkrxfnwfl3k3asfmnbi"))))
9000 (build-system gnu-build-system)
9001 (outputs '("out"))
9002 (arguments
9003 `(#:tests? #f ; there are no tests
9004 #:make-flags
9005 (let ((prefix-dir (lambda (var dir)
9006 (string-append var "=" %output "/" dir))))
9007 (list (string-append "CC=" ,(cc-for-target))
9008 (prefix-dir "SBINDIR" "sbin/")
9009 (prefix-dir "ETCDIR" "etc/")
9010 (prefix-dir "MANDIR" "share/man/")))
9011 #:phases (modify-phases %standard-phases (delete 'configure))))
9012 (home-page "https://people.redhat.com/~dhowells/cachefs/")
9013 (synopsis "CacheFiles userspace management daemon")
9014 (description "@code{cachefilesd} is a userspace daemon that manages the
9015cache data store that is used by network file systems such as @code{AFS} and
9016@code{NFS} to cache data locally on disk. The content of the cache is
9017persistent over reboots.")
9018 (license license:gpl2+)))
9019
9020(define-public libbpf
9021 (package
9022 (name "libbpf")
9023 (version "0.8.1")
9024 (source
9025 (origin
9026 (method git-fetch)
9027 (uri (git-reference
9028 (url "https://github.com/libbpf/libbpf")
9029 (commit (string-append "v" version))))
9030 (file-name (git-file-name name version))
9031 (sha256
9032 (base32
9033 "1zzpkk4x3f20483dzw43b3ml03d63vvkmqf4j8y3b61b67wm59bm"))))
9034 (build-system gnu-build-system)
9035 (native-inputs
9036 (list pkg-config))
9037 (propagated-inputs
9038 ;; In Requires.private of libbpf.pc.
9039 (list elfutils zlib))
9040 (arguments
9041 `(#:tests? #f ; no tests
9042 #:make-flags
9043 (list
9044 (string-append "PREFIX=" (assoc-ref %outputs "out"))
9045 (string-append "LIBDIR=$(PREFIX)/lib")
9046 (string-append "CC=" ,(cc-for-target)))
9047 #:phases
9048 (modify-phases %standard-phases
9049 (delete 'configure)
9050 (add-before 'build 'pre-build
9051 (lambda _
9052 (chdir "src"))))))
9053 (home-page "https://github.com/libbpf/libbpf")
9054 (synopsis "BPF CO-RE (Compile Once – Run Everywhere)")
9055 (description
9056 "Libbpf supports building BPF CO-RE-enabled applications, which, in
9057contrast to BCC, do not require the Clang/LLVM runtime or linux kernel
9058headers.")
9059 (license `(,license:lgpl2.1 ,license:bsd-2))))
9060
9061(define-public bcc
9062 (package
9063 (name "bcc")
9064 (version "0.24.0")
9065 (source
9066 (origin
9067 (method git-fetch)
9068 (uri (git-reference
9069 (url "https://github.com/iovisor/bcc")
9070 (commit (string-append "v" version))))
9071 (file-name (git-file-name name version))
9072 (sha256
9073 (base32
9074 "1i6xikkxf2nasfkqa91hjzdq0a88mgyzrvia4fi2i2v1d8pbmnp4"))))
9075 (build-system cmake-build-system)
9076 (native-inputs
9077 (list bison flex))
9078 (inputs
9079 `(("clang-toolchain" ,clang-toolchain-9)
9080 ("libbpf" ,(package-source libbpf))
9081 ;; LibElf required but libelf does not contain
9082 ;; archives, only object files.
9083 ;; https://github.com/iovisor/bcc/issues/504
9084 ("elfutils" ,elfutils)
9085 ("luajit" ,luajit)
9086 ("python-wrapper" ,python-wrapper)))
9087 (arguments
9088 `(;; Tests all require root permissions and a "standard" file hierarchy.
9089 #:tests? #f
9090 #:configure-flags
9091 (let ((revision ,version))
9092 `(,(string-append "-DREVISION=" revision)))
9093 #:phases
9094 (modify-phases %standard-phases
9095 ;; FIXME: Use "-DCMAKE_USE_LIBBPF_PACKAGE=ON".
9096 (add-after 'unpack 'copy-libbpf
9097 (lambda* (#:key inputs #:allow-other-keys)
9098 (delete-file-recursively "src/cc/libbpf")
9099 (copy-recursively
9100 (assoc-ref inputs "libbpf") "src/cc/libbpf")))
9101 (add-after 'copy-libbpf 'substitute-libbc
9102 (lambda* (#:key outputs #:allow-other-keys)
9103 (substitute* "src/python/bcc/libbcc.py"
9104 (("(libbcc\\.so.*)\\b" _ libbcc)
9105 (string-append
9106 (assoc-ref outputs "out") "/lib/" libbcc)))))
9107 (add-after 'install 'wrap-tools
9108 (lambda* (#:key outputs #:allow-other-keys)
9109 (use-modules (ice-9 textual-ports))
9110 (let* ((out (assoc-ref outputs "out"))
9111 (lib (string-append out "/lib"))
9112 (tools (string-append out "/share/bcc/tools"))
9113 (python-executable?
9114 (lambda (filename _)
9115 (call-with-input-file filename
9116 (lambda (port)
9117 (string-contains (get-line port)
9118 "/bin/python"))))))
9119 (for-each
9120 (lambda (python-executable)
9121 (format #t "Wrapping: ~A.~%" python-executable)
9122 (wrap-program python-executable
9123 `("GUIX_PYTHONPATH" ":" prefix
9124 (,(string-append lib
9125 "/python"
9126 ,(version-major+minor
9127 (package-version python))
9128 "/site-packages")))))
9129 (find-files tools python-executable?))
9130 #t))))))
9131 (home-page "https://github.com/iovisor/bcc")
9132 (synopsis "Tools for BPF on Linux")
9133 (description
9134 "BCC is a toolkit for creating efficient kernel tracing and manipulation
9135programs, and includes several useful tools and examples. It makes use of
9136extended BPF (Berkeley Packet Filters), formally known as eBPF, a new feature
9137that was first added to Linux 3.15. Much of what BCC uses requires Linux 4.1
9138and above.")
9139 (license license:asl2.0)))
9140
9141(define-public bpftrace
9142 (package
9143 (name "bpftrace")
9144 (version "0.15.0")
9145 (source
9146 (origin
9147 (method git-fetch)
9148 (uri (git-reference
9149 (url "https://github.com/iovisor/bpftrace")
9150 (commit (string-append "v" version))))
9151 (file-name (git-file-name name version))
9152 (sha256
9153 (base32 "022fg0kiz0liahj82wvlxmivkwyp86shs5fwr2v4blx7lh05k9zm"))
9154 (patches (search-patches "bpftrace-disable-bfd-disasm.patch"))))
9155 (build-system cmake-build-system)
9156 (native-inputs
9157 (list bison flex))
9158 (inputs
9159 (list bcc clang-toolchain-9 elfutils libbpf cereal))
9160 (arguments
9161 `(#:tests? #f ;Tests require googletest sources.
9162 #:configure-flags
9163 '("-DBUILD_TESTING=OFF"
9164 ;; FIXME: libbfd misses some link dependencies, when fixed, remove
9165 ;; the associated patch.
9166 "-DHAVE_BFD_DISASM=OFF")))
9167 (home-page "https://github.com/iovisor/bpftrace")
9168 (synopsis "High-level tracing language for Linux eBPF")
9169 (description
9170 "bpftrace is a high-level tracing language for Linux enhanced Berkeley
9171Packet Filter (eBPF) available in recent Linux kernels (4.x). bpftrace uses
9172LLVM as a backend to compile scripts to BPF-bytecode and makes use of BCC for
9173interacting with the Linux BPF system, as well as existing Linux tracing
9174capabilities: kernel dynamic tracing (kprobes), user-level dynamic
9175tracing (uprobes), and tracepoints. The bpftrace language is inspired by awk
9176and C, and predecessor tracers such as DTrace and SystemTap. bpftrace was
9177created by Alastair Robertson.")
9178 (license license:asl2.0)))
9179
9180(define-public ttyebus-linux-module
9181 (let ((revision "0")
9182 (commit "fe4332a2281cf79804ef4d8516aa848ca1c58d1f"))
9183 (package
9184 (name "ttyebus-linux-module")
9185 (version (git-version "1.5" revision commit))
9186 (source
9187 (origin
9188 (method git-fetch)
9189 (uri (git-reference
9190 (url "https://github.com/eBUS/ttyebus")
9191 (commit "fe4332a2281cf79804ef4d8516aa848ca1c58d1f")))
9192 (file-name (git-file-name name version))
9193 (sha256
9194 (base32
9195 "1i66xjs9vln5cca6wx7aiiw7jihrlsk9hjdqyczp36fvm1b1bani"))))
9196 (supported-systems '("armhf-linux" "aarch64-linux"))
9197 (build-system linux-module-build-system)
9198 (arguments
9199 `(#:tests? #f))
9200 (home-page "https://github.com/eBUS/ttyebus")
9201 (synopsis "Low-latency Raspberry Pi UART driver")
9202 (description "This package provides a Linux kernel module that will
9203provide a serial device @code{/dev/ttyebus} with almost no latency upon
9204receiving. It is dedicated to the PL011 UART of the Raspberry Pi.")
9205 (license license:gpl3+))))
9206
9207(define-public ipset
9208 (package
9209 (name "ipset")
9210 (version "7.15")
9211 (source
9212 (origin
9213 (method url-fetch)
9214 (uri (string-append "https://ipset.netfilter.org/"
9215 "ipset-" version ".tar.bz2"))
9216 (sha256
9217 (base32 "0l8pcaym6057hq3a4zwnk53p5y6xg1m3d3c83wn18h5nmnm4am8a"))))
9218 (build-system gnu-build-system)
9219 (inputs
9220 (list libmnl))
9221 (native-inputs
9222 (list pkg-config))
9223 (arguments
9224 `(#:configure-flags '("--disable-static"
9225 "--with-kmod=no")))
9226 (home-page "https://ipset.netfilter.org/")
9227 (synopsis "Administration tool for IP sets")
9228 (description "IP sets are a framework inside the Linux 2.4.x and 2.6.x kernel which
9229can be administered by the ipset utility. Depending on the type,
9230currently an IP set may store IP addresses, (TCP/UDP) port numbers or
9231IP addresses with MAC addresses in a way which ensures lightning speed
9232when matching an entry against a set.
9233
9234If you want to
9235@itemize @bullet
9236@item store multiple IP addresses or port numbers and match against the entire
9237collection using a single iptables rule.
9238@item dynamically update iptables rules against IP addresses or ports without
9239performance penalty.
9240@item express complex IP address and ports based rulesets with a single
9241iptables rule and benefit from the speed of IP sets.
9242@end itemize\n
9243then IP sets may be the proper tool for you.")
9244 (license license:gpl2+)))
9245
9246(define-public liburing
9247 (package
9248 (name "liburing")
9249 (version "2.2")
9250 (source (origin
9251 (method git-fetch)
9252 (uri (git-reference
9253 (url "https://git.kernel.dk/liburing")
9254 (commit (string-append "liburing-" version))))
9255 (file-name (git-file-name name version))
9256 (sha256
9257 (base32
9258 "1677zqqbd9nw9hrdaxqbd1zwy54cxfsv2z0bjipn23mrkz2xzy1k"))))
9259 (build-system gnu-build-system)
9260 (arguments
9261 `(;; Tests are dependent on kernel version and features
9262 #:tests? #f
9263 #:phases
9264 (modify-phases %standard-phases
9265 (replace 'configure
9266 ;; configure fails if it is followed by SHELL, CONFIG_SHELL,
9267 ;; --enable-fast-install, and --build
9268 (lambda* (#:key outputs #:allow-other-keys)
9269 (let ((out (assoc-ref outputs "out")))
9270 (setenv "SHELL" (which "sh"))
9271 (setenv "CONFIG_SHELL" (which "sh"))
9272 (invoke "./configure" (string-append "--prefix=" out))))))))
9273 (home-page "https://github.com/axboe/liburing")
9274 (synopsis "Interface to the Linux kernel @code{io_uring} interface")
9275 (description "This is the io_uring library, liburing. liburing provides
9276helpers to setup and teardown io_uring instances, and also a simplified
9277interface for applications that don't need (or want) to deal with the full
9278kernel side implementation.")
9279 (license license:expat)))
9280
9281(define-public erofs-utils
9282 (package
9283 (name "erofs-utils")
9284 (version "1.5")
9285 (source
9286 (origin
9287 (method git-fetch)
9288 (uri (git-reference
9289 (url "https://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs-utils.git")
9290 (commit (string-append "v" version))))
9291 (file-name (git-file-name name version))
9292 (sha256
9293 (base32 "0rgkw3b924xdg49v3qi8a10w41zfk276wb6fp71lb9q9cfc81idw"))))
9294 (build-system gnu-build-system)
9295 (inputs
9296 (list lz4
9297 `(,util-linux "lib")))
9298 (native-inputs
9299 (list autoconf automake libtool pkg-config))
9300 (home-page "https://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs-utils.git/")
9301 (synopsis "User-space tools for the EROFS file system")
9302 (description
9303 "@acronym{EROFS, The Enhanced Read-Only File System} is a compressed,
9304read-only file system optimized for resource-scarce devices. This package
9305provides user-space tools for creating EROFS file systems.")
9306 (license license:gpl2+)))
9307
9308(define-public rasdaemon
9309 (package
9310 (name "rasdaemon")
9311 (version "0.6.8")
9312 (source
9313 (origin
9314 (method git-fetch)
9315 (uri (git-reference
9316 (url "https://github.com/mchehab/rasdaemon")
9317 (commit (string-append "v" version))))
9318 (file-name (git-file-name name version))
9319 (sha256
9320 (base32 "0r0339mg4rc12p63iiq2kwdqn1zjakyiv014i2a2l9s8v5rjik41"))))
9321 (native-inputs (list autoconf automake libtool))
9322 (inputs (list sqlite))
9323 (arguments
9324 `(#:configure-flags
9325 (list "--enable-all"
9326 ;; Don't install unused /etc/sysconfig/rasdaemon environment file.
9327 "--with-sysconfdefdir=."
9328 "--localstatedir=/var")
9329 #:phases
9330 (modify-phases %standard-phases
9331 (add-before 'configure 'munge-autotools
9332 (lambda _
9333 ;; For some reason upstream forces sysconfdir=/etc. This results
9334 ;; in EPERM during the install phase. Removing the offending
9335 ;; line lets sysconfdir correctly pick up DESTDIR.
9336 (substitute* "configure.ac"
9337 (("^test .* sysconfdir=/etc\n$") ""))
9338 ;; Upstream tries to create /var/lib/rasdaemon at install time.
9339 ;; This results in EPERM on guix. Instead, the service should
9340 ;; create this at activation time.
9341 (substitute* "Makefile.am"
9342 (("^\\s*\\$\\(install_sh\\) -d .*@RASSTATEDIR@.*$") "")))))))
9343 (build-system gnu-build-system)
9344 (home-page "https://github.com/mchehab/rasdaemon")
9345 (synopsis "Platform Reliability, Availability, and Serviceability tools")
9346 (description
9347 "The @code{rasdaemon} daemon monitors platform @acronym{RAS, Reliability
9348Availability and Serviceability} reports from Linux kernel trace events.
9349These trace events are logged in @file{/sys/kernel/debug/tracing} and reported
9350through standard log mechanisms like syslog.")
9351 (license license:gpl2)))
9352
9353(define-public libgpiod
9354 (package
9355 (name "libgpiod")
9356 (version "1.6.3")
9357 (source
9358 (origin
9359 (method git-fetch)
9360 (uri
9361 (git-reference
9362 (url "https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git")
9363 (commit (string-append "v" version))))
9364 (file-name (git-file-name name version))
9365 (sha256 (base32 "0rv8a11hx3pc6sdw6nfc6k35hkp2clb3v53n1381cvip8fzhbsad"))))
9366 (build-system gnu-build-system)
9367 (arguments
9368 `(#:configure-flags
9369 '("--enable-tools=yes"
9370 "--enable-bindings-cxx"
9371 "--enable-bindings-python")))
9372 (native-inputs
9373 (list automake
9374 autoconf
9375 libtool
9376 autoconf-archive
9377 pkg-config
9378 python-3))
9379 (synopsis "Interact with the Linux GPIO character device")
9380 (description
9381 "This package provides a C library with C++/Python bindings and
9382command-line tools for interacting with GPIO devices that avoids the usage of
9383older system-wide @file{/sys} interface.")
9384 (home-page "https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/")
9385 (license (list license:lgpl2.1+ ;; libgpiod
9386 license:gpl2+ ;; gpio-tools
9387 license:lgpl3+)))) ;; C++ bindings
9388
9389(define-public libtree
9390 (package
9391 (name "libtree")
9392 (version "3.1.1")
9393 (source
9394 (origin
9395 (method git-fetch)
9396 (uri (git-reference
9397 (url "https://github.com/haampie/libtree")
9398 (commit (string-append "v" version))))
9399 (file-name (git-file-name name version))
9400 (sha256
9401 (base32 "1jbc60cslzcfxk9jwva51ncr1zl1nz0fkgfjdckgv81is11nswmb"))))
9402 (arguments
9403 (list #:make-flags
9404 ;; NOTE: Official documentation recommends to build libtree with
9405 ;; "-static" flag.
9406 #~(list (string-append "CC=" #$(cc-for-target))
9407 (string-append "PREFIX=" #$output))
9408 #:phases
9409 #~(modify-phases %standard-phases
9410 (add-after 'unpack 'fix-tests
9411 ;; XXX: '08_nodeflib' fails as 'libtree' returns a non-zero
9412 ;; code in one of the tests.
9413 ;;
9414 ;; See <https://github.com/haampie/libtree/issues/80>).
9415 (lambda _
9416 (substitute* "tests/08_nodeflib/Makefile"
9417 (("! ../../libtree -vvv exe_b")
9418 "../../libtree -vvv exe_b"))))
9419 (delete 'configure))))
9420 (build-system gnu-build-system)
9421 (home-page "https://github.com/haampie/libtree")
9422 (synopsis "Show output of @command{ldd} as a tree")
9423 (description
9424 "This tool turns @command{ldd} into a tree and explains how shared
9425libraries are found or why they cannot be located.")
9426 (license license:expat)))
9427
9428(define-public touchegg
9429 (package
9430 (name "touchegg")
9431 (version "2.0.14")
9432 (source
9433 (origin
9434 (method git-fetch)
9435 (uri (git-reference
9436 (url "https://github.com/JoseExposito/touchegg")
9437 (commit version)))
9438 (file-name (git-file-name name version))
9439 (sha256
9440 (base32 "0shvslz0c8nqx5f988z55qjc9xw0in9rb7b19r6vr1f7cdkqb6yr"))))
9441 (build-system cmake-build-system)
9442 (arguments
9443 `(#:tests? #f ; No tests exist
9444 #:configure-flags
9445 (list "-DUSE_SYSTEMD=OFF"))) ; No systemd
9446 (native-inputs
9447 (list
9448 pkg-config))
9449 (inputs
9450 (list
9451 cairo
9452 gtk+
9453 libgudev
9454 libinput
9455 libxrandr
9456 libxtst
9457 pugixml))
9458 (home-page "https://github.com/JoseExposito/touchegg")
9459 (synopsis "Multitouch gesture recognizer")
9460 (description
9461 "Touchégg is an application that runs in the background and transform the
9462gestures you make on your touchpad or touchscreen into visible actions in your
9463desktop.")
9464 (license license:gpl3+)))
9465
9466(define-public evtest
9467 (package
9468 (name "evtest")
9469 (version "1.35")
9470 (source (origin
9471 (method git-fetch)
9472 (uri (git-reference
9473 (url "https://gitlab.freedesktop.org/libevdev/evtest")
9474 (commit (string-append "evtest-" version))))
9475 (file-name (git-file-name name version))
9476 (sha256
9477 (base32
9478 "164prnw35kda6jfykl7h52lfzy99ma2lk029zscyqk766k19spf4"))))
9479 (build-system gnu-build-system)
9480 (arguments
9481 (list #:tests? #f ;No tests exist
9482 #:make-flags #~(list (string-append "CC="
9483 #$(cc-for-target))
9484 (string-append "PREFIX="
9485 #$output))
9486 #:phases #~(modify-phases %standard-phases
9487 (add-after 'unpack 'generate-doc
9488 (lambda _
9489 (invoke "asciidoc" "-d" "manpage"
9490 "-b" "docbook"
9491 "-o" "evtest.1.xml"
9492 "evtest.txt")
9493 (invoke "xsltproc" "--nonet"
9494 (string-append
9495 #$(this-package-native-input "docbook-xsl")
9496 "/xml/xsl/docbook-xsl-"
9497 #$(package-version
9498 (this-package-native-input "docbook-xsl"))
9499 "/manpages/docbook.xsl")
9500 "evtest.1.xml")))
9501 (replace 'bootstrap
9502 (lambda _
9503 (setenv "CONFIG_SHELL" (which "sh"))
9504 (invoke "autoreconf" "-fi"))))))
9505 (native-inputs (list autoconf
9506 automake
9507 bash-minimal
9508 xmlto
9509 docbook-xsl
9510 libxslt
9511 asciidoc))
9512 (home-page "https://gitlab.freedesktop.org/libevdev/evtest")
9513 (synopsis "Kernel evdev device information and monitor")
9514 (description
9515 "@code{evtest} is a tool to print @code{evdev} kernel events. It reads
9516directly from the kernel device and prints a device description and the events
9517with the value and the symbolic name.")
9518 (license license:gpl2+)))
9519
9520(define-public tp-smapi-module
9521 (package
9522 (name "tp-smapi-module")
9523 (version "0.43")
9524 (source (origin
9525 (method git-fetch)
9526 (uri (git-reference
9527 (url "https://github.com/linux-thinkpad/tp_smapi")
9528 (commit (string-append "tp-smapi/" version))))
9529 (file-name (git-file-name name version))
9530 (sha256
9531 (base32
9532 "1rjb0njckczc2mj05cagvj0lkyvmyk6bw7wkiinv81lw8m90g77g"))))
9533 (build-system linux-module-build-system)
9534 (arguments
9535 `(#:tests? #f)) ;there are none.
9536 (home-page "https://github.com/linux-thinkpad/tp_smapi")
9537 (synopsis
9538 "Linux Kernel module exposing features of ThinkPad hardware")
9539 (description
9540 "This package provides a Linux Kernel module that controls
9541battery charging of specific ThinkPad laptops. It also includes an improved
9542version of the HDAPS driver. The underlying hardware interfaces are
9543@acronym{SMAPI, System Management Application Program Interface} and direct
9544access to the embedded controller.")
9545 (license license:gpl2+)))
9546
9547(define-public modprobed-db
9548 (package
9549 (name "modprobed-db")
9550 (version "2.46")
9551 (source (origin
9552 (method git-fetch)
9553 (uri (git-reference
9554 (url "https://github.com/graysky2/modprobed-db")
9555 (commit (string-append "v" version))))
9556 (file-name (git-file-name name version))
9557 (sha256
9558 (base32
9559 "017w9czm31f5c7wjyrl5fy6cw7ji681jjc7s913nbc0r43j080qr"))))
9560 (build-system gnu-build-system)
9561 (arguments
9562 (list #:tests? #f ;no tests
9563 #:make-flags
9564 #~(list (string-append "PREFIX=" #$output)
9565 "INITDIR_SYSTEMD=no-thanks")
9566 #:phases
9567 #~(modify-phases %standard-phases
9568 (delete 'configure)
9569 (add-after 'install 'fix-path
9570 (lambda* (#:key inputs #:allow-other-keys)
9571 (substitute* (string-append #$output "/bin/modprobed-db")
9572 (("/usr") #$output)
9573 (((string-append "(" (string-join (list "awk"
9574 "cp"
9575 "cut"
9576 "getent"
9577 "grep"
9578 "logname"
9579 "md5sum"
9580 "mkdir"
9581 "mv"
9582 "sed"
9583 "sort"
9584 "uniq"
9585 "wc")
9586 "|") ")") m)
9587 (search-input-file inputs (string-append "/bin/" m)))
9588 (("modprobe ")
9589 (string-append
9590 (search-input-file inputs "/bin/modprobe") " "))))))))
9591 (inputs (list coreutils kmod gawk glibc grep sed))
9592 (home-page "https://wiki.archlinux.org/title/Modprobed-db")
9593 (synopsis "Keep track of Linux modules that have been probed")
9594 (description
9595 "Modprobed-db is a useful utility for users wishing to build a minimal
9596kernel via a @code{make localmodconfig}. In a nutshell, this @command{make}
9597target creates a config based on the current config and a list of modules you
9598define (that @command{modprobed-db} keeps for you). It then disables any
9599module option that is not needed thus not building extraneous modules. This
9600results in a system-specific, streamlined kernel package and footprint as well
9601as reduced compilation times.
9602
9603Modprobed-db simply logs every module ever probed on the target system to a
9604text-based database (@file{$XDG_CONFIG_HOME/modprobed-db}), which can be read
9605directly by @code{make localmodconfig} as described above.")
9606 (license license:expat)))
9607
9608(define-public kconfig-hardened-check
9609 (package
9610 (name "kconfig-hardened-check")
9611 (version "0.5.17")
9612 (source (origin
9613 (method git-fetch)
9614 (uri (git-reference
9615 (url "https://github.com/a13xp0p0v/kconfig-hardened-check")
9616 (commit (string-append "v" version))))
9617 (file-name (git-file-name name version))
9618 (sha256
9619 (base32
9620 "0p9pywfxwyk4yfgaf7bhqrf72ywc6w6k77dbi7lldynha886ih4a"))))
9621 (build-system python-build-system)
9622 (home-page "https://github.com/a13xp0p0v/kconfig-hardened-check")
9623 (synopsis
9624 "Tool for checking the security hardening options of the Linux kernel")
9625 (description
9626 "@code{kconfig-hardened-check} is a tool for checking the security
9627hardening options of the Linux kernel. Provided preferences are based on
9628suggestions from various sources, including:
9629
9630@itemize
9631@item KSPP recommended settings
9632@item CLIP OS kernel configuration
9633@item Last public grsecurity patch (options which they disable)
9634@item SECURITY_LOCKDOWN_LSM patchset
9635@item Direct feedback from the Linux kernel maintainers
9636@end itemize\n
9637This tool supports checking Kconfig options and kernel cmdline parameters.")
9638 (license license:gpl3)))
9639
9640(define-public edac-utils
9641 (package
9642 (name "edac-utils")
9643 (version "0.18")
9644 (source (origin
9645 (method git-fetch)
9646 (uri (git-reference
9647 (url "https://github.com/grondo/edac-utils.git")
9648 (commit version)))
9649 (file-name (string-append name "-" version "-checkout"))
9650 (sha256
9651 (base32
9652 "04j686m58wsnyy5di7rz0sw9jahlm4ziwxjmgs31pjb87vzw3xgp"))))
9653 (build-system gnu-build-system)
9654 (native-inputs
9655 (list perl))
9656 (inputs
9657 (list sysfsutils))
9658 (synopsis "Memory error detection and correction userspace helpers")
9659 (description "This package provides userspace helpers for memory
9660error detection and correction (EDAC).")
9661 (home-page "https://github.com/grondo/edac-utils")
9662 (license license:gpl2+)))
9663
9664(define-public spectre-meltdown-checker
9665 (package
9666 (name "spectre-meltdown-checker")
9667 (version "0.45")
9668 (source (origin
9669 (method git-fetch)
9670 (uri (git-reference
9671 (url "https://github.com/speed47/spectre-meltdown-checker")
9672 (commit (string-append "v" version))))
9673 (file-name (git-file-name name version))
9674 (patches
9675 (search-patches
9676 "spectre-meltdown-checker-externalize-fwdb.patch"
9677 "spectre-meltdown-checker-find-kernel.patch"))
9678 ;; Remove builtin firmware database.
9679 (modules '((guix build utils)))
9680 (snippet '(substitute* "spectre-meltdown-checker.sh"
9681 (("^# [AI],.*") "")))
9682 (sha256
9683 (base32
9684 "1xx8h5791lhc2xw0dcbzjkklzvlxwxkjzh8di4g8divfy24fqsn8"))))
9685 (build-system copy-build-system)
9686 (arguments
9687 (list
9688 #:install-plan
9689 #~'(("spectre-meltdown-checker.sh" "bin/spectre-meltdown-checker"))
9690 #:phases
9691 #~(modify-phases %standard-phases
9692 (add-after 'unpack 'fixpath
9693 (lambda* (#:key inputs #:allow-other-keys)
9694 (define* (find-command inputs cmd #:optional (bin "bin"))
9695 (search-input-file inputs (string-append bin "/" cmd)))
9696 (substitute* "spectre-meltdown-checker.sh"
9697 ;; ${opt_arch_prefix}CMD
9698 (("\\$\\{opt_arch_prefix\\}\\<(nm|objdump|readelf|strings)\\>"
9699 all cmd)
9700 (find-command inputs cmd))
9701
9702 ;; Commands safe to substitute directly.
9703 (("\\<(awk|(base|dir)name|bunzip|g(un)?zip|lz4)\\>" all cmd)
9704 (find-command inputs cmd))
9705 (("\\<(modprobe|pgrep|rmmod|umount|unlzma)\\>" all cmd)
9706 (find-command inputs cmd))
9707 (("\\<(unxz|unzstd|uuencode)\\>" all cmd)
9708 (find-command inputs cmd))
9709
9710 ;; Commands which should only be substituted based on their
9711 ;; surroundings: First up, dd.
9712 (("\\<(dd)\\> if=" all cmd)
9713 (string-append
9714 (find-command inputs cmd)
9715 " if="))
9716
9717 ;; Another special case: sysctl is in sbin.
9718 (("(if |\\$\\( *)\\<(sysctl)\\>" all pre cmd)
9719 (string-append pre (find-command inputs cmd "sbin")))
9720
9721 ;; Meow
9722 (("cat (<<EOF|\"\\$)" all what)
9723 (string-append (find-command inputs "cat") " " what))
9724 (("'cat'")
9725 (string-append "'" (find-command inputs "cat") "'"))
9726 (("\"cat\"")
9727 (string-append "\"" (find-command inputs "cat") "\""))
9728
9729 ;; ${COMMAND} -
9730 ;; ${COMMAND} ^
9731 (("\\<(base64|cut|grep|head|id|mount)\\> ([-^])" all cmd suffix)
9732 (string-append (find-command inputs cmd) " " suffix))
9733 (("\\<(od|perl|rm|uname|xargs)\\> ([-^])" all cmd suffix)
9734 (string-append (find-command inputs cmd) " " suffix))
9735
9736 ;; ${COMMAND} |
9737 (("\\<(dmesg)\\> \\|" all cmd)
9738 (string-append (find-command inputs cmd) " |"))
9739 ;; | ${COMMAND}
9740 (("\\| \\<(grep|sed|sort|stat|tr)\\>" all cmd)
9741 (string-append "| " (find-command inputs cmd)))
9742
9743 ;; Command in sub-shell, i.e. $($COMMAND ...)
9744 (("\\$\\( *(\\<cat|find|grep|mount|nproc|stat|tr\\>)"
9745 all cmd)
9746 (string-append "$(" (find-command inputs cmd)))
9747
9748 ;; command -v
9749 (("command -v \"*\\<(base64|nproc|perl|printf)\\>\"*" all cmd)
9750 (string-append "command -v " (find-command inputs cmd)))))))))
9751 (inputs (list kmod lz4 lzop perl procps sharutils util-linux zstd))
9752 (home-page "https://github.com/speed47/spectre-meltdown-checker")
9753 (synopsis "CPU vulnerability / mitigation checker")
9754 (description
9755 "This package provides a shell script to assess your system's resilience
9756against the several transient execution CVEs that were published since early
97572018, and gives guidance as to how to mitigate them.")
9758 (license license:gpl3)))