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