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