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