gnu: linux-libre: Update to 5.12.5.
[jackhill/guix/guix.git] / gnu / packages / linux.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2021 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2013, 2014, 2015, 2016 Andreas Enge <andreas@enge.fr>
4 ;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
5 ;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2019, 2020 Mark H Weaver <mhw@netris.org>
6 ;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch>
7 ;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
8 ;;; Copyright © 2015, 2016, 2017, 2018, 2020 Efraim Flashner <efraim@flashner.co.il>
9 ;;; Copyright © 2016 Christopher Allan Webber <cwebber@dustycloud.org>
10 ;;; Copyright © 2016–2021 Tobias Geerinckx-Rice <me@tobias.gr>
11 ;;; Copyright © 2016, 2017 Alex Kost <alezost@gmail.com>
12 ;;; Copyright © 2016 Raymond Nicholson <rain1@openmailbox.org>
13 ;;; Copyright © 2016 Mathieu Lirzin <mthl@gnu.org>
14 ;;; Copyright © 2016, 2018, 2019, 2020 Nicolas Goaziou <mail@nicolasgoaziou.fr>
15 ;;; Copyright © 2016, 2018, 2019, 2020 Ricardo Wurmus <rekado@elephly.net>
16 ;;; Copyright © 2016 David Craven <david@craven.ch>
17 ;;; Copyright © 2016 John Darrington <jmd@gnu.org>
18 ;;; Copyright © 2016, 2017, 2018, 2019, 2020, 2021 Marius Bakke <marius@gnu.org>
19 ;;; Copyright © 2016, 2018 Rene Saavedra <pacoon@protonmail.com>
20 ;;; Copyright © 2016 Carlos Sánchez de La Lama <csanchezdll@gmail.com>
21 ;;; Copyright © 2016, 2017 Nikita <nikita@n0.is>
22 ;;; Copyright © 2017, 2018, 2020 Leo Famulari <leo@famulari.name>
23 ;;; Copyright © 2017 José Miguel Sánchez García <jmi2k@openmailbox.com>
24 ;;; Copyright © 2017 Gábor Boskovits <boskovits@gmail.com>
25 ;;; Copyright © 2017, 2019 Mathieu Othacehe <m.othacehe@gmail.com>
26 ;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
27 ;;; Copyright © 2017, 2018, 2019 Rutger Helling <rhelling@mykolab.com>
28 ;;; Copyright © 2017 nee <nee-git@hidamari.blue>
29 ;;; Copyright © 2017 Dave Love <fx@gnu.org>
30 ;;; Copyright © 2018 Pierre-Antoine Rouby <pierre-antoine.rouby@inria.fr>
31 ;;; Copyright © 2018, 2020 Brendan Tildesley <mail@brendan.scot>
32 ;;; Copyright © 2018 Manuel Graf <graf@init.at>
33 ;;; Copyright © 2018 Pierre Langlois <pierre.langlois@gmx.com>
34 ;;; Copyright © 2018 Vasile Dumitrascu <va511e@yahoo.com>
35 ;;; Copyright © 2019 Tim Gesthuizen <tim.gesthuizen@yahoo.de>
36 ;;; Copyright © 2019, 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
37 ;;; Copyright © 2019 Stefan Stefanović <stefanx2ovic@gmail.com>
38 ;;; Copyright © 2019 Pierre Langlois <pierre.langlois@gmx.com>
39 ;;; Copyright © 2019, 2020 Brice Waegeneire <brice@waegenei.re>
40 ;;; Copyright © 2019 Kei Kebreau <kkebreau@posteo.net>
41 ;;; Copyright © 2020 Oleg Pykhalov <go.wigust@gmail.com>
42 ;;; Copyright © 2020 Pierre Neidhardt <mail@ambrevar.xyz>
43 ;;; Copyright © 2020 Chris Marusich <cmmarusich@gmail.com>
44 ;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
45 ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
46 ;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re>
47 ;;; Copyright © 2020 Morgan Smith <Morgan.J.Smith@outlook.com>
48 ;;; Copyright © 2020 John Soo <jsoo1@asu.edu>
49 ;;; Copyright © 2020 Michael Rohleder <mike@rohleder.de>
50 ;;; Copyright © 2020 Anders Thuné <asse.97@gmail.com>
51 ;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
52 ;;; Copyright © 2020, 2021 Greg Hogan <code@greghogan.com>
53 ;;; Copyright © 2020 Zhu Zihao <all_but_last@163.com>
54 ;;; Copyright © 2020 David Dashyan <mail@davie.li>
55 ;;; Copyright © 2020 pukkamustard <pukkamustard@posteo.net>
56 ;;; Copyright © 2021 B. Wilson <elaexuotee@wilsonb.com>
57 ;;;
58 ;;; This file is part of GNU Guix.
59 ;;;
60 ;;; GNU Guix is free software; you can redistribute it and/or modify it
61 ;;; under the terms of the GNU General Public License as published by
62 ;;; the Free Software Foundation; either version 3 of the License, or (at
63 ;;; your option) any later version.
64 ;;;
65 ;;; GNU Guix is distributed in the hope that it will be useful, but
66 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
67 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
68 ;;; GNU General Public License for more details.
69 ;;;
70 ;;; You should have received a copy of the GNU General Public License
71 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
72
73 (define-module (gnu packages linux)
74 #:use-module (gnu packages)
75 #:use-module (gnu packages acl)
76 #:use-module (gnu packages admin)
77 #:use-module (gnu packages algebra)
78 #:use-module (gnu packages audio)
79 #:use-module (gnu packages autotools)
80 #:use-module (gnu packages backup)
81 #:use-module (gnu packages base)
82 #:use-module (gnu packages bash)
83 #:use-module (gnu packages bison)
84 #:use-module (gnu packages boost)
85 #:use-module (gnu packages calendar)
86 #:use-module (gnu packages check)
87 #:use-module (gnu packages cpio)
88 #:use-module (gnu packages crypto)
89 #:use-module (gnu packages cryptsetup)
90 #:use-module (gnu packages compression)
91 #:use-module (gnu packages dbm)
92 #:use-module (gnu packages datastructures)
93 #:use-module (gnu packages docbook)
94 #:use-module (gnu packages documentation)
95 #:use-module (gnu packages elf)
96 #:use-module (gnu packages flex)
97 #:use-module (gnu packages file)
98 #:use-module (gnu packages freedesktop)
99 #:use-module (gnu packages gawk)
100 #:use-module (gnu packages gcc)
101 #:use-module (gnu packages gettext)
102 #:use-module (gnu packages glib)
103 #:use-module (gnu packages golang)
104 #:use-module (gnu packages gperf)
105 #:use-module (gnu packages gstreamer)
106 #:use-module (gnu packages gtk)
107 #:use-module (gnu packages haskell-apps)
108 #:use-module (gnu packages haskell-xyz)
109 #:use-module (gnu packages libunwind)
110 #:use-module (gnu packages libusb)
111 #:use-module (gnu packages llvm)
112 #:use-module (gnu packages lua)
113 #:use-module (gnu packages man)
114 #:use-module (gnu packages maths)
115 #:use-module (gnu packages multiprecision)
116 #:use-module (gnu packages ncurses)
117 #:use-module (gnu packages netpbm)
118 #:use-module (gnu packages networking)
119 #:use-module (gnu packages ninja)
120 #:use-module (gnu packages nss)
121 #:use-module (gnu packages perl)
122 #:use-module (gnu packages pciutils)
123 #:use-module (gnu packages pkg-config)
124 #:use-module (gnu packages popt)
125 #:use-module (gnu packages pulseaudio)
126 #:use-module (gnu packages python)
127 #:use-module (gnu packages python-xyz)
128 #:use-module (gnu packages readline)
129 #:use-module (gnu packages rrdtool)
130 #:use-module (gnu packages samba)
131 #:use-module (gnu packages sdl)
132 #:use-module (gnu packages serialization)
133 #:use-module (gnu packages slang)
134 #:use-module (gnu packages sqlite)
135 #:use-module (gnu packages texinfo)
136 #:use-module (gnu packages tls)
137 #:use-module (gnu packages valgrind)
138 #:use-module (gnu packages video)
139 #:use-module (gnu packages vulkan)
140 #:use-module (gnu packages web)
141 #:use-module (gnu packages xiph)
142 #:use-module (gnu packages xml)
143 #:use-module (gnu packages xdisorg)
144 #:use-module (gnu packages xorg)
145 #:use-module (gnu packages groff)
146 #:use-module (gnu packages rsync)
147 #:use-module (gnu packages selinux)
148 #:use-module (gnu packages swig)
149 #:use-module (guix build-system cmake)
150 #:use-module (guix build-system gnu)
151 #:use-module (guix build-system go)
152 #:use-module (guix build-system meson)
153 #:use-module (guix build-system python)
154 #:use-module (guix build-system trivial)
155 #:use-module (guix build-system linux-module)
156 #:use-module (guix download)
157 #:use-module (guix git-download)
158 #:use-module ((guix licenses) #:prefix license:)
159 #:use-module (guix packages)
160 #:use-module (guix gexp)
161 #:use-module (guix store)
162 #:use-module (guix monads)
163 #:use-module (guix utils)
164 #:use-module (guix deprecation) ;for libcap/next
165 #:use-module (srfi srfi-1)
166 #:use-module (srfi srfi-2)
167 #:use-module (srfi srfi-26)
168 #:use-module (ice-9 match))
169
170 (define-public (system->linux-architecture arch)
171 "Return the Linux architecture name for ARCH, a Guix system name such as
172 \"x86_64-linux\" or a target triplet such as \"arm-linux-gnueabihf\"."
173 (let ((arch (car (string-split arch #\-))))
174 (cond ((string=? arch "i686") "i386")
175 ((string-prefix? "mips" arch) "mips")
176 ((string-prefix? "arm" arch) "arm")
177 ((string-prefix? "aarch64" arch) "arm64")
178 ((string-prefix? "alpha" arch) "alpha")
179 ((string-prefix? "powerpc" arch) "powerpc") ;including "powerpc64le"
180 ((string-prefix? "s390" arch) "s390")
181 ((string-prefix? "riscv" arch) "riscv")
182 (else arch))))
183
184 (define-public (system->defconfig system)
185 "Some systems (notably powerpc-linux) require a special target for kernel
186 defconfig. Return the appropriate make target if applicable, otherwise return
187 \"defconfig\"."
188 (cond ((string-prefix? "powerpc-" system) "pmac32_defconfig")
189 ((string-prefix? "powerpc64-" system) "ppc64_defconfig")
190 ((string-prefix? "powerpc64le-" system) "ppc64_defconfig")
191 (else "defconfig")))
192
193 \f
194 ;;;
195 ;;; Kernel source code deblobbing.
196 ;;;
197
198 (define (linux-libre-deblob-scripts version
199 deblob-hash
200 deblob-check-hash)
201 (list (version-major+minor version)
202 (origin
203 (method url-fetch)
204 (uri (string-append "https://linux-libre.fsfla.org"
205 "/pub/linux-libre/releases/" version "-gnu/"
206 "deblob-" (version-major+minor version)))
207 (file-name (string-append "linux-libre-deblob-"
208 version))
209 (sha256 deblob-hash))
210 (origin
211 (method url-fetch)
212 (uri (string-append "https://linux-libre.fsfla.org"
213 "/pub/linux-libre/releases/" version "-gnu/"
214 "deblob-check"))
215 (file-name (string-append "linux-libre-deblob-check-" version))
216 (sha256 deblob-check-hash))))
217
218 (define* (computed-origin-method gexp-promise hash-algo hash
219 #:optional (name "source")
220 #:key (system (%current-system))
221 (guile (default-guile)))
222 "Return a derivation that executes the G-expression that results
223 from forcing GEXP-PROMISE."
224 (mlet %store-monad ((guile (package->derivation guile system)))
225 (gexp->derivation (or name "computed-origin")
226 (force gexp-promise)
227 #:graft? #f ;nothing to graft
228 #:system system
229 #:guile-for-build guile)))
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
235 corresponding 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 \f
329 ;;;
330 ;;; Kernel sources.
331 ;;;
332
333 (define (linux-libre-urls version)
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/linux-libre-" version "-gnu.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.tar.xz")
343
344 ;; Maybe this URL will become valid eventually.
345 (string-append
346 "mirror://gnu/linux-libre/" version "-gnu/linux-libre-"
347 version "-gnu.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 (define-public linux-libre-5.12-version "5.12.5")
360 (define deblob-scripts-5.12
361 (linux-libre-deblob-scripts
362 linux-libre-5.12-version
363 (base32 "1vdsr9y4gckknrbqcjyfakwva3k0vb5zcivzk3k1s9mh7qp9dils")
364 (base32 "1qp25fd4wgjyk7dzdq9yirm1z5w68sd1p3wv8lch8259i51gwjnf")))
365 (define-public linux-libre-5.12-pristine-source
366 (let ((version linux-libre-5.12-version)
367 (hash (base32 "1x39sdswww4j8zr54wpjzy9dia52kihs11xwljxcnz8pck0vwja0")))
368 (make-linux-libre-source version
369 (%upstream-linux-source version hash)
370 deblob-scripts-5.12)))
371
372 ;; The "longterm" kernels — the older releases with long-term upstream support.
373 ;; Here are the support timelines:
374 ;; <https://www.kernel.org/category/releases.html>
375 (define-public linux-libre-5.10-version "5.10.38")
376 (define deblob-scripts-5.10
377 (linux-libre-deblob-scripts
378 linux-libre-5.10-version
379 (base32 "1rmnx1px4sizs2lq831yd2g9dyflg0vmykz3cv9443x2a2vwy81f")
380 (base32 "0hh27ccqimagr3aij7ygwikxw66y63sqwd0xlf49bhpjd090r9a7")))
381 (define-public linux-libre-5.10-pristine-source
382 (let ((version linux-libre-5.10-version)
383 (hash (base32 "0bzipgnfvd5w70rv1x6g81iwknn2qskw92p2bpyiks7r52qmmwij")))
384 (make-linux-libre-source version
385 (%upstream-linux-source version hash)
386 deblob-scripts-5.10)))
387
388 (define-public linux-libre-5.4-version "5.4.120")
389 (define deblob-scripts-5.4
390 (linux-libre-deblob-scripts
391 linux-libre-5.4-version
392 (base32 "12g1wm7xvjvmjanbgg0ahxm4vs2n5bvicfnnnag4h35vl4q3lggg")
393 (base32 "1xghbbnaisjd0k1klbyn1p7r6r4x5a1bpmkm56a3gh2zvw4s7mj8")))
394 (define-public linux-libre-5.4-pristine-source
395 (let ((version linux-libre-5.4-version)
396 (hash (base32 "0q08q6q2l9k04p8a0vvbnhwfp4yiags8s6wc9dnac0fhd4y3gl1q")))
397 (make-linux-libre-source version
398 (%upstream-linux-source version hash)
399 deblob-scripts-5.4)))
400
401 (define-public linux-libre-4.19-version "4.19.190")
402 (define deblob-scripts-4.19
403 (linux-libre-deblob-scripts
404 linux-libre-4.19-version
405 (base32 "1jfcz4lnm44b3xzrkiipvw35kl0vvdvhr2pg7jfwf02f6qbvay18")
406 (base32 "1jiaw0as1ippkrjdpd52657w5mz9qczg3y2hlra7m9k0xawwiqlf")))
407 (define-public linux-libre-4.19-pristine-source
408 (let ((version linux-libre-4.19-version)
409 (hash (base32 "0pf8py0id0r8wzr5050bik1sbhl8gsznnr5bvcmrs4jkhpp2m73g")))
410 (make-linux-libre-source version
411 (%upstream-linux-source version hash)
412 deblob-scripts-4.19)))
413
414 (define-public linux-libre-4.14-version "4.14.232")
415 (define deblob-scripts-4.14
416 (linux-libre-deblob-scripts
417 linux-libre-4.14-version
418 (base32 "091jk9jkn9jf39bxpc7395bhcb7p96nkg3a8047380ki06lnfxh6")
419 (base32 "1qij18inijj6c3ma8hv98yjagnzxdxyn134da9fd23ky8q6hbvky")))
420 (define-public linux-libre-4.14-pristine-source
421 (let ((version linux-libre-4.14-version)
422 (hash (base32 "0sa3sz7bznlhijd0iwv37nyrrnw34iq6dq1bqr6cj2wpyrhr7h8x")))
423 (make-linux-libre-source version
424 (%upstream-linux-source version hash)
425 deblob-scripts-4.14)))
426
427 (define-public linux-libre-4.9-version "4.9.268")
428 (define deblob-scripts-4.9
429 (linux-libre-deblob-scripts
430 linux-libre-4.9-version
431 (base32 "1wvldzlv7q2xdbadas87dh593nxr4a8p5n0f8zpm72lja6w18hmg")
432 (base32 "0fxajshb75siq39lj5h8xvhdj8lcmddkslwlyj65rhlwk6g2r4b2")))
433 (define-public linux-libre-4.9-pristine-source
434 (let ((version linux-libre-4.9-version)
435 (hash (base32 "0aknrlf5q0dsqib8c9klmf5c60dy7hg2zksb020qvyrp077gcrjv")))
436 (make-linux-libre-source version
437 (%upstream-linux-source version hash)
438 deblob-scripts-4.9)))
439
440 (define-public linux-libre-4.4-version "4.4.268")
441 (define deblob-scripts-4.4
442 (linux-libre-deblob-scripts
443 linux-libre-4.4-version
444 (base32 "0x2j1i88am54ih2mk7gyl79g25l9zz4r08xhl482l3fvjj2irwbw")
445 (base32 "0hhin1jpfkd6nwrb6xqxjzl3hdxy4pn8a15hy2d3d83yw6pflbsf")))
446 (define-public linux-libre-4.4-pristine-source
447 (let ((version linux-libre-4.4-version)
448 (hash (base32 "1srk08kaxq5jjlqx804cgjffhcsrdkv3idh8ipagl6v2w4kas5v8")))
449 (make-linux-libre-source version
450 (%upstream-linux-source version hash)
451 deblob-scripts-4.4)))
452
453 (define %boot-logo-patch
454 ;; Linux-Libre boot logo featuring Freedo and a gnu.
455 (origin
456 (method url-fetch)
457 (uri (string-append "http://www.fsfla.org/svn/fsfla/software/linux-libre/"
458 "lemote/gnewsense/branches/3.16/100gnu+freedo.patch"))
459 (sha256
460 (base32
461 "1hk9swxxc80bmn2zd2qr5ccrjrk28xkypwhl4z0qx4hbivj7qm06"))))
462
463 (define %linux-libre-arm-export-__sync_icache_dcache-patch
464 (origin
465 (method url-fetch)
466 (uri (string-append
467 "https://salsa.debian.org/kernel-team/linux"
468 "/raw/34a7d9011fcfcfa38b68282fd2b1a8797e6834f0"
469 "/debian/patches/bugfix/arm/"
470 "arm-mm-export-__sync_icache_dcache-for-xen-privcmd.patch"))
471 (file-name "linux-libre-arm-export-__sync_icache_dcache.patch")
472 (sha256
473 (base32 "1ifnfhpakzffn4b8n7x7w5cps9mzjxlkcfz9zqak2vaw8nzvl39f"))))
474
475 (define (source-with-patches source patches)
476 (origin
477 (inherit source)
478 (patches (append (origin-patches source)
479 patches))))
480
481 (define-public linux-libre-5.12-source
482 (source-with-patches linux-libre-5.12-pristine-source
483 (list %boot-logo-patch
484 %linux-libre-arm-export-__sync_icache_dcache-patch)))
485
486 (define-public linux-libre-5.10-source
487 (source-with-patches linux-libre-5.10-pristine-source
488 (list %boot-logo-patch
489 %linux-libre-arm-export-__sync_icache_dcache-patch
490 (search-patch
491 "linux-libre-arm64-generic-pinebook-lcd.patch"))))
492
493 (define-public linux-libre-5.4-source
494 (source-with-patches linux-libre-5.4-pristine-source
495 (list %boot-logo-patch
496 %linux-libre-arm-export-__sync_icache_dcache-patch
497 ;; Pinebook Pro patch from linux-next,
498 ;; can be dropped for linux-libre 5.7
499 (search-patch
500 "linux-libre-support-for-Pinebook-Pro.patch"))))
501
502 (define-public linux-libre-4.19-source
503 (source-with-patches linux-libre-4.19-pristine-source
504 (list %boot-logo-patch
505 %linux-libre-arm-export-__sync_icache_dcache-patch)))
506
507 (define-public linux-libre-4.14-source
508 (source-with-patches linux-libre-4.14-pristine-source
509 (list %boot-logo-patch)))
510
511 (define-public linux-libre-4.9-source
512 (source-with-patches linux-libre-4.9-pristine-source
513 (list %boot-logo-patch)))
514
515 (define-public linux-libre-4.4-source
516 (source-with-patches linux-libre-4.4-pristine-source
517 (list %boot-logo-patch)))
518
519 \f
520 ;;;
521 ;;; Kernel headers.
522 ;;;
523
524 (define (make-linux-libre-headers version hash-string)
525 (make-linux-libre-headers* version
526 (origin
527 (method url-fetch)
528 (uri (linux-libre-urls version))
529 (sha256 (base32 hash-string)))))
530
531 (define (make-linux-libre-headers* version source)
532 (package
533 (name "linux-libre-headers")
534 (version version)
535 (source source)
536 (build-system gnu-build-system)
537 (native-inputs `(("perl" ,perl)
538 ,@(if (version>=? version "4.16")
539 `(("flex" ,flex)
540 ("bison" ,bison))
541 '())
542 ,@(if (version>=? version "5.3")
543 `(("rsync" ,rsync))
544 '())))
545 (arguments
546 `(#:modules ((guix build gnu-build-system)
547 (guix build utils)
548 (srfi srfi-1))
549 #:phases
550 (modify-phases %standard-phases
551 (delete 'configure)
552 (replace 'build
553 (lambda _
554 (let ((arch ,(system->linux-architecture
555 (or (%current-target-system)
556 (%current-system))))
557 (defconfig ,(system->defconfig
558 (or (%current-target-system)
559 (%current-system)))))
560 (setenv "ARCH" arch)
561 (format #t "`ARCH' set to `~a'~%" (getenv "ARCH"))
562 (invoke "make" defconfig)
563 (invoke "make" "mrproper" "headers_check"))))
564 (replace 'install
565 (lambda* (#:key outputs #:allow-other-keys)
566 (let ((out (assoc-ref outputs "out")))
567 (invoke "make"
568 (string-append "INSTALL_HDR_PATH=" out)
569 "headers_install")
570
571 (mkdir (string-append out "/include/config"))
572 (call-with-output-file
573 (string-append out
574 "/include/config/kernel.release")
575 (lambda (p)
576 (format p "~a-default~%" ,version)))
577
578 ;; Remove the '.install' and '..install.cmd' files; the
579 ;; latter contains store paths, which pulls in bootstrap
580 ;; binaries in the build environment, and prevents bit
581 ;; reproducibility for the bootstrap binaries.
582 (for-each delete-file (find-files out "\\.install"))
583
584 #t))))
585 #:allowed-references ()
586 #:tests? #f))
587 (home-page "https://www.gnu.org/software/linux-libre/")
588 (synopsis "GNU Linux-Libre kernel headers")
589 (description "Headers of the Linux-Libre kernel.")
590 (license license:gpl2)))
591
592 (define-public linux-libre-headers-5.12
593 (make-linux-libre-headers* linux-libre-5.12-version
594 linux-libre-5.12-source))
595
596 (define-public linux-libre-headers-5.10
597 (make-linux-libre-headers* linux-libre-5.10-version
598 linux-libre-5.10-source))
599
600 (define-public linux-libre-headers-5.4
601 (make-linux-libre-headers* linux-libre-5.4-version
602 linux-libre-5.4-source))
603
604 (define-public linux-libre-headers-4.19
605 (make-linux-libre-headers* linux-libre-4.19-version
606 linux-libre-4.19-source))
607
608 (define-public linux-libre-headers-4.14
609 (make-linux-libre-headers* linux-libre-4.14-version
610 linux-libre-4.14-source))
611
612 (define-public linux-libre-headers-4.9
613 (make-linux-libre-headers* linux-libre-4.9-version
614 linux-libre-4.9-source))
615
616 (define-public linux-libre-headers-4.4
617 (make-linux-libre-headers* linux-libre-4.4-version
618 linux-libre-4.4-source))
619
620 ;; The following package is used in the early bootstrap, and thus must be kept
621 ;; stable and with minimal build requirements.
622 (define-public linux-libre-headers-5.4.20
623 (make-linux-libre-headers "5.4.20"
624 "1qxhf6dmcwjblzx8fgn6vr10p38xw10iwh6d1y1v1mxb25y30b47"))
625
626 (define-public linux-libre-headers linux-libre-headers-5.4.20)
627
628 \f
629 ;;;
630 ;;; Kernel configurations.
631 ;;;
632
633 (define* (kernel-config arch #:key variant)
634 "Return the absolute file name of the Linux-Libre build configuration file
635 for ARCH and optionally VARIANT, or #f if there is no such configuration."
636 (let* ((name (string-append (if variant (string-append variant "-") "")
637 (if (string=? "i386" arch) "i686" arch) ".conf"))
638 (file (string-append "linux-libre/" name)))
639 (search-auxiliary-file file)))
640
641 (define %default-extra-linux-options
642 `(;; Some very mild hardening.
643 ("CONFIG_SECURITY_DMESG_RESTRICT" . #t)
644 ;; All kernels should have NAMESPACES options enabled
645 ("CONFIG_NAMESPACES" . #t)
646 ("CONFIG_UTS_NS" . #t)
647 ("CONFIG_IPC_NS" . #t)
648 ("CONFIG_USER_NS" . #t)
649 ("CONFIG_PID_NS" . #t)
650 ("CONFIG_NET_NS" . #t)
651 ;; Various options needed for elogind service:
652 ;; https://issues.guix.gnu.org/43078
653 ("CONFIG_CGROUP_FREEZER" . #t)
654 ("CONFIG_BLK_CGROUP" . #t)
655 ("CONFIG_CGROUP_WRITEBACK" . #t)
656 ("CONFIG_CGROUP_SCHED" . #t)
657 ("CONFIG_CGROUP_PIDS" . #t)
658 ("CONFIG_CGROUP_FREEZER" . #t)
659 ("CONFIG_CGROUP_DEVICE" . #t)
660 ("CONFIG_CGROUP_CPUACCT" . #t)
661 ("CONFIG_CGROUP_PERF" . #t)
662 ("CONFIG_SOCK_CGROUP_DATA" . #t)
663 ("CONFIG_BLK_CGROUP_IOCOST" . #t)
664 ("CONFIG_CGROUP_NET_PRIO" . #t)
665 ("CONFIG_CGROUP_NET_CLASSID" . #t)
666 ("CONFIG_MEMCG" . #t)
667 ("CONFIG_MEMCG_SWAP" . #t)
668 ("CONFIG_MEMCG_KMEM" . #t)
669 ("CONFIG_CPUSETS" . #t)
670 ("CONFIG_PROC_PID_CPUSET" . #t)
671 ;; Allow disk encryption by default
672 ("CONFIG_DM_CRYPT" . m)
673 ;; Modules required for initrd:
674 ("CONFIG_NET_9P" . m)
675 ("CONFIG_NET_9P_VIRTIO" . m)
676 ("CONFIG_VIRTIO_BLK" . m)
677 ("CONFIG_VIRTIO_NET" . m)
678 ("CONFIG_VIRTIO_PCI" . m)
679 ("CONFIG_VIRTIO_BALLOON" . m)
680 ("CONFIG_VIRTIO_MMIO" . m)
681 ("CONFIG_FUSE_FS" . m)
682 ("CONFIG_CIFS" . m)
683 ("CONFIG_9P_FS" . m)))
684
685 ;; See https://github.com/iovisor/bcc/blob/master/INSTALL.md#kernel-configuration
686 (define %bpf-extra-linux-options
687 `(;; Needed for probes
688 ("CONFIG_UPROBE_EVENTS" . #t)
689 ("CONFIG_KPROBE_EVENTS" . #t)
690 ;; kheaders module also helpful for tracing
691 ("CONFIG_IKHEADERS" . #t)
692 ("CONFIG_BPF" . #t)
693 ("CONFIG_BPF_SYSCALL" . #t)
694 ("CONFIG_BPF_JIT_ALWAYS_ON" . #t)
695 ;; optional, for tc filters
696 ("CONFIG_NET_CLS_BPF" . m)
697 ;; optional, for tc actions
698 ("CONFIG_NET_ACT_BPF" . m)
699 ("CONFIG_BPF_JIT" . #t)
700 ;; for Linux kernel versions 4.1 through 4.6
701 ;; ("CONFIG_HAVE_BPF_JIT" . y)
702 ;; for Linux kernel versions 4.7 and later
703 ("CONFIG_HAVE_EBPF_JIT" . #t)
704 ;; optional, for kprobes
705 ("CONFIG_BPF_EVENTS" . #t)
706 ;; kheaders module
707 ("CONFIG_IKHEADERS" . #t)))
708
709 (define (config->string options)
710 (string-join (map (match-lambda
711 ((option . 'm)
712 (string-append option "=m"))
713 ((option . #t)
714 (string-append option "=y"))
715 ((option . #f)
716 (string-append option "=n")))
717 options)
718 "\n"))
719
720 \f
721 ;;;
722 ;;; Kernel package utilities.
723 ;;;
724
725 (define* (make-linux-libre version hash-string supported-systems
726 #:key
727 ;; A function that takes an arch and a variant.
728 ;; See kernel-config for an example.
729 (extra-version #f)
730 (configuration-file #f)
731 (defconfig "defconfig")
732 (extra-options %default-extra-linux-options)
733 (patches (list %boot-logo-patch)))
734 (make-linux-libre* version
735 (origin
736 (method url-fetch)
737 (uri (linux-libre-urls version))
738 (sha256 (base32 hash-string))
739 (patches patches))
740 supported-systems
741 #:extra-version extra-version
742 #:configuration-file configuration-file
743 #:defconfig defconfig
744 #:extra-options extra-options))
745
746 (define* (make-linux-libre* version source supported-systems
747 #:key
748 ;; A function that takes an arch and a variant.
749 ;; See kernel-config for an example.
750 (extra-version #f)
751 (configuration-file #f)
752 (defconfig "defconfig")
753 (extra-options %default-extra-linux-options))
754 (package
755 (name (if extra-version
756 (string-append "linux-libre-" extra-version)
757 "linux-libre"))
758 (version version)
759 (source source)
760 (supported-systems supported-systems)
761 (build-system gnu-build-system)
762 (native-inputs
763 `(("perl" ,perl)
764 ("bc" ,bc)
765 ("openssl" ,openssl)
766 ("elfutils" ,elfutils) ; Needed to enable CONFIG_STACK_VALIDATION
767 ("flex" ,flex)
768 ("bison" ,bison)
769
770 ;; These are needed to compile the GCC plugins.
771 ("gmp" ,gmp)
772 ("mpfr" ,mpfr)
773 ("mpc" ,mpc)
774
775 ,@(match (and configuration-file
776 (configuration-file
777 (system->linux-architecture
778 (or (%current-target-system) (%current-system)))
779 #:variant (version-major+minor version)))
780 (#f ;no config for this platform
781 '())
782 ((? string? config)
783 `(("kconfig" ,config))))))
784 (arguments
785 `(#:modules ((guix build gnu-build-system)
786 (guix build utils)
787 (srfi srfi-1)
788 (srfi srfi-26)
789 (ice-9 ftw)
790 (ice-9 match))
791 #:phases
792 (modify-phases %standard-phases
793 (add-after 'unpack 'patch-/bin/pwd
794 (lambda _
795 (substitute* (find-files "." "^Makefile(\\.include)?$")
796 (("/bin/pwd") "pwd"))
797 #t))
798 (replace 'configure
799 (lambda* (#:key inputs native-inputs target #:allow-other-keys)
800 ;; Avoid introducing timestamps
801 (setenv "KCONFIG_NOTIMESTAMP" "1")
802 (setenv "KBUILD_BUILD_TIMESTAMP" (getenv "SOURCE_DATE_EPOCH"))
803
804 ;; Set ARCH and CROSS_COMPILE
805 (let ((arch ,(system->linux-architecture
806 (or (%current-target-system)
807 (%current-system)))))
808 (setenv "ARCH" arch)
809 (format #t "`ARCH' set to `~a'~%" (getenv "ARCH"))
810
811 (when target
812 (setenv "CROSS_COMPILE" (string-append target "-"))
813 (format #t "`CROSS_COMPILE' set to `~a'~%"
814 (getenv "CROSS_COMPILE"))))
815
816 (setenv "EXTRA_VERSION" ,extra-version)
817
818 (let ((build (assoc-ref %standard-phases 'build))
819 (config (assoc-ref (or native-inputs inputs) "kconfig")))
820
821 ;; Use a custom kernel configuration file or a default
822 ;; configuration file.
823 (if config
824 (begin
825 (copy-file config ".config")
826 (chmod ".config" #o666))
827 (invoke "make" ,defconfig))
828
829 ;; Appending works even when the option wasn't in the
830 ;; file. The last one prevails if duplicated.
831 (let ((port (open-file ".config" "a"))
832 (extra-configuration ,(config->string extra-options)))
833 (display extra-configuration port)
834 (close-port port))
835
836 (invoke "make" "oldconfig"))))
837 (replace 'install
838 (lambda* (#:key inputs native-inputs outputs #:allow-other-keys)
839 (let* ((out (assoc-ref outputs "out"))
840 (moddir (string-append out "/lib/modules"))
841 (dtbdir (string-append out "/lib/dtbs")))
842 ;; Install kernel image, kernel configuration and link map.
843 (for-each (lambda (file) (install-file file out))
844 (find-files "." "^(\\.config|bzImage|zImage|Image|vmlinuz|System\\.map|Module\\.symvers)$"))
845 ;; Install device tree files
846 (unless (null? (find-files "." "\\.dtb$"))
847 (mkdir-p dtbdir)
848 (invoke "make" (string-append "INSTALL_DTBS_PATH=" dtbdir)
849 "dtbs_install"))
850 ;; Install kernel modules
851 (mkdir-p moddir)
852 (invoke "make"
853 ;; Disable depmod because the Guix system's module directory
854 ;; is an union of potentially multiple packages. It is not
855 ;; possible to use depmod to usefully calculate a dependency
856 ;; graph while building only one of those packages.
857 "DEPMOD=true"
858 (string-append "MODULE_DIR=" moddir)
859 (string-append "INSTALL_PATH=" out)
860 (string-append "INSTALL_MOD_PATH=" out)
861 "INSTALL_MOD_STRIP=1"
862 "modules_install")
863 (let* ((versions (filter (lambda (name)
864 (not (string-prefix? "." name)))
865 (scandir moddir)))
866 (version (match versions
867 ((x) x))))
868 ;; There are symlinks to the build and source directory,
869 ;; both of which will point to target /tmp/guix-build*
870 ;; and thus not be useful in a profile. Delete the symlinks.
871 (false-if-file-not-found
872 (delete-file (string-append moddir "/" version "/build")))
873 (false-if-file-not-found
874 (delete-file (string-append moddir "/" version "/source"))))
875 #t))))
876 #:tests? #f))
877 (home-page "https://www.gnu.org/software/linux-libre/")
878 (synopsis "100% free redistribution of a cleaned Linux kernel")
879 (description
880 "GNU Linux-Libre is a free (as in freedom) variant of the Linux kernel.
881 It has been modified to remove all non-free binary blobs.")
882 (license license:gpl2)
883 (properties '((max-silent-time . 3600))))) ;don't timeout on blob scan.
884
885 \f
886 ;;;
887 ;;; Generic kernel packages.
888 ;;;
889
890 (define-public linux-libre-5.12
891 (make-linux-libre* linux-libre-5.12-version
892 linux-libre-5.12-source
893 '("x86_64-linux" "i686-linux" "armhf-linux" "aarch64-linux" "riscv64-linux")
894 #:configuration-file kernel-config))
895
896 (define-public linux-libre-version linux-libre-5.12-version)
897 (define-public linux-libre-pristine-source linux-libre-5.12-pristine-source)
898 (define-public linux-libre-source linux-libre-5.12-source)
899 (define-public linux-libre linux-libre-5.12)
900
901 (define-public linux-libre-5.10
902 (make-linux-libre* linux-libre-5.10-version
903 linux-libre-5.10-source
904 '("x86_64-linux" "i686-linux" "armhf-linux" "aarch64-linux" "riscv64-linux")
905 #:configuration-file kernel-config))
906
907 (define-public linux-libre-5.4
908 (make-linux-libre* linux-libre-5.4-version
909 linux-libre-5.4-source
910 '("x86_64-linux" "i686-linux" "armhf-linux" "aarch64-linux" "riscv64-linux")
911 #:configuration-file kernel-config))
912
913 (define-public linux-libre-4.19
914 (make-linux-libre* linux-libre-4.19-version
915 linux-libre-4.19-source
916 '("x86_64-linux" "i686-linux" "armhf-linux" "aarch64-linux")
917 #:configuration-file kernel-config))
918
919 (define-public linux-libre-4.14
920 (make-linux-libre* linux-libre-4.14-version
921 linux-libre-4.14-source
922 '("x86_64-linux" "i686-linux" "armhf-linux")
923 #:configuration-file kernel-config))
924
925 (define-public linux-libre-4.9
926 (make-linux-libre* linux-libre-4.9-version
927 linux-libre-4.9-source
928 '("x86_64-linux" "i686-linux")
929 #:configuration-file kernel-config))
930
931 (define-public linux-libre-4.4
932 (make-linux-libre* linux-libre-4.4-version
933 linux-libre-4.4-source
934 '("x86_64-linux" "i686-linux")
935 #:configuration-file kernel-config
936 #:extra-options
937 (append
938 `(;; https://lists.gnu.org/archive/html/guix-devel/2014-04/msg00039.html
939 ;; This option was removed upstream in version 4.7.
940 ("CONFIG_DEVPTS_MULTIPLE_INSTANCES" . #t))
941 %default-extra-linux-options)))
942
943 ;; Linux-Libre-LTS points to the *newest* released long-term support version of
944 ;; Linux-Libre.
945 ;; Reference: https://jxself.org/linux-libre/
946
947 (define-public linux-libre-lts-version linux-libre-5.10-version)
948 (define-public linux-libre-lts-pristine-source linux-libre-5.10-pristine-source)
949 (define-public linux-libre-lts-source linux-libre-5.10-source)
950 (define-public linux-libre-lts linux-libre-5.10)
951
952 \f
953 ;;;
954 ;;; Specialized kernel variants.
955 ;;;
956
957 (define-public linux-libre-arm-generic
958 (make-linux-libre* linux-libre-version
959 linux-libre-source
960 '("armhf-linux")
961 #:defconfig "multi_v7_defconfig"
962 #:extra-version "arm-generic"
963 #:extra-options
964 (append
965 `(;; needed to fix the RTC on rockchip platforms
966 ("CONFIG_RTC_DRV_RK808" . #t))
967 %default-extra-linux-options)))
968
969 (define-public linux-libre-arm-veyron
970 (deprecated-package "linux-libre-arm-veyron" linux-libre-arm-generic))
971
972 (define-public linux-libre-arm-generic-5.10
973 (make-linux-libre* linux-libre-5.10-version
974 linux-libre-5.10-source
975 '("armhf-linux")
976 #:defconfig "multi_v7_defconfig"
977 #:extra-version "arm-generic"
978 #:extra-options
979 (append
980 `(;; needed to fix the RTC on rockchip platforms
981 ("CONFIG_RTC_DRV_RK808" . #t))
982 %default-extra-linux-options)))
983
984 (define-public linux-libre-arm-generic-5.4
985 (make-linux-libre* linux-libre-5.4-version
986 linux-libre-5.4-source
987 '("armhf-linux")
988 #:defconfig "multi_v7_defconfig"
989 #:extra-version "arm-generic"
990 #:extra-options
991 (append
992 `(;; needed to fix the RTC on rockchip platforms
993 ("CONFIG_RTC_DRV_RK808" . #t))
994 %default-extra-linux-options)))
995
996 (define-public linux-libre-arm-generic-4.19
997 (make-linux-libre* linux-libre-4.19-version
998 linux-libre-4.19-source
999 '("armhf-linux")
1000 #:defconfig "multi_v7_defconfig"
1001 #:extra-version "arm-generic"))
1002
1003 (define-public linux-libre-arm-generic-4.14
1004 (make-linux-libre* linux-libre-4.14-version
1005 linux-libre-4.14-source
1006 '("armhf-linux")
1007 #:defconfig "multi_v7_defconfig"
1008 #:extra-version "arm-generic"))
1009
1010 (define-public linux-libre-arm-omap2plus
1011 (make-linux-libre* linux-libre-version
1012 linux-libre-source
1013 '("armhf-linux")
1014 #:defconfig "omap2plus_defconfig"
1015 #:extra-version "arm-omap2plus"))
1016
1017 (define-public linux-libre-arm-omap2plus-4.19
1018 (make-linux-libre* linux-libre-4.19-version
1019 linux-libre-4.19-source
1020 '("armhf-linux")
1021 #:defconfig "omap2plus_defconfig"
1022 #:extra-version "arm-omap2plus"))
1023
1024 (define-public linux-libre-arm-omap2plus-4.14
1025 (make-linux-libre* linux-libre-4.14-version
1026 linux-libre-4.14-source
1027 '("armhf-linux")
1028 #:defconfig "omap2plus_defconfig"
1029 #:extra-version "arm-omap2plus"))
1030
1031 (define-public linux-libre-arm64-generic
1032 (make-linux-libre* linux-libre-version
1033 linux-libre-source
1034 '("aarch64-linux")
1035 #:defconfig "defconfig"
1036 #:extra-version "arm64-generic"
1037 #:extra-options
1038 (append
1039 `(;; needed to fix the RTC on rockchip platforms
1040 ("CONFIG_RTC_DRV_RK808" . #t)
1041 ;; Pinebook display, battery, charger and usb
1042 ("CONFIG_DRM_ANALOGIX_ANX6345" . m)
1043 ("CONFIG_CHARGER_AXP20X" . m)
1044 ("CONFIG_INPUT_AXP20X_PEK" . m)
1045 ("CONFIG_CHARGER_AXP20X" . m)
1046 ("CONFIG_BATTERY_AXP20X" . m)
1047 ("CONFIG_PINCTRL_AXP209" . m)
1048 ("CONFIG_AXP20X_POWER" . m)
1049 ("CONFIG_AXP20X_ADC" . m)
1050 ;; Pinebook PRO battery and sound support
1051 ("CONFIG_BATTERY_CW2015" . m)
1052 ("CONFIG_CHARGER_GPIO" . m)
1053 ("CONFIG_SND_SOC_ES8316" . m))
1054 %default-extra-linux-options)))
1055
1056 (define-public linux-libre-arm64-generic-5.10
1057 (make-linux-libre* linux-libre-5.10-version
1058 linux-libre-5.10-source
1059 '("aarch64-linux")
1060 #:defconfig "defconfig"
1061 #:extra-version "arm64-generic"
1062 #:extra-options
1063 (append
1064 `(;; needed to fix the RTC on rockchip platforms
1065 ("CONFIG_RTC_DRV_RK808" . #t)
1066 ;; Pinebook display, battery, charger and usb
1067 ("CONFIG_DRM_ANALOGIX_ANX6345" . m)
1068 ("CONFIG_CHARGER_AXP20X" . m)
1069 ("CONFIG_INPUT_AXP20X_PEK" . m)
1070 ("CONFIG_CHARGER_AXP20X" . m)
1071 ("CONFIG_BATTERY_AXP20X" . m)
1072 ("CONFIG_PINCTRL_AXP209" . m)
1073 ("CONFIG_AXP20X_POWER" . m)
1074 ("CONFIG_AXP20X_ADC" . m)
1075 ;; Pinebook PRO battery and sound support
1076 ("CONFIG_BATTERY_CW2015" . m)
1077 ("CONFIG_CHARGER_GPIO" . m)
1078 ("CONFIG_SND_SOC_ES8316" . m))
1079 %default-extra-linux-options)))
1080
1081 (define-public linux-libre-arm64-generic-5.4
1082 (make-linux-libre* linux-libre-5.4-version
1083 linux-libre-5.4-source
1084 '("aarch64-linux")
1085 #:defconfig "defconfig"
1086 #:extra-version "arm64-generic"
1087 #:extra-options
1088 (append
1089 `(;; needed to fix the RTC on rockchip platforms
1090 ("CONFIG_RTC_DRV_RK808" . #t))
1091 %default-extra-linux-options)))
1092
1093 (define-public linux-libre-riscv64-generic
1094 (make-linux-libre* linux-libre-version
1095 linux-libre-source
1096 '("riscv64-linux")
1097 #:extra-version "riscv64-generic"))
1098
1099 (define-public linux-libre-mips64el-fuloong2e
1100 (make-linux-libre* linux-libre-version
1101 linux-libre-source
1102 '("mips64el-linux")
1103 #:defconfig "fuloong2e_defconfig"
1104 #:extra-version "mips64el-fuloong2e"
1105 #:extra-options
1106 (append
1107 `(("CONFIG_OVERLAY_FS" . m))
1108 %default-extra-linux-options)))
1109
1110 (define-public linux-libre-with-bpf
1111 (let ((base-linux-libre
1112 (make-linux-libre*
1113 linux-libre-5.12-version
1114 linux-libre-5.12-source
1115 '("x86_64-linux" "i686-linux" "armhf-linux"
1116 "aarch64-linux" "riscv64-linux")
1117 #:extra-version "bpf"
1118 #:configuration-file kernel-config
1119 #:extra-options
1120 (append %bpf-extra-linux-options
1121 %default-extra-linux-options))))
1122 (package
1123 (inherit base-linux-libre)
1124 (inputs `(("cpio" ,cpio) ,@(package-inputs base-linux-libre))))))
1125
1126
1127 \f
1128 ;;;
1129 ;;; Linux kernel modules.
1130 ;;;
1131
1132 (define-public acpi-call-linux-module
1133 (package
1134 (name "acpi-call-linux-module")
1135 (version "1.2.1")
1136 (source
1137 (origin
1138 (method git-fetch)
1139 (uri (git-reference
1140 (url "https://github.com/nix-community/acpi_call")
1141 (commit (string-append "v" version))))
1142 (file-name (git-file-name name version))
1143 (sha256
1144 (base32 "0mr4rjbv6fj4phf038addrgv32940bphghw2v9n1z4awvw7wzkbg"))))
1145 (build-system linux-module-build-system)
1146 (arguments
1147 `(#:tests? #f ; no tests
1148 #:phases
1149 (modify-phases %standard-phases
1150 (add-before 'install 'patch-shebangs-harder
1151 ;; The (only) shebangs in examples/ don't justify a reference.
1152 ;; However, do substitute a more portable one than the original.
1153 (lambda _
1154 (substitute* (find-files "examples" ".")
1155 (("^(#! *)/[^ ]*/" _ shebang)
1156 (string-append shebang "/usr/bin/env ")))
1157 #t))
1158 (add-after 'install 'install-documentation
1159 (lambda* (#:key outputs #:allow-other-keys)
1160 (let* ((out (assoc-ref outputs "out"))
1161 (doc (string-append out "/share/doc/" ,name "-" ,version)))
1162 (for-each (lambda (file)
1163 (let ((target (string-append doc "/" file)))
1164 (mkdir-p (dirname target))
1165 (copy-recursively file target)))
1166 (list "README.md" "examples"))
1167 #t))))))
1168 (home-page "https://github.com/teleshoes/acpi_call")
1169 (synopsis "Linux kernel module to perform ACPI method calls")
1170 (description
1171 "This simple Linux kernel module allows calls from user space to any
1172 @acronym{ACPI, Advanced Configuration and Power Interface} method provided by
1173 your computer's firmware, by writing to @file{/proc/acpi/call}. You can pass
1174 any number of parameters of types @code{ACPI_INTEGER}, @code{ACPI_STRING},
1175 and @code{ACPI_BUFFER}.
1176
1177 It grants direct and undocumented access to your hardware that may cause damage
1178 and should be used with caution, especially on untested models.")
1179 (license license:gpl3+))) ; see README.md (no licence headers)
1180
1181 (define-public rtl8812au-aircrack-ng-linux-module
1182 (let ((commit "059e06a51be025fde5b2bec6565540b3d9981b0b")
1183 (revision "4"))
1184 (package
1185 (name "rtl8812au-aircrack-ng-linux-module")
1186 (version (git-version "5.6.4.2" revision commit))
1187 (source
1188 (origin
1189 (method git-fetch)
1190 (uri (git-reference
1191 (url "https://github.com/aircrack-ng/rtl8812au")
1192 (commit commit)))
1193 (file-name (git-file-name name version))
1194 (sha256
1195 (base32 "0h6l2r3yj7j9zf11dw0zcdyn50ajnjw8yvv86dzlfj80dn75n98f"))
1196 (modules '((guix build utils)))
1197 (snippet
1198 '(begin
1199 ;; Remove bundled tarballs, APKs, word lists, speadsheets,
1200 ;; and other unnecessary unlicenced things.
1201 (for-each delete-file-recursively (list "android"
1202 "docs"
1203 "tools"))
1204 #t))))
1205 (build-system linux-module-build-system)
1206 (arguments
1207 `(#:make-flags
1208 (list (string-append "KSRC="
1209 (assoc-ref %build-inputs "linux-module-builder")
1210 "/lib/modules/build"))
1211 #:phases
1212 (modify-phases %standard-phases
1213 (replace 'build
1214 (lambda* (#:key (make-flags '()) #:allow-other-keys)
1215 (apply invoke "make" make-flags))))
1216 #:tests? #f)) ; no test suite
1217 (supported-systems '("x86_64-linux" "i686-linux"))
1218 (home-page "https://github.com/aircrack-ng/rtl8812au")
1219 (synopsis "Linux driver for Realtek USB wireless network adapters")
1220 (description
1221 "This is Realtek's rtl8812au Linux driver for USB 802.11n wireless
1222 network adapters, modified by the aircrack-ng project to support monitor mode
1223 and frame injection. It provides a @code{88XXau} kernel module that supports
1224 RTL8812AU, RTL8821AU, and RTL8814AU chips.")
1225 (license license:gpl2+))))
1226
1227 (define-public rtl8821ce-linux-module
1228 (let ((commit "14b536f0c9ad2d0abbdab8afc7ade684900ca9cf")
1229 (revision "2"))
1230 (package
1231 (name "rtl8821ce-linux-module")
1232 (version (git-version "0.0.0" revision commit))
1233 (source
1234 (origin
1235 (method git-fetch)
1236 (uri (git-reference
1237 (url "https://github.com/tomaspinho/rtl8821ce")
1238 (commit commit)))
1239 (file-name (git-file-name name version))
1240 (sha256
1241 (base32
1242 "0z7r7spsgn22gwv9pcmkdjn9ingi8jj7xkxasph8118h46fw8ip2"))))
1243 (build-system linux-module-build-system)
1244 (arguments
1245 `(#:make-flags
1246 (list "CC=gcc"
1247 (string-append "KSRC="
1248 (assoc-ref %build-inputs "linux-module-builder")
1249 "/lib/modules/build"))
1250 #:phases
1251 (modify-phases %standard-phases
1252 (replace 'build
1253 (lambda* (#:key (make-flags '()) #:allow-other-keys)
1254 (apply invoke "make" make-flags))))
1255 #:tests? #f)) ; no test suite
1256 (home-page "https://github.com/tomaspinho/rtl8821ce")
1257 (synopsis "Linux driver for Realtek RTL8821CE wireless network adapters")
1258 (description "This is Realtek's RTL8821CE Linux driver for wireless
1259 network adapters.")
1260 (license license:gpl2))))
1261
1262 (define-public vhba-module
1263 (package
1264 (name "vhba-module")
1265 (version "20200106")
1266 (source (origin
1267 (method url-fetch)
1268 (uri (string-append
1269 "http://downloads.sourceforge.net/cdemu/vhba-module/vhba-module-"
1270 version ".tar.bz2"))
1271 (sha256
1272 (base32
1273 "10rlvsfj0fw6n0qmwcnvhimqnsnhi7n55lyl7fq1pkwggf5218sr"))))
1274 (build-system linux-module-build-system)
1275 (arguments
1276 ;; TODO: No tests?
1277 `(#:tests? #f))
1278 (home-page "https://cdemu.sourceforge.io/")
1279 (synopsis "Kernel module that emulates SCSI devices")
1280 (description "VHBA module provides a Virtual (SCSI) HBA, which is the link
1281 between the CDemu userspace daemon and linux kernel.")
1282 (license license:gpl2+)))
1283
1284 (define-public bbswitch-module
1285 ;; Use "develop" branch since stable release does not build on Linux >= 5.6.
1286 ;; See https://github.com/Bumblebee-Project/bbswitch/issues/205.
1287 (let ((commit "ddbd243638c7bc2baecf43a78aff46cdc12e9b2e"))
1288 (package
1289 (name "bbswitch-module")
1290 (version (git-version "0.8" "1" commit))
1291 (source (origin
1292 (method git-fetch)
1293 (uri (git-reference
1294 (url "https://github.com/Bumblebee-Project/bbswitch")
1295 (commit commit)))
1296 (file-name (git-file-name name version))
1297 (sha256
1298 (base32
1299 "1pgldnza7mzd0flrxg4q69dwbq1fhl58m5c62ary5drb0xyf3lqb"))))
1300 (build-system linux-module-build-system)
1301 (arguments
1302 ;; No tests.
1303 `(#:tests? #f))
1304 (home-page "https://github.com/Bumblebee-Project/bbswitch")
1305 (synopsis "Kernel module that disables discrete Nvidia graphics cards")
1306 (description "The bbswitch module provides a way to toggle the Nvidia
1307 graphics card on Optimus laptops.")
1308 (license license:gpl2))))
1309
1310 (define-public ddcci-driver-linux
1311 (package
1312 (name "ddcci-driver-linux")
1313 (version "0.3.3")
1314 (source
1315 (origin
1316 (method git-fetch)
1317 (uri
1318 (git-reference
1319 (url "https://gitlab.com/ddcci-driver-linux/ddcci-driver-linux.git")
1320 (commit (string-append "v" version))))
1321 (file-name (git-file-name name version))
1322 (sha256
1323 (base32
1324 "0vkkja3ykjil783zjpwp0vz7jy2fp9ccazzi3afd4fjk8gldin7f"))))
1325 (build-system linux-module-build-system)
1326 (arguments
1327 `(#:tests? #f ; no tests
1328 #:phases
1329 (modify-phases %standard-phases
1330 (replace 'build
1331 (lambda args
1332 (for-each
1333 (lambda (module)
1334 (with-directory-excursion module
1335 (apply (assoc-ref %standard-phases 'build) args)))
1336 '("ddcci" "ddcci-backlight"))
1337 #t))
1338 (replace 'install
1339 (lambda args
1340 (for-each
1341 (lambda (module)
1342 (with-directory-excursion module
1343 (apply (assoc-ref %standard-phases 'install) args)))
1344 '("ddcci" "ddcci-backlight"))
1345 #t)))))
1346 (home-page "https://gitlab.com/ddcci-driver-linux/ddcci-driver-linux")
1347 (synopsis "Pair of Linux kernel drivers for DDC/CI monitors")
1348 (description "This package provides two Linux kernel drivers, ddcci and
1349 ddcci-backlight, that allows the control of DDC/CI monitors through the sysfs
1350 interface. The ddcci module creates a character device for each DDC/CI
1351 monitors in @file{/dev/bus/ddcci/[I²C busnumber]}. While the ddcci-backlight
1352 module allows the control of the backlight level or luminance property when
1353 supported under @file{/sys/class/backlight/}.")
1354 (license license:gpl2+)))
1355
1356 (define-public v4l2loopback-linux-module
1357 (package
1358 (name "v4l2loopback-linux-module")
1359 (version "0.12.5")
1360 (source (origin
1361 (method git-fetch)
1362 (uri (git-reference
1363 (url "https://github.com/umlaeute/v4l2loopback")
1364 (commit (string-append "v" version))))
1365 (file-name (git-file-name name version))
1366 (sha256
1367 (base32
1368 "1qi4l6yam8nrlmc3zwkrz9vph0xsj1cgmkqci4652mbpbzigg7vn"))))
1369 (build-system linux-module-build-system)
1370 (arguments
1371 `(#:tests? #f)) ; no test suite
1372 (home-page "https://github.com/umlaeute/v4l2loopback")
1373 (synopsis "Linux kernel module to create virtual V4L2 video devices")
1374 (description
1375 "This Linux module creates virtual video devices. @acronym{V4L2, Video
1376 for Linux 2} applications will treat these as ordinary video devices but read
1377 video data generated by another application, instead of a hardware device such
1378 as a capture card.
1379
1380 This lets you apply nifty effects to your Jitsi video, for example, but also
1381 allows some more serious things like adding streaming capabilities to an
1382 application by hooking GStreamer into the loopback device.")
1383 (license license:gpl2+)))
1384
1385 \f
1386 ;;;
1387 ;;; Pluggable authentication modules (PAM).
1388 ;;;
1389
1390 (define-public linux-pam
1391 (package
1392 (name "linux-pam")
1393 (version "1.5.1")
1394 (source
1395 (origin
1396 (method url-fetch)
1397 (uri (string-append
1398 "https://github.com/linux-pam/linux-pam/releases/download/v"
1399 version "/Linux-PAM-" version ".tar.xz"))
1400 (sha256
1401 (base32
1402 "1z4jayf69qyyxln1gl6ch4qxfd66ib1g42garnrv2d8i1drl0790"))
1403 (patches (search-patches "linux-pam-no-setfsuid.patch"))))
1404
1405 (build-system gnu-build-system)
1406 (native-inputs
1407 `(("flex" ,flex)
1408
1409 ;; TODO: optional dependencies
1410 ;; ("libxcrypt" ,libxcrypt)
1411 ;; ("cracklib" ,cracklib)
1412 ))
1413 (arguments
1414 `(;; Most users, such as `shadow', expect the headers to be under
1415 ;; `security'.
1416 #:configure-flags (list (string-append "--includedir="
1417 (assoc-ref %outputs "out")
1418 "/include/security")
1419
1420 ;; XXX: <rpc/rpc.h> is missing from glibc when
1421 ;; cross-compiling, so we have to disable NIS
1422 ;; support altogether.
1423 ,@(if (%current-target-system)
1424 '("--disable-nis")
1425 '()))
1426
1427 ;; XXX: Tests won't run in chroot, presumably because /etc/pam.d
1428 ;; isn't available.
1429 #:tests? #f))
1430 (home-page "http://www.linux-pam.org/")
1431 (synopsis "Pluggable authentication modules for Linux")
1432 (description
1433 "A *Free* project to implement OSF's RFC 86.0.
1434 Pluggable authentication modules are small shared object files that can
1435 be used through the PAM API to perform tasks, like authenticating a user
1436 at login. Local and dynamic reconfiguration are its key features.")
1437 (license license:bsd-3)))
1438
1439 (define-public linux-pam-1.2
1440 (package
1441 (inherit linux-pam)
1442 (version "1.2.1")
1443 (source
1444 (origin
1445 (method url-fetch)
1446 (uri (string-append
1447 "http://www.linux-pam.org/library/"
1448 "Linux-PAM-" version ".tar.bz2"))
1449 (sha256
1450 (base32
1451 "1n9lnf9gjs72kbj1g354v1xhi2j27aqaah15vykh7cnkq08i4arl"))
1452 (patches (search-patches "linux-pam-no-setfsuid.patch"))))))
1453
1454 (define-public python-pamela
1455 (package
1456 (name "python-pamela")
1457 (version "1.0.0")
1458 (source
1459 (origin
1460 ;; Tests not distributed in pypi release.
1461 (method git-fetch)
1462 (uri (git-reference
1463 (url "https://github.com/minrk/pamela")
1464 (commit version)))
1465 (file-name (git-file-name name version))
1466 (sha256
1467 (base32
1468 "0cg3w6np1fbjpvzhv54xg567hpf38szwp2d4gvzb9r736nxbv0vr"))))
1469 (build-system python-build-system)
1470 (arguments
1471 '(#:tests? #f ; Test suite isn't designed to be run inside a container.
1472 #:phases
1473 (modify-phases %standard-phases
1474 (add-after 'unpack 'hardcode-pam.so
1475 (lambda* (#:key inputs #:allow-other-keys)
1476 (let ((pam (assoc-ref inputs "linux-pam")))
1477 (substitute* "pamela.py"
1478 (("find_library\\(\"pam\")")
1479 (string-append "'" pam "/lib/libpam.so'")))
1480 #t)))
1481 (replace 'check
1482 (lambda* (#:key tests? #:allow-other-keys)
1483 (if tests?
1484 (if (file-exists? "test_pamela.py")
1485 (invoke "py.test" "--assert=plain" "test_pamela.py")
1486 (invoke "python" "-m" "pamela" "-a" "`whoami`"))
1487 #t))))))
1488 (inputs
1489 `(("linux-pam" ,linux-pam)))
1490 (native-inputs
1491 `(("python-pytest" ,python-pytest)))
1492 (home-page "https://github.com/minrk/pamela")
1493 (synopsis "PAM interface using ctypes")
1494 (description "This package provides a PAM interface using @code{ctypes}.")
1495 (license license:expat)))
1496
1497
1498 ;;;
1499 ;;; Miscellaneous.
1500 ;;;
1501
1502 (define-public powerstat
1503 (package
1504 (name "powerstat")
1505 (version "0.02.25")
1506 (source
1507 (origin
1508 (method url-fetch)
1509 (uri (string-append "https://kernel.ubuntu.com/~cking/tarballs/"
1510 "powerstat/powerstat-" version ".tar.gz"))
1511 (sha256
1512 (base32 "0dmixbxm4qd08ds26i0wvxwyy8nrjzfjj2q9ylx35564g4wh58qb"))))
1513 (build-system gnu-build-system)
1514 (arguments
1515 `(#:make-flags
1516 (list (string-append "CC=" ,(cc-for-target))
1517 (string-append "prefix=" (assoc-ref %outputs "out")))
1518 #:tests? #f ; no test suite
1519 #:phases
1520 (modify-phases %standard-phases
1521 (add-after 'unpack 'respect-$prefix
1522 ;; https://bugs.launchpad.net/ubuntu/+source/powerstat/+bug/1877744
1523 (lambda _
1524 (substitute* "Makefile"
1525 (("DIR=/usr/") "DIR=$(prefix)/"))
1526 #t))
1527 (delete 'configure)))) ; no configure script
1528 (home-page "https://kernel.ubuntu.com/~cking/powerstat/")
1529 (synopsis "Measure system power consumption")
1530 (description
1531 "Powerstat measures and reports your computer's power consumption in real
1532 time. On mobile PCs, it uses ACPI battery information to measure the power
1533 drain of the entire system.
1534
1535 Powerstat can also report @acronym{RAPL, Running Average Power Limit} power
1536 domain measurements. These are available only on some hardware such as Intel
1537 Sandybridge and newer, and cover only part of the machine's components such as
1538 CPU, DRAM, and graphics. However, they provide accurate and immediate readings
1539 and don't require a battery at all.
1540
1541 The output is like @command{vmstat} but also shows power consumption statistics:
1542 at the end of a run, @command{powerstat} will calculate the average, standard
1543 deviation, and minimum and maximum values. It can show a nice histogram too.")
1544 (license license:gpl2)))
1545
1546 (define-public psmisc
1547 (package
1548 (name "psmisc")
1549 (version "23.4")
1550 (source
1551 (origin
1552 (method url-fetch)
1553 (uri (string-append "mirror://sourceforge/psmisc/psmisc/psmisc-"
1554 version ".tar.xz"))
1555 (sha256
1556 (base32 "0y8n1jd2dn4cvc5mh806d66qnq8xl0xmzczbycjwal10rvmcw33z"))))
1557 (build-system gnu-build-system)
1558 (arguments
1559 `(,@(if (%current-target-system)
1560 '(#:configure-flags
1561 (list
1562 "ac_cv_func_malloc_0_nonnull=yes"
1563 "ac_cv_func_realloc_0_nonnull=yes"))
1564 '())))
1565 (inputs `(("ncurses" ,ncurses)))
1566 (home-page "https://gitlab.com/psmisc/psmisc")
1567 (synopsis "Small utilities that use the proc file system")
1568 (description
1569 "This PSmisc package is a set of some small useful utilities that
1570 use the proc file system. We're not about changing the world, but
1571 providing the system administrator with some help in common tasks.")
1572 (license license:gpl2+)))
1573
1574 (define-public util-linux
1575 (package
1576 (name "util-linux")
1577 (version "2.35.1")
1578 (source (origin
1579 (method url-fetch)
1580 (uri (string-append "mirror://kernel.org/linux/utils/"
1581 "util-linux/v" (version-major+minor version) "/"
1582 "util-linux-" version ".tar.xz"))
1583 (sha256
1584 (base32
1585 "1yfpy6bkab4jw61mpx48gfy24yrqp4a7arvpis8csrkk53fkxpnr"))
1586 (patches (search-patches "util-linux-tests.patch"))
1587 (modules '((guix build utils)))
1588 (snippet
1589 ;; We take 'nologin' from Shadow, the 'logger' program from
1590 ;; GNU Inetutils and 'kill' from GNU Coreutils.
1591 '(begin
1592 (substitute* "configure"
1593 (("build_nologin=yes") "build_nologin=no")
1594 (("build_logger=yes") "build_logger=no")
1595 (("build_kill=yes") "build_kill=no"))
1596 #t))))
1597 (build-system gnu-build-system)
1598 (outputs '("out" ;6.4 MiB executables and documentation
1599 "lib" ;8.8 MiB shared libraries, headers and locales
1600 "static")) ;2.9 MiB static .a libraries
1601 (arguments
1602 `(#:configure-flags (list "--disable-use-tty-group"
1603 "--enable-fs-paths-default=/run/current-system/profile/sbin"
1604 ;; Don't try to chown root:root mount and umount
1605 "--disable-makeinstall-chown"
1606 "--localstatedir=/var"
1607 (string-append "--localedir="
1608 (assoc-ref %outputs "lib")
1609 "/share/locale")
1610 ;; Install completions where our
1611 ;; bash-completion package expects them.
1612 (string-append "--with-bashcompletiondir="
1613 (assoc-ref %outputs "out")
1614 "/etc/bash_completion.d"))
1615
1616 ;; FIXME: For now we cannot reliably run tests on GNU/Hurd:
1617 ;; <https://bugs.gnu.org/47791>.
1618 #:tests? ,(and (not (%current-target-system))
1619 (not (string-suffix? "-gnu" (%current-system))))
1620
1621 #:phases (modify-phases %standard-phases
1622 (add-before 'configure 'patch-build-scripts
1623 (lambda* (#:key outputs #:allow-other-keys)
1624 (substitute* "configure"
1625 ;; The build system assumes that we want to install
1626 ;; libraries below $exec_prefix when $libdir does not
1627 ;; match any of the "usual" locations. Fix that.
1628 (("usrlib_execdir='\\$\\{exec_prefix\\}'\\$libdir")
1629 "usrlib_execdir=$libdir"))
1630 #t))
1631 (add-before 'build 'set-umount-file-name
1632 (lambda* (#:key outputs #:allow-other-keys)
1633 ;; Tell 'eject' the right file name of 'umount'.
1634 (let ((out (assoc-ref outputs "out")))
1635 (substitute* "sys-utils/eject.c"
1636 (("\"/bin/umount\"")
1637 (string-append "\"" out "/bin/umount\"")))
1638 #t)))
1639 (add-before 'check 'pre-check
1640 (lambda* (#:key inputs outputs #:allow-other-keys)
1641 (let ((out (assoc-ref outputs "out"))
1642 (net (assoc-ref inputs "net-base")))
1643 ;; Change the test to refer to the right file.
1644 (substitute* "tests/ts/misc/mcookie"
1645 (("/etc/services")
1646 (string-append net "/etc/services")))
1647
1648 ;; The C.UTF-8 locale does not exist in our libc.
1649 (substitute* "tests/ts/column/invalid-multibyte"
1650 (("C\\.UTF-8") "en_US.utf8"))
1651 #t)))
1652 ;; TODO: Remove the conditional on the next rebuild cycle.
1653 ,@(if (string-prefix? "arm" (%current-system))
1654 '((add-before 'check 'disable-setarch-test
1655 (lambda _
1656 ;; The setarch tests are unreliable in QEMU's
1657 ;; user-mode emulation, which is our primary
1658 ;; method of building ARMv7 packages.
1659 ;; <https://github.com/karelzak/util-linux/issues/601>
1660 (substitute* "tests/ts/misc/setarch"
1661 (("ts_init_subtest.*" all)
1662 (string-append
1663 all "\n"
1664 "ts_skip \"setarch tests are unreliable under QEMU\"")))
1665 #t)))
1666 '())
1667 (add-after 'install 'move-static-libraries
1668 (lambda* (#:key outputs #:allow-other-keys)
1669 (let ((lib (assoc-ref outputs "lib"))
1670 (static (assoc-ref outputs "static")))
1671
1672 ;; Move static libraries to the "static" output.
1673 (mkdir-p (string-append static "/lib"))
1674 (with-directory-excursion lib
1675 (for-each (lambda (file)
1676 (rename-file file
1677 (string-append static "/"
1678 file)))
1679 (find-files "lib" "\\.a$"))
1680
1681 ;; Remove references to the static library from the '.la'
1682 ;; files so that Libtool does the right thing when both
1683 ;; the shared and static library is available.
1684 (substitute* (find-files "lib" "\\.la$")
1685 (("old_library=.*") "old_library=''\n")))
1686
1687 #t)))
1688 (add-after 'install 'adjust-pkg-config-files
1689 (lambda* (#:key outputs #:allow-other-keys)
1690 (let ((lib (assoc-ref outputs "lib")))
1691 ;; Drop the unused "prefix=" and "exec_prefix=" variables from
1692 ;; the pkg-config files to avoid a cyclic reference on "out".
1693 (substitute* (find-files (string-append lib "/lib/pkgconfig")
1694 "\\.pc$")
1695 (("^(exec_)?prefix=.*") "")))
1696 #t)))))
1697 (inputs `(("zlib" ,zlib)
1698 ("ncurses" ,ncurses)
1699
1700 ;; XXX: This is so that the 'pre-check' phase can find it.
1701 ,@(if (%current-target-system)
1702 `(("net-base" ,net-base))
1703 '())))
1704 (native-inputs
1705 `(("perl" ,perl)
1706 ("net-base" ,net-base))) ;for tests
1707 (home-page "https://www.kernel.org/pub/linux/utils/util-linux/")
1708 (synopsis "Collection of utilities for the Linux kernel")
1709 (description "Util-linux is a diverse collection of Linux kernel
1710 utilities. It provides dmesg and includes tools for working with file systems,
1711 block devices, UUIDs, TTYs, and many other tools.")
1712
1713 ;; Note that util-linux doesn't use the same license for all the
1714 ;; code. GPLv2+ is the default license for a code without an
1715 ;; explicitly defined license.
1716 (license (list license:gpl3+ license:gpl2+ license:gpl2 license:lgpl2.0+
1717 license:bsd-4 license:public-domain))))
1718
1719 ;; util-linux optionally supports udev, which allows lsblk to read file system
1720 ;; metadata without special privileges. Add it as a separate package to avoid
1721 ;; a circular dependency, and to keep the size small.
1722 (define-public util-linux+udev
1723 (package/inherit
1724 util-linux
1725 (name "util-linux-with-udev")
1726 (inputs
1727 `(("udev" ,eudev)
1728 ,@(package-inputs util-linux)))))
1729
1730 (define-public ddate
1731 (package
1732 (name "ddate")
1733 (version "0.2.2")
1734 (source (origin
1735 (method git-fetch)
1736 (uri (git-reference
1737 (url "https://github.com/bo0ts/ddate")
1738 (commit (string-append "v" version))))
1739 (file-name (git-file-name name version))
1740 (sha256
1741 (base32 "1qchxnxvghbma6gp1g78wnjxsri0b72ha9axyk31cplssl7yn73f"))))
1742 (build-system cmake-build-system)
1743 (arguments '(#:tests? #f))
1744 (home-page "https://github.com/bo0ts/ddate")
1745 (synopsis "PERPETUAL DATE CONVERTER FROM GREGORIAN TO POEE CALENDAR")
1746 (description
1747 "ddate displays the Discordian date and holidays of a given date.
1748 The Discordian calendar was made popular by the \"Illuminatus!\" trilogy
1749 by Robert Shea and Robert Anton Wilson.")
1750 (license license:public-domain)))
1751
1752 (define-public fbset
1753 (package
1754 (name "fbset")
1755 (version "2.1")
1756 (source
1757 (origin
1758 (method url-fetch)
1759 (uri (string-append "http://users.telenet.be/geertu/Linux/fbdev/fbset-"
1760 version ".tar.gz"))
1761 (sha256
1762 (base32 "080wnisi0jq7dp0jcwdp83rq8q8s3kw41vc712516xbv4jq4mzs0"))))
1763 (build-system gnu-build-system)
1764 (arguments
1765 '(#:modules ((guix build gnu-build-system)
1766 (guix build utils)
1767 (srfi srfi-26))
1768 #:phases
1769 (modify-phases %standard-phases
1770 (delete 'configure) ; no configure script
1771 (add-before 'install 'pre-install
1772 (lambda* (#:key outputs #:allow-other-keys)
1773 (let ((out (assoc-ref outputs "out")))
1774 (substitute* "Makefile"
1775 (("mknod ") "true ")
1776 ;; The Makefile doesn't honour PREFIX or similar.
1777 (("/usr") out))
1778 (mkdir out)
1779 (with-directory-excursion out
1780 (for-each mkdir-p (list "sbin"
1781 "man/man5"
1782 "man/man8")))
1783 #t)))
1784 (add-after 'install 'install-fb.modes
1785 (lambda* (#:key outputs #:allow-other-keys)
1786 (let* ((out (assoc-ref outputs "out"))
1787 (etc (string-append out "/etc")))
1788 (for-each (cut install-file <> etc)
1789 (find-files "etc" "^fb\\.modes"))
1790 (symlink "fb.modes.ATI"
1791 (string-append etc "/fb.modes"))
1792 #t))))
1793 ;; Parallel building races to create modes.tab.c.
1794 #:parallel-build? #f
1795 #:tests? #f)) ; no test suite
1796 (native-inputs
1797 `(("bison" ,bison)
1798 ("flex" ,flex)))
1799 (home-page "http://users.telenet.be/geertu/Linux/fbdev/")
1800 (synopsis "Show and modify Linux frame buffer settings")
1801 (description
1802 "The kernel Linux's @dfn{frame buffers} provide a simple interface to
1803 different kinds of graphic displays. The @command{fbset} utility can query and
1804 change various device settings such as depth, virtual resolution, and timing
1805 parameters.")
1806 (license license:gpl2)))
1807
1808 (define-public procps
1809 (package
1810 (name "procps")
1811 (version "3.3.16")
1812 (source (origin
1813 (method url-fetch)
1814 (uri (string-append "mirror://sourceforge/procps-ng/Production/"
1815 "procps-ng-" version ".tar.xz"))
1816 (sha256
1817 (base32
1818 "1br0g93ysqhlv13i1k4lfbimsgxnpy5rgs4lxfc9rkzdbpbaqplj"))))
1819 (build-system gnu-build-system)
1820 (arguments
1821 `(#:modules ((guix build utils)
1822 (guix build gnu-build-system)
1823 (srfi srfi-1)
1824 (srfi srfi-26))
1825 ,@(if (%current-target-system)
1826 '(#:configure-flags
1827 (list
1828 "ac_cv_func_malloc_0_nonnull=yes"
1829 "ac_cv_func_realloc_0_nonnull=yes"))
1830 '())
1831 #:phases
1832 (modify-phases %standard-phases
1833 (add-after
1834 'install 'post-install
1835 ;; Remove commands and man pages redudant with
1836 ;; Coreutils.
1837 (lambda* (#:key outputs #:allow-other-keys)
1838 (let* ((out (assoc-ref outputs "out"))
1839 (dup (append-map (cut find-files out <>)
1840 '("^kill" "^uptime"))))
1841 (for-each delete-file dup)
1842 #t))))))
1843 (inputs `(("ncurses" ,ncurses)))
1844 (home-page "https://gitlab.com/procps-ng/procps/")
1845 (synopsis "Utilities that give information about processes")
1846 (description
1847 "Procps is the package that has a bunch of small useful utilities
1848 that give information about processes using the Linux /proc file system.
1849 The package includes the programs free, pgrep, pidof, pkill, pmap, ps, pwdx,
1850 slabtop, tload, top, vmstat, w, watch and sysctl.")
1851 (license license:gpl2)))
1852
1853 (define-public usbutils
1854 (package
1855 (name "usbutils")
1856 (version "013")
1857 (source
1858 (origin
1859 (method url-fetch)
1860 (uri (string-append "mirror://kernel.org/linux/utils/usb/usbutils/"
1861 "usbutils-" version ".tar.xz"))
1862 (sha256
1863 (base32 "0f0klk6d3hmbpf6p4dcwa1qjzblmkhbxs1wsw87aidvqri7lj8wy"))))
1864 (build-system gnu-build-system)
1865 (outputs (list "out" "python"))
1866 (arguments
1867 `(#:phases
1868 (modify-phases %standard-phases
1869 (add-before 'bootstrap 'patch-bootstrap-scripts
1870 (lambda _
1871 (substitute* "usbhid-dump/bootstrap"
1872 (("/bin/sh") (which "sh")))
1873
1874 ;; Don't let autogen.sh run configure with bogus options & CFLAGS.
1875 (substitute* "autogen.sh"
1876 (("^\\./configure.*") ""))
1877 #t))
1878 (add-after 'install 'separate-python-output
1879 ;; Separating one Python script shaves more than 106 MiB from :out.
1880 (lambda* (#:key outputs #:allow-other-keys)
1881 (let ((out (assoc-ref outputs "out"))
1882 (out:python (assoc-ref outputs "python")))
1883 (for-each (lambda (file)
1884 (let ((old (string-append out "/" file))
1885 (new (string-append out:python "/" file)))
1886 (mkdir-p (dirname new))
1887 (rename-file old new)))
1888 (list "bin/lsusb.py"))
1889 #t))))))
1890 (inputs
1891 `(("eudev" ,eudev)
1892 ("libusb" ,libusb)
1893 ("python" ,python)))
1894 (native-inputs
1895 `(("autoconf" ,autoconf)
1896 ("automake" ,automake)
1897 ("libtool" ,libtool)
1898 ("pkg-config" ,pkg-config)))
1899 (home-page "http://www.linux-usb.org/")
1900 (synopsis
1901 "Tools for working with USB devices, such as lsusb")
1902 (description
1903 "Tools for working with USB devices, such as lsusb.")
1904 (license license:gpl2+)))
1905
1906 (define-public e2fsprogs
1907 (package
1908 (name "e2fsprogs")
1909 (version "1.45.6")
1910 (source (origin
1911 (method url-fetch)
1912 (uri (string-append
1913 "mirror://kernel.org/linux/kernel/people/tytso/"
1914 "e2fsprogs/v" version "/"
1915 "e2fsprogs-" version ".tar.xz"))
1916 (sha256
1917 (base32
1918 "0mj2yizwygs7xww8jfy5mxjn8ww4pvc0b1hg1p2vsnirailsx9zz"))))
1919 (build-system gnu-build-system)
1920 (inputs `(("util-linux" ,util-linux "lib")))
1921 (native-inputs `(("pkg-config" ,pkg-config)
1922 ("texinfo" ,texinfo) ;for the libext2fs Info manual
1923
1924 ;; For tests.
1925 ("perl" ,perl)
1926 ("procps" ,procps)))
1927 (arguments
1928 '(;; util-linux is the preferred source for some of the libraries and
1929 ;; commands, so disable them (see, e.g.,
1930 ;; <http://git.buildroot.net/buildroot/commit/?id=e1ffc2f791b33633>.)
1931 #:configure-flags (list "--disable-libblkid"
1932 "--disable-libuuid" "--disable-uuidd"
1933 "--disable-fsck"
1934
1935 ;; Use symlinks instead of hard links for
1936 ;; 'fsck.extN' etc. This makes the resulting nar
1937 ;; smaller and is preserved across copies.
1938 "--enable-symlink-install"
1939
1940 (string-append "LDFLAGS=-Wl,-rpath="
1941 (assoc-ref %outputs "out")
1942 "/lib")
1943
1944 ;; Install libext2fs et al.
1945 "--enable-elf-shlibs")
1946
1947 #:phases
1948 (modify-phases %standard-phases
1949 (add-before 'configure 'patch-shells
1950 (lambda _
1951 (substitute* "configure"
1952 (("/bin/sh (.*)parse-types.sh" _ dir)
1953 (string-append (which "sh") " " dir
1954 "parse-types.sh")))
1955 (substitute* "MCONFIG.in"
1956 (("INSTALL_SYMLINK = /bin/sh")
1957 "INSTALL_SYMLINK = sh"))
1958 (substitute* (find-files "." "^Makefile.in$")
1959 (("#!/bin/sh")
1960 (string-append "#!" (which "sh"))))
1961 #t))
1962 (add-after 'install 'install-libs
1963 (lambda* (#:key outputs #:allow-other-keys)
1964 (let* ((out (assoc-ref outputs "out"))
1965 (lib (string-append out "/lib")))
1966 (invoke "make" "install-libs")
1967
1968 ;; Make the .a writable so that 'strip' works.
1969 ;; Failing to do that, due to debug symbols, we
1970 ;; retain a reference to the final
1971 ;; linux-libre-headers, which refer to the
1972 ;; bootstrap binaries.
1973 (let ((archives (find-files lib "\\.a$")))
1974 (for-each (lambda (file)
1975 (chmod file #o666))
1976 archives))
1977 #t))))))
1978 (home-page "http://e2fsprogs.sourceforge.net/")
1979 (synopsis "Creating and checking ext2/ext3/ext4 file systems")
1980 (description
1981 "This package provides tools for manipulating ext2/ext3/ext4 file systems.")
1982 (license (list license:gpl2 ;programs
1983 license:lgpl2.0 ;libext2fs
1984 license:x11)))) ;libuuid
1985
1986 (define e2fsprogs/static
1987 (static-package
1988 (package (inherit e2fsprogs)
1989 (arguments
1990 ;; Do not build shared libraries.
1991 (substitute-keyword-arguments (package-arguments e2fsprogs)
1992 ((#:configure-flags _)
1993 '(list "--disable-blkid"))
1994 ((#:make-flags _)
1995 '(list)))))))
1996
1997 (define-public e2fsck/static
1998 (package
1999 (name "e2fsck-static")
2000 (version (package-version e2fsprogs))
2001 (build-system trivial-build-system)
2002 (source #f)
2003 (inputs
2004 `(("e2fsprogs" ,e2fsprogs/static)))
2005 (arguments
2006 `(#:modules ((guix build utils))
2007 #:builder
2008 (begin
2009 (use-modules (guix build utils)
2010 (ice-9 ftw)
2011 (srfi srfi-26))
2012
2013 (let ((e2fsck (string-append (assoc-ref %build-inputs "e2fsprogs")
2014 "/sbin/e2fsck"))
2015 (bin (string-append (assoc-ref %outputs "out") "/sbin")))
2016 (mkdir-p bin)
2017 (with-directory-excursion bin
2018 (copy-file e2fsck "e2fsck")
2019 (remove-store-references "e2fsck")
2020 (chmod "e2fsck" #o555))
2021 #t))))
2022 (home-page (package-home-page e2fsprogs))
2023 (synopsis "Statically-linked e2fsck command from e2fsprogs")
2024 (description "This package provides statically-linked e2fsck command taken
2025 from the e2fsprogs package. It is meant to be used in initrds.")
2026 (license (package-license e2fsprogs))))
2027
2028 (define-public extundelete
2029 (package
2030 (name "extundelete")
2031 (version "0.2.4")
2032 (source
2033 (origin
2034 (method url-fetch)
2035 (uri (string-append "mirror://sourceforge/extundelete/"
2036 "extundelete/" version "/extundelete-"
2037 version ".tar.bz2"))
2038 (sha256
2039 (base32
2040 "1x0r7ylxlp9lbj3d7sqf6j2a222dwy2nfpff05jd6mkh4ihxvyd1"))
2041 (patches (search-patches "extundelete-e2fsprogs-1.44.patch"))))
2042 (build-system gnu-build-system)
2043 (inputs `(("e2fsprogs" ,e2fsprogs)))
2044 (home-page "http://extundelete.sourceforge.net/")
2045 (synopsis "Recover deleted files from ext2/3/4 partitions")
2046 (description
2047 "Extundelete is a set of tools that can recover deleted files from an
2048 ext3 or ext4 partition.")
2049 (license license:gpl2)))
2050
2051 (define-public zerofree
2052 (package
2053 (name "zerofree")
2054 (version "1.1.1")
2055 (home-page "https://frippery.org/uml/")
2056 (source (origin
2057 (method url-fetch)
2058 (uri (string-append home-page name "-" version
2059 ".tgz"))
2060 (sha256
2061 (base32
2062 "0rrqfa5z103ws89vi8kfvbks1cfs74ix6n1wb6vs582vnmhwhswm"))))
2063 (build-system gnu-build-system)
2064 (arguments
2065 '(#:phases
2066 (modify-phases %standard-phases
2067 (delete 'configure) ; no configure script
2068 (replace 'install
2069 ;; The Makefile lacks an ‘install’ target.
2070 (lambda* (#:key outputs #:allow-other-keys)
2071 (let* ((out (assoc-ref outputs "out"))
2072 (bin (string-append out "/bin")))
2073 (chmod "zerofree" #o555)
2074 (install-file "zerofree" bin)
2075 #t))))
2076 #:tests? #f)) ; no tests
2077 (inputs `(("libext2fs" ,e2fsprogs)))
2078 (synopsis "Zero non-allocated regions in ext2/ext3/ext4 file systems")
2079 (description
2080 "Zerofree finds the unallocated blocks with non-zero value content in an
2081 ext2, ext3, or ext4 file system and fills them with zeroes (or another value).
2082 This is a simple way to make disk images more compressible.
2083 Zerofree requires the file system to be unmounted or mounted read-only.")
2084 (license license:gpl2)))
2085
2086 (define-public strace
2087 (package
2088 (name "strace")
2089 (version "5.8")
2090 (home-page "https://strace.io")
2091 (source (origin
2092 (method url-fetch)
2093 (uri (string-append home-page "/files/" version
2094 "/strace-" version ".tar.xz"))
2095 (sha256
2096 (base32
2097 "1abs3svkg9985f4jrxx34sj1dcpsf95vv1a0g01c777zgygncjnz"))))
2098 (build-system gnu-build-system)
2099 (arguments
2100 '(#:phases
2101 (modify-phases %standard-phases
2102 (add-after 'unpack 'patch-/bin/sh
2103 (lambda _
2104 (substitute* "strace.c"
2105 (("/bin/sh") (which "sh")))
2106 #t))
2107 (add-after 'unpack 'disable-failing-tests
2108 (lambda _
2109 ;; XXX These hang forever even if the test time-out is extended.
2110 (substitute* "tests/Makefile.in"
2111 (("^\tstrace-DD?D?\\.test \\\\.*") ""))
2112 #t)))
2113 ;; Don't fail if the architecture doesn't support different personalities.
2114 #:configure-flags '("--enable-mpers=check")
2115 ;; See <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=32459>.
2116 #:parallel-tests? #f)) ; undeterministic failures
2117 (native-inputs `(("perl" ,perl)))
2118 (synopsis "System call tracer for Linux")
2119 (description
2120 "strace is a system call tracer, i.e. a debugging tool which prints out a
2121 trace of all the system calls made by a another process/program.")
2122 (license license:lgpl2.1+)))
2123
2124 (define-public ltrace
2125 (package
2126 (name "ltrace")
2127 (version "0.7.3")
2128 (source (origin
2129 (method url-fetch)
2130 (uri (string-append "http://www.ltrace.org/ltrace_" version
2131 ".orig.tar.bz2"))
2132 (sha256
2133 (base32
2134 "00wmbdghqbz6x95m1mcdd3wd46l6hgcr4wggdp049dbifh3qqvqf"))))
2135 (build-system gnu-build-system)
2136 (inputs `(("libelf" ,elfutils)))
2137 (arguments
2138 ;; Compilation uses -Werror by default, but it fails.
2139 '(#:configure-flags '("--disable-werror")))
2140 (home-page "https://www.ltrace.org/")
2141 (synopsis "Library call tracer for Linux")
2142 (description
2143 "ltrace intercepts and records dynamic library calls which are called by
2144 an executed process and the signals received by that process. It can also
2145 intercept and print the system calls executed by the program.")
2146 (license license:gpl2+)))
2147
2148 (define-public alsa-lib
2149 (package
2150 (name "alsa-lib")
2151 (version "1.2.4")
2152 (source (origin
2153 (method url-fetch)
2154 (uri (string-append
2155 "ftp://ftp.alsa-project.org/pub/lib/alsa-lib-"
2156 version ".tar.bz2"))
2157 (sha256
2158 (base32
2159 "1xq8d48wfy59qw4x7383j32n8j5njndw5hcgnmlg9pvclphlnmgp"))))
2160 (build-system gnu-build-system)
2161 (arguments
2162 '(#:configure-flags (list (string-append "LDFLAGS=-Wl,-rpath="
2163 (assoc-ref %outputs "out")
2164 "/lib"))))
2165 (home-page "https://www.alsa-project.org/")
2166 (synopsis "The Advanced Linux Sound Architecture libraries")
2167 (description
2168 "The Advanced Linux Sound Architecture (ALSA) provides audio and
2169 MIDI functionality to the Linux-based operating system.")
2170 (license license:lgpl2.1+)))
2171
2172 (define-public alsa-utils
2173 (package
2174 (name "alsa-utils")
2175 (version "1.2.4")
2176 (source (origin
2177 (method url-fetch)
2178 (uri (string-append "ftp://ftp.alsa-project.org/pub/utils/"
2179 name "-" version ".tar.bz2"))
2180 (sha256
2181 (base32
2182 "09m4dnn4kplawprd2bl15nwa0b4r1brab3x44ga7f1fyk7aw5zwq"))))
2183 (build-system gnu-build-system)
2184 (arguments
2185 ;; XXX: Disable man page creation until we have DocBook.
2186 '(#:configure-flags (list "--disable-xmlto"
2187
2188 ;; The udev rule is responsible for restoring
2189 ;; the volume.
2190 (string-append "--with-udev-rules-dir="
2191 (assoc-ref %outputs "out")
2192 "/lib/udev/rules.d"))
2193 #:phases
2194 (modify-phases %standard-phases
2195 (add-before 'check 'disable-broken-test
2196 (lambda _
2197 ;; XXX: The 1.1.8 release tarball is missing a header that's
2198 ;; required for this test to work. Fixed in 1.1.9.
2199 (substitute* "axfer/test/Makefile"
2200 ((".*container-test.*") ""))
2201 #t))
2202 (add-before
2203 'install 'pre-install
2204 (lambda _
2205 ;; Don't try to mkdir /var/lib/alsa.
2206 (substitute* "Makefile"
2207 (("\\$\\(MKDIR_P\\) .*ASOUND_STATE_DIR.*")
2208 "true\n"))
2209 #t)))))
2210 (native-inputs
2211 `(("gettext" ,gettext-minimal)))
2212 (inputs
2213 `(("libsamplerate" ,libsamplerate)
2214 ("ncurses" ,ncurses)
2215 ("alsa-lib" ,alsa-lib)
2216 ("xmlto" ,xmlto)))
2217 (home-page "http://www.alsa-project.org/")
2218 (synopsis "Utilities for the Advanced Linux Sound Architecture (ALSA)")
2219 (description
2220 "The Advanced Linux Sound Architecture (ALSA) provides audio and
2221 MIDI functionality to the Linux-based operating system.")
2222
2223 ;; This is mostly GPLv2+ but a few files such as 'alsactl.c' are
2224 ;; GPLv2-only.
2225 (license license:gpl2)))
2226
2227 (define-public alsa-plugins
2228 (package
2229 (name "alsa-plugins")
2230 (version "1.2.2")
2231 (source (origin
2232 (method url-fetch)
2233 (uri (string-append "ftp://ftp.alsa-project.org/pub/plugins/"
2234 name "-" version ".tar.bz2"))
2235 (sha256
2236 (base32
2237 "0z9k3ssbfk2ky2w13avgyf202j1drsz9sv3834bp33cj1i2hc3qw"))))
2238 (build-system gnu-build-system)
2239 ;; TODO: Split libavcodec and speex if possible. It looks like they can not
2240 ;; be split, there are references to both in files.
2241 ;; TODO: Remove OSS related plugins, they add support to run native
2242 ;; ALSA applications on OSS however we do not offer OSS and OSS is
2243 ;; obsolete.
2244 (outputs '("out" "pulseaudio" "jack"))
2245 (native-search-paths
2246 (list (search-path-specification
2247 (variable "ALSA_PLUGIN_DIR")
2248 (files '("lib/alsa-lib"))
2249 (separator #f))))
2250 (arguments
2251 `(#:configure-flags '(;; Do not install a "local" configuration targeted
2252 ;; for /etc/alsa. On Guix System plugins are loaded from
2253 ;; the ALSA service, and other distributions likely
2254 ;; won't use these files.
2255 "--with-alsalconfdir=/tmp/noop")
2256 #:phases
2257 (modify-phases %standard-phases
2258 (add-after 'install 'split
2259 (lambda* (#:key inputs outputs #:allow-other-keys)
2260 ;; Distribute the binaries to the various outputs.
2261 (let* ((out (assoc-ref outputs "out"))
2262 (jack (assoc-ref outputs "jack"))
2263 (jacklib (string-append jack "/lib/alsa-lib"))
2264 (pua (assoc-ref outputs "pulseaudio"))
2265 (pualib (string-append pua "/lib/alsa-lib")))
2266 ;; For jack.
2267 (mkdir-p jacklib)
2268 (for-each (lambda (file)
2269 (rename-file file (string-append jacklib "/" (basename file))))
2270 (find-files out ".*jack\\.(la|so)"))
2271 ;; For pulseaudio.
2272 (mkdir-p pualib)
2273 (for-each (lambda (file)
2274 (rename-file file (string-append pualib "/" (basename file))))
2275 (find-files out ".*pulse\\.(la|so)"))
2276 #t))))))
2277 (inputs
2278 `(("alsa-lib" ,alsa-lib)
2279 ("jack" ,jack-1)
2280 ("speex" ,speex) ; libspeexdsp resampling plugin
2281 ("libsamplerate" ,libsamplerate) ; libsamplerate resampling plugin
2282 ("ffmpeg" ,ffmpeg) ; libavcodec resampling plugin, a52 plugin
2283 ("pulseaudio" ,pulseaudio))) ; PulseAudio plugin
2284 (native-inputs
2285 `(("pkg-config" ,pkg-config)))
2286 (home-page "http://www.alsa-project.org/")
2287 (synopsis "Plugins for the Advanced Linux Sound Architecture (ALSA)")
2288 (description
2289 "The Advanced Linux Sound Architecture (ALSA) provides audio and
2290 MIDI functionality to the Linux-based operating system. This package enhances ALSA
2291 by providing additional plugins which include: upmixing, downmixing, jackd and
2292 pulseaudio support for native alsa applications, format conversion (s16 to a52), and
2293 external rate conversion.")
2294 (license (list license:gpl2+
2295 ;; `rate/rate_samplerate.c': LGPL v2.1 or later.
2296 license:lgpl2.1+))))
2297
2298 (define-public iptables
2299 (package
2300 (name "iptables")
2301 (version "1.8.7")
2302 (source
2303 (origin
2304 (method url-fetch)
2305 (uri (list (string-append "mirror://netfilter.org/iptables/iptables-"
2306 version ".tar.bz2")
2307 (string-append "https://www.netfilter.org/projects/iptables/"
2308 "files/iptables-" version ".tar.bz2")))
2309 (sha256
2310 (base32 "1w6qx3sxzkv80shk21f63rq41c84irpx68k62m2cv629n1mwj2f1"))))
2311 (build-system gnu-build-system)
2312 (native-inputs
2313 `(("pkg-config" ,pkg-config)
2314 ("flex" ,flex)
2315 ("bison" ,bison)))
2316 (inputs
2317 `(("libmnl" ,libmnl)
2318 ("libnftnl" ,libnftnl)))
2319 (arguments
2320 '(#:tests? #f ; no test suite
2321 #:configure-flags ; add $libdir to the RUNPATH of executables
2322 (list (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib"))))
2323 (home-page "https://www.netfilter.org/projects/iptables/index.html")
2324 (synopsis "Programs to configure Linux IP packet filtering rules")
2325 (description
2326 "@command{iptables} is the user-space command line program used to
2327 configure the Linux 2.4.x and later IPv4 packet filtering ruleset
2328 (@dfn{firewall}), including @dfn{NAT} (Network Address Translation).
2329
2330 This package also includes @command{ip6tables}, which is used to configure the
2331 IPv6 packet filter.
2332
2333 Both commands are targeted at system administrators.")
2334 (license license:gpl2+)))
2335
2336 (define-public jitterentropy-rngd
2337 (package
2338 (name "jitterentropy-rngd")
2339 (version "1.2.0")
2340 (source
2341 (origin
2342 (method git-fetch)
2343 (uri (git-reference
2344 (url "https://github.com/smuellerDD/jitterentropy-rngd")
2345 (commit (string-append "v" version))))
2346 (file-name (git-file-name name version))
2347 (sha256
2348 (base32 "1fb8zfwhwkl1d8n4cdn7rdv5rwd75qgc00d36pmkl7wgnj3c9xda"))))
2349 (build-system gnu-build-system)
2350 (arguments
2351 `(#:tests? #f ; no test suite
2352 #:make-flags
2353 (list (string-append "CC=" ,(cc-for-target))
2354 (string-append "PREFIX=" (assoc-ref %outputs "out"))
2355 "UNITDIR=$(PREFIX)/lib/systemd/system")
2356 #:phases
2357 (modify-phases %standard-phases
2358 (delete 'configure)))) ; no ./configure script
2359 (home-page "https://www.chronox.de/jent.html")
2360 (synopsis "CPU jitter random number generator daemon")
2361 (description
2362 "This simple daemon feeds entropy from the CPU Jitter @acronym{RNG, random
2363 number generator} core to the kernel Linux's entropy estimator. This prevents
2364 the @file{/dev/random} device from blocking and should benefit users of the
2365 preferred @file{/dev/urandom} and @code{getrandom()} interfaces too.
2366
2367 The CPU Jitter RNG itself is part of the kernel and claims to provide good
2368 entropy by collecting and magnifying differences in CPU execution time as
2369 measured by the high-resolution timer built into modern CPUs. It requires no
2370 additional hardware or external entropy source.
2371
2372 The random bit stream generated by @command{jitterentropy-rngd} is not processed
2373 by a cryptographically secure whitening function. Nonetheless, its authors
2374 believe it to be a suitable source of cryptographically secure key material or
2375 other cryptographically sensitive data.
2376
2377 If you agree with them, start this daemon as early as possible to provide
2378 properly seeded random numbers to services like SSH or those using TLS during
2379 early boot when entropy may be low, especially in virtualised environments.")
2380 (license (list license:bsd-3 ; or
2381 license:gpl2+))))
2382
2383 (define-public lsscsi
2384 (package
2385 (name "lsscsi")
2386 (version "0.32")
2387 (source (origin
2388 (method url-fetch)
2389 (uri (string-append
2390 "http://sg.danny.cz/scsi/lsscsi-" version ".tar.xz"))
2391 (sha256
2392 (base32
2393 "0jp458m2b3wckr18qkln69i01152qlwz33zm49103lq8fgx0n6d4"))))
2394 (build-system gnu-build-system)
2395 (synopsis "Lists information about SCSI or NVMe devices in Linux")
2396 (home-page "http://sg.danny.cz/scsi/lsscsi.html")
2397 (description
2398 "@command{lsscsi} lists SCSI logical units or SCSI targets. It can
2399 also list NVMe namespaces or controllers and show the relationship between a
2400 device's primary node name, its SCSI generic (sg) node name and its kernel
2401 name.")
2402 (license license:gpl2)))
2403
2404 (define-public ebtables
2405 (package
2406 (name "ebtables")
2407 (version "2.0.11")
2408 (source (origin
2409 (method url-fetch)
2410 (uri (string-append
2411 "mirror://netfilter.org/ebtables/ebtables-"
2412 version ".tar.gz"))
2413 (sha256
2414 (base32
2415 "0apxgmkhsk3vxn9q3libxn3dgrdljrxyy4mli2gk49m7hi3na7xp"))))
2416 (build-system gnu-build-system)
2417 (inputs
2418 `(("perl" ,perl)
2419 ("iptables" ,iptables)))
2420 (synopsis "Ethernet bridge frame table administration")
2421 (home-page "https://ebtables.netfilter.org/")
2422 (description
2423 "ebtables is an application program used to set up and maintain the
2424 tables of rules (inside the Linux kernel) that inspect Ethernet frames. It is
2425 analogous to the iptables application, but less complicated, due to the fact
2426 that the Ethernet protocol is much simpler than the IP protocol.")
2427 (license license:gpl2+)))
2428
2429 (define-public iproute
2430 (package
2431 (name "iproute2")
2432 (version "5.12.0")
2433 (source (origin
2434 (method url-fetch)
2435 (uri (string-append
2436 "mirror://kernel.org/linux/utils/net/iproute2/iproute2-"
2437 version ".tar.xz"))
2438 (sha256
2439 (base32
2440 "0vrjbzhwzcvaxyyhkr2ii89w2vznzwp2pfgk7w72mviniawqs9lx"))))
2441 (build-system gnu-build-system)
2442 (arguments
2443 `( ;; There is a test suite, but it wants network namespaces and sudo.
2444 #:tests? #f
2445 #:make-flags (let ((out (assoc-ref %outputs "out")))
2446 (list "DESTDIR="
2447 (string-append "CC=" ,(cc-for-target))
2448 "HOSTCC=gcc"
2449 (string-append "BASH_COMPDIR=" out
2450 "/etc/bash_completion.d")
2451 (string-append "LIBDIR=" out "/lib")
2452 (string-append "HDRDIR=" out "/include")
2453 (string-append "SBINDIR=" out "/sbin")
2454 (string-append "CONFDIR=" out "/etc")
2455 (string-append "DOCDIR=" out "/share/doc/"
2456 ,name "-" ,version)
2457 (string-append "MANDIR=" out "/share/man")))
2458 #:phases (modify-phases %standard-phases
2459 (add-before 'install 'pre-install
2460 (lambda _
2461 ;; Don't attempt to create /var/lib/arpd.
2462 (substitute* "Makefile"
2463 (("^.*ARPDDIR.*$") ""))
2464 #t))
2465 (add-after 'unpack 'patch-configure
2466 (lambda _
2467 (let ((target ,(%current-target-system)))
2468 (substitute* "configure"
2469 (("pkg-config")
2470 (if target
2471 (string-append target "-pkg-config")
2472 "pkg-config")))
2473 #t))))))
2474 (inputs
2475 `(("db4" ,bdb)
2476 ("iptables" ,iptables)
2477 ("libmnl" ,libmnl)))
2478 (native-inputs
2479 `(("bison" ,bison)
2480 ("flex" ,flex)
2481 ("pkg-config" ,pkg-config)))
2482 ;; For tests.
2483 ;; ("libmnl" ,libmnl)
2484 ;; ("util-linux" ,util-linux)
2485 (home-page
2486 "https://wiki.linuxfoundation.org/networking/iproute2")
2487 (synopsis
2488 "Utilities for controlling TCP/IP networking and traffic in Linux")
2489 (description
2490 "Iproute2 is a collection of utilities for controlling TCP/IP networking
2491 and traffic with the Linux kernel. The most important of these are
2492 @command{ip}, which configures IPv4 and IPv6, and @command{tc} for traffic
2493 control.
2494
2495 Most network configuration manuals still refer to ifconfig and route as the
2496 primary network configuration tools, but ifconfig is known to behave
2497 inadequately in modern network environments, and both should be deprecated.")
2498 (license license:gpl2+)))
2499
2500 (define-public net-tools
2501 ;; XXX: This package is basically unmaintained, but it provides a few
2502 ;; commands not yet provided by Inetutils, such as 'route', so we have to
2503 ;; live with it.
2504 (let ((commit "479bb4a7e11a4084e2935c0a576388f92469225b")
2505 (revision "0"))
2506 (package
2507 (name "net-tools")
2508 (version (string-append "1.60-" revision "." (string-take commit 7)))
2509 (source (origin
2510 (method url-fetch)
2511 (uri (string-append "https://sourceforge.net/code-snapshots/git/"
2512 "n/ne/net-tools/code.git/net-tools-code-"
2513 commit ".zip"))
2514 (file-name (string-append name "-" version ".zip"))
2515 (sha256
2516 (base32
2517 "0hz9fda9d78spp774b6rr5xaxav7cm4h0qcpxf70rvdbrf6qx7vy"))))
2518 (home-page "http://net-tools.sourceforge.net/")
2519 (build-system gnu-build-system)
2520 (arguments
2521 `(#:modules ((guix build gnu-build-system)
2522 (guix build utils)
2523 (srfi srfi-1)
2524 (srfi srfi-26))
2525 #:phases
2526 (modify-phases %standard-phases
2527 (replace 'configure
2528 (lambda* (#:key outputs #:allow-other-keys)
2529 (let ((out (assoc-ref outputs "out")))
2530 (mkdir-p (string-append out "/bin"))
2531 (mkdir-p (string-append out "/sbin"))
2532
2533 ;; Pretend we have everything...
2534 (system "yes | make config")
2535
2536 ;; ... except for the things we don't have.
2537 ;; HAVE_AFDECnet requires libdnet, which we don't have.
2538 ;; HAVE_HWSTRIP and HAVE_HWTR require kernel headers
2539 ;; that have been removed.
2540 ;; XXX SELINUX and AFBLUETOOTH are removed for now, but we should
2541 ;; think about adding them later.
2542 (substitute* '("config.make" "config.h")
2543 (("^.*HAVE_(AFDECnet|HWSTRIP|HWTR|SELINUX|AFBLUETOOTH)[ =]1.*$")
2544 ""))
2545 #t)))
2546 (add-after 'install 'remove-redundant-commands
2547 (lambda* (#:key outputs #:allow-other-keys)
2548 ;; Remove commands and man pages redundant with Inetutils.
2549 (let* ((out (assoc-ref outputs "out"))
2550 (dup (append-map (cut find-files out <>)
2551 '("^hostname"
2552 "^(yp|nis|dns)?domainname"))))
2553 (for-each delete-file dup)
2554 #t))))
2555 ;; Binaries that depend on libnet-tools.a don't declare that
2556 ;; dependency, making it parallel-unsafe.
2557 #:parallel-build? #f
2558
2559 #:tests? #f ; no test suite
2560 #:make-flags (let ((out (assoc-ref %outputs "out")))
2561 (list ,(string-append "CC=" (cc-for-target))
2562 (string-append "BASEDIR=" out)
2563 (string-append "INSTALLNLSDIR=" out "/share/locale")
2564 (string-append "mandir=/share/man")))))
2565 (native-inputs `(("gettext" ,gettext-minimal)
2566 ("unzip" ,unzip)))
2567 (supported-systems (delete "i586-gnu" %supported-systems))
2568 (synopsis "Tools for controlling the network subsystem in Linux")
2569 (description
2570 "This package includes the important tools for controlling the network
2571 subsystem of the Linux kernel. This includes arp, ifconfig, netstat, rarp and
2572 route. Additionally, this package contains utilities relating to particular
2573 network hardware types (plipconfig, slattach) and advanced aspects of IP
2574 configuration (iptunnel, ipmaddr).")
2575 (license license:gpl2+))))
2576
2577 (define-public libcap-2.31
2578 (package
2579 (name "libcap")
2580 (version "2.31")
2581 (source (origin
2582 (method url-fetch)
2583 (uri (string-append
2584 "mirror://kernel.org/linux/libs/security/linux-privs/"
2585 "libcap2/libcap-" version ".tar.xz"))
2586 (sha256
2587 (base32
2588 "0ikwm0kngrqa4ci80lqnrkk17kg09q7dxrz28y0gm5qw3vj8s266"))))
2589 (build-system gnu-build-system)
2590 (arguments '(#:phases
2591 (modify-phases %standard-phases
2592 (replace 'configure
2593 ;; Add $libdir to the RUNPATH of executables.
2594 (lambda _
2595 (substitute* "Make.Rules"
2596 (("LDFLAGS := #-g")
2597 (string-append "LDFLAGS := -Wl,-rpath="
2598 %output "/lib")))
2599 #t)))
2600 #:test-target "test"
2601 #:make-flags (list "lib=lib"
2602 (string-append "prefix="
2603 (assoc-ref %outputs "out"))
2604 "RAISE_SETFCAP=no")))
2605 (native-inputs `(("perl" ,perl)))
2606 (supported-systems (delete "i586-gnu" %supported-systems))
2607 (home-page "https://sites.google.com/site/fullycapable/")
2608 (synopsis "Library for working with POSIX capabilities")
2609 (description
2610 "Libcap2 provides a programming interface to POSIX capabilities on
2611 Linux-based operating systems.")
2612
2613 ;; License is BSD-3 or GPLv2, at the user's choice.
2614 (license license:gpl2)))
2615
2616 ;; libcap 2.31 has problems with newer kernels, so provide this newer variant.
2617 ;; Keep the old libcap around to avoid rebuilding 'coreutils' and 'avahi'.
2618 ;; To be merged with libcap on the next rebuild cycle.
2619 (define-public libcap
2620 (package
2621 (inherit libcap-2.31)
2622 (version "2.45")
2623 (source (origin
2624 (method url-fetch)
2625 (uri (string-append
2626 "mirror://kernel.org/linux/libs/security/linux-privs/"
2627 "libcap2/libcap-" version ".tar.xz"))
2628 (sha256
2629 (base32
2630 "11ijmi7jik9iw6pdszc6bylhggghr8cza03bcrbhbqf0cpvkjrnn"))))
2631 (arguments
2632 (substitute-keyword-arguments (package-arguments libcap-2.31)
2633 ((#:phases phases)
2634 `(modify-phases ,phases
2635 (replace 'configure
2636 (lambda _
2637 ;; Add $libdir to the RUNPATH of executables.
2638 (substitute* "Make.Rules"
2639 (("LDFLAGS \\?= #-g")
2640 (string-append "LDFLAGS ?= -Wl,-rpath="
2641 %output "/lib")))
2642 #t))))))))
2643
2644 (define-deprecated libcap/next libcap)
2645 (export libcap/next)
2646
2647 (define-public bridge-utils
2648 (package
2649 (name "bridge-utils")
2650 (version "1.7")
2651 (source
2652 (origin
2653 (method url-fetch)
2654 (uri (string-append "mirror://kernel.org/linux/kernel/people/shemminger/"
2655 "bridge-utils/bridge-utils-" version ".tar.xz"))
2656 (sha256
2657 (base32 "0zlrigizac2nfwgvksm92v4wafrpgxlbci3gwimc795ib7k8g6ck"))))
2658 (build-system gnu-build-system)
2659
2660 ;; The tarball lacks all the generated files.
2661 (native-inputs `(("autoconf" ,autoconf)
2662 ("automake" ,automake)))
2663 (arguments
2664 '(#:phases
2665 (modify-phases %standard-phases
2666 (add-before 'bootstrap 'patch-stuff
2667 (lambda _
2668 ;; Fix "field ‘ip6’ has incomplete type" errors.
2669 (substitute* "libbridge/libbridge.h"
2670 (("#include <linux/if_bridge.h>")
2671 "#include <linux/in6.h>\n#include <linux/if_bridge.h>"))
2672
2673 ;; Ensure that the entire build fails if one of the
2674 ;; sub-Makefiles fails.
2675 (substitute* "Makefile.in"
2676 (("\\$\\(MAKE\\) \\$\\(MFLAGS\\) -C \\$\\$x ;")
2677 "$(MAKE) $(MFLAGS) -C $$x || exit 1;"))
2678
2679 #t)))
2680 #:tests? #f)) ; no 'check' target
2681
2682 (home-page "https://wiki.linuxfoundation.org/networking/bridge")
2683 (synopsis "Manipulate Ethernet bridges")
2684 (description
2685 "Utilities for Linux's Ethernet bridging facilities. A bridge is a way
2686 to connect two Ethernet segments together in a protocol independent way.
2687 Packets are forwarded based on Ethernet address, rather than IP address (like
2688 a router). Since forwarding is done at Layer 2, all protocols can go
2689 transparently through a bridge.")
2690 (license license:gpl2+)))
2691
2692 (define-public libnl
2693 (package
2694 (name "libnl")
2695 (version "3.5.0")
2696 (source (origin
2697 (method url-fetch)
2698 (uri (string-append
2699 "https://github.com/thom311/libnl/releases/download/"
2700 "libnl" (string-join (string-split version #\.) "_")
2701 "/libnl-" version ".tar.gz"))
2702 (sha256
2703 (base32
2704 "1yh5bqmkivd78x378x34gzb28lvykn6b9k3hgvvpdnj5jpn3689m"))))
2705 (build-system gnu-build-system)
2706 (native-inputs
2707 `(("bison" ,bison)
2708 ("flex" ,flex)
2709 ("pkg-config" ,pkg-config)
2710 ("swig" ,swig)
2711 ("libnl3-doc"
2712 ,(origin
2713 (method url-fetch)
2714 (uri (string-append
2715 "https://github.com/thom311/libnl/releases/download/libnl"
2716 (string-join (string-split version #\.) "_")
2717 "/libnl-doc-" version ".tar.gz"))
2718 (sha256
2719 (base32 "19p5y8q3cm5wqvamqc4s5syxnnkvzxy3gw8ivxk6fv9ybn8jm35h"))))))
2720 (outputs `("out" "doc"))
2721 (arguments
2722 `(#:phases
2723 (modify-phases %standard-phases
2724 (add-after 'install 'install-doc
2725 (lambda* (#:key inputs native-inputs outputs #:allow-other-keys)
2726 (let ((dest (string-append (assoc-ref outputs "doc")
2727 "/share/doc/libnl")))
2728 (mkdir-p dest)
2729 (invoke "tar" "xf" (assoc-ref
2730 (or native-inputs inputs)
2731 "libnl3-doc")
2732 "--strip-components=1" "-C" dest)))))))
2733 (home-page "https://www.infradead.org/~tgr/libnl/")
2734 (synopsis "NetLink protocol library suite")
2735 (description
2736 "The libnl suite is a collection of libraries providing APIs to netlink
2737 protocol based Linux kernel interfaces. Netlink is an IPC mechanism primarily
2738 between the kernel and user space processes. It was designed to be a more
2739 flexible successor to ioctl to provide mainly networking related kernel
2740 configuration and monitoring interfaces.")
2741
2742 ;; Most files are LGPLv2.1-only, but some are GPLv2-only (like
2743 ;; 'nl-addr-add.c'), so the result is GPLv2-only.
2744 (license license:gpl2)))
2745
2746 ;; libnl python extensions used to be outputs of libnl. However, as
2747 ;; cross-compiling python extensions is currently broken, create separate
2748 ;; packages for libnl python extensions.
2749 (define (libnl-python-package python)
2750 (let ((name (string-append "libnl-" python)))
2751 (package
2752 (inherit libnl)
2753 (name name)
2754 (inputs `(,@(cond
2755 ((string=? python "python2")
2756 `(("python-2" ,python-2)))
2757 ((string=? python "python3")
2758 `(("python-3" ,python-3))))))
2759 (propagated-inputs `(("libnl" ,libnl)))
2760 (outputs '("out"))
2761 (arguments
2762 `(#:modules ((guix build gnu-build-system)
2763 (guix build utils)
2764 (srfi srfi-1))
2765 #:phases
2766 (modify-phases %standard-phases
2767 (replace 'install
2768 (lambda* (#:key inputs outputs #:allow-other-keys)
2769 (define (python-inst python)
2770 (invoke python "setup.py" "build")
2771 (invoke python "setup.py" "install"
2772 (string-append "--prefix="
2773 (assoc-ref %outputs "out")))
2774 (invoke python "setup.py" "clean"))
2775 (setenv "LDFLAGS" (format #f "-Wl,-rpath=~a/lib"
2776 (assoc-ref inputs "libnl")))
2777 (with-directory-excursion "./python" (python-inst ,python))
2778 #t))))))))
2779
2780 (define-public libnl-python2 (libnl-python-package "python2"))
2781 (define-public libnl-python3 (libnl-python-package "python3"))
2782
2783 (define-public iw
2784 (package
2785 (name "iw")
2786 (version "4.14")
2787 (source (origin
2788 (method url-fetch)
2789 (uri (string-append
2790 "mirror://kernel.org/software/network/iw/iw-"
2791 version ".tar.xz"))
2792 (sha256
2793 (base32
2794 "12ddd6vh6vs97135bnlyr0szv7hvpbnmfh48584frzab0z0725ph"))))
2795 (build-system gnu-build-system)
2796 (native-inputs `(("pkg-config" ,pkg-config)))
2797 (inputs `(("libnl" ,libnl)))
2798 (arguments
2799 `(#:make-flags
2800 (let* ((target ,(%current-target-system))
2801 (pkg-config (if target
2802 (string-append target "-pkg-config")
2803 "pkg-config")))
2804 (list
2805 ,(string-append "CC=" (cc-for-target))
2806 (string-append "PKG_CONFIG="
2807 (assoc-ref %build-inputs "pkg-config")
2808 "/bin/" pkg-config)
2809 (string-append "PREFIX=" (assoc-ref %outputs "out"))))
2810 #:phases (modify-phases %standard-phases (delete 'configure))))
2811 (home-page "https://wireless.wiki.kernel.org/")
2812 (synopsis "Tool for configuring wireless devices")
2813 (description
2814 "iw is a new nl80211 based CLI configuration utility for wireless
2815 devices. It replaces @code{iwconfig}, which is deprecated.")
2816 (license license:isc)))
2817
2818 (define-public powertop
2819 (package
2820 (name "powertop")
2821 (version "2.14")
2822 (source
2823 (origin
2824 (method git-fetch)
2825 (uri (git-reference
2826 (url "https://github.com/fenrus75/powertop")
2827 (commit (string-append "v" version))))
2828 (file-name (git-file-name name version))
2829 (sha256
2830 (base32 "1zkr2y5nb1nr22nq8a3zli87iyfasfq6489p7h1k428pv8k45w4f"))))
2831 (build-system gnu-build-system)
2832 (arguments
2833 '(#:configure-flags
2834 (list "LDFLAGS=-pthread")
2835 #:phases
2836 (modify-phases %standard-phases
2837 ;; TODO: Patch some hardcoded "wlan0" in calibrate/calibrate.cpp to
2838 ;; allow calibrating the network interface in Guix System.
2839 (add-after 'unpack 'patch-absolute-file-names
2840 (lambda* (#:key inputs #:allow-other-keys)
2841 (let ((kmod (assoc-ref inputs "kmod")))
2842 (substitute* (find-files "src" "\\.cpp$")
2843 ;; Give the right 'modprobe' file name so that essential
2844 ;; modules such as msr.ko can be loaded.
2845 (("/sbin/modprobe") (string-append kmod "/bin/modprobe"))
2846 ;; These programs are only needed to calibrate, so using
2847 ;; relative file names avoids adding extra inputs. When they
2848 ;; are missing powertop gracefully handles it.
2849 (("/usr/bin/hcitool") "hcitool")
2850 (("/usr/bin/xset") "xset")
2851 (("/usr/sbin/hciconfig") "hciconfig"))
2852 #t))))))
2853 (inputs
2854 `(("kmod" ,kmod)
2855 ("libnl" ,libnl)
2856 ("ncurses" ,ncurses)
2857 ("pciutils" ,pciutils)
2858 ("zlib" ,zlib)))
2859 (native-inputs
2860 `(("autoconf" ,autoconf)
2861 ("automake" ,automake)
2862 ("gettext" ,gettext-minimal)
2863 ("libtool" ,libtool)
2864 ("pkg-config" ,pkg-config)))
2865 (home-page "https://01.org/powertop/")
2866 (synopsis "Analyze power consumption on Intel-based laptops")
2867 (description
2868 "PowerTOP is a Linux tool to diagnose issues with power consumption and
2869 power management. In addition to being a diagnostic tool, PowerTOP also has
2870 an interactive mode where the user can experiment various power management
2871 settings for cases where the operating system has not enabled these
2872 settings.")
2873 (license license:gpl2)))
2874
2875 (define-public aumix
2876 (package
2877 (name "aumix")
2878 (version "2.9.1")
2879 (source (origin
2880 (method url-fetch)
2881 (uri (string-append
2882 "http://www.jpj.net/~trevor/aumix/releases/aumix-"
2883 version ".tar.bz2"))
2884 (sha256
2885 (base32
2886 "0a8fwyxnc5qdxff8sl2sfsbnvgh6pkij4yafiln0fxgg6bal7knj"))))
2887 (build-system gnu-build-system)
2888 (inputs `(("ncurses" ,ncurses)))
2889 (home-page "http://www.jpj.net/~trevor/aumix.html")
2890 (synopsis "Audio mixer for X and the console")
2891 (description
2892 "Aumix adjusts an audio mixer from X, the console, a terminal,
2893 the command line or a script.")
2894 (license license:gpl2+)))
2895
2896 (define-public iotop
2897 (package
2898 (name "iotop")
2899 (version "0.6")
2900 (source
2901 (origin
2902 (method url-fetch)
2903 (uri (string-append "http://guichaz.free.fr/iotop/files/iotop-"
2904 version ".tar.gz"))
2905 (sha256 (base32
2906 "1kp8mqg2pbxq4xzpianypadfxcsyfgwcaqgqia6h9fsq6zyh4z0s"))))
2907 (build-system python-build-system)
2908 (arguments
2909 '(#:phases
2910 (modify-phases %standard-phases
2911 (add-after 'unpack 'fix-build-with-python3
2912 (lambda _
2913 (substitute* "setup.py"
2914 (("itervalues") "values"))
2915 #t)))
2916 ;; There are currently no checks in the package.
2917 #:tests? #f))
2918 (native-inputs `(("python" ,python)))
2919 (home-page "http://guichaz.free.fr/iotop/")
2920 (synopsis
2921 "Displays the IO activity of running processes")
2922 (description
2923 "Iotop is a Python program with a top like user interface to show the
2924 processes currently causing I/O.")
2925 (license license:gpl2+)))
2926
2927 (define-public fuse
2928 (package
2929 (name "fuse")
2930 (version "2.9.9")
2931 (source (origin
2932 (method url-fetch)
2933 (uri (string-append "https://github.com/libfuse/libfuse/releases/"
2934 "download/fuse-" version
2935 "/fuse-" version ".tar.gz"))
2936 (sha256
2937 (base32
2938 "1ddlq6kzxilccgbvxjfx80jx6kamgw4sv49phks2zhlcc1frvrnh"))
2939 (patches (search-patches "fuse-overlapping-headers.patch"))))
2940 (build-system gnu-build-system)
2941 (inputs `(("util-linux" ,util-linux)))
2942 (arguments
2943 '(#:configure-flags (list (string-append "MOUNT_FUSE_PATH="
2944 (assoc-ref %outputs "out")
2945 "/sbin")
2946 (string-append "INIT_D_PATH="
2947 (assoc-ref %outputs "out")
2948 "/etc/init.d")
2949
2950 ;; The rule makes /dev/fuse 666.
2951 (string-append "UDEV_RULES_PATH="
2952 (assoc-ref %outputs "out")
2953 "/lib/udev/rules.d"))
2954 #:phases
2955 (modify-phases %standard-phases
2956 (add-before 'build 'set-file-names
2957 (lambda* (#:key inputs #:allow-other-keys)
2958 ;; libfuse calls out to mount(8) and umount(8). Make sure
2959 ;; it refers to the right ones.
2960 (substitute* '("lib/mount_util.c" "util/mount_util.c")
2961 (("/bin/(u?)mount" _ maybe-u)
2962 (string-append (assoc-ref inputs "util-linux")
2963 "/bin/" maybe-u "mount")))
2964 (substitute* '("util/mount.fuse.c")
2965 (("/bin/sh")
2966 (which "sh")))
2967
2968 ;; This hack leads libfuse to search for 'fusermount' in
2969 ;; $PATH, where it may find a setuid-root binary, instead of
2970 ;; trying solely $out/sbin/fusermount and failing because
2971 ;; it's not setuid.
2972 (substitute* "lib/Makefile"
2973 (("-DFUSERMOUNT_DIR=[[:graph:]]+")
2974 "-DFUSERMOUNT_DIR=\\\"/var/empty\\\""))
2975 #t)))))
2976 (supported-systems (delete "i586-gnu" %supported-systems))
2977 (home-page "https://github.com/libfuse/libfuse")
2978 (synopsis "Support file systems implemented in user space")
2979 (description
2980 "As a consequence of its monolithic design, file system code for Linux
2981 normally goes into the kernel itself---which is not only a robustness issue,
2982 but also an impediment to system extensibility. FUSE, for \"file systems in
2983 user space\", is a kernel module and user-space library that tries to address
2984 part of this problem by allowing users to run file system implementations as
2985 user-space processes.")
2986 (license (list license:lgpl2.1 ;library
2987 license:gpl2+)))) ;command-line utilities
2988
2989 (define-public unionfs-fuse
2990 (package
2991 (name "unionfs-fuse")
2992 (version "2.1")
2993 (source (origin
2994 (method git-fetch)
2995 (uri (git-reference
2996 (url "https://github.com/rpodgorny/unionfs-fuse")
2997 (commit (string-append "v" version))))
2998 (file-name (git-file-name name version))
2999 (sha256
3000 (base32
3001 "0bwx70x834qgqh53vqp18bhbxbsny80hz922rbgj8k9wj7cbfilm"))))
3002 (build-system cmake-build-system)
3003 (native-inputs
3004 `(("python" ,python)))
3005 (inputs `(("fuse" ,fuse)))
3006 (arguments
3007 ;; The tests were never actually run ("collected 0 items"), but in recent
3008 ;; versions of pytest that causes an error.
3009 '(#:tests? #f))
3010 (home-page "https://github.com/rpodgorny/unionfs-fuse")
3011 (synopsis "User-space union file system")
3012 (description
3013 "UnionFS-FUSE is a flexible union file system implementation in user
3014 space, using the FUSE library. Mounting a union file system allows you to
3015 \"aggregate\" the contents of several directories into a single mount point.
3016 UnionFS-FUSE additionally supports copy-on-write.")
3017 (license license:bsd-3)))
3018
3019 (define fuse-static
3020 (package (inherit fuse)
3021 (name "fuse-static")
3022 (source (origin (inherit (package-source fuse))
3023 (modules '((guix build utils)))
3024 (snippet
3025 '(begin
3026 ;; Normally libfuse invokes mount(8) so that /etc/mtab is
3027 ;; updated. Change calls to 'mtab_needs_update' to 0 so
3028 ;; that it doesn't do that, allowing us to remove the
3029 ;; dependency on util-linux (something that is useful in
3030 ;; initrds.)
3031 (substitute* '("lib/mount_util.c"
3032 "util/mount_util.c")
3033 (("mtab_needs_update[[:blank:]]*\\([a-z_]+\\)")
3034 "0")
3035 (("/bin/")
3036 ""))
3037 #t))))))
3038
3039 (define-public unionfs-fuse/static
3040 (package (inherit unionfs-fuse)
3041 (synopsis "User-space union file system (statically linked)")
3042 (name (string-append (package-name unionfs-fuse) "-static"))
3043 (source (origin (inherit (package-source unionfs-fuse))
3044 (modules '((guix build utils)))
3045 (snippet
3046 '(begin
3047 ;; Add -ldl to the libraries, because libfuse.a needs that.
3048 (substitute* "src/CMakeLists.txt"
3049 (("target_link_libraries(.*)\\)" _ libs)
3050 (string-append "target_link_libraries"
3051 libs " dl)")))
3052 #t))))
3053 (arguments
3054 '(#:tests? #f
3055 #:configure-flags '("-DCMAKE_EXE_LINKER_FLAGS=-static")
3056 #:phases
3057 (modify-phases %standard-phases
3058 (add-after 'install 'post-install
3059 (lambda* (#:key outputs #:allow-other-keys)
3060 (let* ((out (assoc-ref outputs "out"))
3061 (exe (string-append out "/bin/unionfs")))
3062 ;; By default, 'unionfs' keeps references to
3063 ;; $glibc/share/locale and similar stuff. Remove them.
3064 (remove-store-references exe)
3065
3066 ;; 'unionfsctl' has references to glibc as well. Since
3067 ;; we don't need it, remove it.
3068 (delete-file (string-append out "/bin/unionfsctl"))
3069 #t))))))
3070 (inputs `(("fuse" ,fuse-static)))))
3071
3072 (define-public sshfs
3073 (package
3074 (name "sshfs")
3075 (version "2.10")
3076 (source (origin
3077 (method url-fetch)
3078 (uri (string-append "https://github.com/libfuse/sshfs/releases/"
3079 "download/sshfs-" version "/sshfs-" version
3080 ".tar.gz"))
3081 (sha256
3082 (base32
3083 "00fir2iykdx11g8nv5gijg0zjrp2g3ldypnv0yi6lq3h5pg5v13h"))))
3084 (build-system gnu-build-system)
3085 (inputs
3086 `(("fuse" ,fuse)
3087 ("glib" ,glib)))
3088 (native-inputs
3089 `(("pkg-config" ,pkg-config)))
3090 (home-page "https://github.com/libfuse/sshfs")
3091 (synopsis "Mount remote file systems over SSH")
3092 (description
3093 "This is a file system client based on the SSH File Transfer Protocol.
3094 Since most SSH servers already support this protocol it is very easy to set
3095 up: on the server side there's nothing to do; on the client side mounting the
3096 file system is as easy as logging into the server with an SSH client.")
3097 (license license:gpl2+)))
3098
3099 (define-public sshfs-fuse
3100 (package (inherit sshfs)
3101 (name "sshfs-fuse")
3102 (properties `((superseded . ,sshfs)))))
3103
3104 (define-public archivemount
3105 (package
3106 (name "archivemount")
3107 (version "0.9.1")
3108 (source
3109 (origin
3110 (method url-fetch)
3111 (uri (string-append "https://www.cybernoia.de/software/archivemount/"
3112 "archivemount-" version ".tar.gz"))
3113 (sha256
3114 (base32 "1cy5b6qril9c3ry6fv7ir87s8iyy5vxxmbyx90dm86fbra0vjaf5"))))
3115 (build-system gnu-build-system)
3116 (inputs `(("fuse" ,fuse)
3117 ("libarchive" ,libarchive)))
3118 (native-inputs `(("pkg-config" ,pkg-config)))
3119 (home-page "https://www.cybernoia.de/software/archivemount.html")
3120 (synopsis "Tool for mounting archive files with FUSE")
3121 (description "archivemount is a FUSE-based file system for Unix variants,
3122 including Linux. Its purpose is to mount archives (i.e. tar, tar.gz, etc.) to a
3123 mount point where it can be read from or written to as with any other file
3124 system. This makes accessing the contents of the archive, which may be
3125 compressed, transparent to other programs, without decompressing them.")
3126 (license license:lgpl2.0+)))
3127
3128 (define-public numactl
3129 (package
3130 (name "numactl")
3131 (version "2.0.14")
3132 (source (origin
3133 (method url-fetch)
3134 (uri (string-append
3135 "https://github.com/numactl/numactl/releases/download/v"
3136 version "/numactl-" version ".tar.gz"))
3137 (sha256
3138 (base32
3139 "1xngddsph43bxljywahi9d44fxr022slsap4hh91w8xnq54d2sw2"))))
3140 (build-system gnu-build-system)
3141 (arguments
3142 '(;; There's a 'test' target, but it requires NUMA support in the kernel
3143 ;; to run, which we can't assume to have.
3144 #:tests? #f))
3145
3146 ;; NUMA is apparently not supported on armhf, see
3147 ;; http://www.spinics.net/lists/linux-numa/msg01157.html
3148 (supported-systems (delete "armhf-linux" %supported-systems))
3149 (home-page "https://github.com/numactl/numactl")
3150 (synopsis "Tools for non-uniform memory access (NUMA) machines")
3151 (description
3152 "NUMA stands for Non-Uniform Memory Access, in other words a system whose
3153 memory is not all in one place. The @command{numactl} program allows you to
3154 run your application program on specific CPUs and memory nodes. It does this
3155 by supplying a NUMA memory policy to the operating system before running your
3156 program.
3157
3158 The package contains other commands, such as @command{numastat},
3159 @command{memhog}, and @command{numademo} which provides a quick overview of
3160 NUMA performance on your system.")
3161 (license (list license:gpl2 ;programs
3162 license:lgpl2.1)))) ;library
3163
3164 (define-public kbd-neo
3165 (package
3166 (name "kbd-neo")
3167 (version "2486")
3168 (source
3169 (origin
3170 (method url-fetch)
3171 (uri (string-append "https://svn.neo-layout.org/!svn/bc/"
3172 version "/linux/console/neo.map"))
3173 (file-name (string-append name "-" version ".map"))
3174 (sha256
3175 (base32
3176 "19mfrd31vzpsjiwc7pshxm0b0sz5dd17xrz6k079cy4im1vf0r4g"))))
3177 (build-system trivial-build-system)
3178 (arguments
3179 `(#:modules ((guix build utils))
3180 #:builder (begin
3181 (use-modules (guix build utils))
3182 (let ((out (string-append %output "/share/keymaps"))
3183 (source (assoc-ref %build-inputs "source")))
3184 (mkdir-p out)
3185 (copy-file source (string-append out "/neo.map"))
3186 #t))))
3187 (home-page "https://neo-layout.org")
3188 (synopsis "Neo2 console layout")
3189 (description
3190 "Kbd-neo provides the Neo2 keyboard layout for use with
3191 @command{loadkeys(1)} from @code{kbd(4)}.")
3192 ;; The file is located in an svn directory, the entire content of
3193 ;; the directory is licensed as GPL3.
3194 (license license:gpl3+)))
3195
3196 (define-public kbd
3197 (package
3198 (name "kbd")
3199 (version "2.4.0")
3200 (source (origin
3201 (method url-fetch)
3202 (uri (string-append "mirror://kernel.org/linux/utils/kbd/kbd-"
3203 version ".tar.xz"))
3204 (sha256
3205 (base32
3206 "17wvrqz2kk0w87idinhyvd31ih1dp7ldfl2yfx7ailygb0279w2m"))
3207 (modules '((guix build utils)))
3208 (snippet
3209 '(begin
3210 (substitute* '("src/unicode_start" "src/unicode_stop")
3211 ;; Assume the Coreutils are in $PATH.
3212 (("/usr/bin/tty")
3213 "tty"))))))
3214 (build-system gnu-build-system)
3215 (arguments
3216 '(#:phases
3217 (modify-phases %standard-phases
3218 (add-before 'build 'pre-build
3219 (lambda* (#:key inputs #:allow-other-keys)
3220 (let ((bzip2 (assoc-ref inputs "bzip2"))
3221 (gzip (assoc-ref inputs "gzip"))
3222 (xz (assoc-ref inputs "xz"))
3223 (zstd (assoc-ref inputs "zstd")))
3224 (substitute* "src/libkbdfile/kbdfile.c"
3225 (("bzip2") (string-append bzip2 "/bin/bzip2"))
3226 (("gzip") (string-append gzip "/bin/gzip"))
3227 (("xz -d") (string-append xz "/bin/xz -d"))
3228 (("zstd") (string-append zstd "/bin/zstd"))))))
3229 (add-after 'install 'post-install
3230 (lambda* (#:key outputs #:allow-other-keys)
3231 ;; Make sure these programs find their comrades.
3232 (let* ((out (assoc-ref outputs "out"))
3233 (bin (string-append out "/bin")))
3234 (for-each (lambda (prog)
3235 (wrap-program (string-append bin "/" prog)
3236 `("PATH" ":" prefix (,bin))))
3237 '("unicode_start" "unicode_stop"))))))))
3238 (native-inputs
3239 `(("autoconf" ,autoconf)
3240 ("pkg-config" ,pkg-config)))
3241 (inputs
3242 `(("bzip2" ,bzip2)
3243 ("gzip" ,gzip)
3244 ("pam" ,linux-pam)
3245 ("xz" ,xz)
3246 ("zstd" ,zstd)))
3247 (native-search-paths
3248 (list (search-path-specification
3249 (variable "LOADKEYS_KEYMAP_PATH")
3250 ;; Append ‘/**’ to recursively search all directories. One can then
3251 ;; run (for example) ‘loadkeys en-latin9’ instead of having to find
3252 ;; and type ‘i386/colemak/en-latin9’ on a mislabelled keyboard.
3253 (files (list "share/keymaps/**")))))
3254 (home-page "http://kbd-project.org/")
3255 (synopsis "Linux keyboard utilities and keyboard maps")
3256 (description
3257 "This package contains keytable files and keyboard utilities compatible
3258 for systems using the Linux kernel. This includes commands such as
3259 @code{loadkeys}, @code{setfont}, @code{kbdinfo}, and @code{chvt}.")
3260 (license license:gpl2+)))
3261
3262 (define-public loadkeys-static
3263 (package
3264 (inherit kbd)
3265 (name "loadkeys-static")
3266 (arguments
3267 (substitute-keyword-arguments (package-arguments kbd)
3268 ((#:configure-flags flags ''())
3269 `(append '("LDFLAGS=-static" "--disable-shared" "--disable-nls"
3270 "--disable-vlock" ;so we don't need libpam
3271 "--disable-libkeymap")
3272 ,flags))
3273 ((#:make-flags flags ''())
3274 `(cons "LDFLAGS=-all-static -lrt -lpthread" ,flags))
3275 ((#:phases phases '%standard-phases)
3276 `(modify-phases ,phases
3277 (replace 'install
3278 (lambda* (#:key outputs #:allow-other-keys)
3279 (let ((out (assoc-ref outputs "out")))
3280 ;; The binary keeps references to gzip, among other things,
3281 ;; which we don't need in the initrd, so strip references.
3282 (remove-store-references "src/loadkeys")
3283
3284 (install-file "src/loadkeys"
3285 (string-append out "/bin")))))
3286 (delete 'post-install)))
3287 ((#:strip-flags _ '())
3288 ''("--strip-all"))
3289 ((#:allowed-references _ '())
3290 '())))
3291
3292 (synopsis "Statically-linked @command{loadkeys} program")
3293
3294 ;; This package is meant to be used internally in the initrd so don't
3295 ;; expose it.
3296 (properties '((hidden? . #t)))))
3297
3298 (define-public inotify-tools
3299 (package
3300 (name "inotify-tools")
3301 (version "3.20.11.0")
3302 (source (origin
3303 (method git-fetch)
3304 (uri (git-reference
3305 (url "https://github.com/rvoicilas/inotify-tools")
3306 (commit version)))
3307 (file-name (git-file-name name version))
3308 (sha256
3309 (base32
3310 "1m8avqccrhm38krlhp88a7v949f3hrzx060bbrr5dp5qw2nmw9j2"))))
3311 (build-system gnu-build-system)
3312 (native-inputs
3313 `(("autoconf" ,autoconf)
3314 ("automake" ,automake)
3315 ("libtool" ,libtool)))
3316 (arguments
3317 `(#:configure-flags
3318 (list "--disable-static")))
3319 (home-page "https://github.com/rvoicilas/inotify-tools/wiki")
3320 (synopsis "Monitor file accesses")
3321 (description
3322 "The inotify-tools packages provides a C library and command-line tools
3323 to use Linux' inotify mechanism, which allows file accesses to be monitored.")
3324 (license license:gpl2+)))
3325
3326 (define-public kmod
3327 (package
3328 (name "kmod")
3329 (version "27")
3330 (source (origin
3331 (method url-fetch)
3332 (uri
3333 (string-append "mirror://kernel.org/linux/utils/kernel/kmod/"
3334 "kmod-" version ".tar.xz"))
3335 (sha256
3336 (base32
3337 "035wzfzjx4nwidk747p8n085mgkvy531ppn16krrajx2dkqzply1"))
3338 (patches (search-patches "kmod-module-directory.patch"))))
3339 (build-system gnu-build-system)
3340 (native-inputs
3341 `(("pkg-config" ,pkg-config)))
3342 (inputs
3343 `(("xz" ,xz)
3344 ("zlib" ,zlib)))
3345 (arguments
3346 `(#:configure-flags '("--with-xz" "--with-zlib"
3347 "--disable-test-modules")
3348 #:phases
3349 (modify-phases %standard-phases
3350 (add-after 'unpack 'disable-tests
3351 (lambda _
3352 ;; XXX: These tests need '--sysconfdir=/etc' to pass.
3353 (substitute* "Makefile.in"
3354 (("testsuite/test-modprobe") "")
3355 (("testsuite/test-depmod") "")
3356 (("testsuite/test-blacklist") ""))
3357 #t))
3358 (add-after 'install 'install-modprobe&co
3359 (lambda* (#:key outputs #:allow-other-keys)
3360 (let* ((out (assoc-ref outputs "out"))
3361 (bin (string-append out "/bin")))
3362 (for-each (lambda (tool)
3363 (symlink "kmod"
3364 (string-append bin "/" tool)))
3365 '("insmod" "rmmod" "lsmod" "modprobe"
3366 "modinfo" "depmod"))
3367 #t))))))
3368 (supported-systems (delete "i586-gnu" %supported-systems))
3369 (home-page "https://www.kernel.org/")
3370 (synopsis "Kernel module tools")
3371 (description "Kmod is a set of tools to handle common tasks with Linux
3372 kernel modules like insert, remove, list, check properties, resolve
3373 dependencies and aliases.
3374
3375 These tools are designed on top of libkmod, a library that is shipped with
3376 kmod. The aim is to be compatible with tools, configurations and indices
3377 from the module-init-tools project.")
3378 (license license:gpl2+))) ; library under lgpl2.1+
3379
3380 (define-public earlyoom
3381 (package
3382 (name "earlyoom")
3383 (version "1.6.2")
3384 (source (origin
3385 (method git-fetch)
3386 (uri (git-reference
3387 (url "https://github.com/rfjakob/earlyoom")
3388 (commit (string-append "v" version))))
3389 (file-name (git-file-name name version))
3390 (sha256
3391 (base32
3392 "16iyn51xlrsbshc7p5xl2338yyfzknaqc538sa7mamgccqwgyvvq"))))
3393 (build-system gnu-build-system)
3394 (arguments
3395 `(#:phases
3396 (modify-phases %standard-phases
3397 (delete 'configure) ; no configure script
3398 (add-before 'check 'set-go-HOME
3399 (lambda _
3400 (setenv "HOME" (getcwd))
3401 #t))
3402 (add-before 'check 'disable-failing-test
3403 (lambda _
3404 ;; This test relies on writing to /proc/%d/oom_score_adj.
3405 (substitute* "testsuite_cli_test.go"
3406 (("TestI" match)
3407 (string-append "skipped" match)))
3408 #t)))
3409 #:make-flags (let* ((prefix (assoc-ref %outputs "out")))
3410 (list ,(string-append "CC=" (cc-for-target))
3411 (string-append "VERSION=v" ,version)
3412 (string-append "PREFIX=" prefix)
3413 (string-append "SYSCONFDIR=" prefix "/etc")))
3414 #:test-target "test"))
3415 (native-inputs `(("go" ,go) ;for the test suite
3416 ("pandoc" ,pandoc))) ;to generate the manpage
3417 (home-page "https://github.com/rfjakob/earlyoom")
3418 (synopsis "Simple out of memory (OOM) daemon for the Linux kernel")
3419 (description "Early OOM is a minimalist out of memory (OOM) daemon that
3420 runs in user space and provides a more responsive and configurable alternative
3421 to the in-kernel OOM killer.")
3422 (license license:expat)))
3423
3424 (define-public eudev
3425 ;; The post-systemd fork, maintained by Gentoo.
3426 (package
3427 (name "eudev")
3428 (version "3.2.9")
3429 (source (origin
3430 (method git-fetch)
3431 (uri (git-reference (url "https://github.com/gentoo/eudev")
3432 (commit (string-append "v" version))))
3433 (file-name (git-file-name name version))
3434 (sha256
3435 (base32
3436 "1g9z3d33m0i3hmbhm0wxpvkzf6ac7xj1drwcfrhzlfhhi63sg9h7"))
3437 (patches (search-patches "eudev-rules-directory.patch"))))
3438 (build-system gnu-build-system)
3439 (arguments
3440 `(#:phases
3441 (modify-phases %standard-phases
3442 (add-after 'unpack 'make-source-writable
3443 (lambda _
3444 ;; XXX: Git checkouts are read-only, but this package needs to
3445 ;; modify some of its files.
3446 (for-each make-file-writable (find-files "."))
3447 #t))
3448 (add-before 'bootstrap 'patch-file-names
3449 (lambda* (#:key inputs native-inputs #:allow-other-keys)
3450 (substitute* "man/make.sh"
3451 (("/usr/bin/xsltproc")
3452 (string-append (assoc-ref
3453 (or native-inputs inputs) "xsltproc")
3454 "/bin/xsltproc")))
3455 #t))
3456 (add-before 'configure 'patch-bindir-in-btrfs-rules
3457 (lambda* (#:key outputs #:allow-other-keys)
3458 ;; The "@bindir@" substitution incorrectly expands to a literal
3459 ;; "${exec_prefix}" (see <https://bugs.gnu.org/39926>). Work
3460 ;; around it.
3461 (let ((out (assoc-ref outputs "out")))
3462 (substitute* "rules/64-btrfs.rules.in"
3463 (("@bindir@")
3464 (string-append out "/bin")))
3465 #t)))
3466 (add-after 'install 'move-static-library
3467 (lambda* (#:key outputs #:allow-other-keys)
3468 (let* ((out (assoc-ref outputs "out"))
3469 (static (assoc-ref outputs "static"))
3470 (source (string-append out "/lib/libudev.a"))
3471 (target (string-append static "/lib/libudev.a")))
3472 (mkdir-p (dirname target))
3473 (link source target)
3474 (delete-file source)
3475 ;; Remove reference to the static library from the .la file
3476 ;; such that Libtool looks for it in the usual places.
3477 (substitute* (string-append out "/lib/libudev.la")
3478 (("old_library=.*")
3479 "old_library=''\n"))
3480 #t)))
3481 (add-after 'install 'build-hwdb
3482 (lambda* (#:key outputs #:allow-other-keys)
3483 ;; Build OUT/etc/udev/hwdb.bin. This allows 'lsusb' and
3484 ;; similar tools to display product names.
3485 ;;
3486 ;; XXX: This can't be done when cross-compiling. Find another way
3487 ;; to generate hwdb.bin for cross-built systems.
3488 (let ((out (assoc-ref outputs "out")))
3489 ,@(if (%current-target-system)
3490 '(#t)
3491 '((invoke (string-append out "/bin/udevadm")
3492 "hwdb" "--update")))))))
3493 #:configure-flags (list "--enable-manpages")))
3494 (native-inputs
3495 `(("autoconf" ,autoconf)
3496 ("automake" ,automake)
3497 ("gperf" ,gperf)
3498 ("libtool" ,libtool)
3499 ("pkg-config" ,pkg-config)
3500 ;; For tests.
3501 ("perl" ,perl)
3502 ("python" ,python-wrapper)
3503 ;; For documentation.
3504 ("docbook-xml" ,docbook-xml-4.2)
3505 ("docbook-xsl" ,docbook-xsl)
3506 ("libxml2" ,libxml2) ;for $XML_CATALOG_FILES
3507 ("xsltproc" ,libxslt)))
3508 (inputs
3509 ;; When linked against libblkid, eudev can populate /dev/disk/by-label
3510 ;; and similar; it also installs the '60-persistent-storage.rules' file,
3511 ;; which contains the rules to do that.
3512 `(("util-linux" ,util-linux "lib") ;for blkid
3513 ("kmod" ,kmod)))
3514 (outputs '("out" "static"))
3515 (home-page "https://wiki.gentoo.org/wiki/Project:Eudev")
3516 (synopsis "Userspace device management")
3517 (description "Udev is a daemon which dynamically creates and removes
3518 device nodes from /dev/, handles hotplug events and loads drivers at boot
3519 time.")
3520 (license license:gpl2+)))
3521
3522 (define-public python-evdev
3523 (package
3524 (name "python-evdev")
3525 (version "1.3.0")
3526 (source
3527 (origin
3528 (method url-fetch)
3529 (uri (pypi-uri "evdev" version))
3530 (sha256
3531 (base32 "0kb3636yaw9l8xi8s184w0r0n9ic5dw3b8hx048jf9fpzss4kimi"))))
3532 (build-system python-build-system)
3533 (native-inputs
3534 `(("kernel-headers" ,linux-libre-headers)))
3535 (arguments
3536 `(#:tests? #f ;no rule for tests
3537 #:phases
3538 (modify-phases %standard-phases
3539 (add-before 'build 'fix-hard-coded-directory
3540 (lambda* (#:key inputs #:allow-other-keys)
3541 (substitute* "setup.py"
3542 (("/usr/include/linux")
3543 (string-append
3544 (assoc-ref inputs "kernel-headers") "/include/linux")))
3545 #t)))))
3546 (home-page "https://github.com/gvalkov/python-evdev")
3547 (synopsis "Bindings to the Linux input handling subsystem")
3548 (description
3549 "Python-evdev provides bindings to the generic input event interface in
3550 Linux. The @code{evdev} interface serves the purpose of passing events
3551 generated in the kernel directly to userspace through character devices that
3552 are typically located in @file{/dev/input/}.
3553
3554 This package also comes with bindings to @code{uinput}, the userspace input
3555 subsystem. @code{uinput} allows userspace programs to create and handle input
3556 devices that can inject events directly into the input subsystem.")
3557 (license license:bsd-3)))
3558
3559 (define-public interception-tools
3560 (package
3561 (name "interception-tools")
3562 (version "0.6.4")
3563 (home-page "https://gitlab.com/interception/linux/tools")
3564 (source (origin
3565 (method git-fetch)
3566 (uri (git-reference
3567 (url home-page)
3568 (commit (string-append "v" version))))
3569 (file-name (git-file-name name version))
3570 (sha256
3571 (base32
3572 "121jy40ynkbzlqnx7g0dqwvkb7dm2ahcy6vwrz6ylsyd0jmi6s5a"))))
3573 (build-system cmake-build-system)
3574 (inputs
3575 `(("boost" ,boost)
3576 ("libevdev" ,libevdev)
3577 ("libudev" ,eudev)
3578 ("yaml-cpp" ,yaml-cpp)))
3579 (arguments
3580 `(#:phases
3581 (modify-phases %standard-phases
3582 (add-after 'unpack 'fix-libevdev-path
3583 (lambda* (#:key inputs #:allow-other-keys)
3584 (let ((libevdev (assoc-ref inputs "libevdev")))
3585 (substitute* "CMakeLists.txt"
3586 (("/usr/include/libevdev-1.0")
3587 (string-append libevdev "/include/libevdev-1.0")))
3588 #t))))
3589 ;; No tests are included.
3590 #:tests? #f))
3591 (synopsis "Utilities for operating on input events of evdev devices")
3592 (description
3593 "Interception Tools provides a composable infrastructure on top of
3594 @code{libudev} and @code{libevdev}. The following utilities are provided:
3595
3596 @itemize
3597 @item @command{udevmon} --- monitor input devices for launching tasks
3598 @item @command{intercept} --- redirect device input events to stdout
3599 @item @command{uinput} --- redirect device input events from stding to virtual device
3600 @item @command{mux} --- mux streams of input events
3601 @end itemize")
3602 ;; Dual-licensed under GPLv3+ or "something else" on request, per
3603 ;; 'README.md'.
3604 (license license:gpl3+)))
3605
3606 (define-public interception-dual-function-keys
3607 (package
3608 (name "interception-dual-function-keys")
3609 (version "1.3.0")
3610 (home-page "https://gitlab.com/interception/linux/plugins/dual-function-keys")
3611 (source (origin
3612 (method git-fetch)
3613 (uri (git-reference
3614 (url home-page)
3615 (commit version)))
3616 (file-name (git-file-name name version))
3617 (sha256
3618 (base32
3619 "1gvhkmwzl5fyyc7k8rc4rf2b9mzh05wa8wcybf9hz2x1mqkc7lmz"))))
3620 (build-system gnu-build-system)
3621 (inputs
3622 `(("libevdev" ,libevdev)
3623 ("yaml-cpp" ,yaml-cpp)))
3624 (arguments
3625 `(#:make-flags (list "CC=gcc" "CXX=g++"
3626 (string-append "PREFIX=" (assoc-ref %outputs "out")))
3627 #:phases
3628 (modify-phases %standard-phases
3629 (add-after 'unpack 'fix-libevdev-path
3630 (lambda* (#:key inputs #:allow-other-keys)
3631 (let ((libevdev (assoc-ref inputs "libevdev")))
3632 (substitute* "config.mk"
3633 (("/usr/include/libevdev-1.0")
3634 (string-append libevdev "/include/libevdev-1.0")))
3635 #t)))
3636 ;; No configure script
3637 (delete 'configure)
3638 ;; No target 'check'
3639 (delete 'check))))
3640 (synopsis "Tap for one key, hold for another")
3641 (description
3642 "Dual Function Keys is a plugin for @code{interception-tools} that allows
3643 one to send arbitrary keycodes when a given key is tapped or held.")
3644 (license license:expat)))
3645
3646 (define-public lvm2
3647 (package
3648 (name "lvm2")
3649 (version "2.03.11")
3650 (source (origin
3651 (method url-fetch)
3652 (uri (list (string-append "https://sourceware.org/ftp/lvm2/LVM2."
3653 version ".tgz")
3654 (string-append "ftp://sources.redhat.com/pub/lvm2/releases/LVM2."
3655 version ".tgz")))
3656 (sha256
3657 (base32
3658 "1m4xpda8vbyd89ca0w8nacvnl4j34yzsa625gn990fb5sh84ab44"))
3659 (modules '((guix build utils)))
3660 (snippet
3661 '(begin
3662 (use-modules (guix build utils))
3663
3664 ;; Honor sysconfdir.
3665 (substitute* "make.tmpl.in"
3666 (("^confdir = .*$")
3667 "confdir = @sysconfdir@\n")
3668 (("DEFAULT_SYS_DIR = @DEFAULT_SYS_DIR@")
3669 "DEFAULT_SYS_DIR = @sysconfdir@"))
3670 #t))
3671 (patches (search-patches "lvm2-static-link.patch"))))
3672 (build-system gnu-build-system)
3673 (native-inputs
3674 `(("pkg-config" ,pkg-config)
3675 ("procps" ,procps))) ;tests use 'pgrep'
3676 (inputs
3677 `(("libaio" ,libaio)
3678 ("udev" ,eudev)))
3679 (arguments
3680 `(#:phases
3681 (modify-phases %standard-phases
3682 (add-after 'configure 'set-makefile-shell
3683 (lambda _
3684 ;; Use 'sh', not 'bash', so that '. lib/utils.sh' works as
3685 ;; expected.
3686 (setenv "SHELL" (which "sh"))
3687
3688 ;; Replace /bin/sh with the right file name.
3689 (patch-makefile-SHELL "make.tmpl")
3690 #t)))
3691
3692 #:configure-flags (list (string-append "--sysconfdir="
3693 (assoc-ref %outputs "out")
3694 "/etc/lvm")
3695 "--enable-udev_sync"
3696 "--enable-udev_rules"
3697 "--enable-pkgconfig"
3698 "--enable-cmdlib"
3699 "--enable-dmeventd" ; Requires '--enable-cmdlib'.
3700
3701 ;; Make sure programs such as 'dmsetup' can
3702 ;; find libdevmapper.so.
3703 (string-append "LDFLAGS=-Wl,-rpath="
3704 (assoc-ref %outputs "out")
3705 "/lib,-rpath="
3706 (assoc-ref %outputs "out")
3707 "/lib/device-mapper")
3708 ;; This is needed when cross-compiling.
3709 ,@(if (%current-target-system)
3710 '("ac_cv_func_malloc_0_nonnull=yes"
3711 "ac_cv_func_realloc_0_nonnull=yes")
3712 '()))
3713
3714 ;; The tests use 'mknod', which requires root access.
3715 #:tests? #f))
3716 (supported-systems (delete "i586-gnu" %supported-systems))
3717 (home-page "https://sourceware.org/lvm2/")
3718 (synopsis "Logical volume management for Linux")
3719 (description
3720 "LVM2 is the logical volume management tool set for Linux-based systems.
3721 This package includes the user-space libraries and tools, including the device
3722 mapper. Kernel components are part of Linux-libre.")
3723
3724 ;; Libraries (liblvm2, libdevmapper) are LGPLv2.1.
3725 ;; Command-line tools are GPLv2.
3726 (license (list license:gpl2 license:lgpl2.1))))
3727
3728 (define-public lvm2-static
3729 (package
3730 (inherit lvm2)
3731 (name "lvm2-static")
3732
3733 ;; Propagate udev because libdevmapper.a depends on libudev.
3734 (propagated-inputs `(("udev:static" ,eudev "static")))
3735
3736 (arguments
3737 (substitute-keyword-arguments (package-arguments lvm2)
3738 ((#:configure-flags flags '())
3739 ;; LVM2 doesn't use Libtool, hence the custom option.
3740 `(append '("--enable-static_link")
3741 ;; Building dmeventd statically is complicated due to a
3742 ;; requirement on libdevmapper.a, which is being phased out
3743 ;; in favor of libdevice-mapper.a, which in turn is is not
3744 ;; easily made available at dmeventd build time. Just ignore
3745 ;; it until the situation improves.
3746 (delete "--enable-dmeventd" ,flags)))
3747 ((#:phases phases)
3748 `(modify-phases ,phases
3749 (add-before 'configure 'adjust-Makefile
3750 (lambda _
3751 ;; These fixes are related to the upstream libdm->device_mapper
3752 ;; migration and will hopefully be fixed upstream in due time.
3753 (substitute* "tools/Makefile.in"
3754 ;; This variable is empty in a static configuration and causes
3755 ;; an erroneous GCC command line.
3756 (("-L\\$\\(interfacebuilddir\\)") "")
3757 ;; Remove obsolete reference to libdevmapper.a.
3758 (("-ldevmapper") ""))
3759 #t))))))
3760 (synopsis "Logical volume management for Linux (statically linked)")))
3761
3762 (define-public thin-provisioning-tools
3763 (package
3764 (name "thin-provisioning-tools")
3765 (version "0.8.5")
3766 (source
3767 (origin
3768 (method git-fetch)
3769 (uri (git-reference
3770 (url "https://github.com/jthornber/thin-provisioning-tools")
3771 (commit (string-append "v" version))))
3772 (file-name (git-file-name name version))
3773 (sha256
3774 (base32 "01wl8c0cjbx1smbhj8dx6av5bnw5775m58gasc3vqwvsj0s9hq19"))))
3775 (build-system gnu-build-system)
3776 (arguments
3777 ;; Doesn't build with --enable-testing due to a function name collision
3778 ;; with glibc. Fixed upstream. TODO: Enable tests when 0.9.0 is released.
3779 `(#:tests? #f))
3780 (native-inputs
3781 `(("automake" ,automake)
3782 ("autoreconf" ,autoconf)))
3783 (inputs
3784 `(("boost" ,boost)
3785 ("expat" ,expat)
3786 ("libaio" ,libaio)))
3787 (synopsis "Tools for manipulating the metadata of device-mapper targets")
3788 (description "A suite of tools for manipulating the metadata of the
3789 dm-thin, dm-cache and dm-era device-mapper targets.")
3790 (home-page "https://github.com/jthornber/thin-provisioning-tools")
3791 (license license:gpl3+)))
3792
3793 (define-public wireless-tools
3794 (package
3795 (name "wireless-tools")
3796 (version "30.pre9")
3797 (source (origin
3798 (method url-fetch)
3799 (uri (string-append "http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/wireless_tools."
3800 version ".tar.gz"))
3801 (sha256
3802 (base32
3803 "0qscyd44jmhs4k32ggp107hlym1pcyjzihiai48xs7xzib4wbndb"))
3804 (snippet
3805 '(begin
3806 ;; Remove the older header files that are not free software.
3807 (for-each (lambda (n)
3808 (delete-file (format #f "wireless.~a.h" n)))
3809 '(10 11 12 13 14 15 16 17 18 19 20))
3810 #t))))
3811 (build-system gnu-build-system)
3812 (arguments
3813 `(#:make-flags
3814 (list (string-append "PREFIX=" %output)
3815 (string-append "INSTALL_MAN=" %output "/share/man")
3816 (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib")
3817 "BUILD_STATIC=")
3818 #:phases
3819 (modify-phases %standard-phases
3820 (replace 'configure
3821 (lambda* (#:key target #:allow-other-keys)
3822 (when ,(%current-target-system)
3823 ;; Cross-compilation: use the cross tools.
3824 (substitute* (find-files "." "Makefile")
3825 (("CC = .*$")
3826 (string-append "CC = " target "-gcc\n"))
3827 (("AR = .*$")
3828 (string-append "AR = " target "-ar\n"))
3829 (("RANLIB = .*$")
3830 (string-append "RANLIB = " target "-ranlib\n"))))
3831 #t)))
3832 #:tests? #f))
3833 (synopsis "Tools for manipulating Linux Wireless Extensions")
3834 (description "Wireless Tools are used to manipulate the now-deprecated
3835 Linux Wireless Extensions; consider using @code{iw} instead. The Wireless
3836 Extension was an interface allowing you to set Wireless LAN specific
3837 parameters and get the specific stats. It is deprecated in favor the nl80211
3838 interface.")
3839 (home-page "https://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html")
3840 ;; wireless.21.h and wireless.22.h are distributed under lgpl2.1+, the
3841 ;; other files are distributed under gpl2.
3842 (license (list license:gpl2 license:lgpl2.1+))))
3843
3844 (define-public crda
3845 (package
3846 (name "crda")
3847 (version "3.18")
3848 (source (origin
3849 (method url-fetch)
3850 (uri (string-append "mirror://kernel.org/software/network/crda/"
3851 "crda-" version ".tar.xz"))
3852 (sha256
3853 (base32
3854 "1gydiqgb08d9gbx4l6gv98zg3pljc984m50hmn3ysxcbkxkvkz23"))
3855 (patches (search-patches "crda-optional-gcrypt.patch"))))
3856 (build-system gnu-build-system)
3857 (arguments
3858 `(#:phases (modify-phases %standard-phases
3859 (delete 'configure)
3860 (add-after 'unpack 'gzip-determinism
3861 (lambda _
3862 (substitute* "Makefile"
3863 (("gzip") "gzip --no-name"))
3864 #t))
3865 ,@(if (%current-target-system)
3866 '((add-after
3867 'unpack 'fix-pkg-config
3868 (lambda* (#:key target #:allow-other-keys)
3869 (substitute*
3870 "Makefile"
3871 (("pkg-config")
3872 (string-append target "-pkg-config")))
3873 #t)))
3874 '())
3875 (add-before
3876 'build 'no-werror-no-ldconfig
3877 (lambda _
3878 (substitute* "Makefile"
3879 (("-Werror") "")
3880 (("ldconfig") "true"))
3881 #t))
3882 (add-before
3883 'build 'set-regulator-db-file-name
3884 (lambda* (#:key native-inputs inputs #:allow-other-keys)
3885 ;; Tell CRDA where to find our database.
3886 (let ((regdb (assoc-ref (or native-inputs inputs)
3887 "wireless-regdb")))
3888 (substitute* "crda.c"
3889 (("\"/lib/crda/regulatory.bin\"")
3890 (string-append "\"" regdb
3891 "/lib/crda/regulatory.bin\"")))
3892 #t))))
3893 #:test-target "verify"
3894 #:make-flags (let ((out (assoc-ref %outputs "out"))
3895 (regdb (assoc-ref %build-inputs "wireless-regdb")))
3896 (list
3897 (string-append "CC=" ,(cc-for-target))
3898 "V=1"
3899
3900 ;; Disable signature-checking on 'regulatory.bin'.
3901 ;; The reason is that this simplifies maintenance
3902 ;; on our side (no need to manage a distro key
3903 ;; pair), and we can guarantee integrity of
3904 ;; 'regulatory.bin' by other means anyway, such as
3905 ;; 'guix gc --verify'. See
3906 ;; <https://wireless.wiki.kernel.org/en/developers/regulatory/wireless-regdb>
3907 ;; for a discssion.
3908 "USE_OPENSSL=0"
3909
3910 (string-append "PREFIX=" out)
3911 (string-append "SBINDIR=" out "/sbin/")
3912 (string-append "UDEV_RULE_DIR="
3913 out "/lib/udev/rules.d")
3914 (string-append "LDFLAGS=-Wl,-rpath="
3915 out "/lib -L.")
3916 (string-append "REG_BIN=" regdb
3917 "/lib/crda/regulatory.bin")
3918 "all_noverify"))))
3919 (native-inputs `(("pkg-config" ,pkg-config)
3920 ("wireless-regdb" ,wireless-regdb)))
3921 (inputs `(("libnl" ,libnl)))
3922 (home-page
3923 "https://wireless.wiki.kernel.org/en/developers/Regulatory/CRDA")
3924 (synopsis "Central regulatory domain agent (CRDA) for WiFi")
3925 (description
3926 "The Central Regulatory Domain Agent (CRDA) acts as the udev helper for
3927 communication between the kernel Linux and user space for regulatory
3928 compliance.")
3929 (license license:copyleft-next)))
3930
3931 (define-public wireless-regdb
3932 (package
3933 (name "wireless-regdb")
3934 (version "2020.11.20")
3935 (source (origin
3936 (method url-fetch)
3937 (uri (string-append
3938 "mirror://kernel.org/software/network/wireless-regdb/"
3939 "wireless-regdb-" version ".tar.xz"))
3940 (sha256
3941 (base32
3942 "0liagyi6ppf5w474qk9j4jz5gbvvn8mc8al1dq4b1xrgv28485ml"))
3943
3944 ;; We're building 'regulatory.bin' by ourselves.
3945 (snippet '(begin
3946 (delete-file "regulatory.bin")
3947 #t))))
3948 (build-system gnu-build-system)
3949 (arguments
3950 '(#:phases
3951 (modify-phases %standard-phases
3952 (add-after 'unpack 'gzip-determinism
3953 (lambda _
3954 (substitute* "Makefile"
3955 (("gzip") "gzip --no-name"))
3956 #t))
3957 (add-after 'unpack 'omit-signature
3958 (lambda _
3959 (substitute* "Makefile"
3960 ;; Signing requires a REGDB_PUBCERT and REGDB_PRIVKEY which we
3961 ;; don't provide (see below). Disable it.
3962 ((" regulatory\\.db\\.p7s") "")
3963 ;; regulatory.db is built as a dependency of regulatory.db.p7s,
3964 ;; but ‘make install’ depends only on the latter while installing
3965 ;; both (and failing). Depend on it explicitly.
3966 (("^install: " all) (string-append all "regulatory.db ")))
3967 #t))
3968 (delete 'configure)) ; no configure script
3969
3970 ;; The 'all' target of the makefile depends on $(REGDB_CHANGED), which
3971 ;; is computed and can be equal to 'maintainer-clean'; when that
3972 ;; happens, we can end up deleting the 'regulatory.bin' file that we
3973 ;; just built. Thus, build things sequentially.
3974 #:parallel-build? #f
3975
3976 #:tests? #f ; no tests
3977 #:make-flags
3978 (let ((out (assoc-ref %outputs "out")))
3979 (list (string-append "PREFIX=" out)
3980 (string-append "FIRMWARE_PATH=$(PREFIX)/lib/firmware")
3981
3982 ;; Leave this empty so that db2bin.py doesn't try to sign
3983 ;; ‘regulatory.bin’. This allows us to avoid managing a key
3984 ;; pair for the whole distribution.
3985 (string-append "REGDB_PRIVKEY=")
3986 ;; Don't generate a public key for the same reason. These are
3987 ;; used as Makefile targets and can't be the empty string.
3988 (string-append "REGDB_PUBCERT=/dev/null")
3989 (string-append "REGDB_PUBKEY=/dev/null")))))
3990 (native-inputs
3991 `(("python" ,python-wrapper)))
3992 (home-page
3993 "https://wireless.wiki.kernel.org/en/developers/regulatory/wireless-regdb")
3994 (synopsis "Wireless regulatory database")
3995 (description
3996 "This package contains the wireless regulatory database for the Central
3997 Regulatory Database Agent (CRDA). The database contains information on
3998 country-specific regulations for the wireless spectrum.")
3999 (license license:isc)))
4000
4001 (define-public lm-sensors
4002 (package
4003 (name "lm-sensors")
4004 (version "3.6.0")
4005 (source
4006 (origin
4007 (method git-fetch)
4008 (uri (git-reference
4009 (url "https://github.com/groeck/lm-sensors")
4010 (commit (string-append "V" (string-join
4011 (string-split version #\.) "-")))))
4012 (file-name (git-file-name name version))
4013 (sha256
4014 (base32 "1ipf6wjx037sqyhy0r5jh4983h216anq9l68ckn2x5c3qc4wfmzn"))
4015 (patches (search-patches "lm-sensors-hwmon-attrs.patch"))))
4016 (build-system gnu-build-system)
4017 (inputs `(("rrdtool" ,rrdtool)
4018 ("perl" ,perl)
4019 ("kmod" ,kmod)
4020 ("gnuplot" ,gnuplot)))
4021 (native-inputs `(("pkg-config" ,pkg-config)
4022 ("flex" ,flex)
4023 ("bison" ,bison)
4024 ("which" ,which)))
4025 (outputs '("lib" ; avoid perl in closure
4026 "out"))
4027 (arguments
4028 `(#:tests? #f ; no 'check' target
4029 #:make-flags (list (string-append "PREFIX=" %output)
4030 (string-append "ETCDIR=" (assoc-ref %outputs "lib") "/etc")
4031 (string-append "INCLUDEDIR="
4032 (assoc-ref %outputs "lib") "/include")
4033 (string-append "MANDIR=" %output "/share/man")
4034 (string-append "LIBDIR=" (assoc-ref %outputs "lib") "/lib"))
4035 #:phases
4036 (modify-phases %standard-phases
4037 (delete 'configure)
4038 (add-before 'build 'patch-exec-paths
4039 (lambda* (#:key inputs outputs #:allow-other-keys)
4040 (substitute* "prog/detect/sensors-detect"
4041 (("`uname")
4042 (string-append "`" (assoc-ref inputs "coreutils")
4043 "/bin/uname"))
4044 (("(`|\")modprobe" all open-quote)
4045 (string-append open-quote
4046 (assoc-ref inputs "kmod")
4047 "/bin/modprobe")))
4048 (substitute* '("prog/pwm/pwmconfig"
4049 "prog/pwm/fancontrol")
4050 (("gnuplot")
4051 (string-append (assoc-ref inputs "gnuplot")
4052 "/bin/gnuplot"))
4053 (("cat ")
4054 (string-append (assoc-ref inputs "coreutils")
4055 "/bin/cat "))
4056 (("e?grep " match)
4057 (string-append (assoc-ref inputs "grep")
4058 "/bin/" match))
4059 (("sed -e")
4060 (string-append (assoc-ref inputs "sed")
4061 "/bin/sed -e"))
4062 (("cut -d")
4063 (string-append (assoc-ref inputs "coreutils")
4064 "/bin/cut -d"))
4065 (("sleep ")
4066 (string-append (assoc-ref inputs "coreutils")
4067 "/bin/sleep "))
4068 (("readlink -f")
4069 (string-append (assoc-ref inputs "coreutils")
4070 "/bin/readlink -f")))
4071 #t)))))
4072 (home-page "https://hwmon.wiki.kernel.org/lm_sensors")
4073 (synopsis "Utilities to read temperature/voltage/fan sensors")
4074 (description
4075 "Lm-sensors is a hardware health monitoring package for Linux. It allows
4076 you to access information from temperature, voltage, and fan speed sensors.
4077 It works with most newer systems.")
4078 (license license:gpl2+)))
4079
4080 (define-public iucode-tool
4081 (package
4082 (name "iucode-tool")
4083 (version "2.3.1")
4084 (source (origin
4085 (method url-fetch)
4086 (uri (string-append "https://gitlab.com/iucode-tool/releases"
4087 "/raw/latest/iucode-tool_" version ".tar.xz"))
4088 (sha256
4089 (base32
4090 "159gvf6ljgg3g4vlhyy6pyr0wz11rcyhp985vc4az58d9px8xf0j"))))
4091 (build-system gnu-build-system)
4092 (home-page "https://gitlab.com/iucode-tool/iucode-tool/wikis/home")
4093 (synopsis "Manipulate Intel microcode bundles")
4094 (description
4095 "@command{iucode_tool} is a utility to work with microcode packages for
4096 Intel processors. It can convert between formats, extract specific versions,
4097 create a firmware image suitable for the Linux kernel, and more.")
4098 ;; cpuid.h is available for i686, x86_64, and ia64.
4099 (supported-systems '("i686-linux" "x86_64-linux"))
4100 (license license:gpl2+)))
4101
4102 (define-public i2c-tools
4103 (package
4104 (name "i2c-tools")
4105 (version "3.1.1")
4106 (source (origin
4107 (method url-fetch)
4108 (uri (string-append
4109 "http://jdelvare.nerim.net/mirror/i2c-tools/i2c-tools-"
4110 version ".tar.bz2"))
4111 (sha256
4112 (base32
4113 "000pvg995qy1b15ks59gd0klri55hb33kqpg5czy84hw1pbdgm0l"))))
4114 (build-system gnu-build-system)
4115 (arguments
4116 `(#:tests? #f ; no 'check' target
4117 #:make-flags (list (string-append "prefix=" %output)
4118 ,(string-append "CC=" (cc-for-target)))
4119 ;; No configure script.
4120 #:phases (modify-phases %standard-phases (delete 'configure))))
4121 (inputs
4122 `(("perl" ,perl)))
4123 (home-page "http://jdelvare.nerim.net/devel.html#i2ctools")
4124 (synopsis "I2C tools for Linux")
4125 (description
4126 "The i2c-tools package contains a heterogeneous set of I2C tools for
4127 Linux: a bus probing tool, a chip dumper, register-level SMBus access helpers,
4128 EEPROM decoding scripts, EEPROM programming tools, and a python module for
4129 SMBus access.")
4130 (license license:gpl2+)))
4131
4132 (define-public xsensors
4133 (package
4134 (name "xsensors")
4135 (version "0.70")
4136 (source (origin
4137 (method url-fetch)
4138 (uri (string-append
4139 "http://www.linuxhardware.org/xsensors/xsensors-"
4140 version ".tar.gz"))
4141 (sha256
4142 (base32
4143 "1siplsfgvcxamyqf44h71jx6jdfmvhfm7mh0y1q8ps4zs6pj2zwh"))))
4144 (build-system gnu-build-system)
4145 (inputs `(("lm-sensors" ,lm-sensors "lib")
4146 ("gtk" ,gtk+-2)))
4147 (native-inputs `(("pkg-config" ,pkg-config)))
4148 (arguments
4149 `(#:phases
4150 (modify-phases %standard-phases
4151 (add-before 'configure 'enable-deprecated
4152 (lambda _
4153 (substitute* "src/Makefile.in"
4154 (("-DGDK_DISABLE_DEPRECATED") "")
4155 (("-DGTK_DISABLE_DEPRECATED") ""))
4156 #t))
4157 (add-before 'configure 'remove-Werror
4158 (lambda _
4159 (substitute* '("configure" "src/Makefile.in")
4160 (("-Werror") ""))
4161 #t)))))
4162 (home-page "http://www.linuxhardware.org/xsensors/")
4163 (synopsis "Hardware health information viewer")
4164 (description
4165 "Xsensors reads data from the libsensors library regarding hardware
4166 health such as temperature, voltage and fan speed and displays the information
4167 in a digital read-out.")
4168 (license license:gpl2+)))
4169
4170 (define-public perf
4171 (package
4172 (name "perf")
4173 (version (package-version linux-libre))
4174 (source (package-source linux-libre))
4175 (build-system gnu-build-system)
4176 (arguments
4177 '(#:phases
4178 (modify-phases %standard-phases
4179 (replace 'configure
4180 (lambda* (#:key inputs #:allow-other-keys)
4181 (setenv "SHELL_PATH" (which "bash"))
4182 (chdir "tools/perf")
4183 #t)))
4184 #:make-flags (list (string-append "prefix="
4185 (assoc-ref %outputs "out"))
4186 "CC=gcc"
4187 "WERROR=0"
4188
4189 ;; By default, 'config/Makefile' uses lib64 on
4190 ;; x86_64. Work around that.
4191 "lib=lib")
4192 #:tests? #f)) ;no tests
4193 (native-inputs
4194 `(("pkg-config" ,pkg-config)
4195 ("bison" ,bison)
4196 ("flex" ,flex)
4197
4198 ;; There are build scripts written in these languages.
4199 ("perl" ,perl)
4200 ("python2" ,python-2)
4201 ("python3" ,python-3)))
4202 (inputs
4203 `(("slang" ,slang) ;for the interactive TUI
4204 ;; ("newt" ,newt)
4205 ("python" ,python-2) ;'perf' links against libpython
4206 ("elfutils" ,elfutils)
4207 ("libiberty" ,libiberty) ;used alongside BDF for symbol demangling
4208 ("libunwind" ,libunwind) ;better stack walking
4209 ("numactl" ,numactl) ;for 'perf bench numa mem'
4210
4211 ;; Documentation.
4212 ("libxml2" ,libxml2) ;for $XML_CATALOG_FILES
4213 ("docbook-xsl" ,docbook-xsl)
4214 ("xmlto" ,xmlto)
4215 ("asciidoc" ,asciidoc)))
4216 (home-page "https://perf.wiki.kernel.org/")
4217 (synopsis "Linux profiling with performance counters")
4218 (description
4219 "perf is a tool suite for profiling using hardware performance counters,
4220 with support in the Linux kernel. perf can instrument CPU performance
4221 counters, tracepoints, kprobes, and uprobes (dynamic tracing). It is capable
4222 of lightweight profiling. This package contains the user-land tools and in
4223 particular the @code{perf} command.")
4224 (license (package-license linux-libre))))
4225
4226 (define-public pflask
4227 (package
4228 (name "pflask")
4229 (version "0.2")
4230 (source (origin
4231 (method git-fetch)
4232 (uri (git-reference
4233 (url "https://github.com/ghedo/pflask")
4234 (commit (string-append "v" version))))
4235 (file-name (git-file-name name version))
4236 (sha256
4237 (base32
4238 "1jikjbhlxlqracnai3v9krzcgd2xwp0p4adw5n07yxc7b857damz"))))
4239 (build-system cmake-build-system)
4240 (arguments
4241 '(#:tests? #f)) ; no tests
4242 (home-page "https://ghedo.github.io/pflask/")
4243 (synopsis "Simple tool for creating Linux namespace containers")
4244 (description "pflask is a simple tool for creating Linux namespace
4245 containers. It can be used for running a command or even booting an OS inside
4246 an isolated container, created with the help of Linux namespaces. It is
4247 similar in functionality to chroot, although pflask provides better isolation
4248 thanks to the use of namespaces.")
4249 (license license:bsd-2)))
4250
4251 (define-public singularity
4252 (package
4253 (name "singularity")
4254 (version "2.6.1")
4255 (source (origin
4256 (method url-fetch)
4257 (uri (string-append "https://github.com/singularityware/singularity/"
4258 "releases/download/" version
4259 "/singularity-" version ".tar.gz"))
4260 (sha256
4261 (base32
4262 "1whx0hqqi1326scgdxxxa1d94vn95mnq0drid6s8wdp84ni4d3gk"))
4263 (modules '((guix build utils)))
4264 (snippet
4265 '(begin
4266 ;; Do not create directories in /var.
4267 (substitute* "Makefile.in"
4268 (("\\$\\(MAKE\\) .*install-data-hook") ""))
4269
4270 ;; The original source overrides PATH so that it points to
4271 ;; /bin, /usr/local/bin, etc., which obviously doesn't work
4272 ;; on Guix System. Leave PATH unchanged so we refer to the
4273 ;; installed Coreutils, grep, etc.
4274 (substitute* "bin/singularity.in"
4275 (("^PATH=.*" all)
4276 (string-append "#" all "\n")))
4277
4278 (substitute* (find-files "libexec/cli" "\\.exec$")
4279 (("\\$SINGULARITY_libexecdir/singularity/bin/([a-z]+)-suid"
4280 _ program)
4281 (string-append "/run/setuid-programs/singularity-"
4282 program "-helper")))
4283
4284 ;; These squashfs mount options are apparently no longer
4285 ;; supported since Linux-libre 5.4.5.
4286 (substitute* "src/lib/image/squashfs/mount.c"
4287 (("\"errors=remount-ro\"")
4288 "NULL"))
4289 #t))))
4290 (build-system gnu-build-system)
4291 (arguments
4292 `(#:configure-flags '("--localstatedir=/var")
4293 #:phases
4294 (modify-phases %standard-phases
4295 (add-after 'unpack 'patch-references
4296 (lambda _
4297 (substitute* "libexec/cli/build.exec.in"
4298 (("-mksquashfs") (string-append "-" (which "mksquashfs"))))
4299 (substitute* (append
4300 (find-files "libexec" "functions")
4301 (find-files "libexec/bootstrap-scripts" ".*sh$")
4302 (find-files "libexec/cli" ".*exec$"))
4303 (("\\| grep ")
4304 (string-append "| " (which "grep") " "))
4305 (("egrep ")
4306 (string-append (which "egrep") " "))
4307 ((" sed ")
4308 (string-append " " (which "sed") " ")))
4309 #t))
4310 (add-after 'install 'set-PATH
4311 (lambda* (#:key inputs outputs #:allow-other-keys)
4312 ;; Have the 'singularity' and 'run-singularity' self-sufficient.
4313 (let ((out (assoc-ref outputs "out"))
4314 (coreutils (assoc-ref inputs "coreutils")))
4315 (wrap-program (string-append out "/bin/singularity")
4316 `("PATH" ":" = (,(string-append coreutils "/bin"))))
4317 (substitute* (string-append out "/bin/run-singularity")
4318 (("/usr/bin/env singularity")
4319 (string-append (which "env") " "
4320 out "/bin/singularity")))
4321 #t))))))
4322 (inputs
4323 `(("libarchive" ,libarchive)
4324 ("python" ,python-wrapper)
4325 ("zlib" ,zlib)
4326 ("squashfs-tools" ,squashfs-tools)))
4327 (home-page "https://singularity.lbl.gov/")
4328 (synopsis "Container platform")
4329 (description "Singularity is a container platform supporting a number of
4330 container image formats. It can build SquashFS container images or import
4331 existing Docker images. Singularity requires kernel support for container
4332 isolation or root privileges.")
4333 (license license:bsd-3)))
4334
4335 (define-public hdparm
4336 (package
4337 (name "hdparm")
4338 (version "9.62")
4339 (source (origin
4340 (method url-fetch)
4341 (uri (string-append "mirror://sourceforge/hdparm/hdparm/"
4342 "hdparm-" version ".tar.gz"))
4343 (sha256
4344 (base32
4345 "0zvppv8qw0y1shlhn34iq1g4883i1cywsa514n595nmyrmsrs3rc"))))
4346 (build-system gnu-build-system)
4347 (arguments
4348 `(#:make-flags
4349 (let ((out (assoc-ref %outputs "out")))
4350 (list (string-append "binprefix=" out)
4351 (string-append "manprefix=" out)
4352 ,(string-append "CC=" (cc-for-target))
4353 ;; Let Guix strip the binaries and not break cross-compilation.
4354 "STRIP=true"))
4355 #:phases
4356 (modify-phases %standard-phases
4357 (delete 'configure)) ; no configure script
4358 #:tests? #f)) ; no test suite
4359 (home-page "https://sourceforge.net/projects/hdparm/")
4360 (synopsis "View and tune ATA disk drive parameters")
4361 (description
4362 "@command{hdparm} is a command-line utility to control ATA controllers and
4363 disk drives. It can increase performance and/or reliability by careful tuning
4364 of hardware settings like power and acoustic management, DMA modes, and caching.
4365 It can also display detailed device information, or be used as a simple
4366 performance benchmarking tool.
4367
4368 @command{hdparm} provides a command line interface to various Linux kernel
4369 interfaces provided by the SATA/ATA/SAS @code{libata} subsystem, and the older
4370 IDE driver subsystem. Many external USB drive enclosures with SCSI-ATA Command
4371 Translation (@dfn{SAT}) are also supported.")
4372 (license (license:non-copyleft "file://LICENSE.TXT"))))
4373
4374 (define-public nvme-cli
4375 (package
4376 (name "nvme-cli")
4377 (version "1.14")
4378 (home-page "https://github.com/linux-nvme/nvme-cli")
4379 (source (origin
4380 (method git-fetch)
4381 (uri (git-reference
4382 (url home-page)
4383 (commit (string-append "v" version))))
4384 (sha256
4385 (base32 "0dpadz945482srqpsbfx1bh7rc499fgpyzz1flhk9g9xjbpapkzc"))
4386 (file-name (git-file-name name version))))
4387 (build-system gnu-build-system)
4388 (arguments
4389 `(#:make-flags
4390 (list ,(string-append "CC=" (cc-for-target)))
4391 #:phases (modify-phases %standard-phases
4392 (delete 'configure) ; no ./configure script
4393 (replace 'install
4394 (lambda _
4395 (invoke "make" "install-spec" "PREFIX="
4396 (string-append "DESTDIR=" %output)))))
4397 ;; The tests require sysfs, which is not accessible from from the build
4398 ;; environment
4399 #:tests? #f))
4400 (synopsis "NVM-Express user space tooling for Linux")
4401 (description "Nvme-cli is a utility to provide standards compliant tooling
4402 for NVM-Express drives. It was made specifically for Linux as it relies on the
4403 IOCTLs defined by the mainline kernel driver.")
4404 (license license:gpl2+)))
4405
4406 (define-public rfkill
4407 (package
4408 (name "rfkill")
4409 (version "0.5")
4410 (source (origin
4411 (method url-fetch)
4412 (uri (string-append "mirror://kernel.org/software/network/"
4413 name "/" name "-" version ".tar.xz"))
4414 (sha256
4415 (base32
4416 "0snqj5h0y991lszbigbyyqb8swj0hxajc1vfqg2scfay44231bp0"))))
4417 (build-system gnu-build-system)
4418 (arguments
4419 `(#:make-flags (list "CC=gcc"
4420 (string-append "PREFIX=" %output))
4421 #:phases (modify-phases %standard-phases
4422 (delete 'configure))
4423 #:tests? #f))
4424 (home-page "https://wireless.wiki.kernel.org/en/users/Documentation/rfkill")
4425 (synopsis "Tool for enabling and disabling wireless devices")
4426 (description
4427 "rfkill is a simple tool for accessing the rfkill device interface,
4428 which is used to enable and disable wireless networking devices, typically
4429 WLAN, Bluetooth and mobile broadband.")
4430 (license (license:non-copyleft "file://COPYING"
4431 "See COPYING in the distribution."))
4432 ;; rfkill is part of util-linux as of 2.31.
4433 (properties `((superseded . ,util-linux)))))
4434
4435 (define-public acpi
4436 (package
4437 (name "acpi")
4438 (version "1.7")
4439 (source (origin
4440 (method url-fetch)
4441 (uri (string-append "mirror://sourceforge/acpiclient/acpiclient/"
4442 version "/" name "-" version ".tar.gz"))
4443 (sha256
4444 (base32
4445 "01ahldvf0gc29dmbd5zi4rrnrw2i1ajnf30sx2vyaski3jv099fp"))))
4446 (build-system gnu-build-system)
4447 (home-page "http://acpiclient.sourceforge.net")
4448 (synopsis "Display information on ACPI devices")
4449 (description "@code{acpi} attempts to replicate the functionality of the
4450 \"old\" @code{apm} command on ACPI systems, including battery and thermal
4451 information. It does not support ACPI suspending, only displays information
4452 about ACPI devices.")
4453 (license license:gpl2+)))
4454
4455 (define-public acpid
4456 (package
4457 (name "acpid")
4458 (version "2.0.32")
4459 (source (origin
4460 (method url-fetch)
4461 (uri (string-append "mirror://sourceforge/acpid2/acpid-"
4462 version ".tar.xz"))
4463 (sha256
4464 (base32
4465 "0zhmxnhnhg4v1viw82yjr22kram6k5k1ixznhayk8cnw7q5x7lpj"))))
4466 (build-system gnu-build-system)
4467 (home-page "https://sourceforge.net/projects/acpid2/")
4468 (synopsis "Daemon for delivering ACPI events to user-space programs")
4469 (description
4470 "acpid is designed to notify user-space programs of Advanced
4471 Configuration and Power Interface (ACPI) events. acpid should be started
4472 during the system boot, and will run as a background process. When an ACPI
4473 event is received from the kernel, acpid will examine the list of rules
4474 specified in /etc/acpi/events and execute the rules that match the event.")
4475 (license license:gpl2+)))
4476
4477 (define-public sysfsutils
4478 (package
4479 (name "sysfsutils")
4480 (version "2.1.0")
4481 (source
4482 (origin
4483 (method url-fetch)
4484 (uri
4485 (string-append
4486 "mirror://sourceforge/linux-diag/sysfsutils/" version "/sysfsutils-"
4487 version ".tar.gz"))
4488 (sha256
4489 (base32 "12i0ip11xbfcjzxz4r10cvz7mbzgq1hfcdn97w6zz7sm3wndwrg8"))))
4490 (build-system gnu-build-system)
4491 (home-page "http://linux-diag.sourceforge.net/Sysfsutils.html")
4492 (synopsis "System utilities based on Linux sysfs")
4493 (description
4494 "These are a set of utilities built upon sysfs, a virtual file system in
4495 Linux kernel versions 2.5+ that exposes a system's device tree. The package
4496 also contains the libsysfs library.")
4497 ;; The library is under lgpl2.1+ (all files say "or any later version").
4498 ;; The rest is mostly gpl2, with a few files indicating gpl2+.
4499 (license (list license:gpl2 license:gpl2+ license:lgpl2.1+))))
4500
4501 (define-public sysfsutils-1
4502 (package
4503 (inherit sysfsutils)
4504 (version "1.3.0")
4505 (source
4506 (origin
4507 (method url-fetch)
4508 (uri
4509 (string-append
4510 "mirror://sourceforge/linux-diag/sysfsutils/sysfsutils-" version
4511 "/sysfsutils-" version ".tar.gz"))
4512 (sha256
4513 (base32 "0kdhs07fm8263pxwd5blwn2x211cg4fk63fyf9ijcdkvzmwxrqq3"))
4514 (modules '((guix build utils)))
4515 (snippet
4516 '(begin
4517 (substitute* "Makefile.in"
4518 (("includedir = /usr/include/sysfs")
4519 "includedir = @includedir@"))
4520 (substitute* "configure"
4521 (("includedir='(\\$\\{prefix\\}/include)'" all orig)
4522 (string-append "includedir='" orig "/sysfs'")))
4523 #t))))
4524 (synopsis "System utilities based on Linux sysfs (version 1.x)")))
4525
4526 (define-public cpufrequtils
4527 (package
4528 (name "cpufrequtils")
4529 (version "0.3")
4530 (source
4531 (origin
4532 (method url-fetch)
4533 (uri (string-append "mirror://kernel.org/linux/utils/kernel/cpufreq/"
4534 "cpufrequtils-" version ".tar.gz"))
4535 (sha256
4536 (base32 "0qfqv7nqmjfr3p0bwrdlxkiqwqr7vmx053cadaa548ybqbghxmvm"))
4537 (patches (search-patches "cpufrequtils-fix-aclocal.patch"))))
4538 (build-system gnu-build-system)
4539 (native-inputs
4540 `(("sysfsutils" ,sysfsutils-1)))
4541 (arguments
4542 '(#:make-flags (list (string-append "LDFLAGS=-Wl,-rpath="
4543 (assoc-ref %outputs "out") "/lib"))))
4544 (home-page "https://www.kernel.org/pub/linux/utils/kernel/cpufreq/")
4545 (synopsis "Utilities to get and set CPU frequency on Linux")
4546 (description
4547 "The cpufrequtils suite contains utilities to retrieve CPU frequency
4548 information, and set the CPU frequency if supported, using the cpufreq
4549 capabilities of the Linux kernel.")
4550 (license license:gpl2)))
4551
4552 (define-public libraw1394
4553 (package
4554 (name "libraw1394")
4555 (version "2.1.2")
4556 (source (origin
4557 (method url-fetch)
4558 (uri (string-append
4559 "mirror://kernel.org/linux/libs/ieee1394/"
4560 name "-" version ".tar.xz"))
4561 (sha256
4562 (base32
4563 "0pm5b415j1qdzyw38wdv8h7ff4yx20831z1727mpsb6jc6bwdk03"))))
4564 (build-system gnu-build-system)
4565 (home-page "https://ieee1394.wiki.kernel.org/index.php/Main_Page")
4566 (synopsis "Interface library for the Linux IEEE1394 drivers")
4567 (description
4568 "Libraw1394 is the only supported interface to the kernel side raw1394 of
4569 the Linux IEEE-1394 subsystem, which provides direct access to the connected
4570 1394 buses to user space. Through libraw1394/raw1394, applications can directly
4571 send to and receive from other nodes without requiring a kernel driver for the
4572 protocol in question.")
4573 (license license:lgpl2.1+)))
4574
4575 (define-public libavc1394
4576 (package
4577 (name "libavc1394")
4578 (version "0.5.4")
4579 (source (origin
4580 (method url-fetch)
4581 (uri (string-append "mirror://sourceforge/libavc1394/libavc1394/"
4582 name "-" version ".tar.gz"))
4583 (sha256
4584 (base32
4585 "0lsv46jdqvdx5hx92v0z2cz3yh6212pz9gk0k3513sbaa04zzcbw"))))
4586 (build-system gnu-build-system)
4587 (native-inputs
4588 `(("pkg-config" ,pkg-config)))
4589 (propagated-inputs
4590 `(("libraw1394" ,libraw1394))) ; required by libavc1394.pc
4591 (home-page "https://sourceforge.net/projects/libavc1394/")
4592 (synopsis "AV/C protocol library for IEEE 1394")
4593 (description
4594 "Libavc1394 is a programming interface to the AV/C specification from
4595 the 1394 Trade Association. AV/C stands for Audio/Video Control.")
4596 (license license:lgpl2.1+)))
4597
4598 (define-public libiec61883
4599 (package
4600 (name "libiec61883")
4601 (version "1.2.0")
4602 (source (origin
4603 (method url-fetch)
4604 (uri (string-append
4605 "mirror://kernel.org/linux/libs/ieee1394/"
4606 name "-" version ".tar.xz"))
4607 (sha256
4608 (base32
4609 "17ph458zya2l8dr2xwqnzy195qd9swrir31g78qkgb3g4xz2rq6i"))))
4610 (build-system gnu-build-system)
4611 (native-inputs
4612 `(("pkg-config" ,pkg-config)))
4613 (propagated-inputs
4614 `(("libraw1394" ,libraw1394))) ; required by libiec61883.pc
4615 (home-page "https://ieee1394.wiki.kernel.org/index.php/Main_Page")
4616 (synopsis "Isochronous streaming media library for IEEE 1394")
4617 (description
4618 "The libiec61883 library provides a higher level API for streaming DV,
4619 MPEG-2 and audio over Linux IEEE 1394.")
4620 (license license:lgpl2.1+)))
4621
4622 (define-public mdadm
4623 (package
4624 (name "mdadm")
4625 (version "4.1")
4626 (source (origin
4627 (method url-fetch)
4628 (uri (string-append
4629 "mirror://kernel.org/linux/utils/raid/mdadm/mdadm-"
4630 version ".tar.xz"))
4631 (sha256
4632 (base32
4633 "0jjgjgqijpdp7ijh8slzzjjw690kydb1jjadf0x5ilq85628hxmb"))))
4634 (build-system gnu-build-system)
4635 (inputs
4636 `(("udev" ,eudev)))
4637 (arguments
4638 `(#:make-flags (let ((out (assoc-ref %outputs "out")))
4639 (list ,(string-append "CC=" (cc-for-target))
4640 "INSTALL=install"
4641 "CHECK_RUN_DIR=0"
4642 ;; TODO: tell it where to find 'sendmail'
4643 ;; (string-append "MAILCMD=" <???> "/sbin/sendmail")
4644 (string-append "BINDIR=" out "/sbin")
4645 (string-append "MANDIR=" out "/share/man")
4646 (string-append "UDEVDIR=" out "/lib/udev")))
4647 #:phases
4648 (modify-phases %standard-phases
4649 (add-before 'build 'patch-program-paths
4650 (lambda* (#:key native-inputs inputs #:allow-other-keys)
4651 (let ((coreutils (assoc-ref (or native-inputs inputs)
4652 "coreutils")))
4653 (substitute* "udev-md-raid-arrays.rules"
4654 (("/usr/bin/(readlink|basename)" all program)
4655 (string-append coreutils "/bin/" program))))
4656 #t))
4657 (add-before 'build 'remove-W-error
4658 (lambda _
4659 ;; We cannot build with -Werror on i686 due to a
4660 ;; 'sign-compare' warning in util.c.
4661 (substitute* "Makefile"
4662 (("-Werror") ""))
4663 #t))
4664 (delete 'configure))
4665 ;;tests must be done as root
4666 #:tests? #f))
4667 (supported-systems (delete "i586-gnu" %supported-systems))
4668 (home-page "http://neil.brown.name/blog/mdadm")
4669 (synopsis "Tool for managing Linux Software RAID arrays")
4670 (description
4671 "mdadm is a tool for managing Linux Software RAID arrays. It can create,
4672 assemble, report on, and monitor arrays. It can also move spares between raid
4673 arrays when needed.")
4674 (license license:gpl2+)))
4675
4676 (define-public mdadm-static
4677 (package
4678 (inherit mdadm)
4679 (name "mdadm-static")
4680 (arguments
4681 (substitute-keyword-arguments (package-arguments mdadm)
4682 ((#:make-flags flags)
4683 `(cons "LDFLAGS = -static" ,flags))
4684 ((#:phases phases)
4685 `(modify-phases ,phases
4686 (add-after 'install 'remove-cruft
4687 (lambda* (#:key outputs #:allow-other-keys)
4688 (let* ((out (assoc-ref outputs "out"))
4689 (precious? (lambda (file)
4690 (member file '("." ".." "sbin"))))
4691 (directories (scandir out (negate precious?))))
4692 (with-directory-excursion out
4693 (for-each delete-file-recursively directories)
4694 (remove-store-references "sbin/mdadm")
4695 (delete-file "sbin/mdmon")
4696 #t))))))
4697 ((#:modules modules %gnu-build-system-modules)
4698 `((ice-9 ftw) ,@modules))
4699 ((#:strip-flags _ '())
4700 ''("--strip-all")) ;strip a few extra KiB
4701 ((#:allowed-references _ '("out"))
4702 '("out")))) ;refer only self
4703 (synopsis "Statically-linked 'mdadm' command for use in an initrd")))
4704
4705 (define-public multipath-tools
4706 (package
4707 (name "multipath-tools")
4708 (version "0.8.5")
4709 (source (origin
4710 (method git-fetch)
4711 (uri (git-reference
4712 (url "https://git.opensvc.com/multipath-tools/.git")
4713 (commit version)))
4714 (file-name (git-file-name name version))
4715 (sha256
4716 (base32
4717 "0gipg0z79h76j0f449cx4wcrfsv69ravjlpphsac11h302g3nrvg"))
4718 (modules '((guix build utils)))
4719 (snippet
4720 '(begin
4721 ;; Drop bundled valgrind headers.
4722 (delete-file-recursively "third-party")
4723 (substitute* '("multipathd/main.c"
4724 "libmultipath/debug.c")
4725 (("#include \"../third-party/")
4726 "#include \""))
4727 #t))))
4728 (build-system gnu-build-system)
4729 (arguments
4730 '(#:test-target "test"
4731 #:parallel-build? #f ;XXX: broken in 0.8.4
4732 #:make-flags (list "CC=gcc"
4733 (string-append "DESTDIR="
4734 (assoc-ref %outputs "out"))
4735 ;; Install Udev rules below this directory, relative
4736 ;; to the prefix.
4737 "SYSTEMDPATH=lib"
4738 (string-append "LDFLAGS=-Wl,-rpath="
4739 (assoc-ref %outputs "out")
4740 "/lib"))
4741 #:phases
4742 (modify-phases %standard-phases
4743 (add-after 'unpack 'patch-source
4744 (lambda* (#:key inputs #:allow-other-keys)
4745 (let ((lvm2 (assoc-ref inputs "lvm2"))
4746 (udev (assoc-ref inputs "udev")))
4747 (substitute* "Makefile.inc"
4748 (("\\$\\(prefix\\)/usr") "$(prefix)")
4749 ;; Do not save timestamp to avoid gzip "timestamp
4750 ;; out-of-range" warnings.
4751 (("gzip -9") "gzip -9n"))
4752 (substitute* '("kpartx/Makefile" "libmultipath/Makefile")
4753 (("/usr/include/libdevmapper.h")
4754 (string-append lvm2 "/include/libdevmapper.h"))
4755 (("/usr/include/libudev.h")
4756 (string-append udev "/include/libudev.h")))
4757 #t)))
4758 (add-after 'unpack 'fix-maybe-uninitialized-variable
4759 (lambda _
4760 ;; This variable gets initialized later if needed, but GCC 7
4761 ;; fails to notice. Should be fixed for > 0.8.4.
4762 ;; https://www.redhat.com/archives/dm-devel/2020-March/msg00137.html
4763 (substitute* "libmultipath/structs_vec.c"
4764 (("bool is_queueing;")
4765 "bool is_queueing = false;"))
4766 #t))
4767 (add-after 'unpack 'fix-linking-tests
4768 (lambda _
4769 ;; Add missing linker flag for -lmpathcmd. This should be fixed
4770 ;; for versions > 0.8.4.
4771 (substitute* "tests/Makefile"
4772 (("-lmultipath -lcmocka")
4773 "-lmultipath -L$(mpathcmddir) -lmpathcmd -lcmocka"))
4774 #t))
4775 (add-after 'unpack 'skip-failing-tests
4776 (lambda _
4777 ;; This test and the module's setup() test an arbitrary block
4778 ;; device node name, but the build environment has none.
4779 (substitute* "tests/devt.c"
4780 (("return get_one_devt.*") "return 0;\n")
4781 (("cmocka_unit_test\\(test_devt2devname_devt_good\\),") ""))
4782 ;; The above triggers -Werror=unused-function. Ignore it.
4783 (substitute* "tests/Makefile"
4784 (("CFLAGS \\+= " match)
4785 (string-append match "-Wno-error=unused-function ")))
4786 #t))
4787 (delete 'configure)))) ; no configure script
4788 (native-inputs
4789 `(("perl" ,perl)
4790 ("pkg-config" ,pkg-config)
4791 ("valgrind" ,valgrind)
4792
4793 ;; For tests.
4794 ("cmocka" ,cmocka)))
4795 (inputs
4796 `(("json-c" ,json-c)
4797 ("libaio" ,libaio)
4798 ("liburcu" ,liburcu)
4799 ("lvm2" ,lvm2)
4800 ("readline" ,readline)
4801 ("udev" ,eudev)))
4802 (home-page "http://christophe.varoqui.free.fr/")
4803 (synopsis "Access block devices through multiple paths")
4804 (description
4805 "This package provides the following binaries to drive the
4806 Linux Device Mapper multipathing driver:
4807 @enumerate
4808 @item @command{multipath} - Device mapper target autoconfig.
4809 @item @command{multipathd} - Multipath daemon.
4810 @item @command{mpathpersist} - Manages SCSI persistent reservations on
4811 @code{dm} multipath devices.
4812 @item @command{kpartx} - Create device maps from partition tables.
4813 @end enumerate")
4814 (license (list license:gpl2+ ; main distribution
4815 license:lgpl2.0+)))) ; libmpathcmd/mpath_cmd.h
4816
4817 (define-public libaio
4818 (package
4819 (name "libaio")
4820 (version "0.3.112")
4821 (source (origin
4822 (method url-fetch)
4823 (uri (list
4824 (string-append "https://releases.pagure.org/libaio/"
4825 name "-" version ".tar.gz")))
4826 (sha256
4827 (base32
4828 "14mlqdapjqq1dhpkdgy5z83mvsaz36fcxca7a4z6hinmr7r6415b"))))
4829 (build-system gnu-build-system)
4830 (arguments
4831 `(#:make-flags
4832 (let ((target ,(%current-target-system)))
4833 (list (string-append "prefix=" %output)
4834 (string-append
4835 "CC=" (if target
4836 (string-append (assoc-ref %build-inputs "cross-gcc")
4837 "/bin/" target "-gcc")
4838 "gcc"))))
4839 #:test-target "partcheck" ; need root for a full 'check'
4840 #:phases
4841 (modify-phases %standard-phases (delete 'configure)))) ; no configure script
4842 (home-page "https://pagure.io/libaio")
4843 (synopsis "Linux-native asynchronous I/O access library")
4844 (description
4845 "This library enables userspace to use Linux kernel asynchronous I/O
4846 system calls, important for the performance of databases and other advanced
4847 applications.")
4848 (license license:lgpl2.1+)))
4849
4850 (define-public blktrace
4851 ;; Take a newer commit to get the fix for CVE-2018-10689.
4852 (let ((commit "db4f6340e04716285ea56fe26d76381c3adabe58")
4853 (revision "1"))
4854 (package
4855 (name "blktrace")
4856 (version (git-version "1.2.0" revision commit))
4857 (home-page
4858 "https://git.kernel.org/pub/scm/linux/kernel/git/axboe/blktrace.git")
4859 (source (origin
4860 (method git-fetch)
4861 (uri (git-reference
4862 (url home-page)
4863 (commit commit)))
4864 (sha256
4865 (base32 "0ah7xn4qnx09k6bm39p69av7d0c8cl6863drv6a1nf914sq1kpgp"))
4866 (file-name (git-file-name name version))))
4867 (build-system gnu-build-system)
4868 (arguments
4869 `(#:make-flags
4870 (list ,(string-append "CC=" (cc-for-target))
4871 (string-append "prefix=" %output))
4872 #:tests? #f ; no tests
4873 #:phases
4874 (modify-phases %standard-phases
4875 (delete 'configure) ; no configure script
4876 (add-after 'unpack 'fix-gnuplot-path
4877 (lambda* (#:key inputs #:allow-other-keys)
4878 (let ((gnuplot (assoc-ref inputs "gnuplot")))
4879 (substitute* "btt/bno_plot.py"
4880 (("gnuplot %s")
4881 (string-append gnuplot "/bin/gnuplot %s")))
4882 #t))))))
4883 (inputs
4884 `(("libaio" ,libaio)
4885 ("gnuplot" ,gnuplot)
4886 ("python" ,python-wrapper))) ;for 'bno_plot.py'
4887 (synopsis "Block layer IO tracing mechanism")
4888 (description "Blktrace is a block layer IO tracing mechanism which provides
4889 detailed information about request queue operations to user space. It extracts
4890 event traces from the kernel (via the relaying through the debug file system).")
4891 (license license:gpl2))))
4892
4893 (define-public sbc
4894 (package
4895 (name "sbc")
4896 (version "1.5")
4897 (source (origin
4898 (method url-fetch)
4899 (uri (string-append "mirror://kernel.org/linux/bluetooth/sbc-"
4900 version ".tar.xz"))
4901 (patches (search-patches "sbc-fix-build-non-x86.patch"))
4902 (sha256
4903 (base32
4904 "1liig5856crb331dps18mp0s13zbkv7yh007zqhq97m94fcddfhc"))))
4905 (build-system gnu-build-system)
4906 (inputs
4907 `(("libsndfile" ,libsndfile)))
4908 (native-inputs
4909 `(("pkg-config" ,pkg-config)))
4910 (home-page "https://www.kernel.org/pub/linux/bluetooth/")
4911 (synopsis "Bluetooth subband audio codec")
4912 (description
4913 "The SBC is a digital audio encoder and decoder used to transfer data to
4914 Bluetooth audio output devices like headphones or loudspeakers.")
4915 (license license:gpl2+)))
4916
4917 (define-public bluez
4918 (package
4919 (name "bluez")
4920 (version "5.55")
4921 (source (origin
4922 (method url-fetch)
4923 (uri (string-append
4924 "mirror://kernel.org/linux/bluetooth/bluez-"
4925 version ".tar.xz"))
4926 (sha256
4927 (base32
4928 "124v9s4y1s7s6klx5vlmzpk1jlr4x84ch7r7scm7x2f42dqp2qw8"))))
4929 (build-system gnu-build-system)
4930 (arguments
4931 `(#:configure-flags
4932 (let ((out (assoc-ref %outputs "out")))
4933 (list "--sysconfdir=/etc"
4934 "--localstatedir=/var"
4935 "--enable-library"
4936 "--disable-systemd"
4937 ;; TODO: is this needed? Not installed by default since 5.55.
4938 "--enable-hid2hci"
4939 ;; Install dbus/udev files to the correct location.
4940 (string-append "--with-dbusconfdir=" out "/etc")
4941 (string-append "--with-udevdir=" out "/lib/udev")))
4942 #:phases
4943 (modify-phases %standard-phases
4944 ;; Test unit/test-gatt fails unpredictably. Seems to be a timing
4945 ;; issue (discussion on upstream mailing list:
4946 ;; https://marc.info/?t=149578476300002&r=1&w=2)
4947 (add-before 'check 'skip-wonky-test
4948 (lambda _
4949 (substitute* "unit/test-gatt.c"
4950 (("tester_init\\(&argc, &argv\\);") "return 77;"))
4951 #t))
4952 (add-after 'install 'post-install
4953 (lambda* (#:key inputs outputs #:allow-other-keys)
4954 (let* ((out (assoc-ref outputs "out"))
4955 (servicedir (string-append out "/share/dbus-1/services"))
4956 (service "obexd/src/org.bluez.obex.service")
4957 (rule (string-append
4958 out "/lib/udev/rules.d/97-hid2hci.rules")))
4959 ;; Install the obex dbus service file.
4960 (substitute* service
4961 (("/bin/false")
4962 (string-append out "/libexec/bluetooth/obexd")))
4963 (install-file service servicedir)
4964 ;; Fix paths in the udev rule.
4965 (substitute* rule
4966 (("hid2hci --method")
4967 (string-append out "/lib/udev/hid2hci --method"))
4968 (("/sbin/udevadm")
4969 (string-append (assoc-ref inputs "eudev") "/bin/udevadm")))
4970 #t))))))
4971 (native-inputs
4972 `(("pkg-config" ,pkg-config)
4973 ("gettext" ,gettext-minimal)))
4974 (inputs
4975 `(("glib" ,glib)
4976 ("dbus" ,dbus)
4977 ("eudev" ,eudev)
4978 ("libical" ,libical)
4979 ("readline" ,readline)))
4980 (home-page "http://www.bluez.org/")
4981 (synopsis "Linux Bluetooth protocol stack")
4982 (description
4983 "BlueZ provides support for the core Bluetooth layers and protocols. It
4984 is flexible, efficient and uses a modular implementation.")
4985 (license license:gpl2+)))
4986
4987 (define-public fuse-exfat
4988 (package
4989 (name "fuse-exfat")
4990 (version "1.3.0")
4991 (source (origin
4992 (method url-fetch)
4993 (uri (string-append
4994 "https://github.com/relan/exfat/releases/download/v"
4995 version "/" name "-" version ".tar.gz"))
4996 (sha256
4997 (base32
4998 "1lz00q8g4590mrdqmf13ba1s9zrqq645ymgm5p9y99ad0qv22r87"))))
4999 (build-system gnu-build-system)
5000 (native-inputs
5001 `(("pkg-config" ,pkg-config)))
5002 (inputs
5003 `(("fuse" ,fuse)))
5004 (home-page "https://github.com/relan/exfat")
5005 (synopsis "Mount exFAT file systems")
5006 (description
5007 "This package provides a FUSE-based file system that provides read and
5008 write access to exFAT devices.")
5009 (license license:gpl2+)))
5010
5011 (define-public fuseiso
5012 (package
5013 (name "fuseiso")
5014 (version "20070708")
5015 (source (origin
5016 (method url-fetch)
5017 (uri (string-append "mirror://sourceforge/fuseiso/fuseiso/"
5018 version "/fuseiso-" version ".tar.bz2"))
5019 (sha256
5020 (base32
5021 "127xql52dcdhmh7s5m9xc6q39jdlj3zhbjar1j821kb6gl3jw94b"))))
5022 (build-system gnu-build-system)
5023 (native-inputs
5024 `(("pkg-config" ,pkg-config)))
5025 (inputs
5026 `(("fuse" ,fuse)
5027 ("glib" ,glib)
5028 ("zlib" ,zlib)))
5029 (home-page "https://sourceforge.net/projects/fuseiso/")
5030 (synopsis "Mount ISO file system images")
5031 (description
5032 "FuseISO is a FUSE module to mount ISO file system images (.iso, .nrg,
5033 .bin, .mdf and .img files). It supports plain ISO9660 Level 1 and 2, Rock
5034 Ridge, Joliet, and zisofs.")
5035 (license license:gpl2)))
5036
5037 (define-public gpm
5038 (package
5039 (name "gpm")
5040 (version "1.20.7")
5041 (source (origin
5042 (method url-fetch)
5043 (uri (string-append
5044 "https://www.nico.schottelius.org/software/gpm/archives/"
5045 "gpm-" version ".tar.bz2"))
5046 (patches (search-patches "gpm-glibc-2.26.patch"))
5047 (sha256
5048 (base32
5049 "13d426a8h403ckpc8zyf7s2p5rql0lqbg2bv0454x0pvgbfbf4gh"))))
5050 (build-system gnu-build-system)
5051 (arguments
5052 '(#:phases (modify-phases %standard-phases
5053 (replace 'bootstrap
5054 (lambda _
5055 ;; The tarball was not generated with 'make dist' so we
5056 ;; need to bootstrap things ourselves.
5057 (substitute* "autogen.sh"
5058 (("/bin/sh") (which "sh")))
5059 (invoke "./autogen.sh")
5060 (patch-makefile-SHELL "Makefile.include.in")
5061 #t)))
5062
5063 ;; Make sure programs find libgpm.so.
5064 #:configure-flags (list (string-append "LDFLAGS=-Wl,-rpath="
5065 (assoc-ref %outputs "out")
5066 "/lib"))))
5067 (native-inputs
5068 `(("texinfo" ,texinfo)
5069 ("bison" ,bison)
5070 ("flex" ,flex)
5071 ("autoconf" ,autoconf)
5072 ("automake" ,automake)
5073 ("libtool" ,libtool)))
5074 (home-page "https://www.nico.schottelius.org/software/gpm/")
5075 (synopsis "Mouse support for the Linux console")
5076 (description
5077 "The GPM (general-purpose mouse) daemon is a mouse server for
5078 applications running on the Linux console. It allows users to select items
5079 and copy/paste text in the console and in xterm.")
5080 (license license:gpl2+)))
5081
5082 (define-public btrfs-progs
5083 (package
5084 (name "btrfs-progs")
5085 (version "5.12.1")
5086 (source (origin
5087 (method url-fetch)
5088 (uri (string-append "mirror://kernel.org/linux/kernel/"
5089 "people/kdave/btrfs-progs/"
5090 "btrfs-progs-v" version ".tar.xz"))
5091 (sha256
5092 (base32
5093 "0n9p8zaz4nrkgc20cp6zj7gp4ib4hd4lbyph74f4pysllkz4c24m"))))
5094 (build-system gnu-build-system)
5095 (outputs '("out"
5096 "static")) ; static versions of the binaries in "out"
5097 (arguments
5098 '(#:phases (modify-phases %standard-phases
5099 (add-after 'unpack 'patch-makefile
5100 (lambda* (#:key outputs #:allow-other-keys)
5101 (substitute* "Makefile"
5102 (("\\$\\(DESTDIR\\)\\$\\(udevruledir\\)")
5103 (string-append (assoc-ref outputs "out")
5104 "/lib/udev/rules.d")))
5105 #t))
5106 (add-after 'build 'build-static
5107 (lambda _ (invoke "make" "static")))
5108 (add-after 'install 'install-bash-completion
5109 (lambda* (#:key outputs #:allow-other-keys)
5110 (let* ((out (assoc-ref outputs "out"))
5111 (bashcomp (string-append out "/etc/bash_completion.d")))
5112 (mkdir-p bashcomp)
5113 (copy-file "btrfs-completion"
5114 (string-append bashcomp "/btrfs"))
5115 #t)))
5116 (add-after 'install 'install-static
5117 (let ((staticbin (string-append (assoc-ref %outputs "static")
5118 "/bin")))
5119 (lambda _
5120 (invoke "make"
5121 (string-append "bindir=" staticbin)
5122 "install-static")))))
5123 #:tests? #f ; XXX: require the 'btrfs' kernel module.
5124 #:test-target "test"
5125 #:parallel-tests? #f)) ; tests fail when run in parallel
5126 (inputs `(("e2fsprogs" ,e2fsprogs) ; for btrfs-convert
5127 ("lzo" ,lzo)
5128 ("util-linux:lib" ,util-linux "lib") ;for libblkid and libuuid
5129 ("util-linux:static" ,util-linux "static") ;ditto
5130 ("zlib" ,zlib)
5131 ("zlib:static" ,zlib "static")
5132 ("zstd" ,zstd "lib")
5133 ("zstd:static" ,zstd "static")))
5134 (native-inputs `(("pkg-config" ,pkg-config)
5135 ("asciidoc" ,asciidoc)
5136 ("python" ,python)
5137 ("xmlto" ,xmlto)
5138 ;; Remove this input entirely when the default headers
5139 ;; version provides blk_zone.capacity (>= 5.9).
5140 ("linux-libre-headers" ,linux-libre-headers-5.10)
5141 ;; For building documentation.
5142 ("libxml2" ,libxml2)
5143 ("docbook-xsl" ,docbook-xsl)
5144 ;; For tests.
5145 ("acl" ,acl)
5146 ("which" ,which)
5147 ("dmsetup" ,lvm2)
5148 ("udevadm" ,eudev)
5149 ;; The tests need 'grep' with perl regexp support.
5150 ("grep" ,grep)))
5151 (home-page "https://btrfs.wiki.kernel.org/index.php/Main_Page")
5152 (synopsis "Create and manage btrfs copy-on-write file systems")
5153 (description "Btrfs is a @dfn{copy-on-write} (CoW) file system for Linux
5154 aimed at implementing advanced features while focusing on fault tolerance,
5155 repair and easy administration.")
5156 ;; GPL2+: crc32.c, radix-tree.c, raid6.c, rbtree.c.
5157 ;; GPL2: Everything else.
5158 (license (list license:gpl2 license:gpl2+))))
5159
5160 (define-public btrfs-progs/static
5161 (package
5162 (name "btrfs-progs-static")
5163 (version (package-version btrfs-progs))
5164 (source #f)
5165 (build-system trivial-build-system)
5166 (inputs
5167 `(("btrfs-progs:static" ,btrfs-progs "static")))
5168 (arguments
5169 `(#:modules ((guix build utils))
5170 #:builder
5171 (begin
5172 (use-modules (guix build utils)
5173 (ice-9 ftw)
5174 (srfi srfi-26))
5175
5176 (let* ((btrfs (assoc-ref %build-inputs "btrfs-progs:static"))
5177 (out (assoc-ref %outputs "out"))
5178 (source (string-append btrfs "/bin/btrfs.static"))
5179 (target (string-append out "/bin/btrfs")))
5180 (mkdir-p (dirname target))
5181 (copy-file source target)
5182 (remove-store-references target)
5183 (chmod target #o555)
5184 #t))))
5185 (home-page (package-home-page btrfs-progs))
5186 (synopsis "Statically-linked btrfs command from btrfs-progs")
5187 (description "This package provides the statically-linked @command{btrfs}
5188 from the btrfs-progs package. It is meant to be used in initrds.")
5189 (license (package-license btrfs-progs))))
5190
5191 (define-public cramfs-tools
5192 (package
5193 (name "cramfs-tools")
5194 (home-page "https://github.com/npitre/cramfs-tools")
5195 (version "2.1")
5196 (source (origin
5197 (method git-fetch)
5198 (uri (git-reference
5199 (url home-page)
5200 (commit (string-append "v" version))))
5201 (sha256
5202 (base32 "183rfqqyzx52q0vxicdgf0p984idh3rqkvzfb93gjvyzfhc15c0p"))
5203 (file-name (git-file-name name version))))
5204 (build-system gnu-build-system)
5205 (arguments
5206 '(#:tests? #f ; No tests.
5207 #:phases
5208 (modify-phases %standard-phases
5209 (delete 'configure)
5210 (replace 'install
5211 (lambda* (#:key outputs #:allow-other-keys)
5212 (let ((out (assoc-ref outputs "out")))
5213 (install-file "mkcramfs" (string-append out "/sbin"))
5214 (install-file "cramfsck" (string-append out "/sbin")))
5215 #t)))))
5216 (inputs
5217 `(("zlib" ,zlib)))
5218 (synopsis "Tools to manage Cramfs file systems")
5219 (description "Cramfs is a Linux file system designed to be simple, small,
5220 and to compress things well. It is used on a number of embedded systems and
5221 small devices. This version has additional features such as uncompressed
5222 blocks and random block placement.")
5223 (license license:gpl2+)))
5224
5225 (define-public compsize
5226 (package
5227 (name "compsize")
5228 (version "1.5")
5229 (home-page "https://github.com/kilobyte/compsize")
5230 (source (origin
5231 (method git-fetch)
5232 (uri (git-reference
5233 (url home-page)
5234 (commit (string-append "v" version))))
5235 (sha256
5236 (base32 "0vqnrwgpv6pc1yjl0g4gl71xyl6v0xl3pyqjanjpwps73c53azir"))
5237 (file-name (git-file-name name version))))
5238 (build-system gnu-build-system)
5239 (inputs
5240 `(("btrfs-progs" ,btrfs-progs)))
5241 (arguments
5242 `(#:tests? #f ; No tests.
5243 #:make-flags
5244 (list (string-append "CC=" ,(cc-for-target)))
5245 #:phases
5246 (modify-phases %standard-phases
5247 (delete 'configure)
5248 (replace 'install
5249 (lambda* (#:key outputs #:allow-other-keys)
5250 (let ((out (assoc-ref outputs "out")))
5251 (install-file "compsize" (string-append out "/bin"))
5252 (install-file "compsize.8" (string-append out "/share/man/man8"))))))))
5253 (synopsis "Find compression type/ratio on Btrfs files")
5254 (description "@command{compsize} takes a list of files (given as
5255 arguments) on a Btrfs file system and measures used compression types and
5256 effective compression ratio, producing a report.
5257
5258 A directory has no extents but has a (recursive) list of files. A non-regular
5259 file is silently ignored.
5260
5261 As it makes no sense to talk about compression ratio of a partial extent,
5262 every referenced extent is counted whole, exactly once -- no matter if you use
5263 only a few bytes of a 1GB extent or reflink it a thousand times. Thus, the
5264 uncompressed size will not match the number given by @command{tar} or
5265 @command{du}. On the other hand, the space used should be accurate (although
5266 obviously it can be shared with files outside our set).")
5267 (license license:gpl2+)))
5268
5269 (define-public f2fs-tools-1.7
5270 (package
5271 (name "f2fs-tools")
5272 (version "1.7.0")
5273 (source (origin
5274 (method url-fetch)
5275 (uri (string-append
5276 "https://git.kernel.org/cgit/linux/kernel/git/jaegeuk"
5277 "/f2fs-tools.git/snapshot/f2fs-tools-" version ".tar.gz"))
5278 (sha256
5279 (base32
5280 "1m6bn1ibq0p53m0n97il91xqgjgn2pzlz74lb5bfzassx7159m1k"))))
5281
5282 (build-system gnu-build-system)
5283 (arguments
5284 `(#:phases
5285 (modify-phases %standard-phases
5286 (add-after 'install 'install-headers
5287 (lambda* (#:key outputs #:allow-other-keys)
5288 (let* ((out (assoc-ref outputs "out"))
5289 (out-include (string-append out "/include")))
5290 (install-file "include/f2fs_fs.h" out-include)
5291 (install-file "mkfs/f2fs_format_utils.h" out-include)
5292 #t))))))
5293 (native-inputs
5294 `(("autoconf" ,autoconf)
5295 ("automake" ,automake)
5296 ("libtool" ,libtool)
5297 ("pkg-config" ,pkg-config)))
5298 (inputs
5299 `(("libuuid" ,util-linux "lib")
5300 ("libselinux" ,libselinux)))
5301 (home-page "https://f2fs.wiki.kernel.org/")
5302 (synopsis "Userland tools for f2fs")
5303 (description
5304 "F2FS, the Flash-Friendly File System, is a modern file system
5305 designed to be fast and durable on flash devices such as solid-state
5306 disks and SD cards. This package provides the userland utilities.")
5307 ;; The formatting utility, libf2fs and include/f2fs_fs.h is dual
5308 ;; GPL2/LGPL2.1, everything else is GPL2 only. See 'COPYING'.
5309 (license (list license:gpl2 license:lgpl2.1))))
5310
5311 (define-public f2fs-tools
5312 (package
5313 (inherit f2fs-tools-1.7)
5314 (name "f2fs-tools")
5315 (version "1.14.0")
5316 (source (origin
5317 (method url-fetch)
5318 (uri (string-append
5319 "https://git.kernel.org/cgit/linux/kernel/git/jaegeuk"
5320 "/f2fs-tools.git/snapshot/f2fs-tools-" version ".tar.gz"))
5321 (sha256
5322 (base32
5323 "1lab1446c78xsjwhpki7s85z4171m8p9279c8yhm4882wba674k1"))))
5324 (inputs
5325 `(("libuuid" ,util-linux "lib")))))
5326
5327 (define-public f2fs-tools/static
5328 (static-package
5329 (package
5330 (inherit f2fs-tools)
5331 (name "f2fs-tools-static")
5332 (arguments
5333 `(#:configure-flags
5334 (let ((libuuid-static (assoc-ref %build-inputs "libuuid:static"))
5335 (libuuid (assoc-ref %build-inputs "libuuid")))
5336 (list
5337 (string-append "libuuid_CFLAGS=-I" libuuid "/include/uuid")
5338 (string-append "libuuid_LIBS=-L" libuuid-static "/lib -luuid")
5339 (string-append "libblkid_CFLAGS=-I" libuuid "/include/uuid "
5340 "-I" libuuid "/include/blkid")
5341 (string-append "libblkid_LIBS=-L" libuuid-static "/lib -lblkid")))
5342 #:disallowed-references (,util-linux)
5343 #:phases
5344 (modify-phases %standard-phases ; TODO: f2fs phases.
5345 (add-after 'unpack 'make-static
5346 (lambda _
5347 (define (append-to-file name body)
5348 (let ((file (open-file name "a")))
5349 (display body file)
5350 (close-port file)))
5351 (append-to-file "mkfs/Makefile.am" "\nmkfs_f2fs_LDFLAGS = -all-static\n")
5352 (append-to-file "fsck/Makefile.am" "\nfsck_f2fs_LDFLAGS = -all-static\n")
5353 (append-to-file "tools/Makefile.am" "\nf2fscrypt_LDFLAGS = -all-static -luuid\n")
5354 #t))
5355 (add-after 'install 'remove-store-references
5356 (lambda* (#:key outputs #:allow-other-keys)
5357 ;; Work around bug in our util-linux.
5358 ;; <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=41019>.
5359 (remove-store-references (string-append (assoc-ref outputs "out")
5360 "/sbin/mkfs.f2fs"))
5361 #t)))))
5362 (inputs
5363 `(("libuuid:static" ,util-linux "static")
5364 ("libuuid" ,util-linux "lib")))))) ; for include files
5365
5366 (define-public f2fs-fsck/static
5367 (package
5368 (name "f2fs-fsck-static")
5369 (version (package-version f2fs-tools/static))
5370 (source #f)
5371 (build-system trivial-build-system)
5372 (arguments
5373 `(#:modules ((guix build utils))
5374 #:builder
5375 (begin
5376 (use-modules (guix build utils)
5377 (ice-9 ftw)
5378 (srfi srfi-26))
5379 (let* ((f2fs-tools (assoc-ref %build-inputs "f2fs-tools-static"))
5380 (fsck "fsck.f2fs")
5381 (out (assoc-ref %outputs "out"))
5382 (sbin (string-append out "/sbin")))
5383 (mkdir-p sbin)
5384 (with-directory-excursion sbin
5385 (install-file (string-append f2fs-tools "/sbin/" fsck)
5386 ".")
5387 (remove-store-references fsck)
5388 (chmod fsck #o555))
5389 #t))))
5390 (inputs
5391 `(("f2fs-tools-static" ,f2fs-tools/static)))
5392 (home-page (package-home-page f2fs-tools/static))
5393 (synopsis "Statically-linked fsck.f2fs command from f2fs-tools")
5394 (description "This package provides statically-linked fsck.f2fs command taken
5395 from the f2fs-tools package. It is meant to be used in initrds.")
5396 (license (package-license f2fs-tools/static))))
5397
5398 (define-public freefall
5399 (package
5400 (name "freefall")
5401 (version (package-version linux-libre))
5402 (source (package-source linux-libre))
5403 (build-system gnu-build-system)
5404 (arguments
5405 '(#:phases (modify-phases %standard-phases
5406 (add-after 'unpack 'enter-subdirectory
5407 (lambda _
5408 (chdir "tools/laptop/freefall")
5409 #t))
5410 (delete 'configure)
5411 (add-before 'build 'increase-timeout
5412 (lambda _
5413 ;; The default of 2 seconds is too low: it assumes an
5414 ;; open lid and AC power without actually checking.
5415 (substitute* "freefall.c"
5416 (("alarm\\(2\\)") "alarm(5)"))
5417 #t)))
5418 #:make-flags (list (string-append "PREFIX="
5419 (assoc-ref %outputs "out"))
5420 "CC=gcc")
5421 #:tests? #f)) ;no tests
5422 (home-page (package-home-page linux-libre))
5423 (synopsis "Free-fall protection for spinning laptop hard drives")
5424 (description
5425 "Prevents shock damage to the internal spinning hard drive(s) of some
5426 HP and Dell laptops. When sudden movement is detected, all input/output
5427 operations on the drive are suspended and its heads are parked on the ramp,
5428 where they are less likely to cause damage to the spinning disc. Requires a
5429 drive that supports the ATA/ATAPI-7 IDLE IMMEDIATE command with unload
5430 feature, and a laptop with an accelerometer. It has no effect on SSDs.")
5431 (license license:gpl2)))
5432
5433 (define-public thinkfan
5434 (package
5435 (name "thinkfan")
5436 (version "1.2.1")
5437 (source
5438 (origin
5439 (method git-fetch)
5440 (uri (git-reference
5441 (url "https://github.com/vmatare/thinkfan")
5442 (commit version)))
5443 (file-name (git-file-name name version))
5444 (sha256
5445 (base32 "18vgm5w5pjnpipa34j4x87q10695w2jnqwvc2f027afy7mnzw7kz"))))
5446 (build-system cmake-build-system)
5447 (arguments
5448 `(#:modules ((guix build cmake-build-system)
5449 (guix build utils)
5450 (srfi srfi-26))
5451 #:tests? #f ; no test target
5452 #:configure-flags
5453 ;; Enable reading temperatures from hard disks via S.M.A.R.T.
5454 ;; Upstream ‘defaults to OFF because libatasmart seems to be horribly
5455 ;; inefficient’.
5456 `("-DUSE_ATASMART:BOOL=ON")
5457 #:phases
5458 (modify-phases %standard-phases
5459 (add-after 'unpack 'create-init-scripts
5460 ;; CMakeLists.txt relies on build-time symptoms of OpenRC and
5461 ;; systemd to patch and install their service files. Fake their
5462 ;; presence rather than duplicating the build system below. Leave
5463 ;; things like ‘/bin/kill’ because they're not worth a dependency.
5464 ;; The sysvinit needs manual patching, but since upstream doesn't
5465 ;; even provide the option to install it: don't.
5466 (lambda* (#:key outputs #:allow-other-keys)
5467 (let* ((out (assoc-ref outputs "out"))
5468 (share (string-append out "/share/" ,name)))
5469 (substitute* "CMakeLists.txt"
5470 (("pkg_check_modules\\((OPENRC|SYSTEMD) .*" _ package)
5471 (format #f "option(~a_FOUND \"Faked\" ON)\n" package))
5472 ;; That was easy! Now we just need to fix the destinations.
5473 (("/etc" directory)
5474 (string-append out directory)))
5475 #t))))))
5476 (native-inputs
5477 `(("pkg-config" ,pkg-config)))
5478 (inputs
5479 `(("libatasmart" ,libatasmart)
5480 ("yaml-cpp" ,yaml-cpp)))
5481 (home-page "https://github.com/vmatare/thinkfan")
5482 (synopsis "Simple fan control program")
5483 (description
5484 "Thinkfan is a simple fan control program. It reads temperatures,
5485 checks them against configured limits and switches to appropriate (also
5486 pre-configured) fan level. It requires a working @code{thinkpad_acpi} or any
5487 other @code{hwmon} driver that enables temperature reading and fan control
5488 from userspace.")
5489 (license license:gpl3+)))
5490
5491 (define-public tpacpi-bat
5492 (package
5493 (name "tpacpi-bat")
5494 (version "3.1")
5495 (source
5496 (origin
5497 (method git-fetch)
5498 (uri (git-reference
5499 (url "https://github.com/teleshoes/tpacpi-bat")
5500 (commit (string-append "v" version))))
5501 (file-name (git-file-name name version))
5502 (sha256
5503 (base32 "0wbaz34z99gqx721alh5vmpxpj2yxg3x9m8jqyivfi1wfpwc2nd5"))))
5504 (build-system gnu-build-system)
5505 (arguments
5506 `(#:tests? #f ; no test target
5507 #:phases
5508 (modify-phases %standard-phases
5509 (add-after 'unpack 'refer-to-inputs
5510 (lambda _
5511 (substitute* "tpacpi-bat"
5512 (("cat ")
5513 (format #f "~a " (which "cat")))
5514 ;; tpacpi-bat modprobes the acpi_call kernel module if it's not
5515 ;; loaded. That's the administrator's prerogative; disable it.
5516 (("system \"(modprobe .*)\"" _ match)
5517 (format #f "die \"Please run ‘~a’ first.\\n\"" match)))
5518 #t))
5519 (delete 'configure) ; nothing to configure
5520 (delete 'build) ; nothing to build
5521 (replace 'install
5522 (lambda* (#:key outputs #:allow-other-keys)
5523 (let* ((out (assoc-ref outputs "out"))
5524 (bin (string-append out "/bin"))
5525 (doc (string-append out "/share/doc/" ,name "-" ,version)))
5526 (install-file "tpacpi-bat" bin)
5527
5528 ;; There's no man page. Install other forms of documentation.
5529 (for-each (lambda (file)
5530 (let ((target (string-append doc "/" file)))
5531 (mkdir-p (dirname target))
5532 (copy-recursively file target)))
5533 (list "battery_asl" "examples" "README.md"))
5534 #t))))))
5535 (inputs
5536 `(("perl" ,perl)))
5537 (home-page "https://github.com/teleshoes/tpacpi-bat")
5538 (synopsis "ThinkPad battery charge controller")
5539 (description
5540 "Tpacpi-bat is a command-line interface to control battery charging on
5541 @uref{https://github.com/teleshoes/tpacpi-bat/wiki/Supported-Hardware, Lenovo
5542 ThinkPad models released after 2011}, starting with the xx20 series. It can
5543 query and set the thresholds at which one or both batteries will start and stop
5544 charging, inhibit charging batteries for a set period of time, or force them to
5545 discharge when they otherwise would not.
5546
5547 This tool merely exposes ACPI calls provided by the @code{acpi_call} Linux
5548 kernel module provided by the @code{acpi-call-linux-module} package, which must
5549 be installed and loaded separately. Only the original vendor firmware is
5550 supported.")
5551 (license license:gpl3+)))
5552
5553 (define-public tmon
5554 (package
5555 (name "tmon")
5556 ;; Tmon's ‘VERSION = 1.0’ hasn't been touched since 2013; the code has.
5557 (version (package-version linux-libre))
5558 (source (package-source linux-libre))
5559 (build-system gnu-build-system)
5560 (arguments
5561 `(#:tests? #f ; no test suite
5562 #:make-flags
5563 (list (string-append "CC=" ,(cc-for-target))
5564 (string-append "INSTALL_ROOT=" (assoc-ref %outputs "out"))
5565 "BINDIR=bin")
5566 #:phases
5567 (modify-phases %standard-phases
5568 (add-after 'unpack 'enter-subdirectory
5569 (lambda _
5570 (chdir "tools/thermal/tmon")
5571 #t))
5572 (add-after 'install 'install-man-page
5573 (lambda* (#:key outputs #:allow-other-keys)
5574 (let* ((out (assoc-ref outputs "out"))
5575 (man8 (string-append out "/share/man/man8")))
5576 (install-file "tmon.8" man8)
5577 #t)))
5578 (delete 'configure)))) ; no configure script
5579 (inputs
5580 `(("ncurses" ,ncurses)))
5581 (home-page (package-home-page linux-libre))
5582 (synopsis "Monitor and test the Linux thermal subsystem in real time")
5583 (description
5584 "Tmon is a tool to interact with the complex thermal subsystem of the
5585 kernel Linux. It helps visualize thermal relationships and real-time thermal
5586 data, tune and test cooling devices and sensors, and collect thermal data for
5587 further analysis.
5588
5589 As computers become smaller and more thermally constrained, more sensors are
5590 added and new cooling capabilities introduced. Thermal relationships can change
5591 dynamically. Their complexity grows exponentially among cooling devices, zones,
5592 sensors, and trip points.
5593
5594 Linux exposes this relationship through @file{/sys/class/thermal} with a matrix
5595 of symbolic links, trip point bindings, and device instances. To traverse it
5596 by hand is no trivial task: @command{tmon} aims to make it understandable.")
5597 (license (list license:gpl2 ; the man page
5598 license:gpl2+)))) ; the actual rest
5599
5600 (define-public turbostat
5601 (package
5602 (name "turbostat")
5603 ;; XXX turbostat reports a version like ‘20.09.30’ but using it here would
5604 ;; make it harder to benefit from ‘free’ linux-libre package updates.
5605 (version (package-version linux-libre))
5606 (source (package-source linux-libre))
5607 (build-system gnu-build-system)
5608 (arguments
5609 `(#:tests? #f ; no test suite
5610 #:make-flags
5611 (list (string-append "CC=" ,(cc-for-target))
5612 (string-append "PREFIX=" (assoc-ref %outputs "out")))
5613 #:phases
5614 (modify-phases %standard-phases
5615 (add-after 'unpack 'enter-subdirectory
5616 (lambda _
5617 (chdir "tools/power/x86/turbostat")
5618 #t))
5619 (delete 'configure)))) ; no configure script
5620 (inputs
5621 `(("libcap" ,libcap)))
5622 (supported-systems '("i686-linux" "x86_64-linux"))
5623 (home-page (package-home-page linux-libre))
5624 (synopsis "Report x86 processor frequency and idle statistics")
5625 (description
5626 "Turbostat reports x86 processor topology, frequency, idle power state
5627 statistics, temperature, and power consumption. Some information is unavailable
5628 on older processors.
5629
5630 It can be used to identify machines that are inefficient in terms of power usage
5631 or idle time, report the rate of @acronym{SMI, system management interrupt}s
5632 occurring on the system, or verify the effects of power management tuning.
5633
5634 @command{turbostat} reads hardware counters but doesn't write to them, so it
5635 won't interfere with the OS or other running processes---including multiple
5636 invocations of itself.")
5637 (license license:gpl2)))
5638
5639 (define-public ntfs-3g
5640 (package
5641 (name "ntfs-3g")
5642 (version "2017.3.23")
5643 (source (origin
5644 (method url-fetch)
5645 (uri (string-append "https://tuxera.com/opensource/"
5646 "ntfs-3g_ntfsprogs-" version ".tgz"))
5647 (patches (search-patches "ntfs-3g-CVE-2019-9755.patch"))
5648 (sha256
5649 (base32
5650 "1mb228p80hv97pgk3myyvgp975r9mxq56c6bdn1n24kngcfh4niy"))
5651 (modules '((guix build utils)))
5652 (snippet '(begin
5653 ;; Install under $prefix.
5654 (substitute* '("src/Makefile.in" "ntfsprogs/Makefile.in")
5655 (("/sbin")
5656 "@sbindir@"))
5657 #t))))
5658 (build-system gnu-build-system)
5659 (inputs `(("util-linux" ,util-linux)
5660 ("fuse" ,fuse))) ;libuuid
5661 (native-inputs `(("pkg-config" ,pkg-config)))
5662 (arguments
5663 '(#:configure-flags (list "--disable-static"
5664 "--exec-prefix=${prefix}"
5665 "--with-fuse=external" ;use our own FUSE
5666 "--enable-mount-helper"
5667 "--enable-posix-acls"
5668 "--enable-xattr-mappings")
5669 #:phases
5670 (modify-phases %standard-phases
5671 ;; If users install ntfs-3g, they probably want to make it the
5672 ;; default driver as well, so we opt for sensible defaults and link
5673 ;; mount.ntfs to mount.ntfs-3g. (libmount tries to run mount.ntfs to
5674 ;; mount NTFS file systems.)
5675 (add-after 'install 'install-link
5676 (lambda* (#:key outputs #:allow-other-keys)
5677 (let* ((out (assoc-ref outputs "out"))
5678 (sbin (string-append out "/sbin")))
5679 (symlink "mount.ntfs-3g"
5680 (string-append sbin "/mount.ntfs")))
5681 #t)))))
5682 (home-page "https://www.tuxera.com/community/open-source-ntfs-3g/")
5683 (synopsis "Read-write access to NTFS file systems")
5684 (description
5685 "NTFS-3G provides read-write access to NTFS file systems, which are
5686 commonly found on Microsoft Windows. It is implemented as a FUSE file system.
5687 The package provides additional NTFS tools.")
5688 (license license:gpl2+)))
5689
5690 (define-public rdma-core
5691 (package
5692 (name "rdma-core")
5693 (version "33.1")
5694 (source (origin
5695 (method url-fetch)
5696 (uri (string-append "https://github.com/linux-rdma/rdma-core"
5697 "/releases/download/v" version "/rdma-core-"
5698 version ".tar.gz"))
5699 (sha256
5700 (base32
5701 "1rah0v9gq9rksqd2c17nmydsxcjz178n7m2y4ricwlf5pq1b2yfi"))))
5702 (build-system cmake-build-system)
5703 (arguments
5704 `(#:tests? #f ; no tests
5705 ;; Upstream uses the "ninja" build system and encourage distros
5706 ;; to do the same for consistency.
5707 #:configure-flags (list "-GNinja"
5708
5709 (string-append "-DRST2MAN_EXECUTABLE="
5710 (assoc-ref %build-inputs
5711 "python-docutils")
5712 "/bin/rst2man.py"))
5713 #:phases
5714 (modify-phases %standard-phases
5715 (replace 'build
5716 (lambda _
5717 (invoke "ninja"
5718 "-j" (number->string (parallel-job-count)))))
5719 (replace 'install
5720 (lambda _
5721 (invoke "ninja" "install"))))))
5722 (native-inputs
5723 `(("ninja" ,ninja)
5724 ("pkg-config" ,pkg-config)
5725 ("python" ,python-wrapper)
5726 ("python-docutils" ,python-docutils))) ;for 'rst2man'
5727 (inputs
5728 `(("libnl" ,libnl)
5729 ("udev" ,eudev)))
5730 (home-page "https://github.com/linux-rdma/rdma-core")
5731 (synopsis "Utilities and libraries for working with RDMA devices")
5732 (description
5733 "This package provides userspace components for the InfiniBand
5734 subsystem of the Linux kernel. Specifically it contains userspace
5735 libraries for the following device nodes:
5736
5737 @enumerate
5738 @item @file{/dev/infiniband/uverbsX} (@code{libibverbs})
5739 @item @file{/dev/infiniband/rdma_cm} (@code{librdmacm})
5740 @item @file{/dev/infiniband/umadX} (@code{libibumad})
5741 @end enumerate
5742
5743 The following service daemons are also provided:
5744 @enumerate
5745 @item @code{srp_daemon} (for the @code{ib_srp} kernel module)
5746 @item @code{iwpmd} (for iWARP kernel providers)
5747 @item @code{ibacm} (for InfiniBand communication management assistant)
5748 @end enumerate")
5749 ;; All library code is dual licensed under GPL2 and a custom MIT
5750 ;; variant. The package also includes some components covered by
5751 ;; other licenses. Consult COPYING.md for full details.
5752 (license
5753 (list license:gpl2
5754 (license:x11-style "See COPYING.BSD_MIT in the distribution")
5755 license:bsd-2 ; Files referring to COPYING.BSD_FB
5756 license:cc0 ; most files in ccan/
5757 license:bsd-3)))) ; providers/hfi1verbs are dual GPL2/BSD-3
5758
5759 (define-public perftest
5760 (package
5761 (name "perftest")
5762 (version "4.4-0.4")
5763 (source
5764 (origin
5765 (method url-fetch)
5766 (uri (string-append "https://github.com/linux-rdma/perftest/releases/download/v"
5767 version "/perftest-" version ".g0927198.tar.gz"))
5768 (sha256
5769 (base32 "11ix4h0rrmqqyi84y55a9xnkvwsmwq0sywr46hvxzm4rqz4ma8vq"))))
5770 (build-system gnu-build-system)
5771 (arguments
5772 `(#:phases
5773 (modify-phases %standard-phases
5774 (add-after 'unpack 'patch-header-paths
5775 (lambda _
5776 (substitute* '("src/raw_ethernet_fs_rate.c"
5777 "src/raw_ethernet_resources.c"
5778 "src/raw_ethernet_resources.h"
5779 "src/raw_ethernet_send_burst_lat.c"
5780 "src/raw_ethernet_send_bw.c"
5781 "src/raw_ethernet_send_lat.c")
5782 (("/usr/include/netinet/ip.h") "netinet/ip.h"))
5783 #t)))))
5784 (inputs `(("rdma-core" ,rdma-core)))
5785 (home-page "https://github.com/linux-rdma/perftest/")
5786 (synopsis "Open Fabrics Enterprise Distribution (OFED) Performance Tests")
5787 (description "This is a collection of tests written over uverbs intended for
5788 use as a performance micro-benchmark. The tests may be used for hardware or
5789 software tuning as well as for functional testing.
5790
5791 The collection contains a set of bandwidth and latency benchmark such as:
5792 @enumerate
5793 @item Send - @code{ib_send_bw} and @code{ib_send_lat}
5794 @item RDMA Read - @code{ib_read_bw} and @code{ib_read_lat}
5795 @item RDMA Write - @code{ib_write_bw} and @code{ib_wriet_lat}
5796 @item RDMA Atomic - @code{ib_atomic_bw} and @code{ib_atomic_lat}
5797 @item Native Ethernet (when working with MOFED2) - @code{raw_ethernet_bw}, @code{raw_ethernet_lat}
5798 @end enumerate")
5799 (license license:gpl2)))
5800
5801 (define-public rng-tools
5802 (package
5803 (name "rng-tools")
5804 (home-page "https://github.com/nhorman/rng-tools")
5805 (version "6.12")
5806 (source (origin
5807 (method git-fetch)
5808 (uri (git-reference (url home-page)
5809 (commit (string-append "v" version))))
5810 (file-name (git-file-name name version))
5811 (sha256
5812 (base32
5813 "0z4j3kqh9k3zsrx6257hwh4fa51vqg79c6dnfrj6lhpcll0wh0hm"))))
5814 (build-system gnu-build-system)
5815 (arguments
5816 `(;; Disable support for various hardware entropy sources as they need
5817 ;; dependencies that are not yet in Guix, and would significantly
5818 ;; increase closure size.
5819 #:configure-flags '("--without-nistbeacon"
5820 "--without-pkcs11"
5821 "--without-rtlsdr")))
5822 (native-inputs
5823 `(("autoconf" ,autoconf)
5824 ("automake" ,automake)
5825 ("pkg-config" ,pkg-config)))
5826 (inputs
5827 `(("libsysfs" ,sysfsutils)
5828 ("openssl" ,openssl)))
5829 (synopsis "Random number generator daemon")
5830 (description
5831 "Monitor a hardware random number generator, and supply entropy
5832 from that to the system kernel's @file{/dev/random} machinery.")
5833 ;; The source package is offered under the GPL2+, but the files
5834 ;; 'rngd_rdrand.c' and 'rdrand_asm.S' are only available under the GPL2.
5835 (license (list license:gpl2 license:gpl2+))))
5836
5837 (define-public cpupower
5838 (package
5839 (name "cpupower")
5840 (version (package-version linux-libre))
5841 (source (package-source linux-libre))
5842 (build-system gnu-build-system)
5843 (arguments
5844 '(#:phases (modify-phases %standard-phases
5845 (add-after 'unpack 'enter-subdirectory
5846 (lambda _
5847 (chdir "tools/power/cpupower")
5848 #t))
5849 (delete 'configure)
5850 (add-before 'build 'fix-makefiles
5851 (lambda _
5852 (substitute* "Makefile"
5853 (("/usr/") "/")
5854 (("/bin/(install|pwd)" _ command) command))
5855 (substitute* "bench/Makefile"
5856 (("\\$\\(CC\\) -o") "$(CC) $(LDFLAGS) -o"))
5857 #t)))
5858 #:make-flags (let ((out (assoc-ref %outputs "out")))
5859 (list (string-append "DESTDIR=" out)
5860 (string-append "LDFLAGS=-Wl,-rpath=" out "/lib")
5861 "libdir=/lib"
5862 "docdir=/share/doc/cpupower"
5863 "confdir=$(docdir)/examples"
5864 ;; The Makefile recommends the following changes
5865 "DEBUG=false"
5866 "PACKAGE_BUGREPORT=bug-guix@gnu.org"))
5867 #:tests? #f)) ;no tests
5868 (native-inputs `(("gettext" ,gettext-minimal)))
5869 (inputs `(("pciutils" ,pciutils)))
5870 (home-page (package-home-page linux-libre))
5871 (synopsis "CPU frequency and voltage scaling tools for Linux")
5872 (description
5873 "cpupower is a set of user-space tools that use the cpufreq feature of the
5874 Linux kernel to retrieve and control processor features related to power saving,
5875 such as frequency and voltage scaling.")
5876 (license license:gpl2)))
5877
5878 (define-public x86-energy-perf-policy
5879 (package
5880 (name "x86-energy-perf-policy")
5881 (version (package-version linux-libre))
5882 (source (package-source linux-libre))
5883 (build-system gnu-build-system)
5884 (arguments
5885 '(#:tests? #f
5886 #:phases
5887 (modify-phases %standard-phases
5888 (add-after 'unpack 'enter-subdirectory
5889 (lambda _
5890 (chdir "tools/power/x86/x86_energy_perf_policy")
5891 #t))
5892 (delete 'configure)
5893 (add-before 'build 'fix-makefile
5894 (lambda _
5895 (substitute* "Makefile" (("/usr") ""))
5896 #t)))
5897 #:make-flags
5898 (let ((out (assoc-ref %outputs "out")))
5899 (list (string-append "DESTDIR=" out)
5900 (string-append "LDFLAGS=-Wl,-rpath=" out "/lib")))))
5901 (supported-systems '("i686-linux" "x86_64-linux"))
5902 (home-page (package-home-page linux-libre))
5903 (synopsis "Display and update Intel-CPU energy-performance policy")
5904 (description
5905 "@command{x86_energy_perf_policy} displays and updates energy-performance
5906 policy settings specific to Intel Architecture Processors. Settings are
5907 accessed via Model Specific Register (MSR) updates, no matter if the Linux
5908 cpufreq sub-system is enabled or not.")
5909 (license license:gpl2)))
5910
5911 (define-public haveged
5912 (package
5913 (name "haveged")
5914 (version "1.9.14")
5915 (source
5916 (origin
5917 (method git-fetch)
5918 (uri (git-reference
5919 (url "https://github.com/jirka-h/haveged")
5920 (commit (string-append "v" version))))
5921 (file-name (git-file-name name version))
5922 (sha256
5923 (base32 "050hmnh5s2s4mb83f4d1fk23mk27pprg840c1aagc6v1sz6x5dhq"))))
5924 (build-system gnu-build-system)
5925 (home-page "https://www.issihosts.com/haveged")
5926 (synopsis "Entropy source for the Linux random number generator")
5927 (description
5928 "haveged generates an unpredictable stream of random numbers for use by
5929 Linux's @file{/dev/random} and @file{/dev/urandom} devices. The kernel's
5930 standard mechanisms for filling the entropy pool may not be sufficient for
5931 systems with high needs or limited user interaction, such as headless servers.
5932
5933 @command{haveged} runs as a privileged daemon, harvesting randomness from the
5934 indirect effects of hardware events on hidden processor state using the
5935 @acronym{HAVEGE, HArdware Volatile Entropy Gathering and Expansion} algorithm.
5936 It tunes itself to its environment and provides the same built-in test suite
5937 for the output stream as used on certified hardware security devices.
5938
5939 The quality of the randomness produced by this algorithm has not been proven.
5940 It is recommended to run it together with another entropy source like rngd, and
5941 not as a replacement for it.")
5942 (license (list (license:non-copyleft "file://nist/mconf.h")
5943 (license:non-copyleft "file://nist/packtest.c")
5944 license:public-domain ; nist/dfft.c
5945 license:gpl3+)))) ; everything else
5946
5947 (define-public ecryptfs-utils
5948 (package
5949 (name "ecryptfs-utils")
5950 (version "111")
5951 (source
5952 (origin
5953 (method url-fetch)
5954 (uri (string-append "https://launchpad.net/ecryptfs/trunk/"
5955 version "/+download/ecryptfs-utils_"
5956 version ".orig.tar.gz"))
5957 (sha256
5958 (base32
5959 "0zwq19siiwf09h7lwa7n7mgmrr8cxifp45lmwgcfr8c1gviv6b0i"))))
5960 (build-system gnu-build-system)
5961 (arguments
5962 `(#:configure-flags (list "--disable-pywrap")
5963 #:phases
5964 (modify-phases %standard-phases
5965 (add-after 'patch-source-shebangs 'patch-hardcoded-paths
5966 (lambda* (#:key inputs outputs #:allow-other-keys)
5967 (let ((out (assoc-ref outputs "out"))
5968 (utils-linux (assoc-ref inputs "utils-linux"))
5969 (cryptsetup (assoc-ref inputs "cryptsetup"))
5970 (linux-pam (assoc-ref inputs "linux-pam"))
5971 (lvm2 (assoc-ref inputs "lvm2")))
5972 (substitute* '("src/utils/ecryptfs-mount-private"
5973 "src/utils/ecryptfs-umount-private"
5974 "src/utils/ecryptfs-setup-private"
5975 "src/utils/ecryptfs-setup-swap"
5976 "src/utils/mount.ecryptfs.c"
5977 "src/utils/umount.ecryptfs.c"
5978 "src/pam_ecryptfs/pam_ecryptfs.c"
5979 "src/desktop/ecryptfs-mount-private.desktop.in"
5980 "src/desktop/ecryptfs-setup-private.desktop.in")
5981 (("/bin/mount")
5982 (string-append utils-linux "/bin/mount"))
5983 (("/bin/umount")
5984 (string-append utils-linux "/bin/umount"))
5985 (("/sbin/mount.ecryptfs_private")
5986 (string-append out "/sbin/mount.ecryptfs_private"))
5987 (("/sbin/umount.ecryptfs_private")
5988 (string-append out "/sbin/umount.ecryptfs_private"))
5989 (("/usr/bin/ecryptfs-mount-private")
5990 (string-append out "/bin/ecryptfs-mount-private"))
5991 (("/usr/bin/ecryptfs-rewrite-file")
5992 (string-append out "/bin/ecryptfs-rewrite-file"))
5993 (("/usr/bin/ecryptfs-setup-private")
5994 (string-append out "/bin/ecryptfs-setup-private"))
5995 (("/sbin/cryptsetup")
5996 (string-append cryptsetup "/sbin/cryptsetup"))
5997 (("/sbin/unix_chkpwd")
5998 (string-append linux-pam "/sbin/unix_chkpwd"))
5999 (("/sbin/dmsetup")
6000 (string-append lvm2 "/sbin/dmsetup")))))))))
6001 (native-inputs
6002 `(("intltool" ,intltool)
6003 ("perl" ,perl) ; for pod2man
6004 ("pkg-config" ,pkg-config)))
6005 (inputs
6006 `(("keyutils" ,keyutils)
6007 ("linux-pam" ,linux-pam)
6008 ("utils-linux" ,util-linux)
6009 ("cryptsetup" ,cryptsetup)
6010 ("lvm2" ,lvm2)
6011 ("nss" ,nss)))
6012 (home-page "https://ecryptfs.org/")
6013 (synopsis "eCryptfs cryptographic file system utilities")
6014 (description
6015 "eCryptfs is a POSIX-compliant stacked cryptographic file system for Linux.
6016 Each file's cryptographic meta-data is stored inside the file itself, along
6017 with the encrypted contents. This allows individual encrypted files to be
6018 copied between hosts and still be decrypted with the proper key. eCryptfs is a
6019 native Linux file system, and has been part of the Linux kernel since version
6020 2.6.19. This package contains the userland utilities to manage it.")
6021 ;; The files src/key_mod/ecryptfs_key_mod_{openssl,pkcs11_helper,tspi}.c
6022 ;; grant additional permission to link with OpenSSL.
6023 (license license:gpl2+)))
6024
6025 (define-public libnfsidmap
6026 (package
6027 (name "libnfsidmap")
6028 (version "0.27")
6029 (source
6030 (origin
6031 (method url-fetch)
6032 (uri (string-append "https://fedorapeople.org/~steved/"
6033 name "/" version "/" name "-" version ".tar.bz2"))
6034 (sha256
6035 (base32 "0bg2bcii424mf1bnp3fssr8jszbvhdxl7wvifm1yf6g596v8b8i5"))))
6036 (build-system gnu-build-system)
6037 (arguments
6038 `(#:configure-flags (list
6039 (string-append "--with-pluginpath="
6040 (assoc-ref %outputs "out")
6041 "/lib/libnfsidmap"))))
6042 (native-inputs
6043 `(("autoconf" ,autoconf))) ; 0.27 still needs autoheader
6044 (home-page
6045 "http://www.citi.umich.edu/projects/nfsv4/crossrealm/libnfsidmap_config.html")
6046 (synopsis "NFSv4 support library for name/ID mapping")
6047 (description "Libnfsidmap is a library holding mulitiple methods of
6048 mapping names to ids and visa versa, mainly for NFSv4. It provides an
6049 extensible array of mapping functions, currently consisting of two choices:
6050 the default @code{nsswitch} and the experimental @code{umich_ldap}.")
6051 (license (license:non-copyleft "file://COPYING"
6052 "See COPYING in the distribution."))))
6053
6054 (define-public module-init-tools
6055 (package
6056 (name "module-init-tools")
6057 (version "3.16")
6058 (source (origin
6059 (method url-fetch)
6060 (uri (string-append
6061 "mirror://kernel.org/linux/utils/kernel/module-init-tools/"
6062 "module-init-tools-" version ".tar.bz2"))
6063 (sha256
6064 (base32
6065 "0jxnz9ahfic79rp93l5wxcbgh4pkv85mwnjlbv1gz3jawv5cvwp1"))
6066 (patches (search-patches "module-init-tools-moduledir.patch"))))
6067 (build-system gnu-build-system)
6068 (arguments
6069 ;; FIXME: The upstream tarball lacks man pages, and building them would
6070 ;; require DocBook & co. We used to use Gentoo's pre-built man pages,
6071 ;; but they vanished. In the meantime, fake it.
6072 '(#:phases
6073 (modify-phases %standard-phases
6074 (add-before 'configure 'fake-docbook
6075 (lambda _
6076 (substitute* "Makefile.in"
6077 (("^DOCBOOKTOMAN.*$")
6078 "DOCBOOKTOMAN = true\n"))
6079 #t)))))
6080 (home-page "https://www.kernel.org/pub/linux/utils/kernel/module-init-tools/")
6081 (synopsis "Tools for loading and managing Linux kernel modules")
6082 (description
6083 "Tools for loading and managing Linux kernel modules, such as
6084 @code{modprobe}, @code{insmod}, @code{lsmod}, and more.")
6085 (license license:gpl2+)))
6086
6087 (define-public mcelog
6088 (package
6089 (name "mcelog")
6090 (version "176")
6091 (source
6092 (origin
6093 (method git-fetch)
6094 (uri (git-reference
6095 (url "https://git.kernel.org/pub/scm/utils/cpu/mce/mcelog.git")
6096 (commit (string-append "v" version))))
6097 (file-name (git-file-name name version))
6098 (sha256
6099 (base32 "1mlwn6ck9qiwqa2vg5wg1gvfva3jv7ygjr7p7bam0qszajs5pirk"))
6100 (modules '((guix build utils)))
6101 (snippet
6102 `(begin
6103 ;; The checkout lacks a .git directory, breaking ‘git describe’.
6104 (substitute* "Makefile"
6105 (("\"unknown\"") (string-append "\"v" ,version "\"")))
6106 #t))))
6107 (build-system gnu-build-system)
6108 (arguments
6109 `(#:phases (modify-phases %standard-phases
6110 (delete 'configure)) ; no configure script
6111 #:make-flags (let ((out (assoc-ref %outputs "out")))
6112 (list (string-append "CC=" ,(cc-for-target))
6113 (string-append "prefix=" out)
6114 (string-append "DOCDIR=" out "/share/doc/"
6115 ,name "-" ,version)
6116 "etcprefix=$(DOCDIR)/examples"))
6117 ;; The tests will only run as root on certain supported CPU models.
6118 #:tests? #f))
6119 (supported-systems (list "i686-linux" "x86_64-linux"))
6120 (home-page "https://mcelog.org/")
6121 (synopsis "Machine check monitor for x86 Linux systems")
6122 (description
6123 "The mcelog daemon logs memory, I/O, CPU, and other hardware errors on x86
6124 systems running the kernel Linux. It can also perform user-defined tasks, such
6125 as bringing bad pages off-line, when configurable error thresholds are
6126 exceeded.")
6127 (license license:gpl2)))
6128
6129 (define-public mtd-utils
6130 (package
6131 (name "mtd-utils")
6132 (version "2.1.2")
6133 (source (origin
6134 (method url-fetch)
6135 (uri (string-append
6136 "ftp://ftp.infradead.org/pub/mtd-utils/"
6137 "mtd-utils-" version ".tar.bz2"))
6138 (sha256
6139 (base32
6140 "1mp9fqgnz5r69s8ly98ry6k2blqnaqpllwi8m930dm0n8zrwbm4a"))))
6141 (arguments
6142 '(#:configure-flags '("--enable-unit-tests")))
6143 (native-inputs
6144 `(("cmocka" ,cmocka)
6145 ("pkg-config" ,pkg-config)))
6146 (inputs
6147 `(("acl" ,acl) ; extended attributes (xattr)
6148 ("libuuid" ,util-linux "lib")
6149 ("lzo" ,lzo)
6150 ("openssl" ,openssl) ; optional crypto support
6151 ("zlib" ,zlib)
6152 ("zstd" ,zstd "lib")))
6153 (build-system gnu-build-system)
6154 (synopsis "MTD Flash Storage Utilities")
6155 (description "This package provides utilities for testing, partitioning, etc
6156 of flash storage.")
6157 (home-page "http://www.linux-mtd.infradead.org/")
6158 (license
6159 (list license:gpl2 ; Almost everything is gpl2 or gpl2+
6160 license:mpl1.1 ; All ftl* files
6161 license:expat)))) ; libiniparser
6162
6163 (define-public libseccomp
6164 (package
6165 (name "libseccomp")
6166 (version "2.5.1")
6167 (source (origin
6168 (method url-fetch)
6169 (uri (string-append "https://github.com/seccomp/libseccomp/"
6170 "releases/download/v" version
6171 "/libseccomp-" version ".tar.gz"))
6172 (sha256
6173 (base32
6174 "0m8dlg1v7kflcxvajs4p76p275qwsm2abbf5mfapkakp7hw7wc7f"))))
6175 (build-system gnu-build-system)
6176 (arguments
6177 '(#:configure-flags '("--disable-static")
6178 #:phases (modify-phases %standard-phases
6179 (add-before 'check 'skip-load-test
6180 (lambda _
6181 ;; This test does a native system call and fails when
6182 ;; run under QEMU user-mode emulation. Just skip it.
6183 (delete-file "tests/52-basic-load.tests")
6184 #t)))))
6185 (native-inputs
6186 `(("gperf" ,gperf)
6187 ("which" ,which)))
6188 (synopsis "Interface to Linux's seccomp syscall filtering mechanism")
6189 (description "The libseccomp library provides an easy to use, platform
6190 independent, interface to the Linux Kernel's syscall filtering mechanism. The
6191 libseccomp API is designed to abstract away the underlying BPF based syscall
6192 filter language and present a more conventional function-call based filtering
6193 interface that should be familiar to, and easily adopted by, application
6194 developers.")
6195 (home-page "https://github.com/seccomp/libseccomp")
6196 (license license:lgpl2.1)))
6197
6198 (define-public radeontop
6199 (package
6200 (name "radeontop")
6201 (version "1.3")
6202 (source
6203 (origin
6204 (method git-fetch)
6205 (uri (git-reference
6206 (url "https://github.com/clbr/radeontop")
6207 (commit (string-append "v" version))))
6208 (file-name (git-file-name name version))
6209 (sha256
6210 (base32 "0ay6vl9zsz9b2scy0fnsy482pzizj52i27syxwny4z4i9wrk2wmn"))))
6211 (build-system gnu-build-system)
6212 (arguments
6213 `(#:phases (modify-phases %standard-phases
6214 ;; getver.sh uses ‘git --describe’, isn't worth an extra git
6215 ;; dependency, and doesn't even work on release(!) tarballs.
6216 (add-after 'unpack 'report-correct-version
6217 (lambda _
6218 (substitute* "getver.sh"
6219 (("ver=unknown")
6220 (string-append "ver=" ,version)))
6221 #t))
6222 (delete 'configure)) ; no configure script
6223 #:make-flags (list "CC=gcc"
6224 (string-append "PREFIX=" %output))
6225 #:tests? #f)) ; no tests
6226 (native-inputs
6227 `(("gettext" ,gettext-minimal)
6228 ("pkg-config" ,pkg-config)))
6229 (inputs
6230 `(("libdrm" ,libdrm)
6231 ("libpciaccess" ,libpciaccess)
6232 ("libxcb" ,libxcb)
6233 ("ncurses" ,ncurses)))
6234 (home-page "https://github.com/clbr/radeontop/")
6235 (synopsis "Usage monitor for AMD Radeon graphics")
6236 (description "RadeonTop monitors resource consumption on supported AMD
6237 Radeon Graphics Processing Units (GPUs), either in real time as bar graphs on
6238 a terminal or saved to a file for further processing. It measures both the
6239 activity of the GPU as a whole, which is also accurate during OpenCL
6240 computations, as well as separate component statistics that are only meaningful
6241 under OpenGL graphics workloads.")
6242 (license license:gpl3)))
6243
6244 (define-public efivar
6245 (package
6246 (name "efivar")
6247 (version "37")
6248 (source (origin
6249 (method url-fetch)
6250 (uri (string-append "https://github.com/rhboot/" name
6251 "/releases/download/" version "/" name
6252 "-" version ".tar.bz2"))
6253 (sha256
6254 (base32
6255 "17vvfivhsrszh7q39b6npjsrhrhsjf1cmmcpp3xrh6wh7ywzwrrw"))))
6256 (build-system gnu-build-system)
6257 (arguments
6258 `(;; Tests require a UEFI system and is not detected in the chroot.
6259 #:tests? #f
6260 #:make-flags (list (string-append "prefix=" %output)
6261 (string-append "libdir=" %output "/lib")
6262 "CC_FOR_BUILD=gcc"
6263 (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib"))
6264 #:phases
6265 (modify-phases %standard-phases
6266 (delete 'configure))))
6267 (native-inputs
6268 `(("pkg-config" ,pkg-config)))
6269 (inputs
6270 `(("popt" ,popt)))
6271 (home-page "https://github.com/rhboot/efivar")
6272 (synopsis "Tool and library to manipulate EFI variables")
6273 (description "This package provides a library and a command line
6274 interface to the variable facility of UEFI boot firmware.")
6275 (license license:lgpl2.1+)))
6276
6277 (define-public efibootmgr
6278 (package
6279 (name "efibootmgr")
6280 (version "17")
6281 (source
6282 (origin
6283 (method git-fetch)
6284 (uri (git-reference
6285 (url "https://github.com/rhinstaller/efibootmgr")
6286 (commit version)))
6287 (file-name (git-file-name name version))
6288 (sha256
6289 (base32 "1niicijxg59rsmiw3rsjwy4bvi1n42dynvm01lnp9haixdzdpq03"))
6290 (patches (search-patches "efibootmgr-remove-extra-decl.patch"))))
6291 (build-system gnu-build-system)
6292 (arguments
6293 `(#:tests? #f ;no tests
6294 #:make-flags (list (string-append "prefix=" %output)
6295 (string-append "libdir=" %output "/lib")
6296 ;; EFIDIR denotes a subdirectory relative to the
6297 ;; EFI System Partition where the loader will be
6298 ;; installed (known as OS_VENDOR in the code).
6299 ;; GRUB overrides this, as such it's only used if
6300 ;; nothing else is specified on the command line.
6301 "EFIDIR=gnu")
6302 #:phases (modify-phases %standard-phases (delete 'configure))))
6303 (native-inputs
6304 `(("pkg-config" ,pkg-config)))
6305 (inputs
6306 `(("efivar" ,efivar)
6307 ("popt" ,popt)))
6308 (home-page "https://github.com/rhinstaller/efibootmgr")
6309 (synopsis "Modify the Extensible Firmware Interface (EFI) boot manager")
6310 (description
6311 "@code{efibootmgr} is a user-space application to modify the Intel
6312 Extensible Firmware Interface (EFI) Boot Manager. This application can
6313 create and destroy boot entries, change the boot order, change the next
6314 running boot option, and more.")
6315 (license license:gpl2+)))
6316
6317 (define-public sysstat
6318 (package
6319 (name "sysstat")
6320 (version "12.4.3")
6321 (source
6322 (origin
6323 (method url-fetch)
6324 (uri (string-append "http://pagesperso-orange.fr/sebastien.godard/"
6325 "sysstat-" version ".tar.xz"))
6326 (sha256
6327 (base32 "1z8bdyj92q0capbrdscwzb51bqh54ng15gpvmjmvrb2syhqj8hxf"))))
6328 (build-system gnu-build-system)
6329 (arguments
6330 `(#:tests? #f ; no test suite.
6331 ;; Without this flag, it tries to install the man pages with group 'root'
6332 ;; and fails because /etc/passwd lacks an entry for the root user.
6333 #:configure-flags
6334 (list "--disable-file-attr"
6335 (string-append "conf_dir=" (assoc-ref %outputs "out") "/etc"))
6336 #:phases
6337 (modify-phases %standard-phases
6338 ;; The build process tries to create '/var/lib/sa', so we skip that
6339 ;; instruction.
6340 (add-after 'build 'skip-touching-var
6341 (lambda _
6342 (substitute* "Makefile"
6343 (("mkdir -p \\$\\(DESTDIR\\)\\$\\(SA_DIR\\)")
6344 ""))
6345 #t)))))
6346 (home-page "http://sebastien.godard.pagesperso-orange.fr/")
6347 (synopsis "Performance monitoring tools for Linux")
6348 (description "The sysstat utilities are a collection of performance
6349 monitoring tools for Linux. These include @code{mpstat}, @code{iostat},
6350 @code{tapestat}, @code{cifsiostat}, @code{pidstat}, @code{sar}, @code{sadc},
6351 @code{sadf} and @code{sa}.")
6352 (license license:gpl2+)))
6353
6354 (define-public light
6355 (package
6356 (name "light")
6357 (version "1.2.2")
6358 (source
6359 (origin
6360 (method git-fetch)
6361 (uri (git-reference
6362 (url "https://github.com/haikarainen/light")
6363 (commit (string-append "v" version))))
6364 (sha256
6365 (base32 "1a70zcf88ifsnwll486aicjnh48zisdf8f7vi34ihw61kdadsq9s"))
6366 (file-name (git-file-name name version))))
6367 (build-system gnu-build-system)
6368 (arguments
6369 `(#:phases
6370 (modify-phases %standard-phases
6371 (add-after 'unpack 'patch-udev-rules-absolute-path-bins
6372 (lambda* (#:key inputs #:allow-other-keys)
6373 (substitute* "90-backlight.rules"
6374 (("/bin/chgrp") (which "chgrp"))
6375 (("/bin/chmod") (which "chmod")))
6376 #t))
6377 (add-after 'install 'install-udev-rules
6378 (lambda* (#:key outputs #:allow-other-keys)
6379 (let ((out (assoc-ref outputs "out")))
6380 (install-file
6381 "90-backlight.rules" (string-append out "/lib/udev/rules.d"))
6382 #t))))))
6383 (native-inputs
6384 `(("autoconf" ,autoconf)
6385 ("automake" ,automake)))
6386 (home-page "https://haikarainen.github.io/light/")
6387 (synopsis "GNU/Linux application to control backlights")
6388 (description
6389 "Light is a program to send commands to screen backlight controllers
6390 under GNU/Linux. Features include:
6391
6392 @itemize
6393 @item It does not rely on X.
6394 @item Light can automatically figure out the best controller to use, making
6395 full use of underlying hardware.
6396 @item It is possible to set a minimum brightness value, as some controllers
6397 set the screen to be pitch black at a value of 0 (or higher).
6398 @end itemize\n")
6399 (license license:gpl3+)))
6400
6401 (define-public brightnessctl
6402 (package
6403 (name "brightnessctl")
6404 (version "0.5.1")
6405 (home-page "https://github.com/Hummer12007/brightnessctl")
6406 (source (origin
6407 (method git-fetch)
6408 (uri (git-reference (url home-page) (commit version)))
6409 (file-name (git-file-name name version))
6410 (sha256
6411 (base32
6412 "0immxc7almmpg80n3bdn834p3nrrz7bspl2syhb04s3lawa5y2lq"))))
6413 (build-system gnu-build-system)
6414 (arguments
6415 `(#:tests? #f ; no tests
6416 #:make-flags (list (string-append "CC=" ,(cc-for-target))
6417 (string-append "PREFIX=" %output)
6418 (string-append "UDEVDIR=" %output "/lib/udev/rules.d/"))
6419 #:phases
6420 (modify-phases %standard-phases
6421 (delete 'configure)
6422 (add-after 'unpack 'adjust-udev-rules
6423 (lambda _
6424 (substitute* "90-brightnessctl.rules"
6425 (("/bin/") "/run/current-system/profile/bin/"))
6426 #t)))))
6427 (synopsis "Backlight and LED brightness control")
6428 (description
6429 "This program allows you read and control device brightness. Devices
6430 include backlight and LEDs. It can also preserve current brightness before
6431 applying the operation, such as on lid close.
6432
6433 The appropriate permissions must be set on the backlight or LED control
6434 interface in sysfs, which can be accomplished with the included udev rules.")
6435 (license license:expat)))
6436
6437 (define-public tlp
6438 (package
6439 (name "tlp")
6440 (version "1.3.1")
6441 (source
6442 (origin
6443 (method git-fetch)
6444 (uri (git-reference
6445 (url "https://github.com/linrunner/TLP")
6446 (commit version)))
6447 (file-name (git-file-name name version))
6448 (sha256
6449 (base32 "14fcnaz9pw534v4d8dddqq4wcvpf1kghr8zlrk62r5lrl46sp1p5"))))
6450 (native-inputs
6451 `(("shellcheck" ,shellcheck)))
6452 (inputs
6453 `(("bash" ,bash)
6454 ("dbus" ,dbus)
6455 ("ethtool" ,ethtool)
6456 ("eudev" ,eudev)
6457 ("grep" ,grep)
6458 ("hdparm" ,hdparm)
6459 ("inetutils" ,inetutils)
6460 ("iw" ,iw)
6461 ("kmod" ,kmod)
6462 ("pciutils" ,pciutils)
6463 ("perl" ,perl)
6464 ("rfkill" ,rfkill)
6465 ("sed" ,sed)
6466 ("usbutils" ,usbutils)
6467 ("util-linux" ,util-linux)
6468 ("wireless-tools" ,wireless-tools)
6469 ,@(if (let ((system (or (%current-target-system)
6470 (%current-system))))
6471 (or (string-prefix? "i686-" system)
6472 (string-prefix? "x86_64-" system)))
6473 `(("x86-energy-perf-policy" ,x86-energy-perf-policy))
6474 '())))
6475 (build-system gnu-build-system)
6476 (arguments
6477 ;; XXX: The full test suite is run with "checkall" but it requires
6478 ;; "checkbashisms" and "perlcritic", not yet packaged in Guix.
6479 `(#:test-target "shellcheck"
6480 #:modules ((guix build gnu-build-system)
6481 (guix build utils)
6482 (srfi srfi-1))
6483 #:phases
6484 (modify-phases %standard-phases
6485 (delete 'configure) ; no configure script
6486 (add-before 'build 'setenv
6487 (lambda* (#:key outputs #:allow-other-keys)
6488 (let ((out (assoc-ref outputs "out")))
6489 (setenv "TLP_WITH_SYSTEMD" "0")
6490 (setenv "TLP_NO_INIT" "1")
6491 (setenv "TLP_NO_PMUTILS" "1")
6492 (setenv "TLP_SBIN" (string-append out "/bin"))
6493 (setenv "TLP_BIN" (string-append out "/bin"))
6494 (setenv "TLP_TLIB" (string-append out "/share/tlp"))
6495 (setenv "TLP_FLIB" (string-append out "/share/tlp/func.d"))
6496 (setenv "TLP_ULIB" (string-append out "/lib/udev"))
6497 (setenv "TLP_CONFDEF"
6498 (string-append out "/share/tlp/defaults.conf"))
6499 (setenv "TLP_CONFDIR" (string-append out "/etc/tlp.d"))
6500 (setenv "TLP_ELOD"
6501 (string-append out "/lib/elogind/system-sleep"))
6502 (setenv "TLP_SHCPL"
6503 (string-append out "/share/bash-completion/completions"))
6504 (setenv "TLP_MAN" (string-append out "/share/man"))
6505 (setenv "TLP_META" (string-append out "/share/metainfo"))
6506 #t)))
6507 (add-before 'install 'fix-installation
6508 (lambda _
6509 ;; Stop the Makefile from trying to create system directories.
6510 (substitute* "Makefile"
6511 (("\\[ -f \\$\\(_CONFUSR\\) \\]") "#")
6512 (("install -d -m 755 \\$\\(_VAR\\)") "#"))
6513 #t))
6514 (replace 'install
6515 (lambda _ (invoke "make" "install-tlp" "install-man-tlp")))
6516 (add-after 'install 'wrap
6517 (lambda* (#:key inputs outputs #:allow-other-keys)
6518 (let* ((bin (string-append (assoc-ref outputs "out") "/bin"))
6519 (bin-files (find-files bin ".*")))
6520 (define (bin-directory input-name)
6521 (let ((p (assoc-ref inputs input-name)))
6522 (and p (string-append p "/bin"))))
6523 (define (sbin-directory input-name)
6524 (string-append (assoc-ref inputs input-name) "/sbin"))
6525 (for-each (lambda (program)
6526 (wrap-program program
6527 `("PATH" ":" prefix
6528 ,(append
6529 (filter-map bin-directory
6530 '("bash"
6531 "coreutils"
6532 "dbus"
6533 "eudev"
6534 "grep"
6535 "inetutils"
6536 "kmod"
6537 "perl"
6538 "sed"
6539 "usbutils"
6540 "util-linux"
6541 "x86-energy-perf-policy"))
6542 (filter-map sbin-directory
6543 '("ethtool"
6544 "hdparm"
6545 "iw"
6546 "pciutils"
6547 "rfkill"
6548 "wireless-tools"))))))
6549 bin-files)
6550 #t))))))
6551 (home-page "https://linrunner.de/en/tlp/tlp.html")
6552 (synopsis "Power management tool for Linux")
6553 (description "TLP is a power management tool for Linux. It comes with
6554 a default configuration already optimized for battery life. Nevertheless,
6555 TLP is customizable to fulfil system requirements. TLP settings are applied
6556 every time the power supply source is changed.")
6557 ;; 'COPYING' is a custom version that says that one file is GPLv3+ and the
6558 ;; rest is GPLv2+.
6559 (license (list license:gpl2+ license:gpl3+))))
6560
6561 (define-public lshw
6562 (package
6563 (name "lshw")
6564 (version "B.02.19.2")
6565 (source (origin
6566 (method url-fetch)
6567 (uri (string-append "https://www.ezix.org/software/"
6568 "files/lshw-" version
6569 ".tar.gz"))
6570 (sha256
6571 (base32
6572 "100gm1c6gb2hkfws22h0xhvv7nz38p49lxd1csikj8qlhyn4gcwv"))))
6573 (build-system gnu-build-system)
6574 (arguments
6575 `(#:phases (modify-phases %standard-phases (delete 'configure))
6576 #:tests? #f ; no tests
6577 #:make-flags
6578 (list (string-append "PREFIX=" (assoc-ref %outputs "out")))))
6579 (synopsis "List hardware information")
6580 (description
6581 "@command{lshw} (Hardware Lister) is a small tool to provide
6582 detailed information on the hardware configuration of the machine.
6583 It can report exact memory configuration, firmware version, mainboard
6584 configuration, CPU version and speed, cache configuration, bus speed,
6585 and more on DMI-capable x86 or EFI (IA-64) systems and on some PowerPC
6586 machines (PowerMac G4 is known to work).")
6587 (home-page "https://www.ezix.org/project/wiki/HardwareLiSter")
6588 (license license:gpl2+)))
6589
6590 (define-public libmnl
6591 (package
6592 (name "libmnl")
6593 (version "1.0.4")
6594 (source
6595 (origin
6596 (method url-fetch)
6597 (uri (string-append "mirror://netfilter.org/libmnl/"
6598 "libmnl-" version ".tar.bz2"))
6599 (sha256
6600 (base32
6601 "108zampspaalv44zn0ar9h386dlfixpd149bnxa5hsi8kxlqj7qp"))))
6602 (build-system gnu-build-system)
6603 (home-page "https://www.netfilter.org/projects/libmnl/")
6604 (synopsis "Netlink utility library")
6605 (description "Libmnl is a minimalistic user-space library oriented to
6606 Netlink developers. There are a lot of common tasks in parsing, validating,
6607 constructing of both the Netlink header and TLVs that are repetitive and easy to
6608 get wrong. This library aims to provide simple helpers that allows you to
6609 re-use code and to avoid re-inventing the wheel.")
6610 (license license:lgpl2.1+)))
6611
6612 (define-public libnftnl
6613 (package
6614 (name "libnftnl")
6615 (version "1.1.9")
6616 (source
6617 (origin
6618 (method url-fetch)
6619 (uri (string-append "mirror://netfilter.org/libnftnl/"
6620 "libnftnl-" version ".tar.bz2"))
6621 (sha256
6622 (base32 "16jbp4fs5dz2yf4c3bl1sb48x9x9wi1chv39zwmfgya1k9pimcp9"))))
6623 (build-system gnu-build-system)
6624 (native-inputs
6625 `(("pkg-config" ,pkg-config)))
6626 (inputs
6627 `(("libmnl" ,libmnl)))
6628 (home-page "https://www.netfilter.org/projects/libnftnl/index.html")
6629 (synopsis "Netlink programming interface to the Linux nf_tables subsystem")
6630 (description "Libnftnl is a userspace library providing a low-level netlink
6631 programming interface to the in-kernel nf_tables subsystem. The library
6632 libnftnl has been previously known as libnftables. This library is currently
6633 used by nftables.")
6634 (license license:gpl2+)))
6635
6636 (define-public nftables
6637 (package
6638 (name "nftables")
6639 (version "0.9.8")
6640 (source
6641 (origin
6642 (method url-fetch)
6643 (uri (list (string-append "mirror://netfilter.org/nftables/nftables-"
6644 version ".tar.bz2")
6645 (string-append "https://www.nftables.org/projects/nftables"
6646 "/files/nftables-" version ".tar.bz2")))
6647 (sha256
6648 (base32 "1r4g22grhd4s1918wws9vggb8821sv4kkj8197ygxr6sar301z30"))))
6649 (build-system gnu-build-system)
6650 (arguments `(#:configure-flags
6651 '("--disable-man-doc"))) ; FIXME: Needs docbook2x.
6652 (inputs `(("gmp" ,gmp)
6653 ("libmnl" ,libmnl)
6654 ("libnftnl" ,libnftnl)
6655 ("readline" ,readline)))
6656 (native-inputs `(("pkg-config" ,pkg-config)
6657 ("bison" ,bison)
6658 ("flex" ,flex)))
6659 (home-page "https://www.nftables.org")
6660 (synopsis "Userspace utility for Linux packet filtering")
6661 (description "nftables is the project that aims to replace the existing
6662 {ip,ip6,arp,eb}tables framework. Basically, this project provides a new packet
6663 filtering framework, a new userspace utility and also a compatibility layer for
6664 {ip,ip6}tables. nftables is built upon the building blocks of the Netfilter
6665 infrastructure such as the existing hooks, the connection tracking system, the
6666 userspace queueing component and the logging subsystem.")
6667 (license license:gpl2)))
6668
6669 (define-public proot
6670 (package
6671 (name "proot")
6672 (version "5.1.0")
6673 (source
6674 (origin
6675 (method git-fetch)
6676 (uri (git-reference
6677 (url "https://github.com/proot-me/PRoot")
6678 (commit (string-append "v" version))))
6679 (file-name (git-file-name name version))
6680 (sha256
6681 (base32 "0azsqis99gxldmbcg43girch85ysg4hwzf0h1b44bmapnsm89fbz"))
6682 (patches (search-patches "proot-test-fhs.patch"))))
6683 (build-system gnu-build-system)
6684 (arguments
6685 '(#:make-flags '("-C" "src")
6686
6687 #:phases (modify-phases %standard-phases
6688 (delete 'configure)
6689 (add-before 'build 'set-shell-file-name
6690 (lambda* (#:key inputs #:allow-other-keys)
6691 (substitute* (find-files "src" "\\.[ch]$")
6692 (("\"/bin/sh\"")
6693 (string-append "\""
6694 (assoc-ref inputs "bash")
6695 "/bin/sh\"")))
6696 #t))
6697 (add-before 'check 'fix-fhs-assumptions-in-tests
6698 (lambda _
6699 (substitute* "tests/test-c6b77b77.mk"
6700 (("/bin/bash") (which "bash"))
6701 (("/usr/bin/test") (which "test")))
6702 (substitute* '("tests/test-16573e73.c")
6703 (("/bin/([a-z-]+)" _ program)
6704 (which program)))
6705
6706 (substitute* (find-files "tests" "\\.sh$")
6707 ;; Some of the tests try to "bind-mount" /bin/true.
6708 (("-b /bin/true:")
6709 (string-append "-b " (which "true") ":"))
6710 ;; Likewise for /bin.
6711 (("-b /bin:") "-b /gnu:")
6712 ;; Others try to run /bin/sh.
6713 (("/bin/sh") (which "sh"))
6714 ;; Others assume /etc/fstab exists.
6715 (("/etc/fstab") "/etc/passwd"))
6716
6717 (substitute* "tests/GNUmakefile"
6718 (("-b /bin:") "-b /gnu:"))
6719
6720 ;; XXX: This test fails in an obscure corner case, just
6721 ;; skip it.
6722 (delete-file "tests/test-kkkkkkkk.c")
6723
6724 #t))
6725 (replace 'check
6726 (lambda _
6727 (let ((n (parallel-job-count)))
6728 ;; For some reason we get lots of segfaults with
6729 ;; seccomp support (x86_64, Linux-libre 4.11.0).
6730 (setenv "PROOT_NO_SECCOMP" "1")
6731
6732 ;; Most of the tests expect "/bin" to be in $PATH so
6733 ;; they can run things that live in $ROOTFS/bin.
6734 (setenv "PATH"
6735 (string-append (getenv "PATH") ":/bin"))
6736
6737 (invoke "make" "check" "-C" "tests"
6738 ;;"V=1"
6739 "-j" (number->string n)))))
6740 (replace 'install
6741 (lambda* (#:key outputs #:allow-other-keys)
6742 ;; The 'install' rule does nearly nothing.
6743 (let* ((out (assoc-ref outputs "out"))
6744 (man1 (string-append out "/share/man/man1")))
6745 ;; TODO: 'make install-care' (does not even
6746 ;; build currently.)
6747 (invoke "make" "-C" "src" "install"
6748 (string-append "PREFIX=" out))
6749
6750 (mkdir-p man1)
6751 (copy-file "doc/proot/man.1"
6752 (string-append man1 "/proot.1"))
6753 #t))))))
6754 (native-inputs `(("which" ,which)
6755
6756 ;; For 'mcookie', used by some of the tests.
6757 ("util-linux" ,util-linux)
6758
6759 ;; XXX: Choose the old coreutils because its 'stat'
6760 ;; program does not use statx(2) when running 'stat -c
6761 ;; %a' or similar, which PRoot doesn't properly support.
6762 ("coreutils-old" ,coreutils-8.30)
6763
6764 ;; XXX: 'test-c6b77b77.sh' runs 'make' and that leads
6765 ;; make 4.3 to segfault.
6766 ("make-old" ,gnu-make-4.2)))
6767 (inputs `(("talloc" ,talloc)))
6768 (home-page "https://github.com/proot-me/PRoot")
6769 (synopsis "Unprivileged chroot, bind mount, and binfmt_misc")
6770 (description
6771 "PRoot is a user-space implementation of @code{chroot}, @code{mount --bind},
6772 and @code{binfmt_misc}. This means that users don't need any privileges or
6773 setup to do things like using an arbitrary directory as the new root
6774 file system, making files accessible somewhere else in the file system
6775 hierarchy, or executing programs built for another CPU architecture
6776 transparently through QEMU user-mode. Also, developers can use PRoot as a
6777 generic process instrumentation engine thanks to its extension mechanism.
6778 Technically PRoot relies on @code{ptrace}, an unprivileged system-call
6779 available in the kernel Linux.")
6780 (license license:gpl2+)))
6781
6782 (define-public proot-static
6783 (package
6784 (inherit proot)
6785 (name "proot-static")
6786 (synopsis
6787 "Unprivileged chroot, bind mount, and binfmt_misc (statically linked)")
6788 (inputs `(("talloc" ,talloc/static)))
6789 (arguments
6790 (substitute-keyword-arguments (package-arguments proot)
6791 ((#:make-flags flags)
6792 `(cons "LDFLAGS = -ltalloc -static -static-libgcc" ,flags))
6793 ((#:phases phases)
6794 `(modify-phases ,phases
6795 (add-after 'strip 'remove-store-references
6796 (lambda* (#:key outputs #:allow-other-keys)
6797 (let* ((out (assoc-ref outputs "out")))
6798 (with-directory-excursion out
6799 (remove-store-references "bin/proot")
6800 #t))))))
6801 ((#:allowed-references _ '("out"))
6802 '("out"))))))
6803
6804 (define-public cpuid
6805 (package
6806 (name "cpuid")
6807 (version "20201006")
6808 (source (origin
6809 (method url-fetch)
6810 (uri (string-append "http://www.etallen.com/cpuid/cpuid-"
6811 version ".src.tar.gz"))
6812 (sha256
6813 (base32
6814 "19jnkh57f979b78ak5mpxmdvnkgc33r55cw9shgd2hc380b3zi8k"))))
6815 (build-system gnu-build-system)
6816 (arguments
6817 `(#:make-flags
6818 (list (string-append "CC=" ,(cc-for-target)))
6819 #:tests? #f ; no tests
6820 #:phases (modify-phases %standard-phases
6821 (delete 'configure) ; no configure script
6822 (add-before 'install 'fix-makefile
6823 (lambda* (#:key outputs #:allow-other-keys)
6824 (substitute* "Makefile"
6825 (("\\$\\(BUILDROOT\\)/usr") (assoc-ref outputs "out")))
6826 ;; Make the compressed manpages writable so that the
6827 ;; reset-gzip-timestamps phase does not error out.
6828 (substitute* "Makefile"
6829 (("-m 444") "-m 644"))
6830 #t)))))
6831 (inputs `(("perl" ,perl)))
6832 (supported-systems '("i686-linux" "x86_64-linux"))
6833 (home-page "http://www.etallen.com/cpuid.html")
6834 (synopsis "Linux tool to dump x86 CPUID information about the CPU(s)")
6835 (description "cpuid dumps detailed information about the CPU(s) gathered
6836 from the CPUID instruction, and also determines the exact model of CPU(s). It
6837 supports Intel, AMD, and VIA CPUs, as well as older Transmeta, Cyrix, UMC,
6838 NexGen, Rise, and SiS CPUs.")
6839 (license license:gpl2+)))
6840
6841 (define-public jmtpfs
6842 (package
6843 (name "jmtpfs")
6844 (version "0.5")
6845 (source
6846 (origin
6847 (method git-fetch)
6848 (uri (git-reference
6849 (url "https://github.com/JasonFerrara/jmtpfs")
6850 (commit (string-append "v" version))))
6851 (file-name (git-file-name name version))
6852 (sha256
6853 (base32
6854 "1pm68agkhrwgrplrfrnbwdcvx5lrivdmqw8pb5gdmm3xppnryji1"))))
6855 (build-system gnu-build-system)
6856 (inputs
6857 `(("file" ,file)
6858 ("fuse" ,fuse)
6859 ("libmtp" ,libmtp)))
6860 (native-inputs
6861 `(("pkg-config" ,pkg-config)))
6862 (home-page "https://github.com/JasonFerrara/jmtpfs")
6863 (synopsis "Use a FUSE file system to access data over MTP")
6864 (description "jmtpfs uses FUSE (file system in userspace) to provide access
6865 to data over the Media Transfer Protocol (MTP). Unprivileged users can mount
6866 the MTP device as a file system.")
6867 (license license:gpl3)))
6868
6869 (define-public procenv
6870 (package
6871 (name "procenv")
6872 (version "0.55")
6873 (source
6874 (origin
6875 (method git-fetch)
6876 (uri (git-reference
6877 (url "https://github.com/jamesodhunt/procenv")
6878 (commit version)))
6879 (file-name (git-file-name name version))
6880 (sha256
6881 (base32 "13fnr4gfj2xlxghw93m5gsxzlwzv3s6jv9hja0w0pb23hlncbmhy"))))
6882 (build-system gnu-build-system)
6883 (native-inputs
6884 `(("pkg-config" ,pkg-config)
6885
6886 ;; For tests.
6887 ("check" ,check)
6888 ("groff" ,groff)))
6889 (inputs
6890 `(("expat" ,expat)
6891 ("libcap" ,libcap)
6892 ("libselinux" ,libselinux)))
6893 (synopsis "Utility to show process environment")
6894 (description "Procenv is a command-line tool that displays as much detail about
6895 itself and its environment as possible. It can be used as a test
6896 tool, to understand the type of environment a process runs in, and for
6897 comparing system environments.")
6898 (home-page "https://github.com/jamesodhunt/procenv/")
6899 (license license:gpl3+)))
6900
6901 (define-public libfabric
6902 (package
6903 (name "libfabric")
6904 (version "1.11.2")
6905 (source
6906 (origin
6907 (method url-fetch)
6908 (uri
6909 (string-append "https://github.com/ofiwg/libfabric/releases/download/v"
6910 version "/libfabric-" version ".tar.bz2"))
6911 (sha256
6912 (base32 "1nnpfkwxhim2nqjkb1vwrb4wj4j3l6w6yvvy69fqam2snlhshazz"))))
6913 (build-system gnu-build-system)
6914 (inputs `(("rdma-core" ,rdma-core)
6915 ,@(match (%current-system)
6916 ((member (package-supported-systems psm))
6917 `(("psm" ,psm)))
6918 (_ `()))
6919 ("libnl" ,libnl)))
6920 (home-page "https://ofiwg.github.io/libfabric/")
6921 (synopsis "Open Fabric Interfaces")
6922 (description
6923 "OpenFabrics Interfaces (OFI) is a framework focused on exporting fabric
6924 communication services to applications. OFI is best described as a collection
6925 of libraries and applications used to export fabric services. The key
6926 components of OFI are: application interfaces, provider libraries, kernel
6927 services, daemons, and test applications.
6928
6929 Libfabric is a core component of OFI. It is the library that defines and
6930 exports the user-space API of OFI, and is typically the only software that
6931 applications deal with directly. It works in conjunction with provider
6932 libraries, which are often integrated directly into libfabric.")
6933 (license (list license:bsd-2 license:gpl2)))) ;dual
6934
6935 (define-public psm
6936 (package
6937 (name "psm")
6938 (version "3.3.20170428")
6939 (home-page "https://github.com/intel/psm")
6940 (source
6941 (origin
6942 (method git-fetch)
6943 (uri (git-reference (url home-page)
6944 (commit "604758e76dc31e68d1de736ccf5ddf16cb22355b")))
6945 (file-name (string-append "psm-" version ".tar.gz"))
6946 (sha256
6947 (base32 "0nsb325dmhn5ia3d2cnksqr0gdvrrx2hmvlylfgvmaqdpq76zm85"))
6948 (patches (search-patches
6949 "psm-arch.patch" ; uname -p returns "unknown" on Debian 9
6950 "psm-ldflags.patch" ; build shared lib with LDFLAGS
6951 "psm-repro.patch" ; reproducibility
6952 "psm-disable-memory-stats.patch"))))
6953 (build-system gnu-build-system)
6954 (outputs '("out" "debug"))
6955 (inputs `(("libuuid" ,util-linux "lib")))
6956 (arguments
6957 '(#:make-flags `("PSM_USE_SYS_UUID=1" "CC=gcc" "WERROR="
6958 ,(string-append "INSTALL_PREFIX=" %output)
6959 ,(string-append "LDFLAGS=-Wl,-rpath=" %output "/lib"))
6960 #:tests? #f
6961 #:phases (modify-phases %standard-phases
6962 (delete 'configure)
6963 (add-after 'unpack 'patch-/usr/include
6964 (lambda _
6965 (substitute* "Makefile"
6966 (("\\$\\{DESTDIR}/usr/include")
6967 (string-append %output "/include")))
6968 (substitute* "Makefile"
6969 (("/lib64") "/lib"))
6970 #t))
6971 (add-after 'unpack 'patch-sysmacros
6972 (lambda _
6973 (substitute* "ipath/ipath_proto.c"
6974 (("#include <sys/poll.h>" m)
6975 (string-append m "\n"
6976 "#include <sys/sysmacros.h>")))
6977 #t)))))
6978 (synopsis "Intel Performance Scaled Messaging (PSM) Libraries")
6979 (description
6980 "The PSM Messaging API, or PSM API, is Intel's low-level user-level
6981 communications interface for the True Scale family of products. PSM users are
6982 enabled with mechanisms necessary to implement higher level communications
6983 interfaces in parallel environments.")
6984 ;; Only Intel-compatable processors are supported.
6985 (supported-systems '("i686-linux" "x86_64-linux"))
6986 (license (list license:bsd-2 license:gpl2)))) ;dual
6987
6988 (define-public snapscreenshot
6989 (package
6990 (name "snapscreenshot")
6991 (version "1.0.14.3")
6992 (source
6993 (origin
6994 (method url-fetch)
6995 (uri (string-append "http://bisqwit.iki.fi/src/arch/"
6996 name "-" version ".tar.bz2"))
6997 (sha256
6998 (base32 "0gzvqsbf6a2sbd1mqvj1lbm57i2bm5k0cr6ncr821d1f32gw03mk"))))
6999 (build-system gnu-build-system)
7000 (arguments
7001 `(#:make-flags
7002 (let ((out (assoc-ref %outputs "out")))
7003 (list (string-append "BINDIR=" out "/bin")
7004 (string-append "MANDIR=" out "/share/man")))
7005 #:tests? #f ; no test suite
7006 #:phases
7007 (modify-phases %standard-phases
7008 (delete 'configure) ; ./configure is a snarky no-op
7009 (add-before 'install 'fix-ownership
7010 ;; Install binaries owned by ‘root’ instead of the nonexistent ‘bin’.
7011 (lambda _
7012 (substitute* "depfun.mak"
7013 ((" -o bin -g bin ") " "))
7014 #t))
7015 (add-before 'install 'create-output-directories
7016 (lambda* (#:key outputs #:allow-other-keys)
7017 (let ((out (assoc-ref outputs "out")))
7018 (mkdir-p (string-append out "/share/man/man1"))
7019 #t))))))
7020 (home-page "https://bisqwit.iki.fi/source/snapscreenshot.html")
7021 (synopsis "Take screenshots of one or more Linux text consoles")
7022 (description
7023 "snapscreenshot saves a screenshot of one or more Linux text consoles as a
7024 Targa (@dfn{.tga}) image. It can be used by anyone with read access to the
7025 relevant @file{/dev/vcs*} file(s).")
7026 (license license:gpl2)))
7027
7028 (define-public fbcat
7029 (package
7030 (name "fbcat")
7031 (version "0.5.1")
7032 (source
7033 (origin
7034 (method url-fetch)
7035 (uri (string-append "https://github.com/jwilk/fbcat/releases/download/"
7036 version "/" name "-" version ".tar.gz"))
7037 (sha256
7038 (base32 "0pj9hxmwhbz6kmd7847yx2jh1scl9l25zgndyi8s9vlzdkq2q8d7"))))
7039 (build-system gnu-build-system)
7040 (inputs
7041 ;; The ‘fbgrab’ wrapper can use one of several PPM-to-PNG converters. We
7042 ;; choose netpbm simply because it's the smallest. It still adds ~94 MiB
7043 ;; to an otherwise tiny package, so we put ‘fbgrab’ in its own output.
7044 `(("pnmtopng" ,netpbm)))
7045 (outputs (list "out" "fbgrab"))
7046 (arguments
7047 `(#:make-flags
7048 (list "CC=gcc"
7049 (string-append "PREFIX=" (assoc-ref %outputs "out")))
7050 #:tests? #f ; no tests
7051 #:phases
7052 (modify-phases %standard-phases
7053 (delete 'configure) ; no configure script
7054 (add-after 'build 'qualify-references
7055 (lambda* (#:key inputs outputs #:allow-other-keys)
7056 (let* ((pnmtopng (assoc-ref inputs "pnmtopng"))
7057 (out (assoc-ref outputs "out")))
7058 (substitute* "fbgrab"
7059 (("fbcat" all)
7060 (string-append out "/bin/" all))
7061 (("pnmtopng" all)
7062 (string-append pnmtopng "/bin/" all)))
7063 #t)))
7064 (add-after 'install 'split-fbgrab-output
7065 (lambda* (#:key outputs #:allow-other-keys)
7066 (let* ((out (assoc-ref outputs "out"))
7067 (out:fbgrab (assoc-ref outputs "fbgrab")))
7068 (for-each (lambda (file)
7069 (let ((old (string-append out "/" file))
7070 (new (string-append out:fbgrab "/" file)))
7071 (mkdir-p (dirname new))
7072 (rename-file old new)))
7073 (list "bin/fbgrab"
7074 "share/man/man1/fbgrab.1"))
7075 #t))))))
7076 (home-page "https://jwilk.net/software/fbcat")
7077 (synopsis "Take a screenshot of the contents of the Linux framebuffer")
7078 (description
7079 "fbcat saves the contents of the Linux framebuffer (@file{/dev/fb*}), or
7080 a dump therof. It supports a wide range of drivers and pixel formats.
7081 @command{fbcat} can take screenshots of virtually any application that can be
7082 made to write its output to the framebuffer, including (but not limited to)
7083 text-mode or graphical applications that don't use a display server.
7084
7085 Also included is @command{fbgrab}, a wrapper around @command{fbcat} that
7086 emulates the behaviour of Gunnar Monell's older fbgrab utility.")
7087 (license license:gpl2)))
7088
7089 (define-public libcgroup
7090 (package
7091 (name "libcgroup")
7092 (version "0.41")
7093 (source
7094 (origin
7095 (method url-fetch)
7096 (uri (string-append
7097 "mirror://sourceforge/libcg/" name "/"
7098 version "/" name "-" version ".tar.bz2"))
7099 (sha256
7100 (base32 "0lgvyq37gq84sk30sg18admxaj0j0p5dq3bl6g74a1ppgvf8pqz4"))))
7101 (build-system gnu-build-system)
7102 (arguments
7103 `(#:tests? #f))
7104 (native-inputs
7105 `(("bison" ,bison)
7106 ("flex" ,flex)))
7107 (inputs
7108 `(("linux-pam" ,linux-pam)))
7109 (home-page "https://sourceforge.net/projects/libcg/")
7110 (synopsis "Control groups management tools")
7111 (description "Control groups is Linux kernel method for process resource
7112 restriction, permission handling and more. This package provides userspace
7113 interface to this kernel feature.")
7114 (license license:lgpl2.1)))
7115
7116 (define-public mbpfan
7117 (package
7118 (name "mbpfan")
7119 (version "2.2.1")
7120 (source
7121 (origin
7122 (method git-fetch)
7123 (uri (git-reference
7124 (url "https://github.com/dgraziotin/mbpfan")
7125 (commit (string-append "v" version))))
7126 (file-name (git-file-name name version))
7127 (sha256
7128 (base32 "0gc9ypxi55vxs77nx8ihhh9zk7fr9v0m0zfm76q7x0bi6jz11mbr"))))
7129 (build-system gnu-build-system)
7130 (arguments
7131 `(#:tests? #f ; tests ask to be run as root
7132 #:make-flags (let ((out (assoc-ref %outputs "out")))
7133 (list (string-append "DESTDIR=" out)
7134 ,(string-append "CC=" (cc-for-target))))
7135 #:phases
7136 (modify-phases %standard-phases
7137 (add-after 'unpack 'patch-paths
7138 (lambda _
7139 (substitute* "Makefile"
7140 (("/usr") ""))
7141 #t))
7142 (delete 'configure)))) ; there's no configure phase
7143 (home-page "https://github.com/dgraziotin/mbpfan")
7144 (synopsis "Control fan speed on Macbooks")
7145 (description
7146 "mbpfan is a fan control daemon for Apple Macbooks. It uses input from
7147 the @code{coretemp} module and sets the fan speed using the @code{applesmc}
7148 module. It can be executed as a daemon or in the foreground with root
7149 privileges.")
7150 (license license:gpl3+)))
7151
7152 (define-public psm2
7153 (package
7154 (name "psm2")
7155 (version "11.2.185")
7156 (source (origin
7157 (method git-fetch)
7158 (uri (git-reference
7159 (url "https://github.com/intel/opa-psm2")
7160 (commit (string-append "PSM2_" version))))
7161 (file-name (git-file-name name version))
7162 (sha256
7163 (base32
7164 "062hg4r6gz7pla9df70nqs5i2a3mp1wszmp4l0g771fykhhrxsjg"))))
7165 (build-system gnu-build-system)
7166 (arguments
7167 '(#:make-flags
7168 `(,(string-append "LDFLAGS=-Wl,-rpath=" %output "/lib"))
7169 #:tests? #f
7170 #:phases (modify-phases %standard-phases
7171 (delete 'configure)
7172 (add-after 'unpack 'patch-Makefiles
7173 (lambda _
7174 (substitute* "Makefile"
7175 (("/lib64") "/lib")
7176 (("/usr") ""))
7177 (substitute* "compat/Makefile"
7178 (("/lib64") "/lib")
7179 (("/usr") ""))
7180 #t))
7181 (replace 'install
7182 (lambda _
7183 (setenv "DESTDIR" %output)
7184 (invoke "make" "install")
7185 #t)))))
7186 (inputs
7187 `(("rdma-core" ,rdma-core)
7188 ("numactl" ,numactl)))
7189 (synopsis "Intel Performance Scaled Messaging 2 (PSM2) library")
7190 (description
7191 "This package is low-level user-level Intel's communications interface.
7192 The PSM2 API is a high-performance vendor-specific protocol that provides a
7193 low-level communications interface for the Intel Omni-Path family of
7194 high-speed networking devices.")
7195 (home-page "https://github.com/intel/opa-psm2")
7196 ;; Only the x86_64 architecure is supported.
7197 (supported-systems '("x86_64-linux"))
7198 (license (list license:bsd-3 license:gpl2)))) ; dual
7199
7200 (define-public libpfm4
7201 (package
7202 (name "libpfm4")
7203 (version "4.9.0")
7204 (source (origin
7205 (method url-fetch)
7206 (uri (string-append "mirror://sourceforge/perfmon2/"
7207 name "/libpfm-" version ".tar.gz"))
7208 (sha256
7209 (base32
7210 "1qp4g4n6dw42p2w5rkwzdb7ynk8h7g5vg01ybpmvxncgwa7bw3yv"))))
7211 (build-system gnu-build-system)
7212 (arguments
7213 '(#:modules ((guix build utils)
7214 (guix build gnu-build-system))
7215 #:phases (modify-phases %standard-phases
7216 (delete 'configure)
7217 (delete 'check)
7218 (replace 'build
7219 (lambda* (#:key inputs outputs #:allow-other-keys)
7220 (let* ((out (assoc-ref outputs "out")))
7221 (setenv "CC" "gcc")
7222 (invoke "make")
7223 #t)))
7224 (replace 'install
7225 (lambda* (#:key outputs #:allow-other-keys)
7226 (let* ((out (assoc-ref outputs "out")))
7227 (invoke "make"
7228 (string-append "PREFIX=" out)
7229 "install")
7230 #t))))))
7231 (synopsis "Performance event monitoring library")
7232 (description
7233 "This package provides a library called libpfm4, which is used to develop
7234 monitoring tools exploiting the performance monitoring events such as those
7235 provided by the Performance Monitoring Unit (PMU) of modern processors.
7236
7237 Libpfm4 helps convert from an event name, expressed as a string, to the event
7238 encoding that is either the raw event as documented by the hardware vendor or
7239 the OS-specific encoding. In the latter case, the library is able to prepare
7240 the OS-specific data structures needed by the kernel to setup the event.
7241
7242 libpfm4 provides support for the @code{perf_events} interface, which was
7243 introduced in Linux 2.6.31.")
7244 (home-page "http://perfmon2.sourceforge.net/")
7245 (license license:expat)))
7246
7247 (define-public libnfnetlink
7248 (package
7249 (name "libnfnetlink")
7250 (version "1.0.1")
7251 (source (origin
7252 (method url-fetch)
7253 (uri (string-append
7254 "https://www.netfilter.org/projects/libnfnetlink/files/"
7255 "libnfnetlink-" version ".tar.bz2"))
7256 (sha256
7257 (base32
7258 "06mm2x4b01k3m7wnrxblk9j0mybyr4pfz28ml7944xhjx6fy2w7j"))))
7259 (build-system gnu-build-system)
7260 (home-page "https://www.netfilter.org/projects/libnfnetlink/")
7261 (synopsis "Low-level netfilter netlink communication library")
7262 (description
7263 "@code{libnfnetlink} is the low-level library for netfilter related
7264 kernel/userspace communication. It provides a generic messaging
7265 infrastructure for in-kernel netfilter subsystems (such as nfnetlink_log,
7266 nfnetlink_queue, nfnetlink_conntrack) and their respective users and/or
7267 management tools in userspace.")
7268 (license license:gpl2)))
7269
7270 (define-public go-netlink
7271 (package
7272 (name "go-netlink")
7273 (version "1.0.0")
7274 (source (origin
7275 (method git-fetch)
7276 (uri (git-reference
7277 (url "https://github.com/vishvananda/netlink")
7278 (commit (string-append "v" version))))
7279 (file-name (git-file-name name version))
7280 (sha256
7281 (base32
7282 "0hpzghf1a4cwawzhkiwdzin80h6hd09fskl77d5ppgc084yvj8x0"))))
7283 (build-system go-build-system)
7284 (arguments
7285 `(#:import-path "github.com/vishvananda/netlink"))
7286 (native-inputs
7287 `(("go-golang-org-x-sys" ,go-golang-org-x-sys)
7288 ("go-netns" ,go-netns)))
7289 (home-page "https://github.com/vishvananda/netlink")
7290 (synopsis "Simple netlink library for Go")
7291 (description "The netlink package provides a simple netlink library for
7292 Go. Netlink is the interface a user-space program in Linux uses to
7293 communicate with the kernel. It can be used to add and remove interfaces, set
7294 IP addresses and routes, and configure IPsec.")
7295 (license license:asl2.0)))
7296
7297 (define-public libinih
7298 (package
7299 (name "libinih")
7300 (version "53")
7301 (source (origin
7302 (method git-fetch)
7303 (uri (git-reference
7304 (url "https://github.com/benhoyt/inih")
7305 (commit (string-append "r" version))))
7306 (file-name (git-file-name name version))
7307 (sha256
7308 (base32
7309 "0dqf5j2sw4hq68rqvxbrsf44ygfzx9ypiyzipk4cvp9aimbvsbc6"))))
7310 (build-system meson-build-system)
7311 (arguments
7312 '(#:configure-flags '("-Ddistro_install=true" "-Ddefault_library=shared")))
7313 (home-page "https://github.com/benhoyt/inih")
7314 (synopsis "Simple .INI parser library for C")
7315 (description "The inih (INI Not Invented Here) library is a simple .INI file
7316 parser written in C. It's only a couple of pages of code, and it was designed to
7317 be small and simple, so it's good for embedded systems. It's also more or less
7318 compatible with Python's ConfigParser style of .INI files, including RFC
7319 822-style multi-line syntax and name: value entries.")
7320 (license license:bsd-3)))
7321
7322 (define-public xfsprogs
7323 (package
7324 (name "xfsprogs")
7325 (version "5.11.0")
7326 (source (origin
7327 (method url-fetch)
7328 (uri (string-append
7329 "mirror://kernel.org/linux/utils/fs/xfs/xfsprogs/"
7330 "xfsprogs-" version ".tar.gz"))
7331 (sha256
7332 (base32
7333 "1byj53qdwsii35d0f11nz0dl618mpvwy5aa44pc9zg281g2r27ab"))))
7334 (build-system gnu-build-system)
7335 (outputs (list "out" "python"))
7336 (arguments
7337 `(#:tests? #f ; kernel/user integration tests are in package "xfstests"
7338 #:phases
7339 (modify-phases %standard-phases
7340 (add-after 'install 'separate-python-output
7341 (lambda* (#:key outputs #:allow-other-keys)
7342 (let ((out (assoc-ref outputs "out"))
7343 (python (assoc-ref outputs "python")))
7344 (for-each
7345 (lambda (script)
7346 (mkdir-p (string-append python (dirname script)))
7347 (rename-file (string-append out script)
7348 (string-append python script)))
7349 (list "/sbin/xfs_scrub_all"))
7350 #t)))
7351 (add-after 'install 'install-headers
7352 (lambda _
7353 (invoke "make" "install-dev"))))))
7354 (native-inputs
7355 `(("gettext" ,gettext-minimal)))
7356 (inputs
7357 `(("libinih" ,libinih)
7358 ("libuuid" ,util-linux "lib")
7359 ("python" ,python-wrapper)))
7360 (home-page "https://xfs.wiki.kernel.org/")
7361 (synopsis "XFS file system tools")
7362 (description "This package provides commands to create and check XFS
7363 file systems.")
7364 ;; The library "libhandle" and the headers in "xfslibs-dev" are
7365 ;; licensed under lgpl2.1. the other stuff is licensed under gpl2.
7366 (license (list license:gpl2 license:lgpl2.1))))
7367
7368 (define-public genext2fs
7369 (package
7370 (name "genext2fs")
7371 (version "1.4.1-4")
7372 (source (origin
7373 (method git-fetch)
7374 (uri (git-reference
7375 (url "https://github.com/jeremie-koenig/genext2fs")
7376 ;; 1.4.1-3 had a VCS tag but 1.4.1-4 doesn't.
7377 (commit "9ee43894634998b0b2b309d636f25c64314c9421")))
7378 (file-name (git-file-name name version))
7379 (sha256
7380 (base32 "0ib5icn78ciz00zhc1bgdlrwaxvsdz7wnplwblng0jirwi9ml7sq"))))
7381 (build-system gnu-build-system)
7382 (arguments
7383 `(#:phases
7384 (modify-phases %standard-phases
7385 (add-after 'unpack 'apply-debian-patches
7386 ;; Debian changes (the revision after ‘-’ in VERSION) are
7387 ;; maintained as separate patches. Apply those relevant to us.
7388 (lambda _
7389 (for-each
7390 (lambda (file-name)
7391 (invoke "patch" "-p1" "-i"
7392 (string-append "debian/patches/" file-name)))
7393 (list "blocksize+creator.diff" ; add -B/-o options
7394 "byteswap_fix.diff"))
7395 #t)))))
7396 (native-inputs
7397 `(("autoconf" ,autoconf)
7398 ("automake" ,automake)))
7399 (home-page "https://github.com/jeremie-koenig/genext2fs")
7400 (synopsis "Generate ext2 file system as a normal user")
7401 (description "This package provides a program to generate an ext2
7402 file system as a normal (non-root) user. It does not require you to mount
7403 the image file to copy files on it, nor does it require that you become
7404 the superuser to make device nodes.")
7405 (license license:gpl2)))
7406
7407 (define-public fakeroot
7408 (package
7409 (name "fakeroot")
7410 (version "1.25.3")
7411 (source (origin
7412 ;; There are no tags in the repository, so take this snapshot.
7413 (method url-fetch)
7414 (uri (string-append "https://deb.debian.org/debian/pool/main/f/"
7415 "fakeroot/fakeroot_" version ".orig.tar.gz"))
7416 (file-name (string-append name "-" version ".tar.gz"))
7417 (sha256
7418 (base32
7419 "0v4m3v1bdqvblwj3vqsb3mllgbci6dsgsydq6765nzvz6n1kd44f"))))
7420 (build-system gnu-build-system)
7421 (arguments
7422 `(#:phases
7423 (modify-phases %standard-phases
7424 (replace 'bootstrap
7425 (lambda _
7426 ;; The "preroll" script takes care of Autoconf and also
7427 ;; prepares the translated manuals.
7428 (invoke "sh" "./preroll")))
7429 (add-after 'configure 'patch-Makefile
7430 (lambda _
7431 ;; Note: The root of the problem is already in "Makefile.am".
7432 (substitute* "Makefile"
7433 (("/bin/sh") (which "sh")))
7434 #t))
7435 (add-after 'unpack 'patch-script
7436 (lambda* (#:key inputs #:allow-other-keys)
7437 (substitute* "scripts/fakeroot.in"
7438 (("getopt")
7439 (string-append (assoc-ref inputs "util-linux")
7440 "/bin/getopt"))
7441 (("sed")
7442 (string-append (assoc-ref inputs "sed")
7443 "/bin/sed"))
7444 (("cut")
7445 (string-append (assoc-ref inputs "coreutils")
7446 "/bin/cut")) )
7447 #t))
7448 (add-before 'configure 'setenv
7449 (lambda _
7450 (setenv "LIBS" "-lacl")
7451 #t))
7452 (add-before 'check 'prepare-check
7453 (lambda _
7454 (setenv "SHELL" (which "bash"))
7455 (setenv "VERBOSE" "1")
7456 (substitute* "test/t.touchinstall"
7457 ;; We don't have the name of the root user, so use ID=0.
7458 (("grep root") "grep \"\\<0\\>\""))
7459 (substitute* "test/tartest"
7460 ;; We don't have the name of the root group, so use ID=0.
7461 (("ROOTGROUP=root") "ROOTGROUP=0")
7462 ;; We don't have the name of the daemon user, so use IDs.
7463 (("daemon:sys") "1:3")
7464 (("daemon:") "1:"))
7465 ;; We don't have an /etc/passwd entry for "root" - use numeric IDs.
7466 (substitute* "test/compare-tar"
7467 (("tar -tvf") "tar --numeric-owner -tvf"))
7468 #t)))))
7469 (native-inputs
7470 `(;; For bootstrapping the package.
7471 ("autoconf" ,autoconf)
7472 ("automake" ,automake)
7473 ("libtool" ,libtool)
7474 ("gettext" ,gettext-minimal)
7475 ("po4a" ,po4a)
7476
7477 ;; For tests.
7478 ("sharutils" ,sharutils)
7479 ("xz" ,xz)))
7480 (inputs
7481 `(("acl" ,acl)
7482 ("libcap" ,libcap)
7483 ("util-linux" ,util-linux)
7484 ("sed" ,sed)
7485 ("coreutils" ,coreutils)))
7486 (synopsis "Provides a fake root environment")
7487 (description "@command{fakeroot} runs a command in an environment where
7488 it appears to have root privileges for file manipulation. This is useful
7489 for allowing users to create archives (tar, ar, .deb etc.) with files in
7490 them with root permissions/ownership. Without fakeroot one would have to
7491 have root privileges to create the constituent files of the archives with
7492 the correct permissions and ownership, and then pack them up, or one would
7493 have to construct the archives directly, without using the archiver.")
7494 (home-page "http://freshmeat.sourceforge.net/projects/fakeroot")
7495 (license license:gpl3+)))
7496
7497 (define-public fakechroot
7498 (package
7499 (name "fakechroot")
7500 (version "2.20.1")
7501 (source (origin
7502 (method url-fetch)
7503 (uri (string-append
7504 "https://github.com/dex4er/fakechroot/releases/download/"
7505 version "/fakechroot-" version ".tar.gz"))
7506 (sha256
7507 (base32
7508 "1aijkd0b45wav25v01qhw8zxwa3pl0nnp9fabmmy1nlx7hr09gas"))))
7509 (build-system gnu-build-system)
7510 (arguments
7511 ;; XXX: The tests heavily assume they run on an FHS system so for now
7512 ;; skip them.
7513 '(#:tests? #f
7514 #:configure-flags '("--disable-static")))
7515 (synopsis "Emulate @code{chroot} by overriding file system calls")
7516 (description
7517 "@command{fakechroot} runs a command in an environment were is additional
7518 possibility to use @code{chroot} command without root privileges. This is
7519 useful for allowing users to create own chrooted environment with possibility
7520 to install another packages without need for root privileges.
7521
7522 It works by providing @file{libfakechroot.so}, a shared library meant to be
7523 set as @code{LD_PRELOAD} to override the C library file system functions.")
7524 (home-page "https://github.com/dex4er/fakechroot/")
7525 (license license:lgpl2.1+)))
7526
7527 (define-public inputattach
7528 (package
7529 (name "inputattach")
7530 (version "0.42.0")
7531 (source (origin
7532 (method git-fetch)
7533 (uri (git-reference
7534 (url "https://github.com/linuxwacom/input-wacom")
7535 (commit (string-append "input-wacom-" version))))
7536 (file-name (git-file-name name version))
7537 (sha256
7538 (base32 "04lnn7v0rm4ppbya140im5d4igcl6c1nrqpgbsr0i8wkral0nv7j"))))
7539 (build-system gnu-build-system)
7540 (arguments
7541 `(#:phases
7542 (modify-phases %standard-phases
7543 (delete 'bootstrap)
7544 (delete 'configure)
7545 (replace 'build
7546 (lambda* (#:key inputs #:allow-other-keys)
7547 (with-directory-excursion "inputattach"
7548 (invoke (string-append (assoc-ref inputs "gcc")
7549 "/bin/gcc")
7550 "-O2" "-o" "inputattach" "inputattach.c"))
7551 #t))
7552 (delete 'check)
7553 (replace 'install
7554 (lambda* (#:key outputs #:allow-other-keys)
7555 (let ((target-dir (string-append
7556 (assoc-ref outputs "out")
7557 "/bin/")))
7558 (mkdir-p target-dir)
7559 (copy-file "inputattach/inputattach"
7560 (string-append target-dir
7561 "inputattach"))
7562 #t))))))
7563 (home-page "https://linuxwacom.github.io/")
7564 (synopsis "Dispatch input peripherals events to a device file")
7565 (description "inputattach dispatches input events from several device
7566 types and interfaces and translates so that the X server can use them.")
7567 (license license:gpl2+)))
7568
7569 (define-public pipewire
7570 (package
7571 (name "pipewire")
7572 (version "0.2.7")
7573 (source (origin
7574 (method git-fetch)
7575 (uri (git-reference
7576 (url "https://github.com/PipeWire/pipewire")
7577 (commit version)))
7578 (file-name (git-file-name name version))
7579 (sha256
7580 (base32
7581 "1q5wrqnhhs6r49p8yvkw1pl0cnsd4rndxy4h5lvdydwgf1civcwc"))))
7582 (build-system meson-build-system)
7583 (arguments
7584 '(#:configure-flags '("-Dsystemd=false")))
7585 (native-inputs
7586 `(("pkg-config" ,pkg-config)))
7587 (inputs
7588 `(("alsa-lib" ,alsa-lib)
7589 ("dbus" ,dbus)
7590 ("eudev" ,eudev)
7591 ("ffmpeg" ,ffmpeg)
7592 ("gstreamer" ,gstreamer)
7593 ("gst-plugins-base" ,gst-plugins-base)
7594 ("libva" ,libva)
7595 ("sbc" ,sbc)
7596 ("sdl2" ,sdl2)))
7597 (home-page "https://pipewire.org/")
7598 (synopsis "Server and user space API to deal with multimedia pipelines")
7599 (description
7600 "PipeWire is a project that aims to greatly improve handling of audio and
7601 video under Linux. It aims to support the usecases currently handled by both
7602 PulseAudio and Jack and at the same time provide same level of powerful handling
7603 of Video input and output. It also introduces a security model that makes
7604 interacting with audio and video devices from containerized applications easy,
7605 with supporting Flatpak applications being the primary goal. Alongside Wayland
7606 and Flatpak we expect PipeWire to provide a core building block for the future
7607 of Linux application development.")
7608 (license license:lgpl2.0+)))
7609
7610 (define-public pipewire-0.3
7611 (package
7612 (inherit pipewire)
7613 (name "pipewire")
7614 (version "0.3.22")
7615 (source (origin
7616 (method git-fetch)
7617 (uri (git-reference
7618 (url "https://github.com/PipeWire/pipewire")
7619 (commit version)))
7620 (file-name (git-file-name name version))
7621 (sha256
7622 (base32
7623 "1ywna5f5v8s79ivrqfwwc8vy6sn3a2zvfwqyalf1fypj5d90w8g9"))))
7624 (arguments
7625 '(#:configure-flags
7626 (list (string-append "-Dudevrulesdir=" (assoc-ref %outputs "out")
7627 "/lib/udev/rules.d")
7628 "-Dsystemd=false")
7629 #:phases
7630 (modify-phases %standard-phases
7631 ;; Skip shrink-runpath, otherwise validate-runpath fails.
7632 (delete 'shrink-runpath))))
7633 (inputs
7634 (append (package-inputs pipewire)
7635 `(("bluez" ,bluez)
7636 ("jack" ,jack-2)
7637 ("pulseaudio" ,pulseaudio)
7638 ("vulkan-loader" ,vulkan-loader)
7639 ("vulkan-headers" ,vulkan-headers))))))
7640
7641 (define-public ell
7642 (package
7643 (name "ell")
7644 (version "0.40")
7645 (source (origin
7646 (method git-fetch)
7647 (uri (git-reference
7648 (url "https://git.kernel.org/pub/scm/libs/ell/ell.git")
7649 (commit version)))
7650 (file-name (git-file-name name version))
7651 (sha256
7652 (base32
7653 "1zzpbfdpmfldd7w0h7mwbq0mfqgqwz54nqbq0rmbqlqqpwlkrgb2"))))
7654 (build-system gnu-build-system)
7655 (arguments
7656 `(#:phases
7657 (modify-phases %standard-phases
7658 (add-after 'unpack 'fix-dbus-tests
7659 (lambda _
7660 (substitute* '("unit/test-dbus-message-fds.c"
7661 "unit/test-dbus-properties.c"
7662 "unit/test-dbus.c")
7663 (("/usr/bin/dbus-daemon") (which "dbus-daemon")))
7664 #t)))))
7665 (inputs
7666 `(("dbus" ,dbus)))
7667 (native-inputs
7668 `(("autoconf" ,autoconf)
7669 ("libtool" ,libtool)
7670 ("pkgconfig" ,pkg-config)
7671 ("automake" ,automake)))
7672 (home-page "https://01.org/ell")
7673 (synopsis "Embedded Linux Library")
7674 (description "The Embedded Linux* Library (ELL) provides core, low-level
7675 functionality for system daemons. It typically has no dependencies other than
7676 the Linux kernel, C standard library, and libdl (for dynamic linking). While
7677 ELL is designed to be efficient and compact enough for use on embedded Linux
7678 platforms, it is not limited to resource-constrained systems.")
7679 (license license:lgpl2.1+)))
7680
7681 (define-public lttng-ust
7682 (package
7683 (name "lttng-ust")
7684 (version "2.11.0")
7685 (source (origin
7686 (method url-fetch)
7687 (uri (string-append "https://lttng.org/files/lttng-ust/"
7688 "lttng-ust-" version ".tar.bz2"))
7689 (sha256
7690 (base32
7691 "1n646yz7882svf5a4ay3vqiiz3qjn3pgkkij9kk22871wp7q0ck8"))))
7692 (build-system gnu-build-system)
7693 (inputs
7694 `(("liburcu" ,liburcu)
7695 ("numactl" ,numactl)))
7696 (native-inputs
7697 `(("python" ,python-3)))
7698 (home-page "https://lttng.org/")
7699 (synopsis "LTTng userspace tracer libraries")
7700 (description "The user space tracing library, liblttng-ust, is the LTTng
7701 user space tracer. It receives commands from a session daemon, for example to
7702 enable and disable specific instrumentation points, and writes event records
7703 to ring buffers shared with a consumer daemon.")
7704 (license license:lgpl2.1+)))
7705
7706 (define-public kexec-tools
7707 (package
7708 (name "kexec-tools")
7709 (version "2.0.22")
7710 (source (origin
7711 (method url-fetch)
7712 (uri (string-append "mirror://kernel.org/linux/utils/kernel"
7713 "/kexec/kexec-tools-" version ".tar.xz"))
7714 (sha256
7715 (base32
7716 "1hj9mj6x3qs9c8x8mrri9xd3wsg3gwzbab3jfa5ry146xm4pzjcn"))))
7717 (build-system gnu-build-system)
7718 (arguments
7719 ;; There are no automated tests.
7720 '(#:tests? #f))
7721 (home-page "https://projects.horms.net/projects/kexec/")
7722 (synopsis "Tools for booting directly into different kernels")
7723 (description "This package provides the @code{kexec} program and ancillary
7724 utilities. Using @code{kexec}, it is possible to boot directly into a new
7725 kernel from the context of an already-running kernel, bypassing the normal
7726 system boot process.")
7727 (license license:gpl2)))
7728
7729 (define-public cachefilesd
7730 (package
7731 (name "cachefilesd")
7732 (version "0.10.10")
7733 (source (origin
7734 (method url-fetch)
7735 (uri (string-append
7736 "https://git.kernel.org/pub/scm/linux/kernel/git/dhowells"
7737 "/cachefilesd.git/snapshot/cachefilesd-"
7738 version ".tar.gz"))
7739 (sha256
7740 (base32
7741 "0g40ljjnn3wzh9gp6il21c95f977298qrrkrxfnwfl3k3asfmnbi"))))
7742 (build-system gnu-build-system)
7743 (outputs '("out"))
7744 (arguments
7745 `(#:tests? #f ; there are no tests
7746 #:make-flags
7747 (let ((prefix-dir (lambda (var dir)
7748 (string-append var "=" %output "/" dir))))
7749 (list (string-append "CC=" ,(cc-for-target))
7750 (prefix-dir "SBINDIR" "sbin/")
7751 (prefix-dir "ETCDIR" "etc/")
7752 (prefix-dir "MANDIR" "share/man/")))
7753 #:phases (modify-phases %standard-phases (delete 'configure))))
7754 (home-page "https://people.redhat.com/~dhowells/cachefs/")
7755 (synopsis "CacheFiles userspace management daemon")
7756 (description "@code{cachefilesd} is a userspace daemon that manages the
7757 cache data store that is used by network file systems such as @code{AFS} and
7758 @code{NFS} to cache data locally on disk. The content of the cache is
7759 persistent over reboots.")
7760 (license license:gpl2+)))
7761
7762 (define-public libbpf
7763 (package
7764 (name "libbpf")
7765 (version "0.1.1")
7766 (source
7767 (origin
7768 (method git-fetch)
7769 (uri (git-reference
7770 (url "https://github.com/libbpf/libbpf")
7771 (commit (string-append "v" version))))
7772 (file-name (git-file-name name version))
7773 (sha256
7774 (base32
7775 "0ilnnm4q22f8fagwp8kb37licy4ks861i2iqh2djsypqhnxvx3fv"))))
7776 (build-system gnu-build-system)
7777 (native-inputs
7778 `(("pkg-config" ,pkg-config)))
7779 (propagated-inputs
7780 ;; In Requires.private of libbpf.pc.
7781 `(("libelf" ,libelf)
7782 ("zlib" ,zlib)))
7783 (arguments
7784 `(#:tests? #f ; no tests
7785 #:make-flags
7786 (list
7787 (string-append "PREFIX=" (assoc-ref %outputs "out"))
7788 (string-append "LIBDIR=$(PREFIX)/lib")
7789 (string-append
7790 "CC=" (assoc-ref %build-inputs "gcc") "/bin/gcc"))
7791 #:phases
7792 (modify-phases %standard-phases
7793 (delete 'configure)
7794 (add-before 'build 'pre-build
7795 (lambda _
7796 (chdir "src")
7797 #t)))))
7798 (home-page "https://github.com/libbpf/libbpf")
7799 (synopsis "BPF CO-RE (Compile Once – Run Everywhere)")
7800 (description
7801 "Libbpf supports building BPF CO-RE-enabled applications, which, in
7802 contrast to BCC, do not require the Clang/LLVM runtime or linux kernel
7803 headers.")
7804 (license `(,license:lgpl2.1 ,license:bsd-2))))
7805
7806 (define-public bcc
7807 (package
7808 (name "bcc")
7809 (version "0.16.0")
7810 (source
7811 (origin
7812 (method git-fetch)
7813 (uri (git-reference
7814 (url "https://github.com/iovisor/bcc")
7815 (commit (string-append "v" version))))
7816 (file-name (git-file-name name version))
7817 (sha256
7818 (base32
7819 "1367c0bzrpclvjvmk0sxgi49rh7j2f9izqk5a7g3yvawh1fmvvjh"))))
7820 (build-system cmake-build-system)
7821 (native-inputs
7822 `(("bison" ,bison)
7823 ("flex" ,flex)))
7824 (inputs
7825 `(("clang-toolchain" ,clang-toolchain)
7826 ("libbpf" ,(package-source libbpf))
7827 ;; LibElf required but libelf does not contain
7828 ;; archives, only object files.
7829 ;; https://github.com/iovisor/bcc/issues/504
7830 ("elfutils" ,elfutils)
7831 ("linux-libre-headers" ,linux-libre-headers)
7832 ("luajit" ,luajit)
7833 ("python-wrapper" ,python-wrapper)))
7834 (arguments
7835 `(;; Tests all require root permissions and a "standard" file hierarchy.
7836 #:tests? #f
7837 #:configure-flags
7838 (let ((revision ,version))
7839 `(,(string-append "-DREVISION=" revision)))
7840 #:phases
7841 (modify-phases %standard-phases
7842 ;; FIXME: Use "-DCMAKE_USE_LIBBPF_PACKAGE=ON".
7843 (add-after 'unpack 'copy-libbpf
7844 (lambda* (#:key inputs #:allow-other-keys)
7845 (delete-file-recursively "src/cc/libbpf")
7846 (copy-recursively
7847 (assoc-ref inputs "libbpf") "src/cc/libbpf")))
7848 (add-after 'copy-libbpf 'substitute-libbc
7849 (lambda* (#:key outputs #:allow-other-keys)
7850 (substitute* "src/python/bcc/libbcc.py"
7851 (("(libbcc\\.so.*)\\b" _ libbcc)
7852 (string-append
7853 (assoc-ref outputs "out") "/lib/" libbcc)))))
7854 (add-after 'install 'wrap-tools
7855 (lambda* (#:key outputs #:allow-other-keys)
7856 (use-modules (ice-9 textual-ports))
7857 (let* ((out (assoc-ref outputs "out"))
7858 (lib (string-append out "/lib"))
7859 (tools (string-append out "/share/bcc/tools"))
7860 (python-executable?
7861 (lambda (filename _)
7862 (call-with-input-file filename
7863 (lambda (port)
7864 (string-contains (get-line port)
7865 "/bin/python"))))))
7866 (for-each
7867 (lambda (python-executable)
7868 (format #t "Wrapping: ~A.~%" python-executable)
7869 (wrap-program python-executable
7870 `("PYTHONPATH" ":" prefix
7871 (,(string-append lib
7872 "/python"
7873 ,(version-major+minor
7874 (package-version python))
7875 "/site-packages")))))
7876 (find-files tools python-executable?))
7877 #t))))))
7878 (home-page "https://github.com/iovisor/bcc")
7879 (synopsis "Tools for BPF on Linux")
7880 (description
7881 "BCC is a toolkit for creating efficient kernel tracing and manipulation
7882 programs, and includes several useful tools and examples. It makes use of
7883 extended BPF (Berkeley Packet Filters), formally known as eBPF, a new feature
7884 that was first added to Linux 3.15. Much of what BCC uses requires Linux 4.1
7885 and above.")
7886 (license license:asl2.0)))
7887
7888 (define-public bpftrace
7889 (package
7890 (name "bpftrace")
7891 (version "0.11.4")
7892 (source
7893 (origin
7894 (method git-fetch)
7895 (uri (git-reference
7896 (url "https://github.com/iovisor/bpftrace")
7897 (commit (string-append "v" version))))
7898 (file-name (git-file-name name version))
7899 (sha256
7900 (base32 "0y4qgm2cpccrsm20rnh92hqplddqsc5q5zhw9nqn2igm3h9i0z7h"))
7901 (patches (search-patches "bpftrace-disable-bfd-disasm.patch"))))
7902 (build-system cmake-build-system)
7903 (native-inputs
7904 `(("bison" ,bison)
7905 ("flex" ,flex)))
7906 (inputs
7907 `(("bcc" ,bcc)
7908 ("clang-toolchain" ,clang-toolchain)
7909 ("elfutils" ,elfutils)
7910 ("libbpf" ,libbpf)
7911 ("linux-libre-headers" ,linux-libre-headers)))
7912 (arguments
7913 `(#:tests? #f ;Tests require googletest sources.
7914 #:configure-flags
7915 '("-DBUILD_TESTING=OFF"
7916 ;; FIXME: libbfd misses some link dependencies, when fixed, remove
7917 ;; the associated patch.
7918 "-DHAVE_BFD_DISASM=OFF")))
7919 (home-page "https://github.com/iovisor/bpftrace")
7920 (synopsis "High-level tracing language for Linux eBPF")
7921 (description
7922 "bpftrace is a high-level tracing language for Linux enhanced Berkeley
7923 Packet Filter (eBPF) available in recent Linux kernels (4.x). bpftrace uses
7924 LLVM as a backend to compile scripts to BPF-bytecode and makes use of BCC for
7925 interacting with the Linux BPF system, as well as existing Linux tracing
7926 capabilities: kernel dynamic tracing (kprobes), user-level dynamic
7927 tracing (uprobes), and tracepoints. The bpftrace language is inspired by awk
7928 and C, and predecessor tracers such as DTrace and SystemTap. bpftrace was
7929 created by Alastair Robertson.")
7930 (license license:asl2.0)))
7931
7932 (define-public ttyebus-linux-module
7933 (let ((revision "0")
7934 (commit "fe4332a2281cf79804ef4d8516aa848ca1c58d1f"))
7935 (package
7936 (name "ttyebus-linux-module")
7937 (version (git-version "1.5" revision commit))
7938 (source
7939 (origin
7940 (method git-fetch)
7941 (uri (git-reference
7942 (url "https://github.com/eBUS/ttyebus")
7943 (commit "fe4332a2281cf79804ef4d8516aa848ca1c58d1f")))
7944 (file-name (git-file-name name version))
7945 (sha256
7946 (base32
7947 "1i66xjs9vln5cca6wx7aiiw7jihrlsk9hjdqyczp36fvm1b1bani"))))
7948 (supported-systems '("armhf-linux" "aarch64-linux"))
7949 (build-system linux-module-build-system)
7950 (arguments
7951 `(#:tests? #f))
7952 (home-page "https://github.com/eBUS/ttyebus")
7953 (synopsis "Low-latency Raspberry Pi UART driver")
7954 (description "This package provides a Linux kernel module that will
7955 provide a serial device @code{/dev/ttyebus} with almost no latency upon
7956 receiving. It is dedicated to the PL011 UART of the Raspberry Pi.")
7957 (license license:gpl3+))))
7958
7959 (define-public ipset
7960 (package
7961 (name "ipset")
7962 (version "7.11")
7963 (source
7964 (origin
7965 (method url-fetch)
7966 (uri (string-append "https://ipset.netfilter.org/"
7967 "ipset-" version ".tar.bz2"))
7968 (sha256
7969 (base32 "0zdzp9fhpp6hmirzxy7w27fb9xx9lxd2ykxbn8by7ngi62nvll9i"))))
7970 (build-system gnu-build-system)
7971 (inputs
7972 `(("libmnl" ,libmnl)))
7973 (native-inputs
7974 `(("pkg-config" ,pkg-config)))
7975 (arguments
7976 `(#:configure-flags '("--with-kmod=no")))
7977 (home-page "https://ipset.netfilter.org/")
7978 (synopsis "Administration tool for IP sets")
7979 (description "IP sets are a framework inside the Linux 2.4.x and 2.6.x kernel which
7980 can be administered by the ipset utility. Depending on the type,
7981 currently an IP set may store IP addresses, (TCP/UDP) port numbers or
7982 IP addresses with MAC addresses in a way which ensures lightning speed
7983 when matching an entry against a set.
7984
7985 If you want to
7986 @itemize @bullet
7987 @item store multiple IP addresses or port numbers and match against the entire
7988 collection using a single iptables rule.
7989 @item dynamically update iptables rules against IP addresses or ports without
7990 performance penalty.
7991 @item express complex IP address and ports based rulesets with a single
7992 iptables rule and benefit from the speed of IP sets.
7993 @end itemize\n
7994 then IP sets may be the proper tool for you.")
7995 (license license:gpl2+)))
7996
7997 (define-public liburing
7998 (package
7999 (name "liburing")
8000 (version "0.7")
8001 (source (origin
8002 (method git-fetch)
8003 (uri (git-reference
8004 (url "https://git.kernel.dk/liburing")
8005 (commit (string-append "liburing-" version))))
8006 (file-name (git-file-name name version))
8007 (sha256
8008 (base32
8009 "15z44l7y4c6s6dlf7v8lq4znlsjbja2r4ifbni0l8cdcnq0w3zh3"))))
8010 (build-system gnu-build-system)
8011 (arguments
8012 `(;; Tests are dependent on kernel version and features
8013 #:tests? #f
8014 #:phases
8015 (modify-phases %standard-phases
8016 (replace 'configure
8017 ;; configure fails if it is followed by SHELL, CONFIG_SHELL,
8018 ;; --enable-fast-install, and --build
8019 (lambda* (#:key outputs #:allow-other-keys)
8020 (let ((out (assoc-ref outputs "out")))
8021 (setenv "SHELL" (which "sh"))
8022 (setenv "CONFIG_SHELL" (which "sh"))
8023 (invoke "./configure" (string-append "--prefix=" out))))))))
8024 (home-page "https://github.com/axboe/liburing")
8025 (synopsis "Interface to the Linux kernel @code{io_uring} interface")
8026 (description "This is the io_uring library, liburing. liburing provides
8027 helpers to setup and teardown io_uring instances, and also a simplified
8028 interface for applications that don't need (or want) to deal with the full
8029 kernel side implementation.")
8030 (license license:expat)))
8031
8032 (define-public erofs-utils
8033 (package
8034 (name "erofs-utils")
8035 (version "1.2.1")
8036 (source
8037 (origin
8038 (method git-fetch)
8039 (uri (git-reference
8040 (url "https://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs-utils.git")
8041 (commit (string-append "v" version))))
8042 (file-name (git-file-name name version))
8043 (sha256
8044 (base32 "1vb4mxsb59g29x7l22cffsqa8x743sra4j5zbmx89hjwpwm9vvcg"))))
8045 (build-system gnu-build-system)
8046 (inputs
8047 `(("lz4" ,lz4)
8048 ("libuuid" ,util-linux "lib")))
8049 (native-inputs
8050 `(("autoconf" ,autoconf)
8051 ("automake" ,automake)
8052 ("libtool" ,libtool)
8053 ("pkg-config" ,pkg-config)))
8054 (home-page "https://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs-utils.git/")
8055 (synopsis "User-space tools for EROFS file system")
8056 (description "EROFS (Enhanced Read-Only File System) is a compressed,
8057 read-only file system optimized for resource-scarce devices. This package
8058 provides user-space tools for creating EROFS file systems.")
8059 (license license:gpl2+)))
8060
8061 (define-public rasdaemon
8062 (package
8063 (name "rasdaemon")
8064 (version "0.6.6")
8065 (source
8066 (origin
8067 (method git-fetch)
8068 (uri (git-reference
8069 (url "https://github.com/mchehab/rasdaemon")
8070 (commit (string-append "v" version))))
8071 (file-name (git-file-name name version))
8072 (sha256
8073 (base32 "13g39x19lfjf9izdcb0nlyfjrgpliivhv4nw3ndgyzi59l3yqc0v"))))
8074 (native-inputs `(("autoconf" ,autoconf)
8075 ("automake" ,automake)
8076 ("libtool" ,libtool)))
8077 (inputs `(("sqlite" ,sqlite)))
8078 (arguments
8079 `(#:configure-flags '("--enable-all"
8080 "--localstatedir=/var")
8081 #:phases
8082 (modify-phases %standard-phases
8083 (add-before 'configure 'munge-autotools
8084 (lambda _
8085 ;; For some reason upstream forces sysconfdir=/etc. This results
8086 ;; in EPERM during the install phase. Removing the offending
8087 ;; line lets sysconfdir correctly pick up DESTDIR.
8088 (substitute* "configure.ac"
8089 (("^test .* sysconfdir=/etc\n$") ""))
8090 ;; Upstream tries to create /var/lib/rasdaemon at install time.
8091 ;; This results in EPERM on guix. Instead, the service should
8092 ;; create this at activation time.
8093 (substitute* "Makefile.am"
8094 (("^\\s*\\$\\(install_sh\\) -d .*@RASSTATEDIR@.*$") "")))))))
8095 (build-system gnu-build-system)
8096 (home-page "https://github.com/mchehab/rasdaemon")
8097 (synopsis "Platform Reliability, Availability, and Serviceability tools")
8098 (description
8099 "The @code{rasdaemon} daemon monitors platform @acronym{RAS, Reliability
8100 Availability and Serviceability} reports from Linux kernel trace events.
8101 These trace events are logged in @file{/sys/kernel/debug/tracing} and reported
8102 through standard log mechanisms like syslog.")
8103 (license license:gpl2)))