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