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