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