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