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