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