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