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