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