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