gnu: Add CRDA.
[guix.git] / gnu / packages / linux.scm
blob1280599490e8cc41439d0132282dd1467d71b315
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2013, 2014, 2015 Andreas Enge <andreas@enge.fr>
4 ;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
5 ;;; Copyright © 2014, 2015 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 ;;;
9 ;;; This file is part of GNU Guix.
10 ;;;
11 ;;; GNU Guix is free software; you can redistribute it and/or modify it
12 ;;; under the terms of the GNU General Public License as published by
13 ;;; the Free Software Foundation; either version 3 of the License, or (at
14 ;;; your option) any later version.
15 ;;;
16 ;;; GNU Guix is distributed in the hope that it will be useful, but
17 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 ;;; GNU General Public License for more details.
20 ;;;
21 ;;; You should have received a copy of the GNU General Public License
22 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
24 (define-module (gnu packages linux)
25   #:use-module ((guix licenses)
26                 #:hide (zlib))
27   #:use-module (gnu packages)
28   #:use-module (gnu packages compression)
29   #:use-module (gnu packages gcc)
30   #:use-module (gnu packages flex)
31   #:use-module (gnu packages bison)
32   #:use-module (gnu packages admin)
33   #:use-module (gnu packages gperf)
34   #:use-module (gnu packages libusb)
35   #:use-module (gnu packages ncurses)
36   #:use-module (gnu packages pciutils)
37   #:use-module (gnu packages databases)
38   #:use-module (gnu packages perl)
39   #:use-module (gnu packages pkg-config)
40   #:use-module (gnu packages python)
41   #:use-module (gnu packages slang)
42   #:use-module (gnu packages algebra)
43   #:use-module (gnu packages gettext)
44   #:use-module (gnu packages glib)
45   #:use-module (gnu packages pulseaudio)
46   #:use-module (gnu packages attr)
47   #:use-module (gnu packages xml)
48   #:use-module (gnu packages autotools)
49   #:use-module (gnu packages texinfo)
50   #:use-module (gnu packages check)
51   #:use-module (gnu packages maths)
52   #:use-module (gnu packages base)
53   #:use-module (gnu packages rrdtool)
54   #:use-module (gnu packages elf)
55   #:use-module (gnu packages gtk)
56   #:use-module (gnu packages docbook)
57   #:use-module (gnu packages asciidoc)
58   #:use-module (gnu packages readline)
59   #:use-module (gnu packages calendar)
60   #:use-module (guix packages)
61   #:use-module (guix download)
62   #:use-module (guix utils)
63   #:use-module (guix build-system gnu)
64   #:use-module (guix build-system cmake)
65   #:use-module (guix build-system python)
66   #:use-module (guix build-system trivial)
67   #:use-module (srfi srfi-26)
68   #:use-module (ice-9 match))
70 (define-public (system->linux-architecture arch)
71   "Return the Linux architecture name for ARCH, a Guix system name such as
72 \"x86_64-linux\"."
73   (let ((arch (car (string-split arch #\-))))
74     (cond ((string=? arch "i686") "i386")
75           ((string-prefix? "mips" arch) "mips")
76           ((string-prefix? "arm" arch) "arm")
77           (else arch))))
79 (define (linux-libre-urls version)
80   "Return a list of URLs for Linux-Libre VERSION."
81   (list (string-append
82          "http://linux-libre.fsfla.org/pub/linux-libre/releases/"
83          version "-gnu/linux-libre-" version "-gnu.tar.xz")
85         ;; XXX: Work around <http://bugs.gnu.org/14851>.
86         (string-append
87          "ftp://alpha.gnu.org/gnu/guix/mirror/linux-libre-"
88          version "-gnu.tar.xz")
90         ;; Maybe this URL will become valid eventually.
91         (string-append
92          "mirror://gnu/linux-libre/" version "-gnu/linux-libre-"
93          version "-gnu.tar.xz")))
95 (define-public linux-libre-headers
96   (let* ((version "3.14.37")
97          (build-phase
98           (lambda (arch)
99             `(lambda _
100                (setenv "ARCH" ,(system->linux-architecture arch))
101                (format #t "`ARCH' set to `~a'~%" (getenv "ARCH"))
103                (and (zero? (system* "make" "defconfig"))
104                     (zero? (system* "make" "mrproper" "headers_check"))))))
105          (install-phase
106           `(lambda* (#:key outputs #:allow-other-keys)
107              (let ((out (assoc-ref outputs "out")))
108                (and (zero? (system* "make"
109                                     (string-append "INSTALL_HDR_PATH=" out)
110                                     "headers_install"))
111                     (begin
112                       (mkdir (string-append out "/include/config"))
113                       (call-with-output-file
114                           (string-append out
115                                          "/include/config/kernel.release")
116                         (lambda (p)
117                           (format p "~a-default~%" ,version)))
119                       ;; Remove the '.install' and '..install.cmd' files; the
120                       ;; latter contains store paths, which pulls in bootstrap
121                       ;; binaries in the build environment, and prevents bit
122                       ;; reproducibility for the bootstrap binaries.
123                       (for-each delete-file (find-files out "\\.install"))
125                       #t))))))
126    (package
127     (name "linux-libre-headers")
128     (version version)
129     (source (origin
130              (method url-fetch)
131              (uri (linux-libre-urls version))
132              (sha256
133               (base32
134                "1blxr2bsvfqi9khj4cpspv434bmx252zak2wsbi2mgl60zh77gza"))))
135     (build-system gnu-build-system)
136     (native-inputs `(("perl" ,perl)))
137     (arguments
138      `(#:modules ((guix build gnu-build-system)
139                   (guix build utils)
140                   (srfi srfi-1))
141        #:phases (alist-replace
142                  'build ,(build-phase (or (%current-target-system)
143                                           (%current-system)))
144                  (alist-replace
145                   'install ,install-phase
146                   (alist-delete 'configure %standard-phases)))
147        #:allowed-references ()
148        #:tests? #f))
149     (synopsis "GNU Linux-Libre kernel headers")
150     (description "Headers of the Linux-Libre kernel.")
151     (license gpl2)
152     (home-page "http://www.gnu.org/software/linux-libre/"))))
154 (define-public module-init-tools
155   (package
156     (name "module-init-tools")
157     (version "3.16")
158     (source (origin
159              (method url-fetch)
160              (uri (string-append
161                    "mirror://kernel.org/linux/utils/kernel/module-init-tools/module-init-tools-"
162                    version ".tar.bz2"))
163              (sha256
164               (base32
165                "0jxnz9ahfic79rp93l5wxcbgh4pkv85mwnjlbv1gz3jawv5cvwp1"))
166              (patches
167               (list (search-patch "module-init-tools-moduledir.patch")))))
168     (build-system gnu-build-system)
169     (arguments
170      ;; FIXME: The upstream tarball lacks man pages, and building them would
171      ;; require DocBook & co.  We used to use Gentoo's pre-built man pages,
172      ;; but they vanished.  In the meantime, fake it.
173      '(#:phases (alist-cons-before
174                  'configure 'fake-docbook
175                  (lambda _
176                    (substitute* "Makefile.in"
177                      (("^DOCBOOKTOMAN.*$")
178                       "DOCBOOKTOMAN = true\n")))
179                  %standard-phases)))
180     (home-page "http://www.kernel.org/pub/linux/utils/kernel/module-init-tools/")
181     (synopsis "Tools for loading and managing Linux kernel modules")
182     (description
183      "Tools for loading and managing Linux kernel modules, such as `modprobe',
184 `insmod', `lsmod', and more.")
185     (license gpl2+)))
187 (define %boot-logo-patch
188   ;; Linux-Libre boot logo featuring Freedo and a gnu.
189   (origin
190     (method url-fetch)
191     (uri (string-append "http://www.fsfla.org/svn/fsfla/software/linux-libre/"
192                         "lemote/gnewsense/branches/3.16/100gnu+freedo.patch"))
193     (sha256
194      (base32
195       "1hk9swxxc80bmn2zd2qr5ccrjrk28xkypwhl4z0qx4hbivj7qm06"))))
197 (define (kernel-config system)
198   "Return the absolute file name of the Linux-Libre build configuration file
199 for SYSTEM, or #f if there is no configuration for SYSTEM."
200   (define (lookup file)
201     (let ((file (string-append "gnu/packages/" file)))
202       (search-path %load-path file)))
204   (match system
205     ("i686-linux"
206      (lookup "linux-libre-i686.conf"))
207     ("x86_64-linux"
208      (lookup "linux-libre-x86_64.conf"))
209     (_
210      #f)))
212 (define-public linux-libre
213   (let* ((version "4.1.2")
214          (build-phase
215           '(lambda* (#:key system inputs #:allow-other-keys #:rest args)
216              ;; Apply the neat patch.
217              (system* "patch" "-p1" "--force"
218                       "-i" (assoc-ref inputs "patch/freedo+gnu"))
220              (let ((arch (car (string-split system #\-))))
221                (setenv "ARCH"
222                        (cond ((string=? arch "i686") "i386")
223                              (else arch)))
224                (format #t "`ARCH' set to `~a'~%" (getenv "ARCH")))
226              (let ((build  (assoc-ref %standard-phases 'build))
227                    (config (assoc-ref inputs "kconfig")))
229                ;; Use the architecture-specific config if available, and
230                ;; 'defconfig' otherwise.
231                (if config
232                    (begin
233                      (copy-file config ".config")
234                      (chmod ".config" #o666))
235                    (system* "make" "defconfig"))
237                ;; Appending works even when the option wasn't in the
238                ;; file.  The last one prevails if duplicated.
239                (let ((port (open-file ".config" "a")))
240                  (display (string-append "CONFIG_NET_9P=m\n"
241                                          "CONFIG_NET_9P_VIRTIO=m\n"
242                                          "CONFIG_VIRTIO_BLK=m\n"
243                                          "CONFIG_VIRTIO_NET=m\n"
244                                          ;; https://lists.gnu.org/archive/html/guix-devel/2014-04/msg00039.html
245                                          "CONFIG_DEVPTS_MULTIPLE_INSTANCES=y\n"
246                                          "CONFIG_VIRTIO_PCI=m\n"
247                                          "CONFIG_VIRTIO_BALLOON=m\n"
248                                          "CONFIG_VIRTIO_MMIO=m\n"
249                                          "CONFIG_FUSE_FS=m\n"
250                                          "CONFIG_CIFS=m\n"
251                                          "CONFIG_9P_FS=m\n")
252                           port)
253                  (close-port port))
255                (zero? (system* "make" "oldconfig"))
257                ;; Call the default `build' phase so `-j' is correctly
258                ;; passed.
259                (apply build #:make-flags "all" args))))
260          (install-phase
261           `(lambda* (#:key inputs outputs #:allow-other-keys)
262              (let* ((out    (assoc-ref outputs "out"))
263                     (moddir (string-append out "/lib/modules"))
264                     (mit    (assoc-ref inputs "module-init-tools")))
265                (mkdir-p moddir)
266                (for-each (lambda (file)
267                            (copy-file file
268                                       (string-append out "/" (basename file))))
269                          (find-files "." "^(bzImage|System\\.map)$"))
270                (copy-file ".config" (string-append out "/config"))
271                (zero? (system* "make"
272                                (string-append "DEPMOD=" mit "/sbin/depmod")
273                                (string-append "MODULE_DIR=" moddir)
274                                (string-append "INSTALL_PATH=" out)
275                                (string-append "INSTALL_MOD_PATH=" out)
276                                "INSTALL_MOD_STRIP=1"
277                                "modules_install"))))))
278    (package
279     (name "linux-libre")
280     (version version)
281     (source (origin
282              (method url-fetch)
283              (uri (linux-libre-urls version))
284              (sha256
285               (base32
286                "0clgjpcw1xzqa7jpm6k5fafg3wnc28mzyar3xgr4vbm6zb61fl7k"))))
287     (build-system gnu-build-system)
288     (native-inputs `(("perl" ,perl)
289                      ("bc" ,bc)
290                      ("module-init-tools" ,module-init-tools)
291                      ("patch/freedo+gnu" ,%boot-logo-patch)
293                      ,@(let ((conf (kernel-config (or (%current-target-system)
294                                                       (%current-system)))))
295                          (if conf
296                              `(("kconfig" ,conf))
297                              '()))))
298     (arguments
299      `(#:modules ((guix build gnu-build-system)
300                   (guix build utils)
301                   (srfi srfi-1)
302                   (ice-9 match))
303        #:phases (alist-replace
304                  'build ,build-phase
305                  (alist-replace
306                   'install ,install-phase
307                   (alist-delete 'configure %standard-phases)))
308        #:tests? #f))
309     (synopsis "100% free redistribution of a cleaned Linux kernel")
310     (description
311      "GNU Linux-Libre is a free (as in freedom) variant of the Linux kernel.
312 It has been modified to remove all non-free binary blobs.")
313     (license gpl2)
314     (home-page "http://www.gnu.org/software/linux-libre/"))))
318 ;;; Pluggable authentication modules (PAM).
321 (define-public linux-pam
322   (package
323     (name "linux-pam")
324     (version "1.1.6")
325     (source
326      (origin
327       (method url-fetch)
328       (uri (list (string-append "http://www.linux-pam.org/library/Linux-PAM-"
329                                 version ".tar.bz2")
330                  (string-append "mirror://kernel.org/linux/libs/pam/library/Linux-PAM-"
331                                 version ".tar.bz2")))
332       (sha256
333        (base32
334         "1hlz2kqvbjisvwyicdincq7nz897b9rrafyzccwzqiqg53b8gf5s"))))
335     (build-system gnu-build-system)
336     (native-inputs
337      `(("flex" ,flex)
339        ;; TODO: optional dependencies
340        ;; ("libxcrypt" ,libxcrypt)
341        ;; ("cracklib" ,cracklib)
342        ))
343     (arguments
344      '(;; Most users, such as `shadow', expect the headers to be under
345        ;; `security'.
346        #:configure-flags (list (string-append "--includedir="
347                                               (assoc-ref %outputs "out")
348                                               "/include/security"))
350        ;; XXX: Tests won't run in chroot, presumably because /etc/pam.d
351        ;; isn't available.
352        #:tests? #f))
353     (home-page "http://www.linux-pam.org/")
354     (synopsis "Pluggable authentication modules for Linux")
355     (description
356      "A *Free* project to implement OSF's RFC 86.0.
357 Pluggable authentication modules are small shared object files that can
358 be used through the PAM API to perform tasks, like authenticating a user
359 at login.  Local and dynamic reconfiguration are its key features")
360     (license bsd-3)))
364 ;;; Miscellaneous.
367 (define-public psmisc
368   (package
369     (name "psmisc")
370     (version "22.20")
371     (source
372      (origin
373       (method url-fetch)
374       (uri (string-append "mirror://sourceforge/psmisc/psmisc/psmisc-"
375                           version ".tar.gz"))
376       (sha256
377        (base32
378         "052mfraykmxnavpi8s78aljx8w87hyvpx8mvzsgpjsjz73i28wmi"))))
379     (build-system gnu-build-system)
380     (inputs `(("ncurses" ,ncurses)))
381     (home-page "http://psmisc.sourceforge.net/")
382     (synopsis
383      "Small utilities that use the proc filesystem")
384     (description
385      "This PSmisc package is a set of some small useful utilities that
386 use the proc filesystem.  We're not about changing the world, but
387 providing the system administrator with some help in common tasks.")
388     (license gpl2+)))
390 (define-public util-linux
391   (package
392     (name "util-linux")
393     (version "2.25.2")
394     (source (origin
395               (method url-fetch)
396               (uri (string-append "mirror://kernel.org/linux/utils/"
397                                   name "/v" (version-major+minor version) "/"
398                                   name "-" version ".tar.xz"))
399               (sha256
400                (base32
401                 "1miwwdq1zwvhf0smrxx3fjddq3mz22s8rc5cw54s7x3kbdqpyig0"))
402               (patches (list (search-patch "util-linux-tests.patch")))
403               (modules '((guix build utils)))
404               (snippet
405                ;; We take the 'logger' program from GNU Inetutils and 'kill'
406                ;; from GNU Coreutils.
407                '(substitute* "configure"
408                   (("build_logger=yes") "build_logger=no")
409                   (("build_kill=yes") "build_kill=no")))))
410     (build-system gnu-build-system)
411     (arguments
412      `(#:configure-flags (list "--disable-use-tty-group"
413                                "--enable-ddate"
415                                ;; Install completions where our
416                                ;; bash-completion package expects them.
417                                (string-append "--with-bashcompletiondir="
418                                               (assoc-ref %outputs "out")
419                                               "/etc/bash_completion.d"))
420        #:phases (alist-cons-before
421                  'check 'pre-check
422                  (lambda* (#:key inputs outputs #:allow-other-keys)
423                    (let ((out (assoc-ref outputs "out"))
424                          (net (assoc-ref inputs "net-base")))
425                      ;; Change the test to refer to the right file.
426                      (substitute* "tests/ts/misc/mcookie"
427                        (("/etc/services")
428                         (string-append net "/etc/services")))
429                      #t))
430                  %standard-phases)))
431     (inputs `(("zlib" ,zlib)
432               ("ncurses" ,ncurses)))
433     (native-inputs
434      `(("perl" ,perl)
435        ("net-base" ,net-base)))                   ;for tests
436     (home-page "https://www.kernel.org/pub/linux/utils/util-linux/")
437     (synopsis "Collection of utilities for the Linux kernel")
438     (description
439      "Util-linux is a random collection of utilities for the Linux kernel.")
441     ;; Note that util-linux doesn't use the same license for all the
442     ;; code.  GPLv2+ is the default license for a code without an
443     ;; explicitly defined license.
444     (license (list gpl3+ gpl2+ gpl2 lgpl2.0+
445                    bsd-4 public-domain))))
447 (define-public procps
448   (package
449     (name "procps")
450     (version "3.2.8")
451     (source (origin
452              (method url-fetch)
453              ;; A mirror://sourceforge URI doesn't work, presumably becuase
454              ;; the SourceForge project is misconfigured.
455              (uri (string-append "http://procps.sourceforge.net/procps-"
456                                  version ".tar.gz"))
457              (sha256
458               (base32
459                "0d8mki0q4yamnkk4533kx8mc0jd879573srxhg6r2fs3lkc6iv8i"))
460              (patches (list (search-patch "procps-make-3.82.patch")))))
461     (build-system gnu-build-system)
462     (inputs `(("ncurses" ,ncurses)))
463     (arguments
464      '(#:modules ((guix build utils)
465                   (guix build gnu-build-system)
466                   (srfi srfi-1)
467                   (srfi srfi-26))
468        #:phases (alist-replace
469                  'configure
470                  (lambda* (#:key outputs #:allow-other-keys)
471                    ;; No `configure', just a single Makefile.
472                    (let ((out (assoc-ref outputs "out")))
473                      (substitute* "Makefile"
474                        (("/usr/") "/")
475                        (("--(owner|group) 0") "")
476                        (("ldconfig") "true")
477                        (("^LDFLAGS[[:blank:]]*:=(.*)$" _ value)
478                         ;; Add libproc to the RPATH.
479                         (string-append "LDFLAGS := -Wl,-rpath="
480                                        out "/lib" value))))
481                    (setenv "CC" "gcc"))
482                  (alist-replace
483                   'install
484                   (lambda* (#:key outputs #:allow-other-keys)
485                     (let ((out (assoc-ref outputs "out")))
486                       (and (zero?
487                             (system* "make" "install"
488                                      (string-append "DESTDIR=" out)))
490                            ;; Remove commands and man pages redundant with
491                            ;; Coreutils.
492                            (let ((dup (append-map (cut find-files out <>)
493                                                   '("^kill" "^uptime"))))
494                              (for-each delete-file dup)
495                              #t)
497                            ;; Sanity check.
498                            (zero?
499                             (system* (string-append out "/bin/ps")
500                                      "--version")))))
501                   %standard-phases))
503        ;; What did you expect?  Tests?
504        #:tests? #f))
505     (home-page "http://procps.sourceforge.net/")
506     (synopsis "Utilities that give information about processes")
507     (description
508      "Procps is the package that has a bunch of small useful utilities
509 that give information about processes using the Linux /proc file system.
510 The package includes the programs ps, top, vmstat, w, kill, free,
511 slabtop, and skill.")
512     (license gpl2)))
514 (define-public usbutils
515   (package
516     (name "usbutils")
517     (version "006")
518     (source
519      (origin
520       (method url-fetch)
521       (uri (string-append "mirror://kernel.org/linux/utils/usb/usbutils/"
522                           "usbutils-" version ".tar.xz"))
523       (sha256
524        (base32
525         "03pd57vv8c6x0hgjqcbrxnzi14h8hcghmapg89p8k5zpwpkvbdfr"))))
526     (build-system gnu-build-system)
527     (inputs
528      `(("libusb" ,libusb)))
529     (native-inputs
530      `(("pkg-config" ,pkg-config)))
531     (home-page "http://www.linux-usb.org/")
532     (synopsis
533      "Tools for working with USB devices, such as lsusb")
534     (description
535      "Tools for working with USB devices, such as lsusb.")
536     (license gpl2+)))
538 (define-public e2fsprogs
539   (package
540     (name "e2fsprogs")
541     (version "1.42.12")
542     (source (origin
543              (method url-fetch)
544              (uri (string-append "mirror://sourceforge/e2fsprogs/e2fsprogs-"
545                                  version ".tar.gz"))
546              (sha256
547               (base32
548                "0v0qcfyls0dlrjy8gx9m3s2wbkp5z3lbsr5hb7x8kp8f3bclcy71"))
549              (modules '((guix build utils)))
550              (snippet
551               '(substitute* "MCONFIG.in"
552                  (("INSTALL_SYMLINK = /bin/sh")
553                   "INSTALL_SYMLINK = sh")))))
554     (build-system gnu-build-system)
555     (inputs `(("util-linux" ,util-linux)))
556     (native-inputs `(("pkg-config" ,pkg-config)
557                      ("texinfo" ,texinfo)))     ;for the libext2fs Info manual
558     (arguments
559      '(;; util-linux is not the preferred source for some of the libraries and
560        ;; commands, so disable them (see, e.g.,
561        ;; <http://git.buildroot.net/buildroot/commit/?id=e1ffc2f791b336339909c90559b7db40b455f172>.)
562        #:configure-flags '("--disable-libblkid"
563                            "--disable-libuuid" "--disable-uuidd"
564                            "--disable-fsck"
566                            ;; Install libext2fs et al.
567                            "--enable-elf-shlibs")
569        #:make-flags (list (string-append "LDFLAGS=-Wl,-rpath="
570                                          (assoc-ref %outputs "out")
571                                          "/lib"))
573        #:phases (alist-cons-before
574                  'configure 'patch-shells
575                  (lambda _
576                    (substitute* "configure"
577                      (("/bin/sh (.*)parse-types.sh" _ dir)
578                       (string-append (which "sh") " " dir
579                                      "parse-types.sh")))
580                    (substitute* (find-files "." "^Makefile.in$")
581                      (("#!/bin/sh")
582                       (string-append "#!" (which "sh")))))
583                  (alist-cons-after
584                   'install 'install-libs
585                   (lambda* (#:key outputs #:allow-other-keys)
586                     (let* ((out (assoc-ref outputs "out"))
587                            (lib (string-append out "/lib")))
588                       (and (zero? (system* "make" "install-libs"))
590                            ;; Make the .a writable so that 'strip' works.
591                            ;; Failing to do that, due to debug symbols, we
592                            ;; retain a reference to the final
593                            ;; linux-libre-headers, which refer to the
594                            ;; bootstrap binaries.
595                            (let ((archives (find-files lib "\\.a$")))
596                              (for-each (lambda (file)
597                                          (chmod file #o666))
598                                        archives)
599                              #t))))
600                   %standard-phases))
602        ;; FIXME: Tests work by comparing the stdout/stderr of programs, that
603        ;; they fail because we get an extra line that says "Can't check if
604        ;; filesystem is mounted due to missing mtab file".
605        #:tests? #f))
606     (home-page "http://e2fsprogs.sourceforge.net/")
607     (synopsis "Creating and checking ext2/ext3/ext4 file systems")
608     (description
609      "This package provides tools for manipulating ext2/ext3/ext4 file systems.")
610     (license (list gpl2                           ; programs
611                    lgpl2.0                        ; libext2fs
612                    x11))))                        ; libuuid
614 (define e2fsprogs/static
615   (static-package
616    (package (inherit e2fsprogs)
617             (arguments
618              ;; Do not build shared libraries.
619              (substitute-keyword-arguments (package-arguments e2fsprogs)
620                ((#:configure-flags _)
621                 '(list "--disable-blkid"))
622                ((#:make-flags _)
623                 '(list)))))))
625 (define-public e2fsck/static
626   (package
627     (name "e2fsck-static")
628     (version (package-version e2fsprogs))
629     (build-system trivial-build-system)
630     (source #f)
631     (arguments
632      `(#:modules ((guix build utils))
633        #:builder
634        (begin
635          (use-modules (guix build utils)
636                       (ice-9 ftw)
637                       (srfi srfi-26))
639          (let ((source (string-append (assoc-ref %build-inputs "e2fsprogs")
640                                       "/sbin"))
641                (bin    (string-append (assoc-ref %outputs "out") "/sbin")))
642            (mkdir-p bin)
643            (with-directory-excursion bin
644              (for-each (lambda (file)
645                          (copy-file (string-append source "/" file)
646                                     file)
647                          (remove-store-references file)
648                          (chmod file #o555))
649                        (scandir source (cut string-prefix? "fsck." <>))))))))
650     (inputs `(("e2fsprogs" ,e2fsprogs/static)))
651     (synopsis "Statically-linked fsck.* commands from e2fsprogs")
652     (description
653      "This package provides statically-linked command of fsck.ext[234] taken
654 from the e2fsprogs package.  It is meant to be used in initrds.")
655     (home-page (package-home-page e2fsprogs))
656     (license (package-license e2fsprogs))))
658 (define-public zerofree
659   (package
660     (name "zerofree")
661     (version "1.0.3")
662     (home-page "http://intgat.tigress.co.uk/rmy/uml/")
663     (source (origin
664               (method url-fetch)
665               (uri (string-append home-page name "-" version
666                                   ".tgz"))
667               (sha256
668                (base32
669                 "1xncw3dn2cp922ly42m96p6fh7jv8ysg6bwqbk5xvw701f3dmkrs"))))
670     (build-system gnu-build-system)
671     (arguments
672      '(#:phases (alist-replace
673                  'install
674                  (lambda* (#:key outputs #:allow-other-keys)
675                    (let* ((out (assoc-ref outputs "out"))
676                           (bin (string-append out "/bin")))
677                      (mkdir-p bin)
678                      (copy-file "zerofree"
679                                 (string-append bin "/zerofree"))
680                      (chmod (string-append bin "/zerofree")
681                             #o555)
682                      #t))
683                  (alist-delete 'configure %standard-phases))
684        #:tests? #f))                              ;no tests
685     (inputs `(("libext2fs" ,e2fsprogs)))
686     (synopsis "Zero non-allocated regions in ext2/ext3/ext4 file systems")
687     (description
688      "The zerofree command scans the free blocks in an ext2 file system and
689 fills any non-zero blocks with zeroes.  This is a useful way to make disk
690 images more compressible.")
691     (license gpl2)))
693 (define-public strace
694   (package
695     (name "strace")
696     (version "4.7")
697     (source (origin
698              (method url-fetch)
699              (uri (string-append "mirror://sourceforge/strace/strace-"
700                                  version ".tar.xz"))
701              (sha256
702               (base32
703                "158iwk0pl2mfw93m1843xb7a2zb8p6lh0qim07rca6f1ff4dk764"))))
704     (build-system gnu-build-system)
705     (native-inputs `(("perl" ,perl)))
706     (home-page "http://strace.sourceforge.net/")
707     (synopsis "System call tracer for Linux")
708     (description
709      "strace is a system call tracer, i.e. a debugging tool which prints out a
710 trace of all the system calls made by a another process/program.")
711     (license bsd-3)))
713 (define-public ltrace
714   (package
715     (name "ltrace")
716     (version "0.7.3")
717     (source (origin
718              (method url-fetch)
719              (uri (string-append "http://www.ltrace.org/ltrace_" version
720                                  ".orig.tar.bz2"))
721              (sha256
722               (base32
723                "00wmbdghqbz6x95m1mcdd3wd46l6hgcr4wggdp049dbifh3qqvqf"))))
724     (build-system gnu-build-system)
725     (inputs `(("libelf" ,libelf)))
726     (arguments
727      ;; Compilation uses -Werror by default, but it fails.
728      '(#:configure-flags '("--disable-werror")))
729     (home-page "http://www.ltrace.org/")
730     (synopsis "Library call tracer for Linux")
731     (description
732      "ltrace intercepts and records dynamic library calls which are called by
733 an executed process and the signals received by that process.  It can also
734 intercept and print the system calls executed by the program.")
735     (license gpl2+)))
737 (define-public alsa-lib
738   (package
739     (name "alsa-lib")
740     (version "1.0.27.1")
741     (source (origin
742              (method url-fetch)
743              (uri (string-append
744                    "ftp://ftp.alsa-project.org/pub/lib/alsa-lib-"
745                    version ".tar.bz2"))
746              (sha256
747               (base32
748                "0fx057746dj7rjdi0jnvx2m9b0y1lgdkh1hks87d8w32xyihf3k9"))
749              (patches (list (search-patch "alsa-lib-mips-atomic-fix.patch")))))
750     (build-system gnu-build-system)
751     (home-page "http://www.alsa-project.org/")
752     (synopsis "The Advanced Linux Sound Architecture libraries")
753     (description
754      "The Advanced Linux Sound Architecture (ALSA) provides audio and
755 MIDI functionality to the Linux-based operating system.")
756     (license lgpl2.1+)))
758 (define-public alsa-utils
759   (package
760     (name "alsa-utils")
761     (version "1.0.27.2")
762     (source (origin
763              (method url-fetch)
764              (uri (string-append "ftp://ftp.alsa-project.org/pub/utils/alsa-utils-"
765                                  version ".tar.bz2"))
766              (sha256
767               (base32
768                "1sjjngnq50jv5ilwsb4zys6smifni3bd6fn28gbnhfrg14wsrgq2"))))
769     (build-system gnu-build-system)
770     (arguments
771      ;; XXX: Disable man page creation until we have DocBook.
772      '(#:configure-flags (list "--disable-xmlto"
774                                ;; The udev rule is responsible for restoring
775                                ;; the volume.
776                                (string-append "--with-udev-rules-dir="
777                                               (assoc-ref %outputs "out")
778                                               "/lib/udev/rules.d"))
779        #:phases (alist-cons-before
780                  'install 'pre-install
781                  (lambda _
782                    ;; Don't try to mkdir /var/lib/alsa.
783                    (substitute* "Makefile"
784                      (("\\$\\(MKDIR_P\\) .*ASOUND_STATE_DIR.*")
785                       "true\n")))
786                  %standard-phases)))
787     (inputs
788      `(("libsamplerate" ,libsamplerate)
789        ("ncurses" ,ncurses)
790        ("alsa-lib" ,alsa-lib)
791        ("xmlto" ,xmlto)
792        ("gettext" ,gnu-gettext)))
793     (home-page "http://www.alsa-project.org/")
794     (synopsis "Utilities for the Advanced Linux Sound Architecture (ALSA)")
795     (description
796      "The Advanced Linux Sound Architecture (ALSA) provides audio and
797 MIDI functionality to the Linux-based operating system.")
799     ;; This is mostly GPLv2+ but a few files such as 'alsactl.c' are
800     ;; GPLv2-only.
801     (license gpl2)))
803 (define-public iptables
804   (package
805     (name "iptables")
806     (version "1.4.16.2")
807     (source (origin
808              (method url-fetch)
809              (uri (string-append
810                    "http://www.netfilter.org/projects/iptables/files/iptables-"
811                    version ".tar.bz2"))
812              (sha256
813               (base32
814                "0vkg5lzkn4l3i1sm6v3x96zzvnv9g7mi0qgj6279ld383mzcws24"))))
815     (build-system gnu-build-system)
816     (arguments
817      '(#:tests? #f       ; no test suite
818        #:configure-flags ; add $libdir to the RUNPATH of executables
819        (list (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib"))))
820     (home-page "http://www.netfilter.org/projects/iptables/index.html")
821     (synopsis "Program to configure the Linux IP packet filtering rules")
822     (description
823      "iptables is the userspace command line program used to configure the
824 Linux 2.4.x and later IPv4 packet filtering ruleset.  It is targeted towards
825 system administrators.  Since Network Address Translation is also configured
826 from the packet filter ruleset, iptables is used for this, too.  The iptables
827 package also includes ip6tables.  ip6tables is used for configuring the IPv6
828 packet filter.")
829     (license gpl2+)))
831 (define-public iproute
832   (package
833     (name "iproute2")
834     (version "3.12.0")
835     (source (origin
836              (method url-fetch)
837              (uri (string-append
838                    "mirror://kernel.org/linux/utils/net/iproute2/iproute2-"
839                    version ".tar.xz"))
840              (sha256
841               (base32
842                "04gi11gh087bg2nlxhj0lxrk8l9qxkpr88nsiil23917bm3h1xj4"))))
843     (build-system gnu-build-system)
844     (arguments
845      `(#:tests? #f                                ; no test suite
846        #:make-flags (let ((out (assoc-ref %outputs "out")))
847                       (list "DESTDIR="
848                             (string-append "LIBDIR=" out "/lib")
849                             (string-append "SBINDIR=" out "/sbin")
850                             (string-append "CONFDIR=" out "/etc")
851                             (string-append "DOCDIR=" out "/share/doc/"
852                                            ,name "-" ,version)
853                             (string-append "MANDIR=" out "/share/man")))
854        #:phases (alist-cons-before
855                  'install 'pre-install
856                  (lambda _
857                    ;; Don't attempt to create /var/lib/arpd.
858                    (substitute* "Makefile"
859                      (("^.*ARPDDIR.*$") "")))
860                  %standard-phases)))
861     (inputs
862      `(("iptables" ,iptables)
863        ("db4" ,bdb)))
864     (native-inputs
865      `(("pkg-config" ,pkg-config)
866        ("flex" ,flex)
867        ("bison" ,bison)))
868     (home-page
869      "http://www.linuxfoundation.org/collaborate/workgroups/networking/iproute2")
870     (synopsis
871      "Utilities for controlling TCP/IP networking and traffic in Linux")
872     (description
873      "Iproute2 is a collection of utilities for controlling TCP/IP
874 networking and traffic with the Linux kernel.
876 Most network configuration manuals still refer to ifconfig and route as the
877 primary network configuration tools, but ifconfig is known to behave
878 inadequately in modern network environments.  They should be deprecated, but
879 most distros still include them.  Most network configuration systems make use
880 of ifconfig and thus provide a limited feature set.  The /etc/net project aims
881 to support most modern network technologies, as it doesn't use ifconfig and
882 allows a system administrator to make use of all iproute2 features, including
883 traffic control.
885 iproute2 is usually shipped in a package called iproute or iproute2 and
886 consists of several tools, of which the most important are ip and tc.  ip
887 controls IPv4 and IPv6 configuration and tc stands for traffic control.  Both
888 tools print detailed usage messages and are accompanied by a set of
889 manpages.")
890     (license gpl2+)))
892 (define-public net-tools
893   ;; XXX: This package is basically unmaintained, but it provides a few
894   ;; commands not yet provided by Inetutils, such as 'route', so we have to
895   ;; live with it.
896   (package
897     (name "net-tools")
898     (version "1.60")
899     (home-page "http://www.tazenda.demon.co.uk/phil/net-tools/")
900     (source (origin
901              (method url-fetch)
902              (uri (string-append home-page "/" name "-"
903                                  version ".tar.bz2"))
904              (sha256
905               (base32
906                "0yvxrzk0mzmspr7sa34hm1anw6sif39gyn85w4c5ywfn8inxvr3s"))
907              (patches
908               (list (search-patch "net-tools-bitrot.patch")))))
909     (build-system gnu-build-system)
910     (arguments
911      '(#:modules ((guix build gnu-build-system)
912                   (guix build utils)
913                   (srfi srfi-1)
914                   (srfi srfi-26))
915        #:phases (alist-cons-after
916                  'unpack 'patch
917                  (lambda* (#:key inputs #:allow-other-keys)
918                    (define (apply-patch file)
919                      (zero? (system* "patch" "-p1" "--force"
920                                      "--input" file)))
922                    (let ((patch.gz (assoc-ref inputs "patch")))
923                      (format #t "applying Debian patch set '~a'...~%"
924                              patch.gz)
925                      (system (string-append "gunzip < " patch.gz " > the-patch"))
926                      (and (apply-patch "the-patch")
927                           (for-each apply-patch
928                                     (find-files "debian/patches"
929                                                 "\\.patch")))))
930                  (alist-replace
931                   'configure
932                   (lambda* (#:key outputs #:allow-other-keys)
933                     (let ((out (assoc-ref outputs "out")))
934                       (mkdir-p (string-append out "/bin"))
935                       (mkdir-p (string-append out "/sbin"))
937                       ;; Pretend we have everything...
938                       (system "yes | make config")
940                       ;; ... except for the things we don't have.
941                       ;; HAVE_AFDECnet requires libdnet, which we don't have.
942                       ;; HAVE_HWSTRIP and HAVE_HWTR require kernel headers
943                       ;; that have been removed.
944                       (substitute* '("config.make" "config.h")
945                         (("^.*HAVE_(AFDECnet|HWSTRIP|HWTR)[ =]1.*$") ""))))
946                   (alist-cons-after
947                    'install 'remove-redundant-commands
948                    (lambda* (#:key outputs #:allow-other-keys)
949                      ;; Remove commands and man pages redundant with
950                      ;; Inetutils.
951                      (let* ((out (assoc-ref outputs "out"))
952                             (dup (append-map (cut find-files out <>)
953                                              '("^hostname"
954                                                "^(yp|nis|dns)?domainname"))))
955                        (for-each delete-file dup)
956                        #t))
957                    %standard-phases)))
959        ;; Binaries that depend on libnet-tools.a don't declare that
960        ;; dependency, making it parallel-unsafe.
961        #:parallel-build? #f
963        #:tests? #f                                ; no test suite
964        #:make-flags (let ((out (assoc-ref %outputs "out")))
965                       (list "CC=gcc"
966                             (string-append "BASEDIR=" out)
967                             (string-append "INSTALLNLSDIR=" out "/share/locale")
968                             (string-append "mandir=/share/man")))))
970     ;; Use the big Debian patch set (the thing does not even compile out of
971     ;; the box.)
972     (inputs `(("patch" ,(origin
973                          (method url-fetch)
974                          (uri
975                           "http://ftp.de.debian.org/debian/pool/main/n/net-tools/net-tools_1.60-24.2.diff.gz")
976                          (sha256
977                           (base32
978                            "0p93lsqx23v5fv4hpbrydmfvw1ha2rgqpn2zqbs2jhxkzhjc030p"))))))
979     (native-inputs `(("gettext" ,gnu-gettext)))
981     (synopsis "Tools for controlling the network subsystem in Linux")
982     (description
983      "This package includes the important tools for controlling the network
984 subsystem of the Linux kernel.  This includes arp, hostname, ifconfig,
985 netstat, rarp and route.  Additionally, this package contains utilities
986 relating to particular network hardware types (plipconfig, slattach) and
987 advanced aspects of IP configuration (iptunnel, ipmaddr).")
988     (license gpl2+)))
990 (define-public libcap
991   (package
992     (name "libcap")
993     (version "2.22")
994     (source (origin
995              (method url-fetch)
997              ;; Tarballs used to be available from
998              ;; <https://www.kernel.org/pub/linux/libs/security/linux-privs/>
999              ;; but they never came back after kernel.org was compromised.
1000              (uri (string-append
1001                    "mirror://debian/pool/main/libc/libcap2/libcap2_"
1002                    version ".orig.tar.gz"))
1003              (sha256
1004               (base32
1005                "07vjhkznm82p8dm4w6j8mmg7h5c70lp5s9bwwfdmgwpbixfydjp1"))))
1006     (build-system gnu-build-system)
1007     (arguments '(#:phases
1008                  (modify-phases %standard-phases
1009                    (replace 'configure
1010                             ;; Add $libdir to the RUNPATH of executables.
1011                             (lambda _
1012                               (substitute* "Make.Rules"
1013                                 (("LDFLAGS := #-g")
1014                                  (string-append "LDFLAGS := -Wl,-rpath="
1015                                                 %output "/lib"))))))
1016                  #:tests? #f                      ; no 'check' target
1017                  #:make-flags (list "lib=lib"
1018                                     (string-append "prefix="
1019                                                    (assoc-ref %outputs "out"))
1020                                     "RAISE_SETFCAP=no")))
1021     (native-inputs `(("perl" ,perl)))
1022     (inputs `(("attr" ,attr)))
1023     (home-page "https://sites.google.com/site/fullycapable/")
1024     (synopsis "Library for working with POSIX capabilities")
1025     (description
1026      "Libcap2 provides a programming interface to POSIX capabilities on
1027 Linux-based operating systems.")
1029     ;; License is BSD-3 or GPLv2, at the user's choice.
1030     (license gpl2)))
1032 (define-public bridge-utils
1033   (package
1034     (name "bridge-utils")
1035     (version "1.5")
1036     (source (origin
1037              (method url-fetch)
1038              (uri (string-append "mirror://sourceforge/bridge/bridge-utils-"
1039                                  version ".tar.gz"))
1040              (sha256
1041               (base32
1042                "12367cwqmi0yqphi6j8rkx97q8hw52yq2fx4k0xfclkcizxybya2"))))
1043     (build-system gnu-build-system)
1045     ;; The tarball lacks all the generated files.
1046     (native-inputs `(("autoconf" ,autoconf)
1047                      ("automake" ,automake)))
1048     (arguments
1049      '(#:phases (alist-cons-after
1050                  'unpack 'bootstrap
1051                  (lambda _
1052                    ;; Fix "field ‘ip6’ has incomplete type" errors.
1053                    (substitute* "libbridge/libbridge.h"
1054                      (("#include <linux/if_bridge.h>")
1055                       "#include <linux/in6.h>\n#include <linux/if_bridge.h>"))
1057                    ;; Ensure that the entire build fails if one of the
1058                    ;; sub-Makefiles fails.
1059                    (substitute* "Makefile.in"
1060                      (("\\$\\(MAKE\\) \\$\\(MFLAGS\\) -C \\$\\$x ;")
1061                       "$(MAKE) $(MFLAGS) -C $$x || exit 1;"))
1063                    (zero? (system* "autoreconf" "-vf")))
1064                  %standard-phases)
1065        #:tests? #f))                              ; no 'check' target
1067     (home-page
1068      "http://www.linuxfoundation.org/collaborate/workgroups/networking/bridge")
1069     (synopsis "Manipulate Ethernet bridges")
1070     (description
1071      "Utilities for Linux's Ethernet bridging facilities.  A bridge is a way
1072 to connect two Ethernet segments together in a protocol independent way.
1073 Packets are forwarded based on Ethernet address, rather than IP address (like
1074 a router).  Since forwarding is done at Layer 2, all protocols can go
1075 transparently through a bridge.")
1076     (license gpl2+)))
1078 (define-public libnl
1079   (package
1080     (name "libnl")
1081     (version "3.2.25")
1082     (source (origin
1083               (method url-fetch)
1084               (uri (string-append
1085                     "http://www.infradead.org/~tgr/libnl/files/libnl-"
1086                     version ".tar.gz"))
1087               (sha256
1088                (base32
1089                 "1icfrv8yihcb74as1gcgmp0wfpdq632q2zvbvqqvjms9cy87bswb"))))
1090     (build-system gnu-build-system)
1091     (native-inputs `(("flex" ,flex) ("bison" ,bison)))
1092     (home-page "http://www.infradead.org/~tgr/libnl/")
1093     (synopsis "NetLink protocol library suite")
1094     (description
1095      "The libnl suite is a collection of libraries providing APIs to netlink
1096 protocol based Linux kernel interfaces.  Netlink is an IPC mechanism primarly
1097 between the kernel and user space processes.  It was designed to be a more
1098 flexible successor to ioctl to provide mainly networking related kernel
1099 configuration and monitoring interfaces.")
1101     ;; Most files are LGPLv2.1-only, but some are GPLv2-only (like
1102     ;; 'nl-addr-add.c'), so the result is GPLv2-only.
1103     (license gpl2)))
1105 (define-public iw
1106   (package
1107     (name "iw")
1108     (version "3.17")
1109     (source (origin
1110               (method url-fetch)
1111               (uri (string-append
1112                     "https://www.kernel.org/pub/software/network/iw/iw-"
1113                     version ".tar.xz"))
1114               (sha256
1115                (base32
1116                 "14zsapqhivk0ws5z21y1ys2c2czi05mzk7bl2yb7qxcfrnsjx9j8"))))
1117     (build-system gnu-build-system)
1118     (native-inputs `(("pkg-config" ,pkg-config)))
1119     (inputs `(("libnl" ,libnl)))
1120     (arguments
1121      `(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
1122                           "CC=gcc")
1123        #:phases (alist-delete 'configure %standard-phases)))
1124     (home-page "http://wireless.kernel.org/en/users/Documentation/iw")
1125     (synopsis "Tool for configuring wireless devices")
1126     (description
1127      "iw is a new nl80211 based CLI configuration utility for wireless
1128 devices.  It replaces 'iwconfig', which is deprecated.")
1129     (license isc)))
1131 (define-public powertop
1132   (package
1133     (name "powertop")
1134     (version "2.5")
1135     (source
1136      (origin
1137        (method url-fetch)
1138        (uri (string-append
1139              "https://01.org/powertop/sites/default/files/downloads/powertop-"
1140              version ".tar.gz"))
1141        (sha256
1142         (base32
1143          "02rwqbpasdayl201v0549gbp2f82rd0hqiv3i111r7npanjhhb4b"))))
1144     (build-system gnu-build-system)
1145     (inputs
1146      ;; TODO: Add pciutils.
1147      `(("zlib" ,zlib)
1148        ;; ("pciutils" ,pciutils)
1149        ("ncurses" ,ncurses)
1150        ("libnl" ,libnl)))
1151     (native-inputs
1152        `(("pkg-config" ,pkg-config)))
1153     (home-page "https://01.org/powertop/")
1154     (synopsis "Analyze power consumption on Intel-based laptops")
1155     (description
1156      "PowerTOP is a Linux tool to diagnose issues with power consumption and
1157 power management.  In addition to being a diagnostic tool, PowerTOP also has
1158 an interactive mode where the user can experiment various power management
1159 settings for cases where the operating system has not enabled these
1160 settings.")
1161     (license gpl2)))
1163 (define-public aumix
1164   (package
1165     (name "aumix")
1166     (version "2.9.1")
1167     (source (origin
1168               (method url-fetch)
1169               (uri (string-append
1170                     "http://www.jpj.net/~trevor/aumix/releases/aumix-"
1171                     version ".tar.bz2"))
1172               (sha256
1173                (base32
1174                 "0a8fwyxnc5qdxff8sl2sfsbnvgh6pkij4yafiln0fxgg6bal7knj"))))
1175     (build-system gnu-build-system)
1176     (inputs `(("ncurses" ,ncurses)))
1177     (home-page "http://www.jpj.net/~trevor/aumix.html")
1178     (synopsis "Audio mixer for X and the console")
1179     (description
1180      "Aumix adjusts an audio mixer from X, the console, a terminal,
1181 the command line or a script.")
1182     (license gpl2+)))
1184 (define-public iotop
1185   (package
1186     (name "iotop")
1187     (version "0.6")
1188     (source
1189      (origin
1190        (method url-fetch)
1191        (uri (string-append "http://guichaz.free.fr/iotop/files/iotop-"
1192                            version ".tar.gz"))
1193        (sha256 (base32
1194                 "1kp8mqg2pbxq4xzpianypadfxcsyfgwcaqgqia6h9fsq6zyh4z0s"))))
1195     (build-system python-build-system)
1196     (arguments
1197      ;; The setup.py script expects python-2.
1198      `(#:python ,python-2
1199        ;; There are currently no checks in the package.
1200        #:tests? #f))
1201     (native-inputs `(("python" ,python-2)))
1202     (home-page "http://guichaz.free.fr/iotop/")
1203     (synopsis
1204      "Displays the IO activity of running processes")
1205     (description
1206      "Iotop is a Python program with a top like user interface to show the
1207 processes currently causing I/O.")
1208     (license gpl2+)))
1210 (define-public fuse
1211   (package
1212     (name "fuse")
1213     (version "2.9.3")
1214     (source (origin
1215               (method url-fetch)
1216               (uri (string-append "mirror://sourceforge/fuse/fuse-"
1217                                   version ".tar.gz"))
1218               (sha256
1219                (base32
1220                 "071r6xjgssy8vwdn6m28qq1bqxsd2bphcd2mzhq0grf5ybm87sqb"))
1221               (patches (list (search-patch "fuse-CVE-2015-3202.patch")))))
1222     (build-system gnu-build-system)
1223     (inputs `(("util-linux" ,util-linux)))
1224     (arguments
1225      '(#:configure-flags (list (string-append "MOUNT_FUSE_PATH="
1226                                               (assoc-ref %outputs "out")
1227                                               "/sbin")
1228                                (string-append "INIT_D_PATH="
1229                                               (assoc-ref %outputs "out")
1230                                               "/etc/init.d")
1232                                ;; The rule makes /dev/fuse 666.
1233                                (string-append "UDEV_RULES_PATH="
1234                                               (assoc-ref %outputs "out")
1235                                               "/lib/udev/rules.d"))
1236       #:phases (alist-cons-before
1237                 'build 'set-file-names
1238                 (lambda* (#:key inputs #:allow-other-keys)
1239                   ;; libfuse calls out to mount(8) and umount(8).  Make sure
1240                   ;; it refers to the right ones.
1241                   (substitute* '("lib/mount_util.c" "util/mount_util.c")
1242                     (("/bin/(u?)mount" _ maybe-u)
1243                      (string-append (assoc-ref inputs "util-linux")
1244                                     "/bin/" maybe-u "mount")))
1245                   (substitute* '("util/mount.fuse.c")
1246                     (("/bin/sh")
1247                      (which "sh")))
1249                   ;; This hack leads libfuse to search for 'fusermount' in
1250                   ;; $PATH, where it may find a setuid-root binary, instead of
1251                   ;; trying solely $out/sbin/fusermount and failing because
1252                   ;; it's not setuid.
1253                   (substitute* "lib/Makefile"
1254                     (("-DFUSERMOUNT_DIR=[[:graph:]]+")
1255                      "-DFUSERMOUNT_DIR=\\\"/var/empty\\\"")))
1256                 %standard-phases)))
1257     (home-page "http://fuse.sourceforge.net/")
1258     (synopsis "Support file systems implemented in user space")
1259     (description
1260      "As a consequence of its monolithic design, file system code for Linux
1261 normally goes into the kernel itself---which is not only a robustness issue,
1262 but also an impediment to system extensibility.  FUSE, for \"file systems in
1263 user space\", is a kernel module and user-space library that tries to address
1264 part of this problem by allowing users to run file system implementations as
1265 user-space processes.")
1266     (license (list lgpl2.1                        ; library
1267                    gpl2+))))                      ; command-line utilities
1269 (define-public unionfs-fuse
1270   (package
1271     (name "unionfs-fuse")
1272     (version "0.26")
1273     (source (origin
1274               (method url-fetch)
1275               (uri (string-append
1276                     "http://podgorny.cz/unionfs-fuse/releases/unionfs-fuse-"
1277                     version ".tar.xz"))
1278               (sha256
1279                (base32
1280                 "0qpnr4czgc62vsfnmv933w62nq3xwcbnvqch72qakfgca75rsp4d"))))
1281     (build-system cmake-build-system)
1282     (inputs `(("fuse" ,fuse)))
1283     (arguments '(#:tests? #f))                    ; no tests
1284     (home-page "http://podgorny.cz/moin/UnionFsFuse")
1285     (synopsis "User-space union file system")
1286     (description
1287      "UnionFS-FUSE is a flexible union file system implementation in user
1288 space, using the FUSE library.  Mounting a union file system allows you to
1289 \"aggregate\" the contents of several directories into a single mount point.
1290 UnionFS-FUSE additionally supports copy-on-write.")
1291     (license bsd-3)))
1293 (define fuse-static
1294   (package (inherit fuse)
1295     (name "fuse-static")
1296     (source (origin (inherit (package-source fuse))
1297               (modules '((guix build utils)))
1298               (snippet
1299                ;; Normally libfuse invokes mount(8) so that /etc/mtab is
1300                ;; updated.  Change calls to 'mtab_needs_update' to 0 so that
1301                ;; it doesn't do that, allowing us to remove the dependency on
1302                ;; util-linux (something that is useful in initrds.)
1303                '(substitute* '("lib/mount_util.c"
1304                                "util/mount_util.c")
1305                   (("mtab_needs_update[[:blank:]]*\\([a-z_]+\\)")
1306                    "0")
1307                   (("/bin/")
1308                    "")))))))
1310 (define-public unionfs-fuse/static
1311   (package (inherit unionfs-fuse)
1312     (synopsis "User-space union file system (statically linked)")
1313     (name (string-append (package-name unionfs-fuse) "-static"))
1314     (source (origin (inherit (package-source unionfs-fuse))
1315               (modules '((guix build utils)))
1316               (snippet
1317                ;; Add -ldl to the libraries, because libfuse.a needs that.
1318                '(substitute* "src/CMakeLists.txt"
1319                   (("target_link_libraries(.*)\\)" _ libs)
1320                    (string-append "target_link_libraries"
1321                                   libs " dl)"))))))
1322     (arguments
1323      '(#:tests? #f
1324        #:configure-flags '("-DCMAKE_EXE_LINKER_FLAGS=-static")
1325        #:phases (alist-cons-after
1326                  'install 'post-install
1327                  (lambda* (#:key outputs #:allow-other-keys)
1328                    (let* ((out (assoc-ref outputs "out"))
1329                           (exe (string-append out "/bin/unionfs")))
1330                      ;; By default, 'unionfs' keeps references to
1331                      ;; $glibc/share/locale and similar stuff.  Remove them.
1332                      (remove-store-references exe)))
1333                  %standard-phases)))
1334     (inputs `(("fuse" ,fuse-static)))))
1336 (define-public sshfs-fuse
1337   (package
1338     (name "sshfs-fuse")
1339     (version "2.5")
1340     (source (origin
1341               (method url-fetch)
1342               (uri (string-append "mirror://sourceforge/fuse/sshfs-fuse-"
1343                                   version ".tar.gz"))
1344               (sha256
1345                (base32
1346                 "0gp6qr33l2p0964j0kds0dfmvyyf5lpgsn11daf0n5fhwm9185z9"))))
1347     (build-system gnu-build-system)
1348     (inputs
1349      `(("fuse" ,fuse)
1350        ("glib" ,glib)))
1351     (native-inputs
1352      `(("pkg-config" ,pkg-config)))
1353     (home-page "http://fuse.sourceforge.net/sshfs.html")
1354     (synopsis "Mount remote file systems over SSH")
1355     (description
1356      "This is a file system client based on the SSH File Transfer Protocol.
1357 Since most SSH servers already support this protocol it is very easy to set
1358 up: on the server side there's nothing to do; on the client side mounting the
1359 file system is as easy as logging into the server with an SSH client.")
1360     (license gpl2+)))
1362 (define-public numactl
1363   (package
1364     (name "numactl")
1365     (version "2.0.9")
1366     (source (origin
1367               (method url-fetch)
1368               (uri (string-append
1369                     "ftp://oss.sgi.com/www/projects/libnuma/download/numactl-"
1370                     version
1371                     ".tar.gz"))
1372               (sha256
1373                (base32
1374                 "073myxlyyhgxh1w3r757ajixb7s2k69czc3r0g12c3scq7k3784w"))))
1375     (build-system gnu-build-system)
1376     (arguments
1377      '(#:phases (alist-replace
1378                  'configure
1379                  (lambda* (#:key outputs #:allow-other-keys)
1380                    ;; There's no 'configure' script, just a raw makefile.
1381                    (substitute* "Makefile"
1382                      (("^prefix := .*$")
1383                       (string-append "prefix := " (assoc-ref outputs "out")
1384                                      "\n"))
1385                      (("^libdir := .*$")
1386                       ;; By default the thing tries to install under
1387                       ;; $prefix/lib64 when on a 64-bit platform.
1388                       (string-append "libdir := $(prefix)/lib\n"))))
1389                  %standard-phases)
1391        #:make-flags (list
1392                      ;; By default the thing tries to use 'cc'.
1393                      "CC=gcc"
1395                      ;; Make sure programs have an RPATH so they can find
1396                      ;; libnuma.so.
1397                      (string-append "LDLIBS=-Wl,-rpath="
1398                                     (assoc-ref %outputs "out") "/lib"))
1400        ;; There's a 'test' target, but it requires NUMA support in the kernel
1401        ;; to run, which we can't assume to have.
1402        #:tests? #f))
1403     (home-page "http://oss.sgi.com/projects/libnuma/")
1404     (synopsis "Tools for non-uniform memory access (NUMA) machines")
1405     (description
1406      "NUMA stands for Non-Uniform Memory Access, in other words a system whose
1407 memory is not all in one place.  The numactl program allows you to run your
1408 application program on specific CPU's and memory nodes.  It does this by
1409 supplying a NUMA memory policy to the operating system before running your
1410 program.
1412 The package contains other commands, such as numademo, numastat and memhog.
1413 The numademo command provides a quick overview of NUMA performance on your
1414 system.")
1415     (license (list gpl2                           ; programs
1416                    lgpl2.1))))                    ; library
1418 (define-public kbd
1419   (package
1420     (name "kbd")
1421     (version "2.0.2")
1422     (source (origin
1423               (method url-fetch)
1424               (uri (string-append "mirror://kernel.org/linux/utils/kbd/kbd-"
1425                                   version ".tar.xz"))
1426               (sha256
1427                (base32
1428                 "04mrms12nm5sas0nxs94yrr3hz7gmqhnmfgb9ff34bh1jszxmzcx"))
1429               (modules '((guix build utils)))
1430               (snippet
1431                '(begin
1432                   (substitute* "tests/Makefile.in"
1433                     ;; The '%: %.in' rule incorrectly uses @VERSION@.
1434                     (("@VERSION@")
1435                      "[@]VERSION[@]"))
1436                   (substitute* '("src/unicode_start" "src/unicode_stop")
1437                     ;; Assume the Coreutils are in $PATH.
1438                     (("/usr/bin/tty")
1439                      "tty"))))))
1440     (build-system gnu-build-system)
1441     (arguments
1442      '(#:phases (alist-cons-before
1443                  'build 'pre-build
1444                  (lambda* (#:key inputs #:allow-other-keys)
1445                    (let ((gzip  (assoc-ref %build-inputs "gzip"))
1446                          (bzip2 (assoc-ref %build-inputs "bzip2")))
1447                      (substitute* "src/libkeymap/findfile.c"
1448                        (("gzip")
1449                         (string-append gzip "/bin/gzip"))
1450                        (("bzip2")
1451                         (string-append bzip2 "/bin/bzip2")))))
1452                  (alist-cons-after
1453                   'install 'post-install
1454                   (lambda* (#:key outputs #:allow-other-keys)
1455                     ;; Make sure these programs find their comrades.
1456                     (let* ((out (assoc-ref outputs "out"))
1457                            (bin (string-append out "/bin")))
1458                       (for-each (lambda (prog)
1459                                   (wrap-program (string-append bin "/" prog)
1460                                                 `("PATH" ":" prefix (,bin))))
1461                                 '("unicode_start" "unicode_stop"))))
1462                   %standard-phases))))
1463     (inputs `(("check" ,check)
1464               ("gzip" ,gzip)
1465               ("bzip2" ,bzip2)
1466               ("pam" ,linux-pam)))
1467     (native-inputs `(("pkg-config" ,pkg-config)))
1468     (home-page "ftp://ftp.kernel.org/pub/linux/utils/kbd/")
1469     (synopsis "Linux keyboard utilities and keyboard maps")
1470     (description
1471      "This package contains keytable files and keyboard utilities compatible
1472 for systems using the Linux kernel.  This includes commands such as
1473 'loadkeys', 'setfont', 'kbdinfo', and 'chvt'.")
1474     (license gpl2+)))
1476 (define-public inotify-tools
1477   (package
1478     (name "inotify-tools")
1479     (version "3.13")
1480     (source (origin
1481               (method url-fetch)
1482               (uri (string-append
1483                     "mirror://sourceforge/inotify-tools/inotify-tools/"
1484                     version "/inotify-tools-" version ".tar.gz"))
1485               (sha256
1486                (base32
1487                 "0icl4bx041axd5dvhg89kilfkysjj86hjakc7bk8n49cxjn4cha6"))))
1488     (build-system gnu-build-system)
1489     (home-page "http://inotify-tools.sourceforge.net/")
1490     (synopsis "Monitor file accesses")
1491     (description
1492      "The inotify-tools packages provides a C library and command-line tools
1493 to use Linux' inotify mechanism, which allows file accesses to be monitored.")
1494     (license gpl2+)))
1496 (define-public kmod
1497   (package
1498     (name "kmod")
1499     (version "17")
1500     (source (origin
1501               (method url-fetch)
1502               (uri
1503                (string-append "mirror://kernel.org/linux/utils/kernel/kmod/"
1504                               "kmod-" version ".tar.xz"))
1505               (sha256
1506                (base32
1507                 "1yid3a9b64a60ybj66fk2ysrq5klnl0ijl4g624cl16y8404g9rv"))
1508               (patches (list (search-patch "kmod-module-directory.patch")))))
1509     (build-system gnu-build-system)
1510     (native-inputs
1511      `(("pkg-config" ,pkg-config)))
1512     (inputs
1513      `(("xz" ,xz)
1514        ("zlib" ,zlib)))
1515     (arguments
1516      `(#:tests? #f ; FIXME: Investigate test failures
1517        #:configure-flags '("--with-xz" "--with-zlib")
1518        #:phases (alist-cons-after
1519                  'install 'install-modprobe&co
1520                  (lambda* (#:key outputs #:allow-other-keys)
1521                    (let* ((out (assoc-ref outputs "out"))
1522                           (bin (string-append out "/bin")))
1523                      (for-each (lambda (tool)
1524                                  (symlink "kmod"
1525                                           (string-append bin "/" tool)))
1526                                '("insmod" "rmmod" "lsmod" "modprobe"
1527                                  "modinfo" "depmod"))))
1528                  %standard-phases)))
1529     (home-page "https://www.kernel.org/")
1530     (synopsis "Kernel module tools")
1531     (description "Kmod is a set of tools to handle common tasks with Linux
1532 kernel modules like insert, remove, list, check properties, resolve
1533 dependencies and aliases.
1535 These tools are designed on top of libkmod, a library that is shipped with
1536 kmod.  The aim is to be compatible with tools, configurations and indices
1537 from the module-init-tools project.")
1538     (license gpl2+))) ; library under lgpl2.1+
1540 (define-public eudev
1541   ;; The post-systemd fork, maintained by Gentoo.
1542   (package
1543     (name "eudev")
1544     (version "2.1.1")
1545     (source (origin
1546               (method url-fetch)
1547               (uri (string-append
1548                     "http://dev.gentoo.org/~blueness/eudev/eudev-"
1549                     version ".tar.gz"))
1550               (sha256
1551                (base32
1552                 "0shf5vqiz9fdxl95aa1a8vh0xjxwim3psc39wr2xr8lnahf11vva"))
1553               (patches (list (search-patch "eudev-rules-directory.patch")))
1554               (modules '((guix build utils)))
1555               (snippet
1556                ;; 'configure' checks uses <linux/btrfs.h> as an indication of
1557                ;; whether Linux headers are available, but it doesn't actually
1558                ;; use it, and our 'linux-libre-headers' package doesn't
1559                ;; provide it.  So just remove that.
1560                '(substitute* "configure"
1561                   (("linux/btrfs\\.h")
1562                    "")))))
1563     (build-system gnu-build-system)
1564     (native-inputs
1565      `(("pkg-config" ,pkg-config)
1566        ("gperf" ,gperf)
1567        ("glib" ,glib "bin")                       ; glib-genmarshal, etc.
1568        ("perl" ,perl)                             ; for the tests
1569        ("python" ,python-2)))                     ; ditto
1570     (inputs
1571      `(("kmod" ,kmod)
1572        ("pciutils" ,pciutils)
1573        ("usbutils" ,usbutils)
1574        ("util-linux" ,util-linux)
1575        ("glib" ,glib)
1576        ("gobject-introspection" ,gobject-introspection)))
1577     (arguments
1578      `(#:configure-flags (list "--enable-libkmod"
1580                                (string-append
1581                                 "--with-pci-ids-path="
1582                                 (assoc-ref %build-inputs "pciutils")
1583                                 "/share/pci.ids.gz")
1585                                "--with-firmware-path=/no/firmware"
1587                                ;; Work around undefined reference to
1588                                ;; 'mq_getattr' in sc-daemon.c.
1589                                "LDFLAGS=-lrt")
1590        #:phases
1591        (alist-cons-before
1592         'build 'pre-build
1593         ;; The program 'g-ir-scanner' (part of the package
1594         ;; 'gobject-introspection'), to generate .gir files, makes some
1595         ;; library pre-processing.  During that phase it looks for the C
1596         ;; compiler as either 'cc' or as defined by the environment variable
1597         ;; 'CC' (with code in 'giscanner/dumper.py').
1598         (lambda* _
1599           (setenv "CC" "gcc"))
1600         %standard-phases)))
1601     (home-page "http://www.gentoo.org/proj/en/eudev/")
1602     (synopsis "Userspace device management")
1603     (description "Udev is a daemon which dynamically creates and removes
1604 device nodes from /dev/, handles hotplug events and loads drivers at boot
1605 time.")
1606     (license gpl2+)))
1608 (define-public lvm2
1609   (package
1610     (name "lvm2")
1611     (version "2.02.109")
1612     (source (origin
1613               (method url-fetch)
1614               (uri (string-append "ftp://sources.redhat.com/pub/lvm2/releases/LVM2."
1615                                   version ".tgz"))
1616               (sha256
1617                (base32
1618                 "1rv5ivg0l1w3nwzwdkqixm96h5bzg7ib4rr196ysb2lw42jmpjbv"))
1619               (modules '((guix build utils)))
1620               (snippet
1621                '(begin
1622                   (use-modules (guix build utils))
1624                   ;; Honor sysconfdir.
1625                   (substitute* "make.tmpl.in"
1626                     (("confdir = .*$")
1627                      "confdir = @sysconfdir@\n")
1628                     (("DEFAULT_SYS_DIR = @DEFAULT_SYS_DIR@")
1629                      "DEFAULT_SYS_DIR = @sysconfdir@"))))))
1630     (build-system gnu-build-system)
1631     (native-inputs
1632      `(("pkg-config" ,pkg-config)
1633        ("procps" ,procps)))                       ;tests use 'pgrep'
1634     (inputs
1635      `(("udev" ,eudev)))
1636     (arguments
1637      '(#:phases (alist-cons-after
1638                  'configure 'set-makefile-shell
1639                  (lambda _
1640                    ;; Use 'sh', not 'bash', so that '. lib/utils.sh' works as
1641                    ;; expected.
1642                    (setenv "SHELL" (which "sh"))
1644                    ;; Replace /bin/sh with the right file name.
1645                    (patch-makefile-SHELL "make.tmpl"))
1646                  %standard-phases)
1648        #:configure-flags (list (string-append "--sysconfdir="
1649                                               (assoc-ref %outputs "out")
1650                                               "/etc/lvm")
1651                                "--enable-udev_sync"
1652                                "--enable-udev_rules"
1654                                ;; Make sure programs such as 'dmsetup' can
1655                                ;; find libdevmapper.so.
1656                                (string-append "LDFLAGS=-Wl,-rpath="
1657                                               (assoc-ref %outputs "out")
1658                                               "/lib"))
1660        ;; The tests use 'mknod', which requires root access.
1661        #:tests? #f))
1662     (home-page "http://sourceware.org/lvm2/")
1663     (synopsis "Logical volume management for Linux")
1664     (description
1665      "LVM2 is the logical volume management tool set for Linux-based systems.
1666 This package includes the user-space libraries and tools, including the device
1667 mapper.  Kernel components are part of Linux-libre.")
1669     ;; Libraries (liblvm2, libdevmapper) are LGPLv2.1.
1670     ;; Command-line tools are GPLv2.
1671     (license (list gpl2 lgpl2.1))))
1673 (define-public wireless-tools
1674   (package
1675     (name "wireless-tools")
1676     (version "30.pre9")
1677     (source (origin
1678               (method url-fetch)
1679               (uri (string-append "http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/wireless_tools."
1680                                   version ".tar.gz"))
1681               (sha256
1682                (base32
1683                 "0qscyd44jmhs4k32ggp107hlym1pcyjzihiai48xs7xzib4wbndb"))
1684               (modules '((guix build utils)))
1685               (snippet
1686                ;; Install the manual pages in the right place.
1687                '(substitute* "Makefile"
1688                   (("INSTALL_MAN= .*")
1689                    "INSTALL_MAN= $(PREFIX)/share/man")))))
1690     (build-system gnu-build-system)
1691     (arguments
1692      `(#:phases (alist-replace
1693                  'configure
1694                  (lambda* (#:key outputs #:allow-other-keys)
1695                    (setenv "PREFIX" (assoc-ref outputs "out")))
1696                  %standard-phases)
1697        #:tests? #f))
1698     (synopsis "Tools for manipulating Linux Wireless Extensions")
1699     (description "Wireless Tools are used to manipulate the now-deprecated
1700 Linux Wireless Extensions; consider using 'iw' instead.  The Wireless
1701 Extension was an interface allowing you to set Wireless LAN specific
1702 parameters and get the specific stats.  It is deprecated in favor the nl80211
1703 interface.")
1704     (home-page "http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html")
1705     (license gpl2+)))
1707 (define-public crda
1708   (package
1709     (name "crda")
1710     (version "3.18")
1711     (source (origin
1712               (method url-fetch)
1713               (uri (string-append "mirror://kernel.org/software/network/crda/"
1714                                   "crda-" version ".tar.xz"))
1715               (sha256
1716                (base32
1717                 "1gydiqgb08d9gbx4l6gv98zg3pljc984m50hmn3ysxcbkxkvkz23"))
1718               (patches (list (search-patch "crda-optional-gcrypt.patch")))))
1719     (build-system gnu-build-system)
1720     (arguments
1721      '(#:phases (modify-phases %standard-phases
1722                   (delete 'configure)
1723                   (add-before
1724                    'build 'no-werror-no-ldconfig
1725                    (lambda _
1726                      (substitute* "Makefile"
1727                        (("-Werror")  "")
1728                        (("ldconfig") "true"))
1729                      #t))
1730                   (add-before
1731                    'build 'set-regulator-db-file-name
1732                    (lambda* (#:key inputs #:allow-other-keys)
1733                      ;; Tell CRDA where to find our database.
1734                      (let ((regdb (assoc-ref inputs "wireless-regdb")))
1735                        (substitute* "crda.c"
1736                          (("\"/lib/crda/regulatory.bin\"")
1737                           (string-append "\"" regdb
1738                                          "/lib/crda/regulatory.bin\"")))
1739                        #t))))
1740        #:test-target "verify"
1741        #:make-flags (let ((out   (assoc-ref %outputs "out"))
1742                           (regdb (assoc-ref %build-inputs "wireless-regdb")))
1743                       (list "CC=gcc" "V=1"
1745                             ;; Disable signature-checking on 'regulatory.bin'.
1746                             ;; The reason is that this simplifies maintenance
1747                             ;; on our side (no need to manage a distro key
1748                             ;; pair), and we can guarantee integrity of
1749                             ;; 'regulatory.bin' by other means anyway, such as
1750                             ;; 'guix gc --verify'.  See
1751                             ;; <https://wireless.wiki.kernel.org/en/developers/regulatory/wireless-regdb>
1752                             ;; for a discssion.
1753                             "USE_OPENSSL=0"
1755                             (string-append "PREFIX=" out)
1756                             (string-append "SBINDIR=" out "/sbin/")
1757                             (string-append "UDEV_RULE_DIR="
1758                                            out "/lib/udev/rules.d")
1759                             (string-append "LDFLAGS=-Wl,-rpath="
1760                                            out "/lib -L.")
1761                             (string-append "REG_BIN=" regdb
1762                                            "/lib/crda/regulatory.bin")))))
1763     (native-inputs `(("pkg-config" ,pkg-config)
1764                      ("python" ,python-2)
1765                      ("wireless-regdb" ,wireless-regdb)))
1766     (inputs `(("libnl" ,libnl)))
1767     (home-page
1768      "https://wireless.wiki.kernel.org/en/developers/Regulatory/CRDA")
1769     (synopsis "Central regulatory domain agent (CRDA) for WiFi")
1770     (description
1771      "The Central Regulatory Domain Agent (CRDA) acts as the udev helper for
1772 communication between the kernel Linux and user space for regulatory
1773 compliance.")
1774     (license copyleft-next)))
1776 (define-public wireless-regdb
1777   (package
1778     (name "wireless-regdb")
1779     (version "2015.04.06")
1780     (source (origin
1781               (method url-fetch)
1782               (uri (string-append
1783                     "mirror://kernel.org/software/network/wireless-regdb/"
1784                     "wireless-regdb-" version ".tar.xz"))
1785               (sha256
1786                (base32
1787                 "0czi83k311fp27z42hxjm8vi88fsbc23mhavv96lkb4pmari0jjc"))))
1788     (build-system gnu-build-system)
1789     (arguments
1790      '(#:phases (modify-phases %standard-phases
1791                   (delete 'configure))
1792        #:tests? #f                                ;no tests
1793        #:make-flags (let ((out (assoc-ref %outputs "out")))
1794                       (list (string-append "PREFIX=" out)
1795                             (string-append "LSB_ID=GuixSD")
1796                             (string-append "DISTRO_PUBKEY=/dev/null")
1797                             (string-append "DISTRO_PRIVKEY=/dev/null")
1798                             (string-append "REGDB_PUBKEY=/dev/null")
1800                             ;; Leave that empty so that db2bin.py doesn't try
1801                             ;; to sign 'regulatory.bin'.  This allows us to
1802                             ;; avoid managing a key pair for the whole distro.
1803                             (string-append "REGDB_PRIVKEY=")))))
1804     (native-inputs `(("python" ,python-2)))
1805     (home-page
1806      "https://wireless.wiki.kernel.org/en/developers/regulatory/wireless-regdb")
1807     (synopsis "Wireless regulatory database")
1808     (description
1809      "This package contains the wireless regulatory database Central
1810 Regulatory Database Agent (CRDA) daemon.  The database contains information on
1811 country-specific regulations for the wireless spectrum.")
1812     (license isc)))
1814 (define-public lm-sensors
1815   (package
1816     (name "lm-sensors")
1817     (version "3.3.5")
1818     (source (origin
1819               (method url-fetch)
1820               (uri (string-append
1821                     "http://dl.lm-sensors.org/lm-sensors/releases/lm_sensors-"
1822                     version ".tar.bz2"))
1823               (sha256
1824                (base32
1825                 "1ksgrynxgrq590nb2fwxrl1gwzisjkqlyg3ljfd1al0ibrk6mbjx"))
1826               (patches (list (search-patch "lm-sensors-hwmon-attrs.patch")))))
1827     (build-system gnu-build-system)
1828     (inputs `(("rrdtool" ,rrdtool)
1829               ("perl" ,perl)
1830               ("kmod" ,kmod)
1831               ("gnuplot" ,gnuplot)))
1832     (native-inputs `(("pkg-config" ,pkg-config)
1833                      ("flex" ,flex)
1834                      ("bison" ,bison)
1835                      ("which" ,which)))
1836     (arguments
1837      `(#:tests? #f  ; no 'check' target
1838        #:make-flags (list (string-append "PREFIX=" %output)
1839                           (string-append "ETCDIR=" %output "/etc")
1840                           (string-append "MANDIR=" %output "/share/man"))
1841        #:phases
1842        (alist-delete
1843         'configure
1844         (alist-cons-before
1845          'build 'patch-exec-paths
1846          (lambda* (#:key inputs outputs #:allow-other-keys)
1847            (substitute* "prog/detect/sensors-detect"
1848              (("`uname")
1849               (string-append "`" (assoc-ref inputs "coreutils")
1850                              "/bin/uname"))
1851              (("(`|\")modprobe" all open-quote)
1852               (string-append open-quote
1853                              (assoc-ref inputs "kmod")
1854                              "/bin/modprobe")))
1855            (substitute* '("prog/pwm/pwmconfig"
1856                           "prog/pwm/fancontrol")
1857              (("gnuplot")
1858               (string-append (assoc-ref inputs "gnuplot")
1859                              "/bin/gnuplot"))
1860              (("cat ")
1861               (string-append (assoc-ref inputs "coreutils")
1862                              "/bin/cat "))
1863              (("egrep ")
1864               (string-append (assoc-ref inputs "grep")
1865                              "/bin/egrep "))
1866              (("sed -e")
1867               (string-append (assoc-ref inputs "sed")
1868                              "/bin/sed -e"))
1869              (("cut -d")
1870               (string-append (assoc-ref inputs "coreutils")
1871                              "/bin/cut -d"))
1872              (("sleep ")
1873               (string-append (assoc-ref inputs "coreutils")
1874                              "/bin/sleep "))
1875              (("readlink -f")
1876               (string-append (assoc-ref inputs "coreutils")
1877                              "/bin/readlink -f"))))
1878          %standard-phases))))
1879     (home-page "http://www.lm-sensors.org/")
1880     (synopsis "Utilities to read temperature/voltage/fan sensors")
1881     (description
1882      "Lm-sensors is a hardware health monitoring package for Linux.  It allows
1883 you to access information from temperature, voltage, and fan speed sensors.
1884 It works with most newer systems.")
1885     (license gpl2+)))
1887 (define-public i2c-tools
1888   (package
1889     (name "i2c-tools")
1890     (version "3.1.1")
1891     (source (origin
1892               (method url-fetch)
1893               (uri (string-append
1894                     "http://dl.lm-sensors.org/i2c-tools/releases/i2c-tools-"
1895                     version ".tar.bz2"))
1896               (sha256
1897                (base32
1898                 "000pvg995qy1b15ks59gd0klri55hb33kqpg5czy84hw1pbdgm0l"))))
1899     (build-system gnu-build-system)
1900     (arguments
1901      `(#:tests? #f  ; no 'check' target
1902        #:make-flags (list (string-append "prefix=" %output)
1903                           "CC=gcc")
1904        ;; no configure script
1905        #:phases (alist-delete 'configure %standard-phases)))
1906     (inputs
1907      `(("perl" ,perl)))
1908     (home-page "http://www.lm-sensors.org/wiki/I2CTools")
1909     (synopsis "I2C tools for Linux")
1910     (description
1911      "The i2c-tools package contains a heterogeneous set of I2C tools for
1912 Linux: a bus probing tool, a chip dumper, register-level SMBus access helpers,
1913 EEPROM decoding scripts, EEPROM programming tools, and a python module for
1914 SMBus access.")
1915     (license gpl2+)))
1917 (define-public xsensors
1918   (package
1919     (name "xsensors")
1920     (version "0.70")
1921     (source (origin
1922               (method url-fetch)
1923               (uri (string-append
1924                     "http://www.linuxhardware.org/xsensors/xsensors-"
1925                     version ".tar.gz"))
1926               (sha256
1927                (base32
1928                 "1siplsfgvcxamyqf44h71jx6jdfmvhfm7mh0y1q8ps4zs6pj2zwh"))))
1929     (build-system gnu-build-system)
1930     (inputs `(("lm-sensors" ,lm-sensors)
1931               ("gtk" ,gtk+-2)))
1932     (native-inputs `(("pkg-config" ,pkg-config)))
1933     (arguments
1934      `(#:phases (alist-cons-before
1935                  'configure 'enable-deprecated
1936                  (lambda _
1937                    (substitute* "src/Makefile.in"
1938                      (("-DGDK_DISABLE_DEPRECATED") "")
1939                      (("-DGTK_DISABLE_DEPRECATED") "")))
1940                  (alist-cons-before
1941                   'configure 'remove-Werror
1942                   (lambda _
1943                     (substitute* '("configure" "src/Makefile.in")
1944                       (("-Werror") "")))
1945                   %standard-phases))))
1946     (home-page "http://www.linuxhardware.org/xsensors/")
1947     (synopsis "Hardware health information viewer")
1948     (description
1949      "Xsensors reads data from the libsensors library regarding hardware
1950 health such as temperature, voltage and fan speed and displays the information
1951 in a digital read-out.")
1952     (license gpl2+)))
1954 (define-public perf
1955   (package
1956     (name "perf")
1957     (version (package-version linux-libre))
1958     (source (package-source linux-libre))
1959     (build-system gnu-build-system)
1960     (arguments
1961      '(#:phases (alist-replace
1962                  'configure
1963                  (lambda* (#:key inputs #:allow-other-keys)
1964                    (setenv "SHELL_PATH" (which "bash"))
1965                    (chdir "tools/perf"))
1966                  %standard-phases)
1967        #:make-flags (list (string-append "DESTDIR="
1968                                          (assoc-ref %outputs "out"))
1969                           "WERROR=0"
1971                           ;; By default, 'config/Makefile' uses lib64 on
1972                           ;; x86_64.  Work around that.
1973                           "lib=lib")
1974        #:tests? #f))                              ;no tests
1975     (native-inputs
1976      `(("pkg-config" ,pkg-config)
1977        ("bison" ,bison)
1978        ("flex" ,flex)
1980        ;; There are build scripts written in these languages.
1981        ("perl" ,perl)
1982        ("python" ,python-2)))
1983     (inputs
1984      `(("slang" ,slang)                        ;for the interactive TUI
1985        ;; ("newt" ,newt)
1986        ("python" ,python-2)                    ;'perf' links against libpython
1987        ("elfutils" ,elfutils)
1989        ;; Documentation.
1990        ("libxml2" ,libxml2)                       ;for $XML_CATALOG_FILES
1991        ("libxslt" ,libxslt)
1992        ("docbook-xml" ,docbook-xml)
1993        ("docbook-xsl" ,docbook-xsl)
1994        ("xmlto" ,xmlto)
1995        ("asciidoc" ,asciidoc)))
1996     (home-page "https://perf.wiki.kernel.org/")
1997     (synopsis "Linux profiling with performance counters")
1998     (description
1999      "perf is a tool suite for profiling using hardware performance counters,
2000 with support in the Linux kernel.  perf can instrument CPU performance
2001 counters, tracepoints, kprobes, and uprobes (dynamic tracing).  It is capable
2002 of lightweight profiling.  This package contains the user-land tools and in
2003 particular the 'perf' command.")
2004     (license (package-license linux-libre))))
2006 (define-public pflask
2007   (package
2008     (name "pflask")
2009     (version "0.2")
2010     (source (origin
2011               (method url-fetch)
2012               (uri (string-append "https://github.com/ghedo/pflask/archive/v"
2013                                   version ".tar.gz"))
2014               (file-name (string-append name "-" version ".tar.gz"))
2015               (sha256
2016                (base32
2017                 "1g8fjj67dfkc2s0852l9vqi1pm61gp4rxbpzbzg780f5s5hd1fys"))))
2018     (build-system cmake-build-system)
2019     (arguments
2020      '(#:tests? #f)) ; no tests
2021     (home-page "http://ghedo.github.io/pflask/")
2022     (synopsis "Simple tool for creating Linux namespace containers")
2023     (description "pflask is a simple tool for creating Linux namespace
2024 containers.  It can be used for running a command or even booting an OS inside
2025 an isolated container, created with the help of Linux namespaces.  It is
2026 similar in functionality to chroot, although pflask provides better isolation
2027 thanks to the use of namespaces.")
2028     (license bsd-2)))
2030 (define-public hdparm
2031   (package
2032     (name "hdparm")
2033     (version "9.45")
2034     (source (origin
2035               (method url-fetch)
2036               (uri (string-append "mirror://sourceforge/" name "/"
2037                                   name "-" version ".tar.gz"))
2038               (sha256
2039                (base32
2040                 "0sc6yf3k6sd7n6a2ig2my9fjlqpak3znlyw7jw4cz5d9asm1rc13"))))
2041     (build-system gnu-build-system)
2042     (arguments
2043      `(#:make-flags (let ((out (assoc-ref %outputs "out")))
2044                       (list (string-append "binprefix=" out)
2045                             (string-append "manprefix=" out)
2046                             "CC=gcc"))
2047        #:phases (alist-delete 'configure %standard-phases)
2048        #:tests? #f))  ; no test suite
2049     (home-page "http://sourceforge.net/projects/hdparm/")
2050     (synopsis "tune hard disk parameters for high performance")
2051     (description
2052      "Get/set device parameters for Linux SATA/IDE drives.  It's primary use
2053 is for enabling irq-unmasking and IDE multiplemode.")
2054     (license (non-copyleft "file://LICENSE.TXT"))))
2056 (define-public acpid
2057   (package
2058     (name "acpid")
2059     (version "2.0.23")
2060     (source (origin
2061               (method url-fetch)
2062               (uri (string-append "mirror://sourceforge/acpid2/acpid-"
2063                                   version ".tar.xz"))
2064               (sha256
2065                (base32
2066                 "1vl7c6vc724v4jwki17czgj6lnrknnj1a6llm8gkl32i2gnam5j3"))))
2067     (build-system gnu-build-system)
2068     (home-page "http://sourceforge.net/projects/acpid2/")
2069     (synopsis "Daemon for delivering ACPI events to user-space programs")
2070     (description
2071      "acpid is designed to notify user-space programs of Advanced
2072 Configuration and Power Interface (ACPI) events.  acpid should be started
2073 during the system boot, and will run as a background process.  When an ACPI
2074 event is received from the kernel, acpid will examine the list of rules
2075 specified in /etc/acpi/events and execute the rules that match the event.")
2076     (license gpl2+)))
2078 (define-public sysfsutils
2079   (package
2080     (name "sysfsutils")
2081     (version "2.1.0")
2082     (source
2083      (origin
2084        (method url-fetch)
2085        (uri
2086         (string-append
2087          "mirror://sourceforge/linux-diag/sysfsutils/" version "/sysfsutils-"
2088          version ".tar.gz"))
2089        (sha256
2090         (base32 "12i0ip11xbfcjzxz4r10cvz7mbzgq1hfcdn97w6zz7sm3wndwrg8"))))
2091     (build-system gnu-build-system)
2092     (home-page "http://linux-diag.sourceforge.net/Sysfsutils.html")
2093     (synopsis "System utilities based on Linux sysfs")
2094     (description
2095      "These are a set of utilites built upon sysfs, a virtual filesystem in
2096 Linux kernel versions 2.5+ that exposes a system's device tree.  The package
2097 also contains the libsysfs library.")
2098     ;; The library is under lgpl2.1+ (all files say "or any later version").
2099     ;; The rest is mostly gpl2, with a few files indicating gpl2+.
2100     (license (list gpl2 gpl2+ lgpl2.1+))))
2102 (define-public sysfsutils-1
2103   (package
2104     (inherit sysfsutils)
2105     (version "1.3.0")
2106     (source
2107      (origin
2108        (method url-fetch)
2109        (uri
2110         (string-append
2111          "mirror://sourceforge/linux-diag/sysfsutils/sysfsutils-" version
2112          "/sysfsutils-" version ".tar.gz"))
2113        (sha256
2114         (base32 "0kdhs07fm8263pxwd5blwn2x211cg4fk63fyf9ijcdkvzmwxrqq3"))
2115        (modules '((guix build utils)))
2116        (snippet
2117         '(begin
2118            (substitute* "Makefile.in"
2119              (("includedir = /usr/include/sysfs")
2120               "includedir = @includedir@"))
2121            (substitute* "configure"
2122              (("includedir='(\\$\\{prefix\\}/include)'" all orig)
2123               (string-append "includedir='" orig "/sysfs'")))))))
2124     ;; XXX sysfsutils-1.3.0's config.guess fails on mips64el
2125     (arguments `(#:configure-flags
2126                  '(,@(if (%current-target-system)
2127                          '()
2128                          (let ((triplet
2129                                 (nix-system->gnu-triplet (%current-system))))
2130                            (list (string-append "--build=" triplet)))))))
2131     (synopsis "System utilities based on Linux sysfs (version 1.x)")))
2133 (define-public cpufrequtils
2134   (package
2135     (name "cpufrequtils")
2136     (version "0.3")
2137     (source
2138      (origin
2139        (method url-fetch)
2140        (uri
2141         (string-append
2142          "https://www.kernel.org/pub/linux/utils/kernel/cpufreq/cpufrequtils-"
2143          version ".tar.gz"))
2144        (sha256
2145         (base32 "0qfqv7nqmjfr3p0bwrdlxkiqwqr7vmx053cadaa548ybqbghxmvm"))
2146        (patches (list (search-patch "cpufrequtils-fix-aclocal.patch")))))
2147     (build-system gnu-build-system)
2148     (native-inputs
2149      `(("sysfsutils" ,sysfsutils-1)))
2150     (arguments
2151      '(#:make-flags (list (string-append "LDFLAGS=-Wl,-rpath="
2152                                          (assoc-ref %outputs "out") "/lib"))))
2153     (home-page "https://www.kernel.org/pub/linux/utils/kernel/cpufreq/")
2154     (synopsis "Utilities to get and set CPU frequency on Linux")
2155     (description
2156      "The cpufrequtils suite contains utilities to retreive CPU frequency
2157 information, and set the CPU frequency if supported, using the cpufreq
2158 capabilities of the Linux kernel.")
2159     (license gpl2)))
2161 (define-public libraw1394
2162   (package
2163     (name "libraw1394")
2164     (version "2.1.0")
2165     (source (origin
2166               (method url-fetch)
2167               (uri (string-append
2168                     "mirror://kernel.org/linux/libs/ieee1394/"
2169                     name "-" version ".tar.xz"))
2170               (sha256
2171                (base32
2172                 "0kwnf4ha45c04mhc4yla672aqmvqqihxix1gvblns5cd2pc2cc8b"))))
2173     (build-system gnu-build-system)
2174     (home-page "https://ieee1394.wiki.kernel.org/index.php/Main_Page")
2175     (synopsis "Interface library for the Linux IEEE1394 drivers")
2176     (description
2177      "Libraw1394 is the only supported interface to the kernel side raw1394 of
2178 the Linux IEEE-1394 subsystem, which provides direct access to the connected
2179 1394 buses to user space.  Through libraw1394/raw1394, applications can directly
2180 send to and receive from other nodes without requiring a kernel driver for the
2181 protocol in question.")
2182     (license lgpl2.1+)))
2184 (define-public libavc1394
2185   (package
2186     (name "libavc1394")
2187     (version "0.5.4")
2188     (source (origin
2189               (method url-fetch)
2190               (uri (string-append "mirror://sourceforge/libavc1394/"
2191                                   name "-" version ".tar.gz"))
2192               (sha256
2193                (base32
2194                 "0lsv46jdqvdx5hx92v0z2cz3yh6212pz9gk0k3513sbaa04zzcbw"))))
2195     (build-system gnu-build-system)
2196     (native-inputs
2197      `(("pkg-config" ,pkg-config)))
2198     (propagated-inputs
2199      `(("libraw1394" ,libraw1394))) ; required by libavc1394.pc
2200     (home-page "http://sourceforge.net/projects/libavc1394/")
2201     (synopsis "AV/C protocol library for IEEE 1394")
2202     (description
2203      "Libavc1394 is a programming interface to the AV/C specification from
2204 the 1394 Trade Assocation.  AV/C stands for Audio/Video Control.")
2205     (license lgpl2.1+)))
2207 (define-public libiec61883
2208   (package
2209     (name "libiec61883")
2210     (version "1.2.0")
2211     (source (origin
2212               (method url-fetch)
2213               (uri (string-append
2214                     "mirror://kernel.org/linux/libs/ieee1394/"
2215                     name "-" version ".tar.xz"))
2216               (sha256
2217                (base32
2218                 "17ph458zya2l8dr2xwqnzy195qd9swrir31g78qkgb3g4xz2rq6i"))))
2219     (build-system gnu-build-system)
2220     (native-inputs
2221      `(("pkg-config" ,pkg-config)))
2222     (propagated-inputs
2223      `(("libraw1394" ,libraw1394))) ; required by libiec61883.pc
2224     (home-page "https://ieee1394.wiki.kernel.org/index.php/Main_Page")
2225     (synopsis "Isochronous streaming media library for IEEE 1394")
2226     (description
2227      "The libiec61883 library provides a higher level API for streaming DV,
2228 MPEG-2 and audio over Linux IEEE 1394.")
2229     (license lgpl2.1+)))
2231 (define-public mdadm
2232   (package
2233     (name "mdadm")
2234     (version "3.3.2")
2235     (source (origin
2236               (method url-fetch)
2237               (uri (string-append
2238                     "mirror://kernel.org/linux/utils/raid/mdadm/mdadm-"
2239                     version ".tar.xz"))
2240               (sha256
2241                (base32
2242                 "132vdvh3myjgcjn6i9w90ck16ddjxjcszklzkyvr4f5ifqd7wfhg"))
2243               (patches (list (search-patch "mdadm-gcc-4.9-fix.patch")))))
2244     (build-system gnu-build-system)
2245     (inputs
2246      `(("udev" ,eudev)))
2247     (arguments
2248      `(#:make-flags (let ((out (assoc-ref %outputs "out")))
2249                       (list "INSTALL=install"
2250                             "CHECK_RUN_DIR=0"
2251                             ;; TODO: tell it where to find 'sendmail'
2252                             ;; (string-append "MAILCMD=" <???> "/sbin/sendmail")
2253                             (string-append "BINDIR=" out "/sbin")
2254                             (string-append "MANDIR=" out "/share/man")
2255                             (string-append "UDEVDIR=" out "/lib/udev")))
2256        #:phases (alist-cons-before
2257                  'build 'patch-program-paths
2258                  (lambda* (#:key inputs #:allow-other-keys)
2259                    (let ((coreutils (assoc-ref inputs "coreutils")))
2260                      (substitute* "udev-md-raid-arrays.rules"
2261                        (("/usr/bin/(readlink|basename)" all program)
2262                         (string-append coreutils "/bin/" program)))))
2263                  (alist-delete 'configure %standard-phases))
2264        ;;tests must be done as root
2265        #:tests? #f))
2266     (home-page "http://neil.brown.name/blog/mdadm")
2267     (synopsis "Tool for managing Linux Software RAID arrays")
2268     (description
2269      "mdadm is a tool for managing Linux Software RAID arrays.  It can create,
2270 assemble, report on, and monitor arrays.  It can also move spares between raid
2271 arrays when needed.")
2272     (license gpl2+)))
2274 (define-public libaio
2275   (package
2276     (name "libaio")
2277     (version "0.3.110")
2278     (source (origin
2279               (method url-fetch)
2280              (uri (list
2281                    (string-append "mirror://debian/pool/main/liba/libaio/"
2282                                   name "_" version ".orig.tar.gz")
2283                    (string-append "https://fedorahosted.org/releases/l/i/libaio/"
2284                                   name "-" version ".tar.gz")))
2285              (sha256
2286               (base32
2287                "0zjzfkwd1kdvq6zpawhzisv7qbq1ffs343i5fs9p498pcf7046g0"))))
2288     (build-system gnu-build-system)
2289     (arguments
2290      '(#:make-flags
2291        (list "CC=gcc" (string-append "prefix=" %output))
2292        #:test-target "partcheck" ; need root for a full 'check'
2293        #:phases
2294        (alist-delete 'configure %standard-phases))) ; no configure script
2295     (home-page "http://lse.sourceforge.net/io/aio.html")
2296     (synopsis "Linux-native asynchronous I/O access library")
2297     (description
2298      "This library enables userspace to use Linux kernel asynchronous I/O
2299 system calls, important for the performance of databases and other advanced
2300 applications.")
2301     (license lgpl2.1+)))
2303 (define-public bluez
2304   (package
2305     (name "bluez")
2306     (version "5.30")
2307     (source (origin
2308               (method url-fetch)
2309               (uri (string-append
2310                     "https://www.kernel.org/pub/linux/bluetooth/bluez-"
2311                     version ".tar.xz"))
2312               (sha256
2313                (base32
2314                 "0b1qbnq1xzcdw5rajg9yyg31bf21jnff0n6gnf1snz89bbdllfhy"))))
2315     (build-system gnu-build-system)
2316     (arguments
2317      '(#:configure-flags
2318        (let ((out (assoc-ref %outputs "out")))
2319          (list "--enable-library"
2320                "--disable-systemd"
2321                ;; Install dbus/udev files to the correct location.
2322                (string-append "--with-dbusconfdir=" out "/etc")
2323                (string-append "--with-udevdir=" out "/lib/udev")))))
2324     (native-inputs
2325      `(("pkg-config" ,pkg-config)
2326        ("gettext" ,gnu-gettext)))
2327     (inputs
2328      `(("glib" ,glib)
2329        ("dbus" ,dbus)
2330        ("eudev" ,eudev)
2331        ("libical" ,libical)
2332        ("readline" ,readline)))
2333     (home-page "http://www.bluez.org/")
2334     (synopsis "Linux Bluetooth protocol stack")
2335     (description
2336      "BlueZ provides support for the core Bluetooth layers and protocols.  It
2337 is flexible, efficient and uses a modular implementation.")
2338     (license gpl2+)))