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