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