1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
5 ;;; This file is part of GNU Guix.
7 ;;; GNU Guix is free software; you can redistribute it and/or modify it
8 ;;; under the terms of the GNU General Public License as published by
9 ;;; the Free Software Foundation; either version 3 of the License, or (at
10 ;;; your option) any later version.
12 ;;; GNU Guix is distributed in the hope that it will be useful, but
13 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;;; GNU General Public License for more details.
17 ;;; You should have received a copy of the GNU General Public License
18 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20 (define-module (gnu packages linux)
21 #:use-module (guix licenses)
22 #:use-module (gnu packages)
23 #:use-module ((gnu packages compression)
24 #:renamer (symbol-prefix-proc 'guix:))
25 #:use-module (gnu packages flex)
26 #:use-module (gnu packages bison)
27 #:use-module (gnu packages libusb)
28 #:use-module (gnu packages ncurses)
29 #:use-module (gnu packages bdb)
30 #:use-module (gnu packages perl)
31 #:use-module (gnu packages pkg-config)
32 #:use-module (gnu packages algebra)
33 #:use-module (gnu packages gettext)
34 #:use-module (gnu packages pulseaudio)
35 #:use-module (gnu packages attr)
36 #:use-module (gnu packages xml)
37 #:use-module (gnu packages autotools)
38 #:use-module (guix packages)
39 #:use-module (guix download)
40 #:use-module (guix build-system gnu))
42 (define-public (system->linux-architecture arch)
43 "Return the Linux architecture name for ARCH, a Guix system name such as
45 (let ((arch (car (string-split arch #\-))))
46 (cond ((string=? arch "i686") "i386")
47 ((string-prefix? "mips" arch) "mips")
48 ((string-prefix? "arm" arch) "arm")
51 (define (linux-libre-urls version)
52 "Return a list of URLs for Linux-Libre VERSION."
54 "http://linux-libre.fsfla.org/pub/linux-libre/releases/"
55 version "-gnu/linux-libre-" version "-gnu.tar.xz")
57 ;; XXX: Work around <http://bugs.gnu.org/14851>.
59 "ftp://alpha.gnu.org/gnu/guix/mirror/linux-libre-"
60 version "-gnu.tar.xz")
62 ;; Maybe this URL will become valid eventually.
64 "mirror://gnu/linux-libre/" version "-gnu/linux-libre-"
65 version "-gnu.tar.xz")))
67 (define-public linux-libre-headers
68 (let* ((version "3.3.8")
72 (setenv "ARCH" ,(system->linux-architecture arch))
73 (format #t "`ARCH' set to `~a'~%" (getenv "ARCH"))
75 (and (zero? (system* "make" "defconfig"))
76 (zero? (system* "make" "mrproper" "headers_check"))))))
78 `(lambda* (#:key outputs #:allow-other-keys)
79 (let ((out (assoc-ref outputs "out")))
80 (and (zero? (system* "make"
81 (string-append "INSTALL_HDR_PATH=" out)
83 (mkdir (string-append out "/include/config"))
84 (call-with-output-file
86 "/include/config/kernel.release")
88 (format p "~a-default~%" ,version))))))))
90 (name "linux-libre-headers")
94 (uri (linux-libre-urls version))
97 "0jkfh0z1s6izvdnc3njm39dhzp1cg8i06jv06izwqz9w9qsprvnl"))))
98 (build-system gnu-build-system)
99 (native-inputs `(("perl" ,perl)))
101 `(#:modules ((guix build gnu-build-system)
104 #:phases (alist-replace
105 'build ,(build-phase (or (%current-target-system)
108 'install ,install-phase
109 (alist-delete 'configure %standard-phases)))
111 (synopsis "GNU Linux-Libre kernel headers")
112 (description "Headers of the Linux-Libre kernel.")
114 (home-page "http://www.gnu.org/software/linux-libre/"))))
116 (define-public module-init-tools
118 (name "module-init-tools")
123 "mirror://kernel.org/linux/utils/kernel/module-init-tools/module-init-tools-"
127 "0jxnz9ahfic79rp93l5wxcbgh4pkv85mwnjlbv1gz3jawv5cvwp1"))))
128 (build-system gnu-build-system)
130 ;; FIXME: The upstream tarball lacks man pages, and building them would
131 ;; require DocBook & co. We used to use Gentoo's pre-built man pages,
132 ;; but they vanished. In the meantime, fake it.
133 '(#:phases (alist-cons-before
134 'configure 'fake-docbook
136 (substitute* "Makefile.in"
137 (("^DOCBOOKTOMAN.*$")
138 "DOCBOOKTOMAN = true\n")))
140 (home-page "http://www.kernel.org/pub/linux/utils/kernel/module-init-tools/")
141 (synopsis "Tools for loading and managing Linux kernel modules")
143 "Tools for loading and managing Linux kernel modules, such as `modprobe',
144 `insmod', `lsmod', and more.")
147 (define-public linux-libre
148 (let* ((version "3.11")
150 '(lambda* (#:key system #:allow-other-keys #:rest args)
151 (let ((arch (car (string-split system #\-))))
153 (cond ((string=? arch "i686") "i386")
155 (format #t "`ARCH' set to `~a'~%" (getenv "ARCH")))
157 (let ((build (assoc-ref %standard-phases 'build)))
158 (and (zero? (system* "make" "defconfig"))
160 (format #t "enabling additional modules...~%")
161 (substitute* ".config"
162 (("^# CONFIG_CIFS.*$")
164 (zero? (system* "make" "oldconfig")))
166 ;; Call the default `build' phase so `-j' is correctly
168 (apply build #:make-flags "all" args)))))
170 `(lambda* (#:key inputs outputs #:allow-other-keys)
171 (let* ((out (assoc-ref outputs "out"))
172 (moddir (string-append out "/lib/modules"))
173 (mit (assoc-ref inputs "module-init-tools")))
175 (for-each (lambda (file)
177 (string-append out "/" (basename file))))
178 (find-files "." "^(bzImage|System\\.map)$"))
179 (copy-file ".config" (string-append out "/config"))
180 (zero? (system* "make"
181 (string-append "DEPMOD=" mit "/sbin/depmod")
182 (string-append "MODULE_DIR=" moddir)
183 (string-append "INSTALL_PATH=" out)
184 (string-append "INSTALL_MOD_PATH=" out)
185 "modules_install"))))))
191 (uri (linux-libre-urls version))
194 "1vlk04xkvyy1kc9zz556md173rn1qzlnvhz7c9sljv4bpk3mdspl"))))
195 (build-system gnu-build-system)
196 (native-inputs `(("perl" ,perl)
198 ("module-init-tools" ,module-init-tools)))
200 `(#:modules ((guix build gnu-build-system)
204 #:phases (alist-replace
207 'install ,install-phase
208 (alist-delete 'configure %standard-phases)))
210 (synopsis "100% free redistribution of a cleaned Linux kernel")
212 "Linux Libre is a free (as in freedom) variant of the Linux kernel. It
213 has been modified to remove any non-free binary blobs.")
215 (home-page "http://www.gnu.org/software/linux-libre/"))))
219 ;;; Pluggable authentication modules (PAM).
222 (define-public linux-pam
229 (uri (list (string-append "http://www.linux-pam.org/library/Linux-PAM-"
231 (string-append "mirror://kernel.org/linux/libs/pam/library/Linux-PAM-"
232 version ".tar.bz2")))
235 "1hlz2kqvbjisvwyicdincq7nz897b9rrafyzccwzqiqg53b8gf5s"))))
236 (build-system gnu-build-system)
240 ;; TODO: optional dependencies
241 ;; ("libxcrypt" ,libxcrypt)
242 ;; ("cracklib" ,cracklib)
245 '(;; Most users, such as `shadow', expect the headers to be under
247 #:configure-flags (list (string-append "--includedir="
248 (assoc-ref %outputs "out")
249 "/include/security"))
251 ;; XXX: Tests won't run in chroot, presumably because /etc/pam.d
254 (home-page "http://www.linux-pam.org/")
255 (synopsis "Pluggable authentication modules for Linux")
257 "A *Free* project to implement OSF's RFC 86.0.
258 Pluggable authentication modules are small shared object files that can
259 be used through the PAM API to perform tasks, like authenticating a user
260 at login. Local and dynamic reconfiguration are its key features")
268 (define-public psmisc
275 (uri (string-append "mirror://sourceforge/psmisc/psmisc/psmisc-"
279 "052mfraykmxnavpi8s78aljx8w87hyvpx8mvzsgpjsjz73i28wmi"))))
280 (build-system gnu-build-system)
281 (inputs `(("ncurses" ,ncurses)))
282 (home-page "http://psmisc.sourceforge.net/")
284 "set of utilities that use the proc filesystem, such as fuser, killall, and pstree")
286 "This PSmisc package is a set of some small useful utilities that
287 use the proc filesystem. We're not about changing the world, but
288 providing the system administrator with some help in common tasks.")
291 (define-public util-linux
298 (uri (string-append "mirror://kernel.org/linux/utils/"
299 name "/v" version "/"
300 name "-" version ".2" ".tar.xz"))
303 "1rpgghf7n0zx0cdy8hibr41wvkm2qp1yvd8ab1rxr193l1jmgcir"))))
304 (build-system gnu-build-system)
306 `(#:configure-flags '("--disable-use-tty-group")
307 #:phases (alist-cons-after
308 'install 'patch-chkdupexe
309 (lambda* (#:key outputs #:allow-other-keys)
310 (let ((out (assoc-ref outputs "out")))
311 (substitute* (string-append out "/bin/chkdupexe")
312 ;; Allow 'patch-shebang' to do its work.
313 (("@PERL@") "/bin/perl"))))
315 (inputs `(("zlib" ,guix:zlib)
318 (home-page "https://www.kernel.org/pub/linux/utils/util-linux/")
319 (synopsis "Collection of utilities for the Linux kernel")
321 "util-linux is a random collection of utilities for the Linux kernel.")
323 ;; Note that util-linux doesn't use the same license for all the
324 ;; code. GPLv2+ is the default license for a code without an
325 ;; explicitly defined license.
326 (license (list gpl3+ gpl2+ gpl2 lgpl2.0+
327 bsd-4 public-domain))))
329 (define-public procps
335 (uri (string-append "http://procps.sourceforge.net/procps-"
339 "0d8mki0q4yamnkk4533kx8mc0jd879573srxhg6r2fs3lkc6iv8i"))
340 (patches (list (search-patch "procps-make-3.82.patch")))))
341 (build-system gnu-build-system)
342 (inputs `(("ncurses" ,ncurses)))
344 '(#:phases (alist-replace
346 (lambda* (#:key outputs #:allow-other-keys)
347 ;; No `configure', just a single Makefile.
348 (let ((out (assoc-ref outputs "out")))
349 (substitute* "Makefile"
351 (("--(owner|group) 0") "")
352 (("ldconfig") "true")
353 (("^LDFLAGS[[:blank:]]*:=(.*)$" _ value)
354 ;; Add libproc to the RPATH.
355 (string-append "LDFLAGS := -Wl,-rpath="
360 (lambda* (#:key outputs #:allow-other-keys)
361 (let ((out (assoc-ref outputs "out")))
363 (system* "make" "install"
364 (string-append "DESTDIR=" out)))
368 (system* (string-append out "/bin/ps")
372 ;; What did you expect? Tests?
374 (home-page "http://procps.sourceforge.net/")
375 (synopsis "Utilities that give information about processes")
377 "procps is the package that has a bunch of small useful utilities
378 that give information about processes using the Linux /proc file system.
379 The package includes the programs ps, top, vmstat, w, kill, free,
380 slabtop, and skill.")
383 (define-public usbutils
390 (uri (string-append "mirror://kernel.org/linux/utils/usb/usbutils/"
391 "usbutils-" version ".tar.xz"))
394 "03pd57vv8c6x0hgjqcbrxnzi14h8hcghmapg89p8k5zpwpkvbdfr"))))
395 (build-system gnu-build-system)
397 `(("libusb" ,libusb) ("pkg-config" ,pkg-config)))
398 (home-page "http://www.linux-usb.org/")
400 "Tools for working with USB devices, such as lsusb")
402 "Tools for working with USB devices, such as lsusb.")
405 (define-public e2fsprogs
411 (uri (string-append "mirror://sourceforge/e2fsprogs/e2fsprogs-"
415 "0ibkkvp6kan0hn0d1anq4n2md70j5gcm7mwna515w82xwyr02rfw"))))
416 (build-system gnu-build-system)
417 (inputs `(("util-linux" ,util-linux)
418 ("pkg-config" ,pkg-config)))
420 '(#:phases (alist-cons-before
421 'configure 'patch-shells
423 (substitute* "configure"
424 (("/bin/sh (.*)parse-types.sh" _ dir)
425 (string-append (which "sh") " " dir
427 (substitute* (find-files "." "^Makefile.in$")
429 (string-append "#!" (which "sh")))))
432 ;; FIXME: Tests work by comparing the stdout/stderr of programs, that
433 ;; they fail because we get an extra line that says "Can't check if
434 ;; filesystem is mounted due to missing mtab file".
436 (home-page "http://e2fsprogs.sourceforge.net/")
437 (synopsis "Creating and checking ext2/ext3/ext4 file systems")
439 "This package provides tools for manipulating ext2/ext3/ext4 file systems.")
440 (license (list gpl2 ; programs
444 (define-public strace
450 (uri (string-append "mirror://sourceforge/strace/strace-"
454 "158iwk0pl2mfw93m1843xb7a2zb8p6lh0qim07rca6f1ff4dk764"))))
455 (build-system gnu-build-system)
456 (inputs `(("perl" ,perl)))
457 (home-page "http://strace.sourceforge.net/")
458 (synopsis "System call tracer for Linux")
460 "strace is a system call tracer, i.e. a debugging tool which prints out a
461 trace of all the system calls made by a another process/program.")
464 (define-public alsa-lib
471 "ftp://ftp.alsa-project.org/pub/lib/alsa-lib-"
475 "0fx057746dj7rjdi0jnvx2m9b0y1lgdkh1hks87d8w32xyihf3k9"))
476 (patches (list (search-patch "alsa-lib-mips-atomic-fix.patch")))))
477 (build-system gnu-build-system)
478 (home-page "http://www.alsa-project.org/")
479 (synopsis "The Advanced Linux Sound Architecture libraries")
481 "The Advanced Linux Sound Architecture (ALSA) provides audio and
482 MIDI functionality to the Linux-based operating system.")
485 (define-public alsa-utils
491 (uri (string-append "ftp://ftp.alsa-project.org/pub/utils/alsa-utils-"
495 "1sjjngnq50jv5ilwsb4zys6smifni3bd6fn28gbnhfrg14wsrgq2"))))
496 (build-system gnu-build-system)
498 ;; XXX: Disable man page creation until we have DocBook.
499 '(#:configure-flags (list "--disable-xmlto"
500 (string-append "--with-udev-rules-dir="
501 (assoc-ref %outputs "out")
502 "/lib/udev/rules.d"))
503 #:phases (alist-cons-before
504 'install 'pre-install
506 ;; Don't try to mkdir /var/lib/alsa.
507 (substitute* "Makefile"
508 (("\\$\\(MKDIR_P\\) .*ASOUND_STATE_DIR.*")
512 `(("libsamplerate" ,libsamplerate)
514 ("alsa-lib" ,alsa-lib)
516 ("gettext" ,gnu-gettext)))
517 (home-page "http://www.alsa-project.org/")
518 (synopsis "Utilities for the Advanced Linux Sound Architecture (ALSA)")
520 "The Advanced Linux Sound Architecture (ALSA) provides audio and
521 MIDI functionality to the Linux-based operating system.")
523 ;; This is mostly GPLv2+ but a few files such as 'alsactl.c' are
527 (define-public iptables
534 "http://www.netfilter.org/projects/iptables/files/iptables-"
538 "0vkg5lzkn4l3i1sm6v3x96zzvnv9g7mi0qgj6279ld383mzcws24"))))
539 (build-system gnu-build-system)
540 (arguments '(#:tests? #f)) ; no test suite
541 (home-page "http://www.netfilter.org/projects/iptables/index.html")
542 (synopsis "Program to configure the Linux IP packet filtering rules")
544 "iptables is the userspace command line program used to configure the
545 Linux 2.4.x and later IPv4 packet filtering ruleset. It is targeted towards
546 system administrators. Since Network Address Translation is also configured
547 from the packet filter ruleset, iptables is used for this, too. The iptables
548 package also includes ip6tables. ip6tables is used for configuring the IPv6
552 (define-public iproute
559 "mirror://kernel.org/linux/utils/net/iproute2/iproute2-"
563 "0kqy30wz2krbg4y7750hjq5218hgy2vj9pm5qzkn1bqskxs4b4ap"))))
564 (build-system gnu-build-system)
566 `(#:tests? #f ; no test suite
567 #:make-flags (let ((out (assoc-ref %outputs "out")))
569 (string-append "LIBDIR=" out "/lib")
570 (string-append "SBINDIR=" out "/sbin")
571 (string-append "CONFDIR=" out "/etc")
572 (string-append "DOCDIR=" out "/share/doc/"
574 (string-append "MANDIR=" out "/share/man")))
575 #:phases (alist-cons-before
576 'install 'pre-install
578 ;; Don't attempt to create /var/lib/arpd.
579 (substitute* "Makefile"
580 (("^.*ARPDDIR.*$") "")))
583 `(("iptables" ,iptables)
585 ("pkg-config" ,pkg-config)
589 "http://www.linuxfoundation.org/collaborate/workgroups/networking/iproute2")
591 "A collection of utilities for controlling TCP/IP networking and traffic control in Linux")
593 "Iproute2 is a collection of utilities for controlling TCP/IP
594 networking and traffic with the Linux kernel.
596 Most network configuration manuals still refer to ifconfig and route as the
597 primary network configuration tools, but ifconfig is known to behave
598 inadequately in modern network environments. They should be deprecated, but
599 most distros still include them. Most network configuration systems make use
600 of ifconfig and thus provide a limited feature set. The /etc/net project aims
601 to support most modern network technologies, as it doesn't use ifconfig and
602 allows a system administrator to make use of all iproute2 features, including
605 iproute2 is usually shipped in a package called iproute or iproute2 and
606 consists of several tools, of which the most important are ip and tc. ip
607 controls IPv4 and IPv6 configuration and tc stands for traffic control. Both
608 tools print detailed usage messages and are accompanied by a set of
612 (define-public net-tools
613 ;; XXX: This package is basically unmaintained, but it provides a few
614 ;; commands not yet provided by Inetutils, such as 'route', so we have to
619 (home-page "http://www.tazenda.demon.co.uk/phil/net-tools/")
622 (uri (string-append home-page "/" name "-"
626 "0yvxrzk0mzmspr7sa34hm1anw6sif39gyn85w4c5ywfn8inxvr3s"))))
627 (build-system gnu-build-system)
629 '(#:phases (alist-replace
631 (lambda* (#:key inputs #:allow-other-keys)
632 (define (apply-patch file)
633 (zero? (system* "patch" "-p1" "--batch"
636 (let ((patch.gz (assoc-ref inputs "patch")))
637 (format #t "applying Debian patch set '~a'...~%"
639 (system (string-append "gunzip < " patch.gz " > the-patch"))
641 (and (apply-patch "the-patch")
642 (for-each apply-patch
643 (find-files "debian/patches"
647 (lambda* (#:key outputs #:allow-other-keys)
648 (let ((out (assoc-ref outputs "out")))
649 (mkdir-p (string-append out "/bin"))
650 (mkdir-p (string-append out "/sbin"))
652 ;; Pretend we have everything...
653 (system "yes | make config")
655 ;; ... except we don't have libdnet, so remove that
657 (substitute* '("config.make" "config.h")
658 (("^.*HAVE_AFDECnet.*$") ""))))
661 ;; Binaries that depend on libnet-tools.a don't declare that
662 ;; dependency, making it parallel-unsafe.
665 #:tests? #f ; no test suite
666 #:make-flags (list "CC=gcc"
667 (string-append "BASEDIR="
668 (assoc-ref %outputs "out")))))
670 ;; Use the big Debian patch set (the thing does not even compile out of
672 (inputs `(("patch" ,(origin
675 "http://ftp.de.debian.org/debian/pool/main/n/net-tools/net-tools_1.60-24.2.diff.gz")
678 "0p93lsqx23v5fv4hpbrydmfvw1ha2rgqpn2zqbs2jhxkzhjc030p"))))))
679 (native-inputs `(("gettext" ,gnu-gettext)))
681 (synopsis "Tools for controlling the network subsystem in Linux")
683 "This package includes the important tools for controlling the network
684 subsystem of the Linux kernel. This includes arp, hostname, ifconfig,
685 netstat, rarp and route. Additionally, this package contains utilities
686 relating to particular network hardware types (plipconfig, slattach) and
687 advanced aspects of IP configuration (iptunnel, ipmaddr).")
690 (define-public libcap
697 ;; Tarballs used to be available from
698 ;; <https://www.kernel.org/pub/linux/libs/security/linux-privs/>
699 ;; but they never came back after kernel.org was compromised.
701 "mirror://debian/pool/main/libc/libcap2/libcap2_"
702 version ".orig.tar.gz"))
705 "07vjhkznm82p8dm4w6j8mmg7h5c70lp5s9bwwfdmgwpbixfydjp1"))))
706 (build-system gnu-build-system)
707 (arguments '(#:phases (alist-delete 'configure %standard-phases)
708 #:tests? #f ; no 'check' target
709 #:make-flags (list "lib=lib"
710 (string-append "prefix="
711 (assoc-ref %outputs "out"))
712 "RAISE_SETFCAP=no")))
713 (native-inputs `(("perl" ,perl)))
714 (inputs `(("attr" ,attr)))
715 (home-page "https://sites.google.com/site/fullycapable/")
716 (synopsis "Library for working with POSIX capabilities")
718 "libcap2 provides a programming interface to POSIX capabilities on
719 Linux-based operating systems.")
721 ;; License is BSD-3 or GPLv2, at the user's choice.
724 (define-public bridge-utils
726 (name "bridge-utils")
730 (uri (string-append "mirror://sourceforge/bridge/bridge-utils-"
734 "12367cwqmi0yqphi6j8rkx97q8hw52yq2fx4k0xfclkcizxybya2"))))
735 (build-system gnu-build-system)
737 ;; The tarball lacks all the generated files.
738 (native-inputs `(("autoconf" ,autoconf)
739 ("automake" ,automake)))
741 '(#:phases (alist-cons-before
742 'configure 'bootstrap
744 (zero? (system* "autoreconf" "-vf")))
746 #:tests? #f)) ; no 'check' target
749 "http://www.linuxfoundation.org/collaborate/workgroups/networking/bridge")
750 (synopsis "Manipulate Ethernet bridges")
752 "Utilities for Linux's Ethernet bridging facilities. A bridge is a way
753 to connect two Ethernet segments together in a protocol independent way.
754 Packets are forwarded based on Ethernet address, rather than IP address (like
755 a router). Since forwarding is done at Layer 2, all protocols can go
756 transparently through a bridge.")