Merge branch 'master' into core-updates
[jackhill/guix/guix.git] / gnu / packages / linux.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2013, 2014 Andreas Enge <andreas@enge.fr>
4 ;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
5 ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
6 ;;;
7 ;;; This file is part of GNU Guix.
8 ;;;
9 ;;; GNU Guix is free software; you can redistribute it and/or modify it
10 ;;; under the terms of the GNU General Public License as published by
11 ;;; the Free Software Foundation; either version 3 of the License, or (at
12 ;;; your option) any later version.
13 ;;;
14 ;;; GNU Guix is distributed in the hope that it will be useful, but
15 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;;; GNU General Public License for more details.
18 ;;;
19 ;;; You should have received a copy of the GNU General Public License
20 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21
22 (define-module (gnu packages linux)
23 #:use-module ((guix licenses)
24 #:hide (zlib))
25 #:use-module (gnu packages)
26 #:use-module ((gnu packages compression) #:prefix guix:)
27 #:use-module (gnu packages flex)
28 #:use-module (gnu packages bison)
29 #:use-module (gnu packages gperf)
30 #:use-module (gnu packages libusb)
31 #:use-module (gnu packages ncurses)
32 #:use-module (gnu packages pciutils)
33 #:use-module (gnu packages databases)
34 #:use-module (gnu packages perl)
35 #:use-module (gnu packages pkg-config)
36 #:use-module (gnu packages python)
37 #:use-module (gnu packages algebra)
38 #:use-module (gnu packages gettext)
39 #:use-module (gnu packages glib)
40 #:use-module (gnu packages pulseaudio)
41 #:use-module (gnu packages attr)
42 #:use-module (gnu packages xml)
43 #:use-module (gnu packages autotools)
44 #:use-module (gnu packages texinfo)
45 #:use-module (gnu packages check)
46 #:use-module (gnu packages maths)
47 #:use-module (gnu packages which)
48 #:use-module (gnu packages rrdtool)
49 #:use-module (gnu packages gtk)
50 #:use-module (guix packages)
51 #:use-module (guix download)
52 #:use-module (guix build-system gnu)
53 #:use-module (guix build-system cmake)
54 #:use-module (guix build-system python)
55 #:use-module (guix build-system trivial)
56 #:use-module (srfi srfi-26)
57 #:use-module (ice-9 match))
58
59 (define-public (system->linux-architecture arch)
60 "Return the Linux architecture name for ARCH, a Guix system name such as
61 \"x86_64-linux\"."
62 (let ((arch (car (string-split arch #\-))))
63 (cond ((string=? arch "i686") "i386")
64 ((string-prefix? "mips" arch) "mips")
65 ((string-prefix? "arm" arch) "arm")
66 (else arch))))
67
68 (define (linux-libre-urls version)
69 "Return a list of URLs for Linux-Libre VERSION."
70 (list (string-append
71 "http://linux-libre.fsfla.org/pub/linux-libre/releases/"
72 version "-gnu/linux-libre-" version "-gnu.tar.xz")
73
74 ;; XXX: Work around <http://bugs.gnu.org/14851>.
75 (string-append
76 "ftp://alpha.gnu.org/gnu/guix/mirror/linux-libre-"
77 version "-gnu.tar.xz")
78
79 ;; Maybe this URL will become valid eventually.
80 (string-append
81 "mirror://gnu/linux-libre/" version "-gnu/linux-libre-"
82 version "-gnu.tar.xz")))
83
84 (define-public linux-libre-headers
85 (let* ((version "3.3.8")
86 (build-phase
87 (lambda (arch)
88 `(lambda _
89 (setenv "ARCH" ,(system->linux-architecture arch))
90 (format #t "`ARCH' set to `~a'~%" (getenv "ARCH"))
91
92 (and (zero? (system* "make" "defconfig"))
93 (zero? (system* "make" "mrproper" "headers_check"))))))
94 (install-phase
95 `(lambda* (#:key outputs #:allow-other-keys)
96 (let ((out (assoc-ref outputs "out")))
97 (and (zero? (system* "make"
98 (string-append "INSTALL_HDR_PATH=" out)
99 "headers_install"))
100 (mkdir (string-append out "/include/config"))
101 (call-with-output-file
102 (string-append out
103 "/include/config/kernel.release")
104 (lambda (p)
105 (format p "~a-default~%" ,version))))))))
106 (package
107 (name "linux-libre-headers")
108 (version version)
109 (source (origin
110 (method url-fetch)
111 (uri (linux-libre-urls version))
112 (sha256
113 (base32
114 "0jkfh0z1s6izvdnc3njm39dhzp1cg8i06jv06izwqz9w9qsprvnl"))))
115 (build-system gnu-build-system)
116 (native-inputs `(("perl" ,perl)))
117 (arguments
118 `(#:modules ((guix build gnu-build-system)
119 (guix build utils)
120 (srfi srfi-1))
121 #:phases (alist-replace
122 'build ,(build-phase (or (%current-target-system)
123 (%current-system)))
124 (alist-replace
125 'install ,install-phase
126 (alist-delete 'configure %standard-phases)))
127 #:tests? #f))
128 (synopsis "GNU Linux-Libre kernel headers")
129 (description "Headers of the Linux-Libre kernel.")
130 (license gpl2)
131 (home-page "http://www.gnu.org/software/linux-libre/"))))
132
133 (define-public module-init-tools
134 (package
135 (name "module-init-tools")
136 (version "3.16")
137 (source (origin
138 (method url-fetch)
139 (uri (string-append
140 "mirror://kernel.org/linux/utils/kernel/module-init-tools/module-init-tools-"
141 version ".tar.bz2"))
142 (sha256
143 (base32
144 "0jxnz9ahfic79rp93l5wxcbgh4pkv85mwnjlbv1gz3jawv5cvwp1"))
145 (patches
146 (list (search-patch "module-init-tools-moduledir.patch")))))
147 (build-system gnu-build-system)
148 (arguments
149 ;; FIXME: The upstream tarball lacks man pages, and building them would
150 ;; require DocBook & co. We used to use Gentoo's pre-built man pages,
151 ;; but they vanished. In the meantime, fake it.
152 '(#:phases (alist-cons-before
153 'configure 'fake-docbook
154 (lambda _
155 (substitute* "Makefile.in"
156 (("^DOCBOOKTOMAN.*$")
157 "DOCBOOKTOMAN = true\n")))
158 %standard-phases)))
159 (home-page "http://www.kernel.org/pub/linux/utils/kernel/module-init-tools/")
160 (synopsis "Tools for loading and managing Linux kernel modules")
161 (description
162 "Tools for loading and managing Linux kernel modules, such as `modprobe',
163 `insmod', `lsmod', and more.")
164 (license gpl2+)))
165
166 (define %boot-logo-patch
167 ;; Linux-Libre boot logo featuring Freedo and a gnu.
168 (origin
169 (method url-fetch)
170 (uri (string-append "http://www.fsfla.org/svn/fsfla/software/linux-libre/"
171 "lemote/gnewsense/branches/3.16/100gnu+freedo.patch"))
172 (sha256
173 (base32
174 "1hk9swxxc80bmn2zd2qr5ccrjrk28xkypwhl4z0qx4hbivj7qm06"))))
175
176 (define (kernel-config system)
177 "Return the absolute file name of the Linux-Libre build configuration file
178 for SYSTEM, or #f if there is no configuration for SYSTEM."
179 (define (lookup file)
180 (let ((file (string-append "gnu/packages/" file)))
181 (search-path %load-path file)))
182
183 (match system
184 ("i686-linux"
185 (lookup "linux-libre-i686.conf"))
186 ("x86_64-linux"
187 (lookup "linux-libre-x86_64.conf"))
188 (_
189 #f)))
190
191 (define-public linux-libre
192 (let* ((version "3.16.2")
193 (build-phase
194 '(lambda* (#:key system inputs #:allow-other-keys #:rest args)
195 ;; Apply the neat patch.
196 (system* "patch" "-p1" "--batch"
197 "-i" (assoc-ref inputs "patch/freedo+gnu"))
198
199 (let ((arch (car (string-split system #\-))))
200 (setenv "ARCH"
201 (cond ((string=? arch "i686") "i386")
202 (else arch)))
203 (format #t "`ARCH' set to `~a'~%" (getenv "ARCH")))
204
205 (let ((build (assoc-ref %standard-phases 'build))
206 (config (assoc-ref inputs "kconfig")))
207
208 ;; Use the architecture-specific config if available, and
209 ;; 'defconfig' otherwise.
210 (if config
211 (begin
212 (copy-file config ".config")
213 (chmod ".config" #o666))
214 (system* "make" "defconfig"))
215
216 ;; Appending works even when the option wasn't in the
217 ;; file. The last one prevails if duplicated.
218 (let ((port (open-file ".config" "a")))
219 (display (string-append "CONFIG_NET_9P=m\n"
220 "CONFIG_NET_9P_VIRTIO=m\n"
221 "CONFIG_VIRTIO_BLK=m\n"
222 "CONFIG_VIRTIO_NET=m\n"
223 ;; https://lists.gnu.org/archive/html/guix-devel/2014-04/msg00039.html
224 "CONFIG_DEVPTS_MULTIPLE_INSTANCES=y\n"
225 "CONFIG_VIRTIO_PCI=m\n"
226 "CONFIG_VIRTIO_BALLOON=m\n"
227 "CONFIG_VIRTIO_MMIO=m\n"
228 "CONFIG_FUSE_FS=m\n"
229 "CONFIG_CIFS=m\n"
230 "CONFIG_9P_FS=m\n")
231 port)
232 (close-port port))
233
234 (zero? (system* "make" "oldconfig"))
235
236 ;; Call the default `build' phase so `-j' is correctly
237 ;; passed.
238 (apply build #:make-flags "all" args))))
239 (install-phase
240 `(lambda* (#:key inputs outputs #:allow-other-keys)
241 (let* ((out (assoc-ref outputs "out"))
242 (moddir (string-append out "/lib/modules"))
243 (mit (assoc-ref inputs "module-init-tools")))
244 (mkdir-p moddir)
245 (for-each (lambda (file)
246 (copy-file file
247 (string-append out "/" (basename file))))
248 (find-files "." "^(bzImage|System\\.map)$"))
249 (copy-file ".config" (string-append out "/config"))
250 (zero? (system* "make"
251 (string-append "DEPMOD=" mit "/sbin/depmod")
252 (string-append "MODULE_DIR=" moddir)
253 (string-append "INSTALL_PATH=" out)
254 (string-append "INSTALL_MOD_PATH=" out)
255 "INSTALL_MOD_STRIP=1"
256 "modules_install"))))))
257 (package
258 (name "linux-libre")
259 (version version)
260 (source (origin
261 (method url-fetch)
262 (uri (linux-libre-urls version))
263 (sha256
264 (base32
265 "1p08cqy6427yi808fpbwbb4zbwhnkibj2i1wbrfa5rjhd4vnnffz"))))
266 (build-system gnu-build-system)
267 (native-inputs `(("perl" ,perl)
268 ("bc" ,bc)
269 ("module-init-tools" ,module-init-tools)
270 ("patch/freedo+gnu" ,%boot-logo-patch)
271
272 ,@(let ((conf (kernel-config (or (%current-target-system)
273 (%current-system)))))
274 (if conf
275 `(("kconfig" ,conf))
276 '()))))
277 (arguments
278 `(#:modules ((guix build gnu-build-system)
279 (guix build utils)
280 (srfi srfi-1)
281 (ice-9 match))
282 #:phases (alist-replace
283 'build ,build-phase
284 (alist-replace
285 'install ,install-phase
286 (alist-delete 'configure %standard-phases)))
287 #:tests? #f))
288 (synopsis "100% free redistribution of a cleaned Linux kernel")
289 (description
290 "GNU Linux-Libre is a free (as in freedom) variant of the Linux kernel.
291 It has been modified to remove all non-free binary blobs.")
292 (license gpl2)
293 (home-page "http://www.gnu.org/software/linux-libre/"))))
294
295 \f
296 ;;;
297 ;;; Pluggable authentication modules (PAM).
298 ;;;
299
300 (define-public linux-pam
301 (package
302 (name "linux-pam")
303 (version "1.1.6")
304 (source
305 (origin
306 (method url-fetch)
307 (uri (list (string-append "http://www.linux-pam.org/library/Linux-PAM-"
308 version ".tar.bz2")
309 (string-append "mirror://kernel.org/linux/libs/pam/library/Linux-PAM-"
310 version ".tar.bz2")))
311 (sha256
312 (base32
313 "1hlz2kqvbjisvwyicdincq7nz897b9rrafyzccwzqiqg53b8gf5s"))))
314 (build-system gnu-build-system)
315 (native-inputs
316 `(("flex" ,flex)
317
318 ;; TODO: optional dependencies
319 ;; ("libxcrypt" ,libxcrypt)
320 ;; ("cracklib" ,cracklib)
321 ))
322 (arguments
323 '(;; Most users, such as `shadow', expect the headers to be under
324 ;; `security'.
325 #:configure-flags (list (string-append "--includedir="
326 (assoc-ref %outputs "out")
327 "/include/security"))
328
329 ;; XXX: Tests won't run in chroot, presumably because /etc/pam.d
330 ;; isn't available.
331 #:tests? #f))
332 (home-page "http://www.linux-pam.org/")
333 (synopsis "Pluggable authentication modules for Linux")
334 (description
335 "A *Free* project to implement OSF's RFC 86.0.
336 Pluggable authentication modules are small shared object files that can
337 be used through the PAM API to perform tasks, like authenticating a user
338 at login. Local and dynamic reconfiguration are its key features")
339 (license bsd-3)))
340
341 \f
342 ;;;
343 ;;; Miscellaneous.
344 ;;;
345
346 (define-public psmisc
347 (package
348 (name "psmisc")
349 (version "22.20")
350 (source
351 (origin
352 (method url-fetch)
353 (uri (string-append "mirror://sourceforge/psmisc/psmisc/psmisc-"
354 version ".tar.gz"))
355 (sha256
356 (base32
357 "052mfraykmxnavpi8s78aljx8w87hyvpx8mvzsgpjsjz73i28wmi"))))
358 (build-system gnu-build-system)
359 (inputs `(("ncurses" ,ncurses)))
360 (home-page "http://psmisc.sourceforge.net/")
361 (synopsis
362 "set of utilities that use the proc filesystem, such as fuser, killall, and pstree")
363 (description
364 "This PSmisc package is a set of some small useful utilities that
365 use the proc filesystem. We're not about changing the world, but
366 providing the system administrator with some help in common tasks.")
367 (license gpl2+)))
368
369 (define-public util-linux
370 (package
371 (name "util-linux")
372 (version "2.21")
373 (source (origin
374 (method url-fetch)
375 (uri (string-append "mirror://kernel.org/linux/utils/"
376 name "/v" version "/"
377 name "-" version ".2" ".tar.xz"))
378 (sha256
379 (base32
380 "1rpgghf7n0zx0cdy8hibr41wvkm2qp1yvd8ab1rxr193l1jmgcir"))
381 (patches (list (search-patch "util-linux-perl.patch")))))
382 (build-system gnu-build-system)
383 (arguments
384 `(#:configure-flags '("--disable-use-tty-group"
385 "--enable-ddate")
386 #:phases (alist-cons-after
387 'install 'patch-chkdupexe
388 (lambda* (#:key outputs #:allow-other-keys)
389 (let ((out (assoc-ref outputs "out")))
390 (substitute* (string-append out "/bin/chkdupexe")
391 ;; Allow 'patch-shebang' to do its work.
392 (("@PERL@") "/bin/perl"))))
393 %standard-phases)))
394 (inputs `(("zlib" ,guix:zlib)
395 ("ncurses" ,ncurses)))
396 (native-inputs
397 `(("perl" ,perl)))
398 (home-page "https://www.kernel.org/pub/linux/utils/util-linux/")
399 (synopsis "Collection of utilities for the Linux kernel")
400 (description
401 "util-linux is a random collection of utilities for the Linux kernel.")
402
403 ;; Note that util-linux doesn't use the same license for all the
404 ;; code. GPLv2+ is the default license for a code without an
405 ;; explicitly defined license.
406 (license (list gpl3+ gpl2+ gpl2 lgpl2.0+
407 bsd-4 public-domain))))
408
409 (define-public procps
410 (package
411 (name "procps")
412 (version "3.2.8")
413 (source (origin
414 (method url-fetch)
415 (uri (string-append "http://procps.sourceforge.net/procps-"
416 version ".tar.gz"))
417 (sha256
418 (base32
419 "0d8mki0q4yamnkk4533kx8mc0jd879573srxhg6r2fs3lkc6iv8i"))
420 (patches (list (search-patch "procps-make-3.82.patch")))))
421 (build-system gnu-build-system)
422 (inputs `(("ncurses" ,ncurses)))
423 (arguments
424 '(#:phases (alist-replace
425 'configure
426 (lambda* (#:key outputs #:allow-other-keys)
427 ;; No `configure', just a single Makefile.
428 (let ((out (assoc-ref outputs "out")))
429 (substitute* "Makefile"
430 (("/usr/") "/")
431 (("--(owner|group) 0") "")
432 (("ldconfig") "true")
433 (("^LDFLAGS[[:blank:]]*:=(.*)$" _ value)
434 ;; Add libproc to the RPATH.
435 (string-append "LDFLAGS := -Wl,-rpath="
436 out "/lib" value))))
437 (setenv "CC" "gcc"))
438 (alist-replace
439 'install
440 (lambda* (#:key outputs #:allow-other-keys)
441 (let ((out (assoc-ref outputs "out")))
442 (and (zero?
443 (system* "make" "install"
444 (string-append "DESTDIR=" out)))
445
446 ;; Sanity check.
447 (zero?
448 (system* (string-append out "/bin/ps")
449 "--version")))))
450 %standard-phases))
451
452 ;; What did you expect? Tests?
453 #:tests? #f))
454 (home-page "http://procps.sourceforge.net/")
455 (synopsis "Utilities that give information about processes")
456 (description
457 "procps is the package that has a bunch of small useful utilities
458 that give information about processes using the Linux /proc file system.
459 The package includes the programs ps, top, vmstat, w, kill, free,
460 slabtop, and skill.")
461 (license gpl2)))
462
463 (define-public usbutils
464 (package
465 (name "usbutils")
466 (version "006")
467 (source
468 (origin
469 (method url-fetch)
470 (uri (string-append "mirror://kernel.org/linux/utils/usb/usbutils/"
471 "usbutils-" version ".tar.xz"))
472 (sha256
473 (base32
474 "03pd57vv8c6x0hgjqcbrxnzi14h8hcghmapg89p8k5zpwpkvbdfr"))))
475 (build-system gnu-build-system)
476 (inputs
477 `(("libusb" ,libusb)))
478 (native-inputs
479 `(("pkg-config" ,pkg-config)))
480 (home-page "http://www.linux-usb.org/")
481 (synopsis
482 "Tools for working with USB devices, such as lsusb")
483 (description
484 "Tools for working with USB devices, such as lsusb.")
485 (license gpl2+)))
486
487 (define-public e2fsprogs
488 (package
489 (name "e2fsprogs")
490 (version "1.42.7")
491 (source (origin
492 (method url-fetch)
493 (uri (string-append "mirror://sourceforge/e2fsprogs/e2fsprogs-"
494 version ".tar.gz"))
495 (sha256
496 (base32
497 "0ibkkvp6kan0hn0d1anq4n2md70j5gcm7mwna515w82xwyr02rfw"))))
498 (build-system gnu-build-system)
499 (inputs `(("util-linux" ,util-linux)))
500 (native-inputs `(("pkg-config" ,pkg-config)
501 ("texinfo" ,texinfo))) ; for the libext2fs Info manual
502 (arguments
503 '(#:phases (alist-cons-before
504 'configure 'patch-shells
505 (lambda _
506 (substitute* "configure"
507 (("/bin/sh (.*)parse-types.sh" _ dir)
508 (string-append (which "sh") " " dir
509 "parse-types.sh")))
510 (substitute* (find-files "." "^Makefile.in$")
511 (("#!/bin/sh")
512 (string-append "#!" (which "sh")))))
513 %standard-phases)
514
515 ;; FIXME: Tests work by comparing the stdout/stderr of programs, that
516 ;; they fail because we get an extra line that says "Can't check if
517 ;; filesystem is mounted due to missing mtab file".
518 #:tests? #f))
519 (home-page "http://e2fsprogs.sourceforge.net/")
520 (synopsis "Creating and checking ext2/ext3/ext4 file systems")
521 (description
522 "This package provides tools for manipulating ext2/ext3/ext4 file systems.")
523 (license (list gpl2 ; programs
524 lgpl2.0 ; libext2fs
525 x11)))) ; libuuid
526
527 (define-public e2fsck/static
528 (package
529 (name "e2fsck-static")
530 (version (package-version e2fsprogs))
531 (build-system trivial-build-system)
532 (source #f)
533 (arguments
534 `(#:modules ((guix build utils))
535 #:builder
536 (begin
537 (use-modules (guix build utils)
538 (ice-9 ftw)
539 (srfi srfi-26))
540
541 (let ((source (string-append (assoc-ref %build-inputs "e2fsprogs")
542 "/sbin"))
543 (bin (string-append (assoc-ref %outputs "out") "/sbin")))
544 (mkdir-p bin)
545 (with-directory-excursion bin
546 (for-each (lambda (file)
547 (copy-file (string-append source "/" file)
548 file)
549 (remove-store-references file)
550 (chmod file #o555))
551 (scandir source (cut string-prefix? "fsck." <>))))))))
552 (inputs `(("e2fsprogs" ,(static-package e2fsprogs))))
553 (synopsis "Statically-linked fsck.* commands from e2fsprogs")
554 (description
555 "This package provides statically-linked command of fsck.ext[234] taken
556 from the e2fsprogs package. It is meant to be used in initrds.")
557 (home-page (package-home-page e2fsprogs))
558 (license (package-license e2fsprogs))))
559
560 (define-public strace
561 (package
562 (name "strace")
563 (version "4.7")
564 (source (origin
565 (method url-fetch)
566 (uri (string-append "mirror://sourceforge/strace/strace-"
567 version ".tar.xz"))
568 (sha256
569 (base32
570 "158iwk0pl2mfw93m1843xb7a2zb8p6lh0qim07rca6f1ff4dk764"))))
571 (build-system gnu-build-system)
572 (native-inputs `(("perl" ,perl)))
573 (home-page "http://strace.sourceforge.net/")
574 (synopsis "System call tracer for Linux")
575 (description
576 "strace is a system call tracer, i.e. a debugging tool which prints out a
577 trace of all the system calls made by a another process/program.")
578 (license bsd-3)))
579
580 (define-public alsa-lib
581 (package
582 (name "alsa-lib")
583 (version "1.0.27.1")
584 (source (origin
585 (method url-fetch)
586 (uri (string-append
587 "ftp://ftp.alsa-project.org/pub/lib/alsa-lib-"
588 version ".tar.bz2"))
589 (sha256
590 (base32
591 "0fx057746dj7rjdi0jnvx2m9b0y1lgdkh1hks87d8w32xyihf3k9"))
592 (patches (list (search-patch "alsa-lib-mips-atomic-fix.patch")))))
593 (build-system gnu-build-system)
594 (home-page "http://www.alsa-project.org/")
595 (synopsis "The Advanced Linux Sound Architecture libraries")
596 (description
597 "The Advanced Linux Sound Architecture (ALSA) provides audio and
598 MIDI functionality to the Linux-based operating system.")
599 (license lgpl2.1+)))
600
601 (define-public alsa-utils
602 (package
603 (name "alsa-utils")
604 (version "1.0.27.2")
605 (source (origin
606 (method url-fetch)
607 (uri (string-append "ftp://ftp.alsa-project.org/pub/utils/alsa-utils-"
608 version ".tar.bz2"))
609 (sha256
610 (base32
611 "1sjjngnq50jv5ilwsb4zys6smifni3bd6fn28gbnhfrg14wsrgq2"))))
612 (build-system gnu-build-system)
613 (arguments
614 ;; XXX: Disable man page creation until we have DocBook.
615 '(#:configure-flags (list "--disable-xmlto"
616
617 ;; The udev rule is responsible for restoring
618 ;; the volume.
619 (string-append "--with-udev-rules-dir="
620 (assoc-ref %outputs "out")
621 "/lib/udev/rules.d"))
622 #:phases (alist-cons-before
623 'install 'pre-install
624 (lambda _
625 ;; Don't try to mkdir /var/lib/alsa.
626 (substitute* "Makefile"
627 (("\\$\\(MKDIR_P\\) .*ASOUND_STATE_DIR.*")
628 "true\n")))
629 %standard-phases)))
630 (inputs
631 `(("libsamplerate" ,libsamplerate)
632 ("ncurses" ,ncurses)
633 ("alsa-lib" ,alsa-lib)
634 ("xmlto" ,xmlto)
635 ("gettext" ,gnu-gettext)))
636 (home-page "http://www.alsa-project.org/")
637 (synopsis "Utilities for the Advanced Linux Sound Architecture (ALSA)")
638 (description
639 "The Advanced Linux Sound Architecture (ALSA) provides audio and
640 MIDI functionality to the Linux-based operating system.")
641
642 ;; This is mostly GPLv2+ but a few files such as 'alsactl.c' are
643 ;; GPLv2-only.
644 (license gpl2)))
645
646 (define-public iptables
647 (package
648 (name "iptables")
649 (version "1.4.16.2")
650 (source (origin
651 (method url-fetch)
652 (uri (string-append
653 "http://www.netfilter.org/projects/iptables/files/iptables-"
654 version ".tar.bz2"))
655 (sha256
656 (base32
657 "0vkg5lzkn4l3i1sm6v3x96zzvnv9g7mi0qgj6279ld383mzcws24"))))
658 (build-system gnu-build-system)
659 (arguments '(#:tests? #f)) ; no test suite
660 (home-page "http://www.netfilter.org/projects/iptables/index.html")
661 (synopsis "Program to configure the Linux IP packet filtering rules")
662 (description
663 "iptables is the userspace command line program used to configure the
664 Linux 2.4.x and later IPv4 packet filtering ruleset. It is targeted towards
665 system administrators. Since Network Address Translation is also configured
666 from the packet filter ruleset, iptables is used for this, too. The iptables
667 package also includes ip6tables. ip6tables is used for configuring the IPv6
668 packet filter.")
669 (license gpl2+)))
670
671 (define-public iproute
672 (package
673 (name "iproute2")
674 (version "3.12.0")
675 (source (origin
676 (method url-fetch)
677 (uri (string-append
678 "mirror://kernel.org/linux/utils/net/iproute2/iproute2-"
679 version ".tar.xz"))
680 (sha256
681 (base32
682 "04gi11gh087bg2nlxhj0lxrk8l9qxkpr88nsiil23917bm3h1xj4"))))
683 (build-system gnu-build-system)
684 (arguments
685 `(#:tests? #f ; no test suite
686 #:make-flags (let ((out (assoc-ref %outputs "out")))
687 (list "DESTDIR="
688 (string-append "LIBDIR=" out "/lib")
689 (string-append "SBINDIR=" out "/sbin")
690 (string-append "CONFDIR=" out "/etc")
691 (string-append "DOCDIR=" out "/share/doc/"
692 ,name "-" ,version)
693 (string-append "MANDIR=" out "/share/man")))
694 #:phases (alist-cons-before
695 'install 'pre-install
696 (lambda _
697 ;; Don't attempt to create /var/lib/arpd.
698 (substitute* "Makefile"
699 (("^.*ARPDDIR.*$") "")))
700 %standard-phases)))
701 (inputs
702 `(("iptables" ,iptables)
703 ("db4" ,bdb)))
704 (native-inputs
705 `(("pkg-config" ,pkg-config)
706 ("flex" ,flex)
707 ("bison" ,bison)))
708 (home-page
709 "http://www.linuxfoundation.org/collaborate/workgroups/networking/iproute2")
710 (synopsis
711 "A collection of utilities for controlling TCP/IP networking and traffic control in Linux")
712 (description
713 "Iproute2 is a collection of utilities for controlling TCP/IP
714 networking and traffic with the Linux kernel.
715
716 Most network configuration manuals still refer to ifconfig and route as the
717 primary network configuration tools, but ifconfig is known to behave
718 inadequately in modern network environments. They should be deprecated, but
719 most distros still include them. Most network configuration systems make use
720 of ifconfig and thus provide a limited feature set. The /etc/net project aims
721 to support most modern network technologies, as it doesn't use ifconfig and
722 allows a system administrator to make use of all iproute2 features, including
723 traffic control.
724
725 iproute2 is usually shipped in a package called iproute or iproute2 and
726 consists of several tools, of which the most important are ip and tc. ip
727 controls IPv4 and IPv6 configuration and tc stands for traffic control. Both
728 tools print detailed usage messages and are accompanied by a set of
729 manpages.")
730 (license gpl2+)))
731
732 (define-public net-tools
733 ;; XXX: This package is basically unmaintained, but it provides a few
734 ;; commands not yet provided by Inetutils, such as 'route', so we have to
735 ;; live with it.
736 (package
737 (name "net-tools")
738 (version "1.60")
739 (home-page "http://www.tazenda.demon.co.uk/phil/net-tools/")
740 (source (origin
741 (method url-fetch)
742 (uri (string-append home-page "/" name "-"
743 version ".tar.bz2"))
744 (sha256
745 (base32
746 "0yvxrzk0mzmspr7sa34hm1anw6sif39gyn85w4c5ywfn8inxvr3s"))))
747 (build-system gnu-build-system)
748 (arguments
749 '(#:phases (alist-cons-after
750 'unpack 'patch
751 (lambda* (#:key inputs #:allow-other-keys)
752 (define (apply-patch file)
753 (zero? (system* "patch" "-p1" "--batch"
754 "--input" file)))
755
756 (let ((patch.gz (assoc-ref inputs "patch")))
757 (format #t "applying Debian patch set '~a'...~%"
758 patch.gz)
759 (system (string-append "gunzip < " patch.gz " > the-patch"))
760 (pk 'here)
761 (and (apply-patch "the-patch")
762 (for-each apply-patch
763 (find-files "debian/patches"
764 "\\.patch")))))
765 (alist-replace
766 'configure
767 (lambda* (#:key outputs #:allow-other-keys)
768 (let ((out (assoc-ref outputs "out")))
769 (mkdir-p (string-append out "/bin"))
770 (mkdir-p (string-append out "/sbin"))
771
772 ;; Pretend we have everything...
773 (system "yes | make config")
774
775 ;; ... except we don't have libdnet, so remove that
776 ;; definition.
777 (substitute* '("config.make" "config.h")
778 (("^.*HAVE_AFDECnet.*$") ""))))
779 %standard-phases))
780
781 ;; Binaries that depend on libnet-tools.a don't declare that
782 ;; dependency, making it parallel-unsafe.
783 #:parallel-build? #f
784
785 #:tests? #f ; no test suite
786 #:make-flags (let ((out (assoc-ref %outputs "out")))
787 (list "CC=gcc"
788 (string-append "BASEDIR=" out)
789 (string-append "INSTALLNLSDIR=" out "/share/locale")
790 (string-append "mandir=/share/man")))))
791
792 ;; Use the big Debian patch set (the thing does not even compile out of
793 ;; the box.)
794 (inputs `(("patch" ,(origin
795 (method url-fetch)
796 (uri
797 "http://ftp.de.debian.org/debian/pool/main/n/net-tools/net-tools_1.60-24.2.diff.gz")
798 (sha256
799 (base32
800 "0p93lsqx23v5fv4hpbrydmfvw1ha2rgqpn2zqbs2jhxkzhjc030p"))))))
801 (native-inputs `(("gettext" ,gnu-gettext)))
802
803 (synopsis "Tools for controlling the network subsystem in Linux")
804 (description
805 "This package includes the important tools for controlling the network
806 subsystem of the Linux kernel. This includes arp, hostname, ifconfig,
807 netstat, rarp and route. Additionally, this package contains utilities
808 relating to particular network hardware types (plipconfig, slattach) and
809 advanced aspects of IP configuration (iptunnel, ipmaddr).")
810 (license gpl2+)))
811
812 (define-public libcap
813 (package
814 (name "libcap")
815 (version "2.22")
816 (source (origin
817 (method url-fetch)
818
819 ;; Tarballs used to be available from
820 ;; <https://www.kernel.org/pub/linux/libs/security/linux-privs/>
821 ;; but they never came back after kernel.org was compromised.
822 (uri (string-append
823 "mirror://debian/pool/main/libc/libcap2/libcap2_"
824 version ".orig.tar.gz"))
825 (sha256
826 (base32
827 "07vjhkznm82p8dm4w6j8mmg7h5c70lp5s9bwwfdmgwpbixfydjp1"))))
828 (build-system gnu-build-system)
829 (arguments '(#:phases (alist-delete 'configure %standard-phases)
830 #:tests? #f ; no 'check' target
831 #:make-flags (list "lib=lib"
832 (string-append "prefix="
833 (assoc-ref %outputs "out"))
834 "RAISE_SETFCAP=no")))
835 (native-inputs `(("perl" ,perl)))
836 (inputs `(("attr" ,attr)))
837 (home-page "https://sites.google.com/site/fullycapable/")
838 (synopsis "Library for working with POSIX capabilities")
839 (description
840 "libcap2 provides a programming interface to POSIX capabilities on
841 Linux-based operating systems.")
842
843 ;; License is BSD-3 or GPLv2, at the user's choice.
844 (license gpl2)))
845
846 (define-public bridge-utils
847 (package
848 (name "bridge-utils")
849 (version "1.5")
850 (source (origin
851 (method url-fetch)
852 (uri (string-append "mirror://sourceforge/bridge/bridge-utils-"
853 version ".tar.gz"))
854 (sha256
855 (base32
856 "12367cwqmi0yqphi6j8rkx97q8hw52yq2fx4k0xfclkcizxybya2"))))
857 (build-system gnu-build-system)
858
859 ;; The tarball lacks all the generated files.
860 (native-inputs `(("autoconf" ,autoconf)
861 ("automake" ,automake)))
862 (arguments
863 '(#:phases (alist-cons-before
864 'configure 'bootstrap
865 (lambda _
866 (zero? (system* "autoreconf" "-vf")))
867 %standard-phases)
868 #:tests? #f)) ; no 'check' target
869
870 (home-page
871 "http://www.linuxfoundation.org/collaborate/workgroups/networking/bridge")
872 (synopsis "Manipulate Ethernet bridges")
873 (description
874 "Utilities for Linux's Ethernet bridging facilities. A bridge is a way
875 to connect two Ethernet segments together in a protocol independent way.
876 Packets are forwarded based on Ethernet address, rather than IP address (like
877 a router). Since forwarding is done at Layer 2, all protocols can go
878 transparently through a bridge.")
879 (license gpl2+)))
880
881 (define-public libnl
882 (package
883 (name "libnl")
884 (version "3.2.13")
885 (source (origin
886 (method url-fetch)
887 (uri (string-append
888 "http://www.infradead.org/~tgr/libnl/files/libnl-"
889 version ".tar.gz"))
890 (sha256
891 (base32
892 "1ydw42lsd572qwrfgws97n76hyvjdpanwrxm03lysnhfxkna1ssd"))))
893 (build-system gnu-build-system)
894 (native-inputs `(("flex" ,flex) ("bison" ,bison)))
895 (home-page "http://www.infradead.org/~tgr/libnl/")
896 (synopsis "NetLink protocol library suite")
897 (description
898 "The libnl suite is a collection of libraries providing APIs to netlink
899 protocol based Linux kernel interfaces. Netlink is an IPC mechanism primarly
900 between the kernel and user space processes. It was designed to be a more
901 flexible successor to ioctl to provide mainly networking related kernel
902 configuration and monitoring interfaces.")
903
904 ;; Most files are LGPLv2.1-only, but some are GPLv2-only (like
905 ;; 'nl-addr-add.c'), so the result is GPLv2-only.
906 (license gpl2)))
907
908 (define-public powertop
909 (package
910 (name "powertop")
911 (version "2.5")
912 (source
913 (origin
914 (method url-fetch)
915 (uri (string-append
916 "https://01.org/powertop/sites/default/files/downloads/powertop-"
917 version ".tar.gz"))
918 (sha256
919 (base32
920 "02rwqbpasdayl201v0549gbp2f82rd0hqiv3i111r7npanjhhb4b"))))
921 (build-system gnu-build-system)
922 (inputs
923 ;; TODO: Add pciutils.
924 `(("zlib" ,guix:zlib)
925 ;; ("pciutils" ,pciutils)
926 ("ncurses" ,ncurses)
927 ("libnl" ,libnl)))
928 (native-inputs
929 `(("pkg-config" ,pkg-config)))
930 (home-page "https://01.org/powertop/")
931 (synopsis "Analyze power consumption on Intel-based laptops")
932 (description
933 "PowerTOP is a Linux tool to diagnose issues with power consumption and
934 power management. In addition to being a diagnostic tool, PowerTOP also has
935 an interactive mode where the user can experiment various power management
936 settings for cases where the operating system has not enabled these
937 settings.")
938 (license gpl2)))
939
940 (define-public aumix
941 (package
942 (name "aumix")
943 (version "2.9.1")
944 (source (origin
945 (method url-fetch)
946 (uri (string-append
947 "http://www.jpj.net/~trevor/aumix/releases/aumix-"
948 version ".tar.bz2"))
949 (sha256
950 (base32
951 "0a8fwyxnc5qdxff8sl2sfsbnvgh6pkij4yafiln0fxgg6bal7knj"))))
952 (build-system gnu-build-system)
953 (inputs `(("ncurses" ,ncurses)))
954 (home-page "http://www.jpj.net/~trevor/aumix.html")
955 (synopsis "Audio mixer for X and the console")
956 (description
957 "Aumix adjusts an audio mixer from X, the console, a terminal,
958 the command line or a script.")
959 (license gpl2+)))
960
961 (define-public iotop
962 (package
963 (name "iotop")
964 (version "0.6")
965 (source
966 (origin
967 (method url-fetch)
968 (uri (string-append "http://guichaz.free.fr/iotop/files/iotop-"
969 version ".tar.gz"))
970 (sha256 (base32
971 "1kp8mqg2pbxq4xzpianypadfxcsyfgwcaqgqia6h9fsq6zyh4z0s"))))
972 (build-system python-build-system)
973 (arguments
974 ;; The setup.py script expects python-2.
975 `(#:python ,python-2
976 ;; There are currently no checks in the package.
977 #:tests? #f))
978 (native-inputs `(("python" ,python-2)))
979 (home-page "http://guichaz.free.fr/iotop/")
980 (synopsis
981 "Displays the IO activity of running processes")
982 (description
983 "Iotop is a Python program with a top like user interface to show the
984 processes currently causing I/O.")
985 (license gpl2+)))
986
987 (define-public fuse
988 (package
989 (name "fuse")
990 (version "2.9.3")
991 (source (origin
992 (method url-fetch)
993 (uri (string-append "mirror://sourceforge/fuse/fuse-"
994 version ".tar.gz"))
995 (sha256
996 (base32
997 "071r6xjgssy8vwdn6m28qq1bqxsd2bphcd2mzhq0grf5ybm87sqb"))))
998 (build-system gnu-build-system)
999 (inputs `(("util-linux" ,util-linux)))
1000 (arguments
1001 '(#:configure-flags (list (string-append "MOUNT_FUSE_PATH="
1002 (assoc-ref %outputs "out")
1003 "/sbin")
1004 (string-append "INIT_D_PATH="
1005 (assoc-ref %outputs "out")
1006 "/etc/init.d")
1007 (string-append "UDEV_RULES_PATH="
1008 (assoc-ref %outputs "out")
1009 "/etc/udev"))
1010 #:phases (alist-cons-before
1011 'build 'set-file-names
1012 (lambda* (#:key inputs #:allow-other-keys)
1013 ;; libfuse calls out to mount(8) and umount(8). Make sure
1014 ;; it refers to the right ones.
1015 (substitute* '("lib/mount_util.c" "util/mount_util.c")
1016 (("/bin/(u?)mount" _ maybe-u)
1017 (string-append (assoc-ref inputs "util-linux")
1018 "/bin/" maybe-u "mount")))
1019 (substitute* '("util/mount.fuse.c")
1020 (("/bin/sh")
1021 (which "sh")))
1022
1023 ;; This hack leads libfuse to search for 'fusermount' in
1024 ;; $PATH, where it may find a setuid-root binary, instead of
1025 ;; trying solely $out/sbin/fusermount and failing because
1026 ;; it's not setuid.
1027 (substitute* "lib/Makefile"
1028 (("-DFUSERMOUNT_DIR=[[:graph:]]+")
1029 "-DFUSERMOUNT_DIR=\\\"/var/empty\\\"")))
1030 %standard-phases)))
1031 (home-page "http://fuse.sourceforge.net/")
1032 (synopsis "Support file systems implemented in user space")
1033 (description
1034 "As a consequence of its monolithic design, file system code for Linux
1035 normally goes into the kernel itself---which is not only a robustness issue,
1036 but also an impediment to system extensibility. FUSE, for \"file systems in
1037 user space\", is a kernel module and user-space library that tries to address
1038 part of this problem by allowing users to run file system implementations as
1039 user-space processes.")
1040 (license (list lgpl2.1 ; library
1041 gpl2+)))) ; command-line utilities
1042
1043 (define-public unionfs-fuse
1044 (package
1045 (name "unionfs-fuse")
1046 (version "0.26")
1047 (source (origin
1048 (method url-fetch)
1049 (uri (string-append
1050 "http://podgorny.cz/unionfs-fuse/releases/unionfs-fuse-"
1051 version ".tar.xz"))
1052 (sha256
1053 (base32
1054 "0qpnr4czgc62vsfnmv933w62nq3xwcbnvqch72qakfgca75rsp4d"))))
1055 (build-system cmake-build-system)
1056 (inputs `(("fuse" ,fuse)))
1057 (arguments '(#:tests? #f)) ; no tests
1058 (home-page "http://podgorny.cz/moin/UnionFsFuse")
1059 (synopsis "User-space union file system")
1060 (description
1061 "UnionFS-FUSE is a flexible union file system implementation in user
1062 space, using the FUSE library. Mounting a union file system allows you to
1063 \"aggregate\" the contents of several directories into a single mount point.
1064 UnionFS-FUSE additionally supports copy-on-write.")
1065 (license bsd-3)))
1066
1067 (define fuse-static
1068 (package (inherit fuse)
1069 (name "fuse-static")
1070 (source (origin (inherit (package-source fuse))
1071 (modules '((guix build utils)))
1072 (snippet
1073 ;; Normally libfuse invokes mount(8) so that /etc/mtab is
1074 ;; updated. Change calls to 'mtab_needs_update' to 0 so that
1075 ;; it doesn't do that, allowing us to remove the dependency on
1076 ;; util-linux (something that is useful in initrds.)
1077 '(substitute* '("lib/mount_util.c"
1078 "util/mount_util.c")
1079 (("mtab_needs_update[[:blank:]]*\\([a-z_]+\\)")
1080 "0")
1081 (("/bin/")
1082 "")))))))
1083
1084 (define-public unionfs-fuse/static
1085 (package (inherit unionfs-fuse)
1086 (synopsis "User-space union file system (statically linked)")
1087 (name (string-append (package-name unionfs-fuse) "-static"))
1088 (source (origin (inherit (package-source unionfs-fuse))
1089 (modules '((guix build utils)))
1090 (snippet
1091 ;; Add -ldl to the libraries, because libfuse.a needs that.
1092 '(substitute* "src/CMakeLists.txt"
1093 (("target_link_libraries(.*)\\)" _ libs)
1094 (string-append "target_link_libraries"
1095 libs " dl)"))))))
1096 (arguments
1097 '(#:tests? #f
1098 #:configure-flags '("-DCMAKE_EXE_LINKER_FLAGS=-static")
1099 #:phases (alist-cons-after
1100 'install 'post-install
1101 (lambda* (#:key outputs #:allow-other-keys)
1102 (let* ((out (assoc-ref outputs "out"))
1103 (exe (string-append out "/bin/unionfs")))
1104 ;; By default, 'unionfs' keeps references to
1105 ;; $glibc/share/locale and similar stuff. Remove them.
1106 (remove-store-references exe)))
1107 %standard-phases)))
1108 (inputs `(("fuse" ,fuse-static)))))
1109
1110 (define-public sshfs-fuse
1111 (package
1112 (name "sshfs-fuse")
1113 (version "2.5")
1114 (source (origin
1115 (method url-fetch)
1116 (uri (string-append "mirror://sourceforge/fuse/sshfs-fuse-"
1117 version ".tar.gz"))
1118 (sha256
1119 (base32
1120 "0gp6qr33l2p0964j0kds0dfmvyyf5lpgsn11daf0n5fhwm9185z9"))))
1121 (build-system gnu-build-system)
1122 (inputs
1123 `(("fuse" ,fuse)
1124 ("glib" ,glib)))
1125 (native-inputs
1126 `(("pkg-config" ,pkg-config)))
1127 (home-page "http://fuse.sourceforge.net/sshfs.html")
1128 (synopsis "Mount remote file systems over SSH")
1129 (description
1130 "This is a file system client based on the SSH File Transfer Protocol.
1131 Since most SSH servers already support this protocol it is very easy to set
1132 up: on the server side there's nothing to do; on the client side mounting the
1133 file system is as easy as logging into the server with an SSH client.")
1134 (license gpl2+)))
1135
1136 (define-public numactl
1137 (package
1138 (name "numactl")
1139 (version "2.0.9")
1140 (source (origin
1141 (method url-fetch)
1142 (uri (string-append
1143 "ftp://oss.sgi.com/www/projects/libnuma/download/numactl-"
1144 version
1145 ".tar.gz"))
1146 (sha256
1147 (base32
1148 "073myxlyyhgxh1w3r757ajixb7s2k69czc3r0g12c3scq7k3784w"))))
1149 (build-system gnu-build-system)
1150 (arguments
1151 '(#:phases (alist-replace
1152 'configure
1153 (lambda* (#:key outputs #:allow-other-keys)
1154 ;; There's no 'configure' script, just a raw makefile.
1155 (substitute* "Makefile"
1156 (("^prefix := .*$")
1157 (string-append "prefix := " (assoc-ref outputs "out")
1158 "\n"))
1159 (("^libdir := .*$")
1160 ;; By default the thing tries to install under
1161 ;; $prefix/lib64 when on a 64-bit platform.
1162 (string-append "libdir := $(prefix)/lib\n"))))
1163 %standard-phases)
1164
1165 #:make-flags (list
1166 ;; By default the thing tries to use 'cc'.
1167 "CC=gcc"
1168
1169 ;; Make sure programs have an RPATH so they can find
1170 ;; libnuma.so.
1171 (string-append "LDLIBS=-Wl,-rpath="
1172 (assoc-ref %outputs "out") "/lib"))
1173
1174 ;; There's a 'test' target, but it requires NUMA support in the kernel
1175 ;; to run, which we can't assume to have.
1176 #:tests? #f))
1177 (home-page "http://oss.sgi.com/projects/libnuma/")
1178 (synopsis "Tools for non-uniform memory access (NUMA) machines")
1179 (description
1180 "NUMA stands for Non-Uniform Memory Access, in other words a system whose
1181 memory is not all in one place. The numactl program allows you to run your
1182 application program on specific CPU's and memory nodes. It does this by
1183 supplying a NUMA memory policy to the operating system before running your
1184 program.
1185
1186 The package contains other commands, such as numademo, numastat and memhog.
1187 The numademo command provides a quick overview of NUMA performance on your
1188 system.")
1189 (license (list gpl2 ; programs
1190 lgpl2.1)))) ; library
1191
1192 (define-public kbd
1193 (package
1194 (name "kbd")
1195 (version "2.0.1")
1196 (source (origin
1197 (method url-fetch)
1198 (uri (string-append "mirror://kernel.org/linux/utils/kbd/kbd-"
1199 version ".tar.gz"))
1200 (sha256
1201 (base32
1202 "0c34b0za2v0934acvgnva0vaqpghmmhz4zh7k0m9jd4mbc91byqm"))
1203 (modules '((guix build utils)))
1204 (snippet
1205 '(begin
1206 (substitute* "tests/Makefile.in"
1207 ;; The '%: %.in' rule incorrectly uses @VERSION@.
1208 (("@VERSION@")
1209 "[@]VERSION[@]"))
1210 (substitute* '("src/unicode_start" "src/unicode_stop")
1211 ;; Assume the Coreutils are in $PATH.
1212 (("/usr/bin/tty")
1213 "tty"))))))
1214 (build-system gnu-build-system)
1215 (arguments
1216 '(#:phases (alist-cons-before
1217 'build 'pre-build
1218 (lambda* (#:key inputs #:allow-other-keys)
1219 (let ((gzip (assoc-ref %build-inputs "gzip"))
1220 (bzip2 (assoc-ref %build-inputs "bzip2")))
1221 (substitute* "src/libkeymap/findfile.c"
1222 (("gzip")
1223 (string-append gzip "/bin/gzip"))
1224 (("bzip2")
1225 (string-append bzip2 "/bin/bzip2")))))
1226 (alist-cons-after
1227 'install 'post-install
1228 (lambda* (#:key outputs #:allow-other-keys)
1229 ;; Make sure these programs find their comrades.
1230 (let* ((out (assoc-ref outputs "out"))
1231 (bin (string-append out "/bin")))
1232 (for-each (lambda (prog)
1233 (wrap-program (string-append bin "/" prog)
1234 `("PATH" ":" prefix (,bin))))
1235 '("unicode_start" "unicode_stop"))))
1236 %standard-phases))))
1237 (inputs `(("check" ,check)
1238 ("gzip" ,guix:gzip)
1239 ("bzip2" ,guix:bzip2)
1240 ("pam" ,linux-pam)))
1241 (native-inputs `(("pkg-config" ,pkg-config)))
1242 (home-page "ftp://ftp.kernel.org/pub/linux/utils/kbd/")
1243 (synopsis "Linux keyboard utilities and keyboard maps")
1244 (description
1245 "This package contains keytable files and keyboard utilities compatible
1246 for systems using the Linux kernel. This includes commands such as
1247 'loadkeys', 'setfont', 'kbdinfo', and 'chvt'.")
1248 (license gpl2+)))
1249
1250 (define-public inotify-tools
1251 (package
1252 (name "inotify-tools")
1253 (version "3.13")
1254 (source (origin
1255 (method url-fetch)
1256 (uri (string-append
1257 "mirror://sourceforge/inotify-tools/inotify-tools/"
1258 version "/inotify-tools-" version ".tar.gz"))
1259 (sha256
1260 (base32
1261 "0icl4bx041axd5dvhg89kilfkysjj86hjakc7bk8n49cxjn4cha6"))))
1262 (build-system gnu-build-system)
1263 (home-page "http://inotify-tools.sourceforge.net/")
1264 (synopsis "Monitor file accesses")
1265 (description
1266 "The inotify-tools packages provides a C library and command-line tools
1267 to use Linux' inotify mechanism, which allows file accesses to be monitored.")
1268 (license gpl2+)))
1269
1270 (define-public kmod
1271 (package
1272 (name "kmod")
1273 (version "17")
1274 (source (origin
1275 (method url-fetch)
1276 (uri
1277 (string-append "mirror://kernel.org/linux/utils/kernel/kmod/"
1278 "kmod-" version ".tar.xz"))
1279 (sha256
1280 (base32
1281 "1yid3a9b64a60ybj66fk2ysrq5klnl0ijl4g624cl16y8404g9rv"))
1282 (patches (list (search-patch "kmod-module-directory.patch")))))
1283 (build-system gnu-build-system)
1284 (native-inputs
1285 `(("pkg-config" ,pkg-config)))
1286 (inputs
1287 `(("xz" ,guix:xz)
1288 ("zlib" ,guix:zlib)))
1289 (arguments
1290 `(#:tests? #f ; FIXME: Investigate test failures
1291 #:configure-flags '("--with-xz" "--with-zlib")
1292 #:phases (alist-cons-after
1293 'install 'install-modprobe&co
1294 (lambda* (#:key outputs #:allow-other-keys)
1295 (let* ((out (assoc-ref outputs "out"))
1296 (bin (string-append out "/bin")))
1297 (for-each (lambda (tool)
1298 (symlink "kmod"
1299 (string-append bin "/" tool)))
1300 '("insmod" "rmmod" "lsmod" "modprobe"
1301 "modinfo" "depmod"))))
1302 %standard-phases)))
1303 (home-page "https://www.kernel.org/")
1304 (synopsis "Kernel module tools")
1305 (description "kmod is a set of tools to handle common tasks with Linux
1306 kernel modules like insert, remove, list, check properties, resolve
1307 dependencies and aliases.
1308
1309 These tools are designed on top of libkmod, a library that is shipped with
1310 kmod. The aim is to be compatible with tools, configurations and indices
1311 from the module-init-tools project.")
1312 (license gpl2+))) ; library under lgpl2.1+
1313
1314 (define-public udev
1315 (package
1316 (name "udev")
1317 (version "182")
1318 (source (origin
1319 (method url-fetch)
1320 (uri (string-append
1321 "mirror://kernel.org/linux/utils/kernel/hotplug/udev-"
1322 version ".tar.xz"))
1323 (sha256
1324 (base32
1325 "1awp7p07gi083w0dwqhhbbas68a7fx2sbm1yf1ip2jwf7cpqkf5d"))
1326 (patches (list (search-patch "udev-gir-libtool.patch")))))
1327 (build-system gnu-build-system)
1328 (arguments
1329 `(#:configure-flags (list (string-append
1330 "--with-pci-ids-path="
1331 (assoc-ref %build-inputs "pciutils")
1332 "/share/pci.ids.gz")
1333
1334 "--with-firmware-path=/no/firmware"
1335
1336 ;; Work around undefined reference to
1337 ;; 'mq_getattr' in sc-daemon.c.
1338 "LDFLAGS=-lrt")))
1339 (native-inputs
1340 `(("pkg-config" ,pkg-config)
1341 ("gperf" ,gperf)
1342 ("glib" ,glib "bin") ; glib-genmarshal, etc.
1343 ("perl" ,perl) ; for the tests
1344 ("python" ,python-2))) ; ditto
1345 (inputs
1346 `(("kmod" ,kmod)
1347 ("pciutils" ,pciutils)
1348 ("usbutils" ,usbutils)
1349 ("util-linux" ,util-linux)
1350 ("glib" ,glib)
1351 ("gobject-introspection" ,gobject-introspection)))
1352 (home-page "http://www.freedesktop.org/software/systemd/libudev/")
1353 (synopsis "Userspace device management")
1354 (description "Udev is a daemon which dynamically creates and removes
1355 device nodes from /dev/, handles hotplug events and loads drivers at boot
1356 time.")
1357 (license gpl2+))) ; libudev is under lgpl2.1+
1358
1359 (define-public lvm2
1360 (package
1361 (name "lvm2")
1362 (version "2.02.109")
1363 (source (origin
1364 (method url-fetch)
1365 (uri (string-append "ftp://sources.redhat.com/pub/lvm2/releases/LVM2."
1366 version ".tgz"))
1367 (sha256
1368 (base32
1369 "1rv5ivg0l1w3nwzwdkqixm96h5bzg7ib4rr196ysb2lw42jmpjbv"))
1370 (modules '((guix build utils)))
1371 (snippet
1372 '(begin
1373 (use-modules (guix build utils))
1374
1375 ;; Honor sysconfdir.
1376 (substitute* "make.tmpl.in"
1377 (("confdir = .*$")
1378 "confdir = @sysconfdir@\n")
1379 (("DEFAULT_SYS_DIR = @DEFAULT_SYS_DIR@")
1380 "DEFAULT_SYS_DIR = @sysconfdir@"))))))
1381 (build-system gnu-build-system)
1382 (native-inputs
1383 `(("pkg-config" ,pkg-config)
1384 ("procps" ,procps))) ;tests use 'pgrep'
1385 (inputs
1386 `(("udev" ,udev)))
1387 (arguments
1388 '(#:phases (alist-cons-after
1389 'configure 'set-makefile-shell
1390 (lambda _
1391 ;; Use 'sh', not 'bash', so that '. lib/utils.sh' works as
1392 ;; expected.
1393 (setenv "SHELL" (which "sh"))
1394
1395 ;; Replace /bin/sh with the right file name.
1396 (patch-makefile-SHELL "make.tmpl"))
1397 %standard-phases)
1398
1399 #:configure-flags (list (string-append "--sysconfdir="
1400 (assoc-ref %outputs "out")
1401 "/etc/lvm")
1402 "--enable-udev_sync"
1403 "--enable-udev_rules"
1404
1405 ;; Make sure programs such as 'dmsetup' can
1406 ;; find libdevmapper.so.
1407 (string-append "LDFLAGS=-Wl,-rpath="
1408 (assoc-ref %outputs "out")
1409 "/lib"))
1410
1411 ;; The tests use 'mknod', which requires root access.
1412 #:tests? #f))
1413 (home-page "http://sourceware.org/lvm2/")
1414 (synopsis "Logical volume management for Linux")
1415 (description
1416 "LVM2 is the logical volume management tool set for Linux-based systems.
1417 This package includes the user-space libraries and tools, including the device
1418 mapper. Kernel components are part of Linux-libre.")
1419
1420 ;; Libraries (liblvm2, libdevmapper) are LGPLv2.1.
1421 ;; Command-line tools are GPLv2.
1422 (license (list gpl2 lgpl2.1))))
1423
1424 (define-public wireless-tools
1425 (package
1426 (name "wireless-tools")
1427 (version "30.pre9")
1428 (source (origin
1429 (method url-fetch)
1430 (uri (string-append "http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/wireless_tools."
1431 version ".tar.gz"))
1432 (sha256
1433 (base32
1434 "0qscyd44jmhs4k32ggp107hlym1pcyjzihiai48xs7xzib4wbndb"))))
1435 (build-system gnu-build-system)
1436 (arguments
1437 `(#:phases (alist-replace
1438 'configure
1439 (lambda* (#:key outputs #:allow-other-keys)
1440 (setenv "PREFIX" (assoc-ref outputs "out")))
1441 %standard-phases)
1442 #:tests? #f))
1443 (synopsis "Tools for manipulating Linux Wireless Extensions")
1444 (description "Wireless Tools are used to manipulate the Linux Wireless
1445 Extensions. The Wireless Extension is an interface allowing you to set
1446 Wireless LAN specific parameters and get the specific stats.")
1447 (home-page "http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html")
1448 (license gpl2+)))
1449
1450 (define-public lm-sensors
1451 (package
1452 (name "lm-sensors")
1453 (version "3.3.5")
1454 (source (origin
1455 (method url-fetch)
1456 (uri (string-append
1457 "http://dl.lm-sensors.org/lm-sensors/releases/lm_sensors-"
1458 version ".tar.bz2"))
1459 (sha256
1460 (base32
1461 "1ksgrynxgrq590nb2fwxrl1gwzisjkqlyg3ljfd1al0ibrk6mbjx"))
1462 (patches (list (search-patch "lm-sensors-hwmon-attrs.patch")))))
1463 (build-system gnu-build-system)
1464 (inputs `(("rrdtool" ,rrdtool)
1465 ("perl" ,perl)
1466 ("kmod" ,kmod)
1467 ("gnuplot" ,gnuplot)))
1468 (native-inputs `(("pkg-config" ,pkg-config)
1469 ("flex" ,flex)
1470 ("bison" ,bison)
1471 ("which" ,which)))
1472 (arguments
1473 `(#:tests? #f ; no 'check' target
1474 #:make-flags (list (string-append "PREFIX=" %output)
1475 (string-append "ETCDIR=" %output "/etc")
1476 (string-append "MANDIR=" %output "/share/man"))
1477 #:phases
1478 (alist-delete
1479 'configure
1480 (alist-cons-before
1481 'build 'patch-exec-paths
1482 (lambda* (#:key inputs outputs #:allow-other-keys)
1483 (substitute* "prog/detect/sensors-detect"
1484 (("`uname")
1485 (string-append "`" (assoc-ref inputs "coreutils")
1486 "/bin/uname"))
1487 (("(`|\")modprobe" all open-quote)
1488 (string-append open-quote
1489 (assoc-ref inputs "kmod")
1490 "/bin/modprobe")))
1491 (substitute* '("prog/pwm/pwmconfig"
1492 "prog/pwm/fancontrol")
1493 (("gnuplot")
1494 (string-append (assoc-ref inputs "gnuplot")
1495 "/bin/gnuplot"))
1496 (("cat ")
1497 (string-append (assoc-ref inputs "coreutils")
1498 "/bin/cat "))
1499 (("egrep ")
1500 (string-append (assoc-ref inputs "grep")
1501 "/bin/egrep "))
1502 (("sed -e")
1503 (string-append (assoc-ref inputs "sed")
1504 "/bin/sed -e"))
1505 (("cut -d")
1506 (string-append (assoc-ref inputs "coreutils")
1507 "/bin/cut -d"))
1508 (("sleep ")
1509 (string-append (assoc-ref inputs "coreutils")
1510 "/bin/sleep "))
1511 (("readlink -f")
1512 (string-append (assoc-ref inputs "coreutils")
1513 "/bin/readlink -f"))))
1514 %standard-phases))))
1515 (home-page "http://www.lm-sensors.org/")
1516 (synopsis "Utilities to read temperature/voltage/fan sensors")
1517 (description
1518 "lm-sensors is a hardware health monitoring package for Linux. It allows
1519 you to access information from temperature, voltage, and fan speed sensors.
1520 It works with most newer systems.")
1521 (license gpl2+)))
1522
1523 (define-public xsensors
1524 (package
1525 (name "xsensors")
1526 (version "0.70")
1527 (source (origin
1528 (method url-fetch)
1529 (uri (string-append
1530 "http://www.linuxhardware.org/xsensors/xsensors-"
1531 version ".tar.gz"))
1532 (sha256
1533 (base32
1534 "1siplsfgvcxamyqf44h71jx6jdfmvhfm7mh0y1q8ps4zs6pj2zwh"))))
1535 (build-system gnu-build-system)
1536 (inputs `(("lm-sensors" ,lm-sensors)
1537 ("gtk" ,gtk+-2)))
1538 (native-inputs `(("pkg-config" ,pkg-config)))
1539 (arguments
1540 `(#:phases (alist-cons-before
1541 'configure 'enable-deprecated
1542 (lambda _
1543 (substitute* "src/Makefile.in"
1544 (("-DGDK_DISABLE_DEPRECATED") "")
1545 (("-DGTK_DISABLE_DEPRECATED") "")))
1546 (alist-cons-before
1547 'configure 'remove-Werror
1548 (lambda _
1549 (substitute* '("configure" "src/Makefile.in")
1550 (("-Werror") "")))
1551 %standard-phases))))
1552 (home-page "http://www.linuxhardware.org/xsensors/")
1553 (synopsis "Hardware health information viewer")
1554 (description
1555 "xsensors reads data from the libsensors library regarding hardware
1556 health such as temperature, voltage and fan speed and displays the information
1557 in a digital read-out.")
1558 (license gpl2+)))