Merge branch 'master' into core-updates
[jackhill/guix/guix.git] / gnu / packages / linux.scm
CommitLineData
233e7676 1;;; GNU Guix --- Functional package management for GNU
e47e3eff 2;;; Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org>
233e7676 3;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
fd76c904 4;;;
233e7676 5;;; This file is part of GNU Guix.
fd76c904 6;;;
233e7676 7;;; GNU Guix is free software; you can redistribute it and/or modify it
fd76c904
LC
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.
11;;;
233e7676 12;;; GNU Guix is distributed in the hope that it will be useful, but
fd76c904
LC
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.
16;;;
17;;; You should have received a copy of the GNU General Public License
233e7676 18;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
fd76c904 19
1ffa7090 20(define-module (gnu packages linux)
4a44e743 21 #:use-module (guix licenses)
59a43334 22 #:use-module (gnu packages)
1ffa7090 23 #:use-module ((gnu packages compression)
4a44e743 24 #:renamer (symbol-prefix-proc 'guix:))
1ffa7090 25 #:use-module (gnu packages flex)
90a0048f 26 #:use-module (gnu packages bison)
1ffa7090
LC
27 #:use-module (gnu packages libusb)
28 #:use-module (gnu packages ncurses)
90a0048f 29 #:use-module (gnu packages bdb)
1ffa7090
LC
30 #:use-module (gnu packages perl)
31 #:use-module (gnu packages pkg-config)
02b80c3f
NK
32 #:use-module (guix packages)
33 #:use-module (guix download)
fd76c904
LC
34 #:use-module (guix build-system gnu))
35
aaf4cb20
LC
36(define-public (system->linux-architecture arch)
37 "Return the Linux architecture name for ARCH, a Guix system name such as
38\"x86_64-linux\"."
618cea69
NK
39 (let ((arch (car (string-split arch #\-))))
40 (cond ((string=? arch "i686") "i386")
41 ((string-prefix? "mips" arch) "mips")
aaf4cb20 42 ((string-prefix? "arm" arch) "arm")
618cea69
NK
43 (else arch))))
44
80fe5c60
LC
45(define-public linux-libre-headers
46 (let* ((version* "3.3.8")
47 (build-phase
618cea69
NK
48 (lambda (arch)
49 `(lambda _
50 (setenv "ARCH" ,(system->linux-architecture arch))
51 (format #t "`ARCH' set to `~a'~%" (getenv "ARCH"))
45298f8f 52
618cea69
NK
53 (and (zero? (system* "make" "defconfig"))
54 (zero? (system* "make" "mrproper" "headers_check"))))))
80fe5c60
LC
55 (install-phase
56 `(lambda* (#:key outputs #:allow-other-keys)
57 (let ((out (assoc-ref outputs "out")))
58 (and (zero? (system* "make"
59 (string-append "INSTALL_HDR_PATH=" out)
60 "headers_install"))
61 (mkdir (string-append out "/include/config"))
62 (call-with-output-file
63 (string-append out
64 "/include/config/kernel.release")
65 (lambda (p)
66 (format p "~a-default~%" ,version*))))))))
67 (package
68 (name "linux-libre-headers")
69 (version version*)
70 (source (origin
71 (method url-fetch)
72 (uri (string-append
73 "http://linux-libre.fsfla.org/pub/linux-libre/releases/3.3.8-gnu/linux-libre-"
74 version "-gnu.tar.xz"))
75 (sha256
76 (base32
77 "0jkfh0z1s6izvdnc3njm39dhzp1cg8i06jv06izwqz9w9qsprvnl"))))
78 (build-system gnu-build-system)
79 (native-inputs `(("perl" ,perl)))
80 (arguments
81 `(#:modules ((guix build gnu-build-system)
82 (guix build utils)
934488cc
LC
83 (srfi srfi-1)
84 ,@(if (%current-target-system)
85 '((guix build gnu-cross-build))
86 '()))
80fe5c60 87 #:phases (alist-replace
618cea69 88 'build ,(build-phase (%current-system))
80fe5c60
LC
89 (alist-replace
90 'install ,install-phase
934488cc
LC
91 (alist-delete 'configure
92 ,(if (%current-target-system)
93 '%standard-cross-phases
94 '%standard-phases))))
80fe5c60
LC
95 #:tests? #f))
96 (synopsis "GNU Linux-Libre kernel headers")
97 (description "Headers of the Linux-Libre kernel.")
38bbd61d 98 (license gpl2)
80fe5c60
LC
99 (home-page "http://www.gnu.org/software/linux-libre/"))))
100
b4fcb735
LC
101(define-public module-init-tools
102 (package
103 (name "module-init-tools")
104 (version "3.16")
105 (source (origin
106 (method url-fetch)
107 (uri (string-append
108 "mirror://kernel.org/linux/utils/kernel/module-init-tools/module-init-tools-"
109 version ".tar.bz2"))
110 (sha256
111 (base32
112 "0jxnz9ahfic79rp93l5wxcbgh4pkv85mwnjlbv1gz3jawv5cvwp1"))))
113 (build-system gnu-build-system)
114 (inputs
115 ;; The upstream tarball lacks man pages, and building them would require
116 ;; DocBook & co. Thus, use Gentoo's pre-built man pages.
117 `(("man-pages"
118 ,(origin
119 (method url-fetch)
120 (uri (string-append
121 "http://distfiles.gentoo.org/distfiles/module-init-tools-" version
122 "-man.tar.bz2"))
123 (sha256
124 (base32
125 "1j1nzi87kgsh4scl645fhwhjvljxj83cmdasa4n4p5krhasgw358"))))))
126 (arguments
127 '(#:phases (alist-cons-before
128 'unpack 'unpack-man-pages
129 (lambda* (#:key inputs #:allow-other-keys)
130 (let ((man-pages (assoc-ref inputs "man-pages")))
131 (zero? (system* "tar" "xvf" man-pages))))
132 %standard-phases)))
133 (home-page "http://www.kernel.org/pub/linux/utils/kernel/module-init-tools/")
134 (synopsis "Tools for loading and managing Linux kernel modules")
135 (description
136 "Tools for loading and managing Linux kernel modules, such as `modprobe',
137`insmod', `lsmod', and more.")
138 (license gpl2+)))
139
beacfcab
LC
140(define-public linux-libre
141 (let* ((version* "3.3.8")
142 (build-phase
143 '(lambda* (#:key system #:allow-other-keys #:rest args)
144 (let ((arch (car (string-split system #\-))))
145 (setenv "ARCH"
146 (cond ((string=? arch "i686") "i386")
147 (else arch)))
148 (format #t "`ARCH' set to `~a'~%" (getenv "ARCH")))
149
150 (let ((build (assoc-ref %standard-phases 'build)))
2e48455d
LC
151 (and (zero? (system* "make" "defconfig"))
152 (begin
153 (format #t "enabling additional modules...~%")
154 (substitute* ".config"
155 (("^# CONFIG_CIFS.*$")
156 "CONFIG_CIFS=m\n"))
157 (zero? (system* "make" "oldconfig")))
beacfcab
LC
158
159 ;; Call the default `build' phase so `-j' is correctly
160 ;; passed.
161 (apply build #:make-flags "all" args)))))
162 (install-phase
163 `(lambda* (#:key inputs outputs #:allow-other-keys)
164 (let* ((out (assoc-ref outputs "out"))
165 (moddir (string-append out "/lib/modules"))
166 (mit (assoc-ref inputs "module-init-tools")))
167 (mkdir-p moddir)
168 (for-each (lambda (file)
169 (copy-file file
170 (string-append out "/" (basename file))))
171 (find-files "." "^(bzImage|System\\.map)$"))
172 (copy-file ".config" (string-append out "/config"))
173 (zero? (system* "make"
174 (string-append "DEPMOD=" mit "/sbin/depmod")
175 (string-append "MODULE_DIR=" moddir)
176 (string-append "INSTALL_PATH=" out)
177 (string-append "INSTALL_MOD_PATH=" out)
178 "modules_install"))))))
179 (package
180 (name "linux-libre")
181 (version version*)
182 (source (origin
183 (method url-fetch)
184 (uri (string-append
185 "http://linux-libre.fsfla.org/pub/linux-libre/releases/3.3.8-gnu/linux-libre-"
186 version "-gnu.tar.xz"))
187 (sha256
188 (base32
189 "0jkfh0z1s6izvdnc3njm39dhzp1cg8i06jv06izwqz9w9qsprvnl"))))
190 (build-system gnu-build-system)
191 (native-inputs `(("perl" ,perl)
192 ("module-init-tools" ,module-init-tools)))
193 (arguments
194 `(#:modules ((guix build gnu-build-system)
195 (guix build utils)
196 (srfi srfi-1)
197 (ice-9 match))
198 #:phases (alist-replace
199 'build ,build-phase
200 (alist-replace
201 'install ,install-phase
202 (alist-delete 'configure %standard-phases)))
203 #:tests? #f))
f50d2669 204 (synopsis "100% free redistribution of a cleaned Linux kernel")
beacfcab
LC
205 (description "Linux-Libre operating system kernel.")
206 (license gpl2)
207 (home-page "http://www.gnu.org/software/linux-libre/"))))
208
fd76c904
LC
209(define-public linux-pam
210 (package
211 (name "linux-pam")
212 (version "1.1.6")
213 (source
214 (origin
215 (method url-fetch)
216 (uri (list (string-append "http://www.linux-pam.org/library/Linux-PAM-"
217 version ".tar.bz2")
218 (string-append "mirror://kernel.org/linux/libs/pam/library/Linux-PAM-"
219 version ".tar.bz2")))
220 (sha256
221 (base32
222 "1hlz2kqvbjisvwyicdincq7nz897b9rrafyzccwzqiqg53b8gf5s"))))
223 (build-system gnu-build-system)
224 (inputs
225 `(("flex" ,flex)
226
227 ;; TODO: optional dependencies
228 ;; ("libxcrypt" ,libxcrypt)
229 ;; ("cracklib" ,cracklib)
230 ))
231 (arguments
232 ;; XXX: Tests won't run in chroot, presumably because /etc/pam.d
233 ;; isn't available.
234 '(#:tests? #f))
235 (home-page "http://www.linux-pam.org/")
236 (synopsis "Pluggable authentication modules for Linux")
237 (description
238 "A *Free* project to implement OSF's RFC 86.0.
239Pluggable authentication modules are small shared object files that can
240be used through the PAM API to perform tasks, like authenticating a user
241at login. Local and dynamic reconfiguration are its key features")
4a44e743 242 (license bsd-3)))
686f14e8
LC
243
244(define-public psmisc
245 (package
246 (name "psmisc")
247 (version "22.20")
248 (source
249 (origin
250 (method url-fetch)
251 (uri (string-append "mirror://sourceforge/psmisc/psmisc/psmisc-"
252 version ".tar.gz"))
253 (sha256
254 (base32
255 "052mfraykmxnavpi8s78aljx8w87hyvpx8mvzsgpjsjz73i28wmi"))))
256 (build-system gnu-build-system)
257 (inputs `(("ncurses" ,ncurses)))
258 (home-page "http://psmisc.sourceforge.net/")
259 (synopsis
260 "set of utilities that use the proc filesystem, such as fuser, killall, and pstree")
261 (description
262 "This PSmisc package is a set of some small useful utilities that
263use the proc filesystem. We're not about changing the world, but
264providing the system administrator with some help in common tasks.")
4a44e743 265 (license gpl2+)))
02b80c3f
NK
266
267(define-public util-linux
268 (package
269 (name "util-linux")
270 (version "2.21")
271 (source
272 (origin
273 (method url-fetch)
274 (uri (string-append "mirror://kernel.org/linux/utils/"
275 name "/v" version "/"
276 name "-" version ".2" ".tar.xz"))
277 (sha256
278 (base32
279 "1rpgghf7n0zx0cdy8hibr41wvkm2qp1yvd8ab1rxr193l1jmgcir"))))
280 (build-system gnu-build-system)
281 (arguments
282 `(#:configure-flags '("--disable-use-tty-group")
283 #:phases (alist-cons-after
284 'install 'patch-chkdupexe
285 (lambda* (#:key outputs #:allow-other-keys)
286 (let ((out (assoc-ref outputs "out")))
287 (substitute* (string-append out "/bin/chkdupexe")
288 ;; Allow 'patch-shebang' to do its work.
289 (("@PERL@") "/bin/perl"))))
290 %standard-phases)))
4a44e743 291 (inputs `(("zlib" ,guix:zlib)
02b80c3f
NK
292 ("ncurses" ,ncurses)
293 ("perl" ,perl)))
294 (home-page "https://www.kernel.org/pub/linux/utils/util-linux/")
35ec07c7 295 (synopsis "Collection of utilities for the Linux kernel")
02b80c3f
NK
296 (description
297 "util-linux is a random collection of utilities for the Linux kernel.")
fe8ccfcc 298
02b80c3f 299 ;; Note that util-linux doesn't use the same license for all the
fe8ccfcc 300 ;; code. GPLv2+ is the default license for a code without an
02b80c3f 301 ;; explicitly defined license.
fe8ccfcc
LC
302 (license (list gpl3+ gpl2+ gpl2 lgpl2.0+
303 bsd-4 public-domain))))
5d5c4278 304
e47e3eff
LC
305(define-public procps
306 (package
307 (name "procps")
308 (version "3.2.8")
309 (source (origin
310 (method url-fetch)
311 (uri (string-append "http://procps.sourceforge.net/procps-"
312 version ".tar.gz"))
313 (sha256
314 (base32
315 "0d8mki0q4yamnkk4533kx8mc0jd879573srxhg6r2fs3lkc6iv8i"))))
316 (build-system gnu-build-system)
317 (inputs `(("ncurses" ,ncurses)
318 ("patch/make-3.82" ,(search-patch "procps-make-3.82.patch"))))
319 (arguments
320 '(#:patches (list (assoc-ref %build-inputs "patch/make-3.82"))
321 #:phases (alist-replace
322 'configure
323 (lambda* (#:key outputs #:allow-other-keys)
324 ;; No `configure', just a single Makefile.
325 (let ((out (assoc-ref outputs "out")))
326 (substitute* "Makefile"
327 (("/usr/") "/")
328 (("--(owner|group) 0") "")
329 (("ldconfig") "true")
330 (("^LDFLAGS[[:blank:]]*:=(.*)$" _ value)
331 ;; Add libproc to the RPATH.
332 (string-append "LDFLAGS := -Wl,-rpath="
333 out "/lib" value))))
334 (setenv "CC" "gcc"))
335 (alist-replace
336 'install
337 (lambda* (#:key outputs #:allow-other-keys)
338 (let ((out (assoc-ref outputs "out")))
339 (and (zero?
340 (system* "make" "install"
341 (string-append "DESTDIR=" out)))
342
343 ;; Sanity check.
344 (zero?
345 (system* (string-append out "/bin/ps")
346 "--version")))))
347 %standard-phases))
348
349 ;; What did you expect? Tests?
350 #:tests? #f))
351 (home-page "http://procps.sourceforge.net/")
35ec07c7 352 (synopsis "Utilities that give information about processes")
e47e3eff
LC
353 (description
354 "procps is the package that has a bunch of small useful utilities
355that give information about processes using the Linux /proc file system.
356The package includes the programs ps, top, vmstat, w, kill, free,
357slabtop, and skill.")
358 (license gpl2)))
359
5d5c4278
NK
360(define-public usbutils
361 (package
362 (name "usbutils")
363 (version "006")
364 (source
365 (origin
366 (method url-fetch)
367 (uri (string-append "mirror://kernel.org/linux/utils/usb/usbutils/"
368 "usbutils-" version ".tar.xz"))
369 (sha256
370 (base32
371 "03pd57vv8c6x0hgjqcbrxnzi14h8hcghmapg89p8k5zpwpkvbdfr"))))
372 (build-system gnu-build-system)
373 (inputs
374 `(("libusb" ,libusb) ("pkg-config" ,pkg-config)))
375 (home-page "http://www.linux-usb.org/")
376 (synopsis
377 "Tools for working with USB devices, such as lsusb")
378 (description
379 "Tools for working with USB devices, such as lsusb.")
4050e5d6 380 (license gpl2+)))
0750452a
LC
381
382(define-public e2fsprogs
383 (package
384 (name "e2fsprogs")
385 (version "1.42.7")
386 (source (origin
387 (method url-fetch)
388 (uri (string-append "mirror://sourceforge/e2fsprogs/e2fsprogs-"
389 version ".tar.gz"))
390 (sha256
391 (base32
392 "0ibkkvp6kan0hn0d1anq4n2md70j5gcm7mwna515w82xwyr02rfw"))))
393 (build-system gnu-build-system)
394 (inputs `(("util-linux" ,util-linux)
395 ("pkg-config" ,pkg-config)))
396 (arguments
397 '(#:phases (alist-cons-before
398 'configure 'patch-shells
399 (lambda _
400 (substitute* "configure"
401 (("/bin/sh (.*)parse-types.sh" _ dir)
402 (string-append (which "sh") " " dir
403 "parse-types.sh")))
404 (substitute* (find-files "." "^Makefile.in$")
405 (("#!/bin/sh")
406 (string-append "#!" (which "sh")))))
407 %standard-phases)
408
409 ;; FIXME: Tests work by comparing the stdout/stderr of programs, that
410 ;; they fail because we get an extra line that says "Can't check if
411 ;; filesystem is mounted due to missing mtab file".
412 #:tests? #f))
413 (home-page "http://e2fsprogs.sourceforge.net/")
35ec07c7 414 (synopsis "Creating and checking ext2/ext3/ext4 file systems")
0750452a
LC
415 (description
416 "This package provides tools for manipulating ext2/ext3/ext4 file systems.")
417 (license (list gpl2 ; programs
418 lgpl2.0 ; libext2fs
419 x11)))) ; libuuid
d8482ad0
LC
420
421(define-public strace
422 (package
423 (name "strace")
424 (version "4.7")
425 (source (origin
426 (method url-fetch)
427 (uri (string-append "mirror://sourceforge/strace/strace-"
428 version ".tar.xz"))
429 (sha256
430 (base32
431 "158iwk0pl2mfw93m1843xb7a2zb8p6lh0qim07rca6f1ff4dk764"))))
432 (build-system gnu-build-system)
433 (inputs `(("perl" ,perl)))
434 (home-page "http://strace.sourceforge.net/")
435 (synopsis "System call tracer for Linux")
436 (description
437 "strace is a system call tracer, i.e. a debugging tool which prints out a
438trace of all the system calls made by a another process/program.")
439 (license bsd-3)))
ba04571a
LC
440
441(define-public alsa-lib
442 (package
443 (name "alsa-lib")
444 (version "1.0.27.1")
445 (source (origin
446 (method url-fetch)
447 (uri (string-append
448 "ftp://ftp.alsa-project.org/pub/lib/alsa-lib-"
449 version ".tar.bz2"))
450 (sha256
451 (base32
452 "0fx057746dj7rjdi0jnvx2m9b0y1lgdkh1hks87d8w32xyihf3k9"))))
453 (build-system gnu-build-system)
454 (home-page "http://www.alsa-project.org/")
455 (synopsis "The Advanced Linux Sound Architecture libraries")
456 (description
457 "The Advanced Linux Sound Architecture (ALSA) provides audio and
458MIDI functionality to the Linux-based operating system.")
459 (license lgpl2.1+)))
10afdf50
LC
460
461(define-public iptables
462 (package
463 (name "iptables")
464 (version "1.4.16.2")
465 (source (origin
466 (method url-fetch)
467 (uri (string-append
468 "http://www.netfilter.org/projects/iptables/files/iptables-"
469 version ".tar.bz2"))
470 (sha256
471 (base32
472 "0vkg5lzkn4l3i1sm6v3x96zzvnv9g7mi0qgj6279ld383mzcws24"))))
473 (build-system gnu-build-system)
474 (arguments '(#:tests? #f)) ; no test suite
475 (home-page "http://www.netfilter.org/projects/iptables/index.html")
476 (synopsis "Program to configure the Linux IP packet filtering rules")
477 (description
478 "iptables is the userspace command line program used to configure the
479Linux 2.4.x and later IPv4 packet filtering ruleset. It is targeted towards
480system administrators. Since Network Address Translation is also configured
481from the packet filter ruleset, iptables is used for this, too. The iptables
482package also includes ip6tables. ip6tables is used for configuring the IPv6
483packet filter.")
484 (license gpl2+)))
90a0048f
LC
485
486(define-public iproute
487 (package
488 (name "iproute2")
489 (version "3.8.0")
490 (source (origin
491 (method url-fetch)
492 (uri (string-append
493 "mirror://kernel.org/linux/utils/net/iproute2/iproute2-"
494 version ".tar.xz"))
495 (sha256
496 (base32
497 "0kqy30wz2krbg4y7750hjq5218hgy2vj9pm5qzkn1bqskxs4b4ap"))))
498 (build-system gnu-build-system)
499 (arguments
500 `(#:tests? #f ; no test suite
501 #:make-flags (let ((out (assoc-ref %outputs "out")))
502 (list "DESTDIR="
503 (string-append "LIBDIR=" out "/lib")
504 (string-append "SBINDIR=" out "/sbin")
505 (string-append "CONFDIR=" out "/etc")
506 (string-append "DOCDIR=" out "/share/doc/"
507 ,name "-" ,version)
508 (string-append "MANDIR=" out "/share/man")))
509 #:phases (alist-cons-before
510 'install 'pre-install
511 (lambda _
512 ;; Don't attempt to create /var/lib/arpd.
513 (substitute* "Makefile"
514 (("^.*ARPDDIR.*$") "")))
515 %standard-phases)))
516 (inputs
517 `(("iptables" ,iptables)
518 ("db4" ,bdb)
519 ("pkg-config" ,pkg-config)
520 ("flex" ,flex)
521 ("bison" ,bison)))
522 (home-page
523 "http://www.linuxfoundation.org/collaborate/workgroups/networking/iproute2")
524 (synopsis
525 "A collection of utilities for controlling TCP/IP networking and traffic control in Linux")
526 (description
527 "Iproute2 is a collection of utilities for controlling TCP/IP
528networking and traffic with the Linux kernel.
529
530Most network configuration manuals still refer to ifconfig and route as the
531primary network configuration tools, but ifconfig is known to behave
532inadequately in modern network environments. They should be deprecated, but
533most distros still include them. Most network configuration systems make use
534of ifconfig and thus provide a limited feature set. The /etc/net project aims
535to support most modern network technologies, as it doesn't use ifconfig and
536allows a system administrator to make use of all iproute2 features, including
537traffic control.
538
539iproute2 is usually shipped in a package called iproute or iproute2 and
540consists of several tools, of which the most important are ip and tc. ip
541controls IPv4 and IPv6 configuration and tc stands for traffic control. Both
542tools print detailed usage messages and are accompanied by a set of
543manpages.")
544 (license gpl2+)))