gnu: openmpi: Fix typo in download uri
[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 © 2012 Nikita Karetnikov <nikita@karetnikov.org>
4 ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
5 ;;;
6 ;;; This file is part of GNU Guix.
7 ;;;
8 ;;; GNU Guix is free software; you can redistribute it and/or modify it
9 ;;; under the terms of the GNU General Public License as published by
10 ;;; the Free Software Foundation; either version 3 of the License, or (at
11 ;;; your option) any later version.
12 ;;;
13 ;;; GNU Guix is distributed in the hope that it will be useful, but
14 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;;; GNU General Public License for more details.
17 ;;;
18 ;;; You should have received a copy of the GNU General Public License
19 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20
21 (define-module (gnu packages linux)
22 #:use-module ((guix licenses)
23 #:hide (zlib))
24 #:use-module (gnu packages)
25 #:use-module ((gnu packages compression)
26 #:renamer (symbol-prefix-proc 'guix:))
27 #:use-module (gnu packages flex)
28 #:use-module (gnu packages bison)
29 #:use-module (gnu packages libusb)
30 #:use-module (gnu packages ncurses)
31 #:use-module (gnu packages bdb)
32 #:use-module (gnu packages perl)
33 #:use-module (gnu packages pkg-config)
34 #:use-module (gnu packages python)
35 #:use-module (gnu packages algebra)
36 #:use-module (gnu packages gettext)
37 #:use-module (gnu packages pulseaudio)
38 #:use-module (gnu packages attr)
39 #:use-module (gnu packages xml)
40 #:use-module (gnu packages autotools)
41 #:use-module (gnu packages texinfo)
42 #:use-module (guix packages)
43 #:use-module (guix download)
44 #:use-module (guix build-system gnu)
45 #:use-module (guix build-system cmake)
46 #:use-module (guix build-system python)
47 #:use-module (guix build-system trivial))
48
49 (define-public (system->linux-architecture arch)
50 "Return the Linux architecture name for ARCH, a Guix system name such as
51 \"x86_64-linux\"."
52 (let ((arch (car (string-split arch #\-))))
53 (cond ((string=? arch "i686") "i386")
54 ((string-prefix? "mips" arch) "mips")
55 ((string-prefix? "arm" arch) "arm")
56 (else arch))))
57
58 (define (linux-libre-urls version)
59 "Return a list of URLs for Linux-Libre VERSION."
60 (list (string-append
61 "http://linux-libre.fsfla.org/pub/linux-libre/releases/"
62 version "-gnu/linux-libre-" version "-gnu.tar.xz")
63
64 ;; XXX: Work around <http://bugs.gnu.org/14851>.
65 (string-append
66 "ftp://alpha.gnu.org/gnu/guix/mirror/linux-libre-"
67 version "-gnu.tar.xz")
68
69 ;; Maybe this URL will become valid eventually.
70 (string-append
71 "mirror://gnu/linux-libre/" version "-gnu/linux-libre-"
72 version "-gnu.tar.xz")))
73
74 (define-public linux-libre-headers
75 (let* ((version "3.3.8")
76 (build-phase
77 (lambda (arch)
78 `(lambda _
79 (setenv "ARCH" ,(system->linux-architecture arch))
80 (format #t "`ARCH' set to `~a'~%" (getenv "ARCH"))
81
82 (and (zero? (system* "make" "defconfig"))
83 (zero? (system* "make" "mrproper" "headers_check"))))))
84 (install-phase
85 `(lambda* (#:key outputs #:allow-other-keys)
86 (let ((out (assoc-ref outputs "out")))
87 (and (zero? (system* "make"
88 (string-append "INSTALL_HDR_PATH=" out)
89 "headers_install"))
90 (mkdir (string-append out "/include/config"))
91 (call-with-output-file
92 (string-append out
93 "/include/config/kernel.release")
94 (lambda (p)
95 (format p "~a-default~%" ,version))))))))
96 (package
97 (name "linux-libre-headers")
98 (version version)
99 (source (origin
100 (method url-fetch)
101 (uri (linux-libre-urls version))
102 (sha256
103 (base32
104 "0jkfh0z1s6izvdnc3njm39dhzp1cg8i06jv06izwqz9w9qsprvnl"))))
105 (build-system gnu-build-system)
106 (native-inputs `(("perl" ,perl)))
107 (arguments
108 `(#:modules ((guix build gnu-build-system)
109 (guix build utils)
110 (srfi srfi-1))
111 #:phases (alist-replace
112 'build ,(build-phase (or (%current-target-system)
113 (%current-system)))
114 (alist-replace
115 'install ,install-phase
116 (alist-delete 'configure %standard-phases)))
117 #:tests? #f))
118 (synopsis "GNU Linux-Libre kernel headers")
119 (description "Headers of the Linux-Libre kernel.")
120 (license gpl2)
121 (home-page "http://www.gnu.org/software/linux-libre/"))))
122
123 (define-public module-init-tools
124 (package
125 (name "module-init-tools")
126 (version "3.16")
127 (source (origin
128 (method url-fetch)
129 (uri (string-append
130 "mirror://kernel.org/linux/utils/kernel/module-init-tools/module-init-tools-"
131 version ".tar.bz2"))
132 (sha256
133 (base32
134 "0jxnz9ahfic79rp93l5wxcbgh4pkv85mwnjlbv1gz3jawv5cvwp1"))))
135 (build-system gnu-build-system)
136 (arguments
137 ;; FIXME: The upstream tarball lacks man pages, and building them would
138 ;; require DocBook & co. We used to use Gentoo's pre-built man pages,
139 ;; but they vanished. In the meantime, fake it.
140 '(#:phases (alist-cons-before
141 'configure 'fake-docbook
142 (lambda _
143 (substitute* "Makefile.in"
144 (("^DOCBOOKTOMAN.*$")
145 "DOCBOOKTOMAN = true\n")))
146 %standard-phases)))
147 (home-page "http://www.kernel.org/pub/linux/utils/kernel/module-init-tools/")
148 (synopsis "Tools for loading and managing Linux kernel modules")
149 (description
150 "Tools for loading and managing Linux kernel modules, such as `modprobe',
151 `insmod', `lsmod', and more.")
152 (license gpl2+)))
153
154 (define-public linux-libre
155 (let* ((version "3.13.7")
156 (build-phase
157 '(lambda* (#:key system #:allow-other-keys #:rest args)
158 (let ((arch (car (string-split system #\-))))
159 (setenv "ARCH"
160 (cond ((string=? arch "i686") "i386")
161 (else arch)))
162 (format #t "`ARCH' set to `~a'~%" (getenv "ARCH")))
163
164 (let ((build (assoc-ref %standard-phases 'build)))
165 (and (zero? (system* "make" "defconfig"))
166 (begin
167 ;; Appending works even when the option wasn't in the
168 ;; file. The last one prevails if duplicated.
169 (let ((port (open-file ".config" "a")))
170 (display (string-append "CONFIG_NET_9P=m\n"
171 "CONFIG_NET_9P_VIRTIO=m\n"
172 "CONFIG_VIRTIO_BLK=m\n"
173 "CONFIG_SATA_SIS=y\n"
174 "CONFIG_VIRTIO_NET=m\n"
175 "CONFIG_SIS190=y\n"
176 ;; https://lists.gnu.org/archive/html/guix-devel/2014-04/msg00039.html
177 "CONFIG_DEVPTS_MULTIPLE_INSTANCES=y\n"
178 "CONFIG_VIRTIO_PCI=m\n"
179 "CONFIG_VIRTIO_BALLOON=m\n"
180 "CONFIG_VIRTIO_MMIO=m\n"
181 "CONFIG_FUSE_FS=m\n"
182 "CONFIG_CIFS=m\n"
183 "CONFIG_9P_FS=m\n")
184 port)
185 (close-port port))
186
187 (zero? (system* "make" "oldconfig")))
188
189 ;; Call the default `build' phase so `-j' is correctly
190 ;; passed.
191 (apply build #:make-flags "all" args)))))
192 (install-phase
193 `(lambda* (#:key inputs outputs #:allow-other-keys)
194 (let* ((out (assoc-ref outputs "out"))
195 (moddir (string-append out "/lib/modules"))
196 (mit (assoc-ref inputs "module-init-tools")))
197 (mkdir-p moddir)
198 (for-each (lambda (file)
199 (copy-file file
200 (string-append out "/" (basename file))))
201 (find-files "." "^(bzImage|System\\.map)$"))
202 (copy-file ".config" (string-append out "/config"))
203 (zero? (system* "make"
204 (string-append "DEPMOD=" mit "/sbin/depmod")
205 (string-append "MODULE_DIR=" moddir)
206 (string-append "INSTALL_PATH=" out)
207 (string-append "INSTALL_MOD_PATH=" out)
208 "modules_install"))))))
209 (package
210 (name "linux-libre")
211 (version version)
212 (source (origin
213 (method url-fetch)
214 (uri (linux-libre-urls version))
215 (sha256
216 (base32
217 "0j28dg0zq4vlbk4ady4fq021i8dxx2h8h90n26mzigr9hky86n8d"))))
218 (build-system gnu-build-system)
219 (native-inputs `(("perl" ,perl)
220 ("bc" ,bc)
221 ("module-init-tools" ,module-init-tools)))
222 (arguments
223 `(#:modules ((guix build gnu-build-system)
224 (guix build utils)
225 (srfi srfi-1)
226 (ice-9 match))
227 #:phases (alist-replace
228 'build ,build-phase
229 (alist-replace
230 'install ,install-phase
231 (alist-delete 'configure %standard-phases)))
232 #:tests? #f))
233 (synopsis "100% free redistribution of a cleaned Linux kernel")
234 (description
235 "GNU Linux-Libre is a free (as in freedom) variant of the Linux kernel.
236 It has been modified to remove all non-free binary blobs.")
237 (license gpl2)
238 (home-page "http://www.gnu.org/software/linux-libre/"))))
239
240 \f
241 ;;;
242 ;;; Pluggable authentication modules (PAM).
243 ;;;
244
245 (define-public linux-pam
246 (package
247 (name "linux-pam")
248 (version "1.1.6")
249 (source
250 (origin
251 (method url-fetch)
252 (uri (list (string-append "http://www.linux-pam.org/library/Linux-PAM-"
253 version ".tar.bz2")
254 (string-append "mirror://kernel.org/linux/libs/pam/library/Linux-PAM-"
255 version ".tar.bz2")))
256 (sha256
257 (base32
258 "1hlz2kqvbjisvwyicdincq7nz897b9rrafyzccwzqiqg53b8gf5s"))))
259 (build-system gnu-build-system)
260 (native-inputs
261 `(("flex" ,flex)
262
263 ;; TODO: optional dependencies
264 ;; ("libxcrypt" ,libxcrypt)
265 ;; ("cracklib" ,cracklib)
266 ))
267 (arguments
268 '(;; Most users, such as `shadow', expect the headers to be under
269 ;; `security'.
270 #:configure-flags (list (string-append "--includedir="
271 (assoc-ref %outputs "out")
272 "/include/security"))
273
274 ;; XXX: Tests won't run in chroot, presumably because /etc/pam.d
275 ;; isn't available.
276 #:tests? #f))
277 (home-page "http://www.linux-pam.org/")
278 (synopsis "Pluggable authentication modules for Linux")
279 (description
280 "A *Free* project to implement OSF's RFC 86.0.
281 Pluggable authentication modules are small shared object files that can
282 be used through the PAM API to perform tasks, like authenticating a user
283 at login. Local and dynamic reconfiguration are its key features")
284 (license bsd-3)))
285
286 \f
287 ;;;
288 ;;; Miscellaneous.
289 ;;;
290
291 (define-public psmisc
292 (package
293 (name "psmisc")
294 (version "22.20")
295 (source
296 (origin
297 (method url-fetch)
298 (uri (string-append "mirror://sourceforge/psmisc/psmisc/psmisc-"
299 version ".tar.gz"))
300 (sha256
301 (base32
302 "052mfraykmxnavpi8s78aljx8w87hyvpx8mvzsgpjsjz73i28wmi"))))
303 (build-system gnu-build-system)
304 (inputs `(("ncurses" ,ncurses)))
305 (home-page "http://psmisc.sourceforge.net/")
306 (synopsis
307 "set of utilities that use the proc filesystem, such as fuser, killall, and pstree")
308 (description
309 "This PSmisc package is a set of some small useful utilities that
310 use the proc filesystem. We're not about changing the world, but
311 providing the system administrator with some help in common tasks.")
312 (license gpl2+)))
313
314 (define-public util-linux
315 (package
316 (name "util-linux")
317 (version "2.21")
318 (source
319 (origin
320 (method url-fetch)
321 (uri (string-append "mirror://kernel.org/linux/utils/"
322 name "/v" version "/"
323 name "-" version ".2" ".tar.xz"))
324 (sha256
325 (base32
326 "1rpgghf7n0zx0cdy8hibr41wvkm2qp1yvd8ab1rxr193l1jmgcir"))))
327 (build-system gnu-build-system)
328 (arguments
329 `(#:configure-flags '("--disable-use-tty-group"
330 "--enable-ddate")
331 #:phases (alist-cons-after
332 'install 'patch-chkdupexe
333 (lambda* (#:key outputs #:allow-other-keys)
334 (let ((out (assoc-ref outputs "out")))
335 (substitute* (string-append out "/bin/chkdupexe")
336 ;; Allow 'patch-shebang' to do its work.
337 (("@PERL@") "/bin/perl"))))
338 %standard-phases)))
339 (inputs `(("zlib" ,guix:zlib)
340 ("ncurses" ,ncurses)))
341 (native-inputs
342 `(("perl" ,perl)))
343 (home-page "https://www.kernel.org/pub/linux/utils/util-linux/")
344 (synopsis "Collection of utilities for the Linux kernel")
345 (description
346 "util-linux is a random collection of utilities for the Linux kernel.")
347
348 ;; Note that util-linux doesn't use the same license for all the
349 ;; code. GPLv2+ is the default license for a code without an
350 ;; explicitly defined license.
351 (license (list gpl3+ gpl2+ gpl2 lgpl2.0+
352 bsd-4 public-domain))))
353
354 (define-public procps
355 (package
356 (name "procps")
357 (version "3.2.8")
358 (source (origin
359 (method url-fetch)
360 (uri (string-append "http://procps.sourceforge.net/procps-"
361 version ".tar.gz"))
362 (sha256
363 (base32
364 "0d8mki0q4yamnkk4533kx8mc0jd879573srxhg6r2fs3lkc6iv8i"))
365 (patches (list (search-patch "procps-make-3.82.patch")))))
366 (build-system gnu-build-system)
367 (inputs `(("ncurses" ,ncurses)))
368 (arguments
369 '(#:phases (alist-replace
370 'configure
371 (lambda* (#:key outputs #:allow-other-keys)
372 ;; No `configure', just a single Makefile.
373 (let ((out (assoc-ref outputs "out")))
374 (substitute* "Makefile"
375 (("/usr/") "/")
376 (("--(owner|group) 0") "")
377 (("ldconfig") "true")
378 (("^LDFLAGS[[:blank:]]*:=(.*)$" _ value)
379 ;; Add libproc to the RPATH.
380 (string-append "LDFLAGS := -Wl,-rpath="
381 out "/lib" value))))
382 (setenv "CC" "gcc"))
383 (alist-replace
384 'install
385 (lambda* (#:key outputs #:allow-other-keys)
386 (let ((out (assoc-ref outputs "out")))
387 (and (zero?
388 (system* "make" "install"
389 (string-append "DESTDIR=" out)))
390
391 ;; Sanity check.
392 (zero?
393 (system* (string-append out "/bin/ps")
394 "--version")))))
395 %standard-phases))
396
397 ;; What did you expect? Tests?
398 #:tests? #f))
399 (home-page "http://procps.sourceforge.net/")
400 (synopsis "Utilities that give information about processes")
401 (description
402 "procps is the package that has a bunch of small useful utilities
403 that give information about processes using the Linux /proc file system.
404 The package includes the programs ps, top, vmstat, w, kill, free,
405 slabtop, and skill.")
406 (license gpl2)))
407
408 (define-public usbutils
409 (package
410 (name "usbutils")
411 (version "006")
412 (source
413 (origin
414 (method url-fetch)
415 (uri (string-append "mirror://kernel.org/linux/utils/usb/usbutils/"
416 "usbutils-" version ".tar.xz"))
417 (sha256
418 (base32
419 "03pd57vv8c6x0hgjqcbrxnzi14h8hcghmapg89p8k5zpwpkvbdfr"))))
420 (build-system gnu-build-system)
421 (inputs
422 `(("libusb" ,libusb)))
423 (native-inputs
424 `(("pkg-config" ,pkg-config)))
425 (home-page "http://www.linux-usb.org/")
426 (synopsis
427 "Tools for working with USB devices, such as lsusb")
428 (description
429 "Tools for working with USB devices, such as lsusb.")
430 (license gpl2+)))
431
432 (define-public e2fsprogs
433 (package
434 (name "e2fsprogs")
435 (version "1.42.7")
436 (source (origin
437 (method url-fetch)
438 (uri (string-append "mirror://sourceforge/e2fsprogs/e2fsprogs-"
439 version ".tar.gz"))
440 (sha256
441 (base32
442 "0ibkkvp6kan0hn0d1anq4n2md70j5gcm7mwna515w82xwyr02rfw"))))
443 (build-system gnu-build-system)
444 (inputs `(("util-linux" ,util-linux)))
445 (native-inputs `(("pkg-config" ,pkg-config)
446 ("texinfo" ,texinfo))) ; for the libext2fs Info manual
447 (arguments
448 '(#:phases (alist-cons-before
449 'configure 'patch-shells
450 (lambda _
451 (substitute* "configure"
452 (("/bin/sh (.*)parse-types.sh" _ dir)
453 (string-append (which "sh") " " dir
454 "parse-types.sh")))
455 (substitute* (find-files "." "^Makefile.in$")
456 (("#!/bin/sh")
457 (string-append "#!" (which "sh")))))
458 %standard-phases)
459
460 ;; FIXME: Tests work by comparing the stdout/stderr of programs, that
461 ;; they fail because we get an extra line that says "Can't check if
462 ;; filesystem is mounted due to missing mtab file".
463 #:tests? #f))
464 (home-page "http://e2fsprogs.sourceforge.net/")
465 (synopsis "Creating and checking ext2/ext3/ext4 file systems")
466 (description
467 "This package provides tools for manipulating ext2/ext3/ext4 file systems.")
468 (license (list gpl2 ; programs
469 lgpl2.0 ; libext2fs
470 x11)))) ; libuuid
471
472 (define-public e2fsck/static
473 (package
474 (name "e2fsck-static")
475 (version (package-version e2fsprogs))
476 (build-system trivial-build-system)
477 (source #f)
478 (arguments
479 `(#:modules ((guix build utils))
480 #:builder
481 (begin
482 (use-modules (guix build utils)
483 (ice-9 ftw)
484 (srfi srfi-26))
485
486 (let ((source (string-append (assoc-ref %build-inputs "e2fsprogs")
487 "/sbin"))
488 (bin (string-append (assoc-ref %outputs "out") "/sbin")))
489 (mkdir-p bin)
490 (with-directory-excursion bin
491 (for-each (lambda (file)
492 (copy-file (string-append source "/" file)
493 file)
494 (remove-store-references file)
495 (chmod file #o555))
496 (scandir source (cut string-prefix? "fsck." <>))))))))
497 (inputs `(("e2fsprogs" ,(static-package e2fsprogs))))
498 (synopsis "Statically-linked fsck.* commands from e2fsprogs")
499 (description
500 "This package provides statically-linked command of fsck.ext[234] taken
501 from the e2fsprogs package. It is meant to be used in initrds.")
502 (home-page (package-home-page e2fsprogs))
503 (license (package-license e2fsprogs))))
504
505 (define-public strace
506 (package
507 (name "strace")
508 (version "4.7")
509 (source (origin
510 (method url-fetch)
511 (uri (string-append "mirror://sourceforge/strace/strace-"
512 version ".tar.xz"))
513 (sha256
514 (base32
515 "158iwk0pl2mfw93m1843xb7a2zb8p6lh0qim07rca6f1ff4dk764"))))
516 (build-system gnu-build-system)
517 (native-inputs `(("perl" ,perl)))
518 (home-page "http://strace.sourceforge.net/")
519 (synopsis "System call tracer for Linux")
520 (description
521 "strace is a system call tracer, i.e. a debugging tool which prints out a
522 trace of all the system calls made by a another process/program.")
523 (license bsd-3)))
524
525 (define-public alsa-lib
526 (package
527 (name "alsa-lib")
528 (version "1.0.27.1")
529 (source (origin
530 (method url-fetch)
531 (uri (string-append
532 "ftp://ftp.alsa-project.org/pub/lib/alsa-lib-"
533 version ".tar.bz2"))
534 (sha256
535 (base32
536 "0fx057746dj7rjdi0jnvx2m9b0y1lgdkh1hks87d8w32xyihf3k9"))
537 (patches (list (search-patch "alsa-lib-mips-atomic-fix.patch")))))
538 (build-system gnu-build-system)
539 (home-page "http://www.alsa-project.org/")
540 (synopsis "The Advanced Linux Sound Architecture libraries")
541 (description
542 "The Advanced Linux Sound Architecture (ALSA) provides audio and
543 MIDI functionality to the Linux-based operating system.")
544 (license lgpl2.1+)))
545
546 (define-public alsa-utils
547 (package
548 (name "alsa-utils")
549 (version "1.0.27.2")
550 (source (origin
551 (method url-fetch)
552 (uri (string-append "ftp://ftp.alsa-project.org/pub/utils/alsa-utils-"
553 version ".tar.bz2"))
554 (sha256
555 (base32
556 "1sjjngnq50jv5ilwsb4zys6smifni3bd6fn28gbnhfrg14wsrgq2"))))
557 (build-system gnu-build-system)
558 (arguments
559 ;; XXX: Disable man page creation until we have DocBook.
560 '(#:configure-flags (list "--disable-xmlto"
561 (string-append "--with-udev-rules-dir="
562 (assoc-ref %outputs "out")
563 "/lib/udev/rules.d"))
564 #:phases (alist-cons-before
565 'install 'pre-install
566 (lambda _
567 ;; Don't try to mkdir /var/lib/alsa.
568 (substitute* "Makefile"
569 (("\\$\\(MKDIR_P\\) .*ASOUND_STATE_DIR.*")
570 "true\n")))
571 %standard-phases)))
572 (inputs
573 `(("libsamplerate" ,libsamplerate)
574 ("ncurses" ,ncurses)
575 ("alsa-lib" ,alsa-lib)
576 ("xmlto" ,xmlto)
577 ("gettext" ,gnu-gettext)))
578 (home-page "http://www.alsa-project.org/")
579 (synopsis "Utilities for the Advanced Linux Sound Architecture (ALSA)")
580 (description
581 "The Advanced Linux Sound Architecture (ALSA) provides audio and
582 MIDI functionality to the Linux-based operating system.")
583
584 ;; This is mostly GPLv2+ but a few files such as 'alsactl.c' are
585 ;; GPLv2-only.
586 (license gpl2)))
587
588 (define-public iptables
589 (package
590 (name "iptables")
591 (version "1.4.16.2")
592 (source (origin
593 (method url-fetch)
594 (uri (string-append
595 "http://www.netfilter.org/projects/iptables/files/iptables-"
596 version ".tar.bz2"))
597 (sha256
598 (base32
599 "0vkg5lzkn4l3i1sm6v3x96zzvnv9g7mi0qgj6279ld383mzcws24"))))
600 (build-system gnu-build-system)
601 (arguments '(#:tests? #f)) ; no test suite
602 (home-page "http://www.netfilter.org/projects/iptables/index.html")
603 (synopsis "Program to configure the Linux IP packet filtering rules")
604 (description
605 "iptables is the userspace command line program used to configure the
606 Linux 2.4.x and later IPv4 packet filtering ruleset. It is targeted towards
607 system administrators. Since Network Address Translation is also configured
608 from the packet filter ruleset, iptables is used for this, too. The iptables
609 package also includes ip6tables. ip6tables is used for configuring the IPv6
610 packet filter.")
611 (license gpl2+)))
612
613 (define-public iproute
614 (package
615 (name "iproute2")
616 (version "3.12.0")
617 (source (origin
618 (method url-fetch)
619 (uri (string-append
620 "mirror://kernel.org/linux/utils/net/iproute2/iproute2-"
621 version ".tar.xz"))
622 (sha256
623 (base32
624 "04gi11gh087bg2nlxhj0lxrk8l9qxkpr88nsiil23917bm3h1xj4"))))
625 (build-system gnu-build-system)
626 (arguments
627 `(#:tests? #f ; no test suite
628 #:make-flags (let ((out (assoc-ref %outputs "out")))
629 (list "DESTDIR="
630 (string-append "LIBDIR=" out "/lib")
631 (string-append "SBINDIR=" out "/sbin")
632 (string-append "CONFDIR=" out "/etc")
633 (string-append "DOCDIR=" out "/share/doc/"
634 ,name "-" ,version)
635 (string-append "MANDIR=" out "/share/man")))
636 #:phases (alist-cons-before
637 'install 'pre-install
638 (lambda _
639 ;; Don't attempt to create /var/lib/arpd.
640 (substitute* "Makefile"
641 (("^.*ARPDDIR.*$") "")))
642 %standard-phases)))
643 (inputs
644 `(("iptables" ,iptables)
645 ("db4" ,bdb)))
646 (native-inputs
647 `(("pkg-config" ,pkg-config)
648 ("flex" ,flex)
649 ("bison" ,bison)))
650 (home-page
651 "http://www.linuxfoundation.org/collaborate/workgroups/networking/iproute2")
652 (synopsis
653 "A collection of utilities for controlling TCP/IP networking and traffic control in Linux")
654 (description
655 "Iproute2 is a collection of utilities for controlling TCP/IP
656 networking and traffic with the Linux kernel.
657
658 Most network configuration manuals still refer to ifconfig and route as the
659 primary network configuration tools, but ifconfig is known to behave
660 inadequately in modern network environments. They should be deprecated, but
661 most distros still include them. Most network configuration systems make use
662 of ifconfig and thus provide a limited feature set. The /etc/net project aims
663 to support most modern network technologies, as it doesn't use ifconfig and
664 allows a system administrator to make use of all iproute2 features, including
665 traffic control.
666
667 iproute2 is usually shipped in a package called iproute or iproute2 and
668 consists of several tools, of which the most important are ip and tc. ip
669 controls IPv4 and IPv6 configuration and tc stands for traffic control. Both
670 tools print detailed usage messages and are accompanied by a set of
671 manpages.")
672 (license gpl2+)))
673
674 (define-public net-tools
675 ;; XXX: This package is basically unmaintained, but it provides a few
676 ;; commands not yet provided by Inetutils, such as 'route', so we have to
677 ;; live with it.
678 (package
679 (name "net-tools")
680 (version "1.60")
681 (home-page "http://www.tazenda.demon.co.uk/phil/net-tools/")
682 (source (origin
683 (method url-fetch)
684 (uri (string-append home-page "/" name "-"
685 version ".tar.bz2"))
686 (sha256
687 (base32
688 "0yvxrzk0mzmspr7sa34hm1anw6sif39gyn85w4c5ywfn8inxvr3s"))))
689 (build-system gnu-build-system)
690 (arguments
691 '(#:phases (alist-cons-after
692 'unpack 'patch
693 (lambda* (#:key inputs #:allow-other-keys)
694 (define (apply-patch file)
695 (zero? (system* "patch" "-p1" "--batch"
696 "--input" file)))
697
698 (let ((patch.gz (assoc-ref inputs "patch")))
699 (format #t "applying Debian patch set '~a'...~%"
700 patch.gz)
701 (system (string-append "gunzip < " patch.gz " > the-patch"))
702 (pk 'here)
703 (and (apply-patch "the-patch")
704 (for-each apply-patch
705 (find-files "debian/patches"
706 "\\.patch")))))
707 (alist-replace
708 'configure
709 (lambda* (#:key outputs #:allow-other-keys)
710 (let ((out (assoc-ref outputs "out")))
711 (mkdir-p (string-append out "/bin"))
712 (mkdir-p (string-append out "/sbin"))
713
714 ;; Pretend we have everything...
715 (system "yes | make config")
716
717 ;; ... except we don't have libdnet, so remove that
718 ;; definition.
719 (substitute* '("config.make" "config.h")
720 (("^.*HAVE_AFDECnet.*$") ""))))
721 %standard-phases))
722
723 ;; Binaries that depend on libnet-tools.a don't declare that
724 ;; dependency, making it parallel-unsafe.
725 #:parallel-build? #f
726
727 #:tests? #f ; no test suite
728 #:make-flags (let ((out (assoc-ref %outputs "out")))
729 (list "CC=gcc"
730 (string-append "BASEDIR=" out)
731 (string-append "INSTALLNLSDIR=" out "/share/locale")
732 (string-append "mandir=/share/man")))))
733
734 ;; Use the big Debian patch set (the thing does not even compile out of
735 ;; the box.)
736 (inputs `(("patch" ,(origin
737 (method url-fetch)
738 (uri
739 "http://ftp.de.debian.org/debian/pool/main/n/net-tools/net-tools_1.60-24.2.diff.gz")
740 (sha256
741 (base32
742 "0p93lsqx23v5fv4hpbrydmfvw1ha2rgqpn2zqbs2jhxkzhjc030p"))))))
743 (native-inputs `(("gettext" ,gnu-gettext)))
744
745 (synopsis "Tools for controlling the network subsystem in Linux")
746 (description
747 "This package includes the important tools for controlling the network
748 subsystem of the Linux kernel. This includes arp, hostname, ifconfig,
749 netstat, rarp and route. Additionally, this package contains utilities
750 relating to particular network hardware types (plipconfig, slattach) and
751 advanced aspects of IP configuration (iptunnel, ipmaddr).")
752 (license gpl2+)))
753
754 (define-public libcap
755 (package
756 (name "libcap")
757 (version "2.22")
758 (source (origin
759 (method url-fetch)
760
761 ;; Tarballs used to be available from
762 ;; <https://www.kernel.org/pub/linux/libs/security/linux-privs/>
763 ;; but they never came back after kernel.org was compromised.
764 (uri (string-append
765 "mirror://debian/pool/main/libc/libcap2/libcap2_"
766 version ".orig.tar.gz"))
767 (sha256
768 (base32
769 "07vjhkznm82p8dm4w6j8mmg7h5c70lp5s9bwwfdmgwpbixfydjp1"))))
770 (build-system gnu-build-system)
771 (arguments '(#:phases (alist-delete 'configure %standard-phases)
772 #:tests? #f ; no 'check' target
773 #:make-flags (list "lib=lib"
774 (string-append "prefix="
775 (assoc-ref %outputs "out"))
776 "RAISE_SETFCAP=no")))
777 (native-inputs `(("perl" ,perl)))
778 (inputs `(("attr" ,attr)))
779 (home-page "https://sites.google.com/site/fullycapable/")
780 (synopsis "Library for working with POSIX capabilities")
781 (description
782 "libcap2 provides a programming interface to POSIX capabilities on
783 Linux-based operating systems.")
784
785 ;; License is BSD-3 or GPLv2, at the user's choice.
786 (license gpl2)))
787
788 (define-public bridge-utils
789 (package
790 (name "bridge-utils")
791 (version "1.5")
792 (source (origin
793 (method url-fetch)
794 (uri (string-append "mirror://sourceforge/bridge/bridge-utils-"
795 version ".tar.gz"))
796 (sha256
797 (base32
798 "12367cwqmi0yqphi6j8rkx97q8hw52yq2fx4k0xfclkcizxybya2"))))
799 (build-system gnu-build-system)
800
801 ;; The tarball lacks all the generated files.
802 (native-inputs `(("autoconf" ,autoconf)
803 ("automake" ,automake)))
804 (arguments
805 '(#:phases (alist-cons-before
806 'configure 'bootstrap
807 (lambda _
808 (zero? (system* "autoreconf" "-vf")))
809 %standard-phases)
810 #:tests? #f)) ; no 'check' target
811
812 (home-page
813 "http://www.linuxfoundation.org/collaborate/workgroups/networking/bridge")
814 (synopsis "Manipulate Ethernet bridges")
815 (description
816 "Utilities for Linux's Ethernet bridging facilities. A bridge is a way
817 to connect two Ethernet segments together in a protocol independent way.
818 Packets are forwarded based on Ethernet address, rather than IP address (like
819 a router). Since forwarding is done at Layer 2, all protocols can go
820 transparently through a bridge.")
821 (license gpl2+)))
822
823 (define-public libnl
824 (package
825 (name "libnl")
826 (version "3.2.13")
827 (source (origin
828 (method url-fetch)
829 (uri (string-append
830 "http://www.infradead.org/~tgr/libnl/files/libnl-"
831 version ".tar.gz"))
832 (sha256
833 (base32
834 "1ydw42lsd572qwrfgws97n76hyvjdpanwrxm03lysnhfxkna1ssd"))))
835 (build-system gnu-build-system)
836 (native-inputs `(("flex" ,flex) ("bison" ,bison)))
837 (home-page "http://www.infradead.org/~tgr/libnl/")
838 (synopsis "NetLink protocol library suite")
839 (description
840 "The libnl suite is a collection of libraries providing APIs to netlink
841 protocol based Linux kernel interfaces. Netlink is an IPC mechanism primarly
842 between the kernel and user space processes. It was designed to be a more
843 flexible successor to ioctl to provide mainly networking related kernel
844 configuration and monitoring interfaces.")
845
846 ;; Most files are LGPLv2.1-only, but some are GPLv2-only (like
847 ;; 'nl-addr-add.c'), so the result is GPLv2-only.
848 (license gpl2)))
849
850 (define-public powertop
851 (package
852 (name "powertop")
853 (version "2.5")
854 (source
855 (origin
856 (method url-fetch)
857 (uri (string-append
858 "https://01.org/powertop/sites/default/files/downloads/powertop-"
859 version ".tar.gz"))
860 (sha256
861 (base32
862 "02rwqbpasdayl201v0549gbp2f82rd0hqiv3i111r7npanjhhb4b"))))
863 (build-system gnu-build-system)
864 (inputs
865 ;; TODO: Add pciutils.
866 `(("zlib" ,guix:zlib)
867 ;; ("pciutils" ,pciutils)
868 ("ncurses" ,ncurses)
869 ("libnl" ,libnl)))
870 (native-inputs
871 `(("pkg-config" ,pkg-config)))
872 (home-page "https://01.org/powertop/")
873 (synopsis "Analyze power consumption on Intel-based laptops")
874 (description
875 "PowerTOP is a Linux tool to diagnose issues with power consumption and
876 power management. In addition to being a diagnostic tool, PowerTOP also has
877 an interactive mode where the user can experiment various power management
878 settings for cases where the operating system has not enabled these
879 settings.")
880 (license gpl2)))
881
882 (define-public aumix
883 (package
884 (name "aumix")
885 (version "2.9.1")
886 (source (origin
887 (method url-fetch)
888 (uri (string-append
889 "http://www.jpj.net/~trevor/aumix/releases/aumix-"
890 version ".tar.bz2"))
891 (sha256
892 (base32
893 "0a8fwyxnc5qdxff8sl2sfsbnvgh6pkij4yafiln0fxgg6bal7knj"))))
894 (build-system gnu-build-system)
895 (inputs `(("ncurses" ,ncurses)))
896 (home-page "http://www.jpj.net/~trevor/aumix.html")
897 (synopsis "Audio mixer for X and the console")
898 (description
899 "Aumix adjusts an audio mixer from X, the console, a terminal,
900 the command line or a script.")
901 (license gpl2+)))
902
903 (define-public iotop
904 (package
905 (name "iotop")
906 (version "0.6")
907 (source
908 (origin
909 (method url-fetch)
910 (uri (string-append "http://guichaz.free.fr/iotop/files/iotop-"
911 version ".tar.gz"))
912 (sha256 (base32
913 "1kp8mqg2pbxq4xzpianypadfxcsyfgwcaqgqia6h9fsq6zyh4z0s"))))
914 (build-system python-build-system)
915 (arguments
916 ;; The setup.py script expects python-2.
917 `(#:python ,python-2
918 ;; There are currently no checks in the package.
919 #:tests? #f))
920 (native-inputs `(("python" ,python-2)))
921 (home-page "http://guichaz.free.fr/iotop/")
922 (synopsis
923 "Displays the IO activity of running processes")
924 (description
925 "Iotop is a Python program with a top like user interface to show the
926 processes currently causing I/O.")
927 (license gpl2+)))
928
929 (define-public fuse
930 (package
931 (name "fuse")
932 (version "2.9.3")
933 (source (origin
934 (method url-fetch)
935 (uri (string-append "mirror://sourceforge/fuse/fuse-"
936 version ".tar.gz"))
937 (sha256
938 (base32
939 "071r6xjgssy8vwdn6m28qq1bqxsd2bphcd2mzhq0grf5ybm87sqb"))))
940 (build-system gnu-build-system)
941 (inputs `(("util-linux" ,util-linux)))
942 (arguments
943 '(#:configure-flags (list (string-append "MOUNT_FUSE_PATH="
944 (assoc-ref %outputs "out")
945 "/sbin")
946 (string-append "INIT_D_PATH="
947 (assoc-ref %outputs "out")
948 "/etc/init.d")
949 (string-append "UDEV_RULES_PATH="
950 (assoc-ref %outputs "out")
951 "/etc/udev"))
952 #:phases (alist-cons-before
953 'build 'set-file-names
954 (lambda* (#:key inputs #:allow-other-keys)
955 ;; libfuse calls out to mount(8) and umount(8). Make sure
956 ;; it refers to the right ones.
957 (substitute* '("lib/mount_util.c" "util/mount_util.c")
958 (("/bin/(u?)mount" _ maybe-u)
959 (string-append (assoc-ref inputs "util-linux")
960 "/bin/" maybe-u "mount")))
961 (substitute* '("util/mount.fuse.c")
962 (("/bin/sh")
963 (which "sh"))))
964 %standard-phases)))
965 (home-page "http://fuse.sourceforge.net/")
966 (synopsis "Support file systems implemented in user space")
967 (description
968 "As a consequence of its monolithic design, file system code for Linux
969 normally goes into the kernel itself---which is not only a robustness issue,
970 but also an impediment to system extensibility. FUSE, for \"file systems in
971 user space\", is a kernel module and user-space library that tries to address
972 part of this problem by allowing users to run file system implementations as
973 user-space processes.")
974 (license (list lgpl2.1 ; library
975 gpl2+)))) ; command-line utilities
976
977 (define-public unionfs-fuse
978 (package
979 (name "unionfs-fuse")
980 (version "0.26")
981 (source (origin
982 (method url-fetch)
983 (uri (string-append
984 "http://podgorny.cz/unionfs-fuse/releases/unionfs-fuse-"
985 version ".tar.xz"))
986 (sha256
987 (base32
988 "0qpnr4czgc62vsfnmv933w62nq3xwcbnvqch72qakfgca75rsp4d"))))
989 (build-system cmake-build-system)
990 (inputs `(("fuse" ,fuse)))
991 (arguments '(#:tests? #f)) ; no tests
992 (home-page "http://podgorny.cz/moin/UnionFsFuse")
993 (synopsis "User-space union file system")
994 (description
995 "UnionFS-FUSE is a flexible union file system implementation in user
996 space, using the FUSE library. Mounting a union file system allows you to
997 \"aggregate\" the contents of several directories into a single mount point.
998 UnionFS-FUSE additionally supports copy-on-write.")
999 (license bsd-3)))
1000
1001 (define fuse-static
1002 (package (inherit fuse)
1003 (name "fuse-static")
1004 (source (origin (inherit (package-source fuse))
1005 (modules '((guix build utils)))
1006 (snippet
1007 ;; Normally libfuse invokes mount(8) so that /etc/mtab is
1008 ;; updated. Change calls to 'mtab_needs_update' to 0 so that
1009 ;; it doesn't do that, allowing us to remove the dependency on
1010 ;; util-linux (something that is useful in initrds.)
1011 '(substitute* '("lib/mount_util.c"
1012 "util/mount_util.c")
1013 (("mtab_needs_update[[:blank:]]*\\([a-z_]+\\)")
1014 "0")
1015 (("/bin/")
1016 "")))))))
1017
1018 (define-public unionfs-fuse/static
1019 (package (inherit unionfs-fuse)
1020 (synopsis "User-space union file system (statically linked)")
1021 (name (string-append (package-name unionfs-fuse) "-static"))
1022 (source (origin (inherit (package-source unionfs-fuse))
1023 (modules '((guix build utils)))
1024 (snippet
1025 ;; Add -ldl to the libraries, because libfuse.a needs that.
1026 '(substitute* "src/CMakeLists.txt"
1027 (("target_link_libraries(.*)\\)" _ libs)
1028 (string-append "target_link_libraries"
1029 libs " dl)"))))))
1030 (arguments
1031 '(#:tests? #f
1032 #:configure-flags '("-DCMAKE_EXE_LINKER_FLAGS=-static")))
1033 (inputs `(("fuse" ,fuse-static)))))