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