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