aboutsummaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
Diffstat (limited to 'gnu')
-rw-r--r--gnu/build/activation.scm60
-rw-r--r--gnu/build/file-systems.scm2
-rw-r--r--gnu/build/linux-boot.scm29
-rw-r--r--gnu/packages/algebra.scm43
-rw-r--r--gnu/packages/backup.scm4
-rw-r--r--gnu/packages/cdrom.scm2
-rw-r--r--gnu/packages/emacs.scm2
-rw-r--r--gnu/packages/guile.scm20
-rw-r--r--gnu/packages/image.scm69
-rw-r--r--gnu/packages/libcanberra.scm36
-rw-r--r--gnu/packages/linux.scm4
-rw-r--r--gnu/packages/maths.scm2
-rw-r--r--gnu/packages/ocaml.scm67
-rw-r--r--gnu/packages/ots.scm4
-rw-r--r--gnu/packages/patches/jbig2dec-ignore-testtest.patch14
-rw-r--r--gnu/packages/patches/mupdf-buildsystem-fix.patch69
-rw-r--r--gnu/packages/patches/valgrind-glibc.patch21
-rw-r--r--gnu/packages/pdf.scm67
-rw-r--r--gnu/packages/pulseaudio.scm9
-rw-r--r--gnu/packages/skribilo.scm16
-rw-r--r--gnu/packages/tcl.scm9
-rw-r--r--gnu/packages/valgrind.scm7
-rw-r--r--gnu/services.scm7
-rw-r--r--gnu/services/base.scm81
-rw-r--r--gnu/services/networking.scm50
-rw-r--r--gnu/system.scm76
-rw-r--r--gnu/system/file-systems.scm17
-rw-r--r--gnu/system/linux-initrd.scm27
-rw-r--r--gnu/system/shadow.scm4
-rw-r--r--gnu/system/vm.scm29
30 files changed, 707 insertions, 140 deletions
diff --git a/gnu/build/activation.scm b/gnu/build/activation.scm
index 16805b9bc6..f46ff62d13 100644
--- a/gnu/build/activation.scm
+++ b/gnu/build/activation.scm
@@ -88,6 +88,33 @@ properties. Return #t on success."
,name)))
(zero? (apply system* "useradd" args)))))
+(define* (modify-user name group
+ #:key uid comment home shell password system?
+ (supplementary-groups '())
+ (log-port (current-error-port)))
+ "Modify user account NAME to have all the given settings."
+ ;; Use 'usermod' from the Shadow package.
+ (let ((args `(,@(if uid `("-u" ,(number->string uid)) '())
+ "-g" ,(if (number? group) (number->string group) group)
+ ,@(if (pair? supplementary-groups)
+ `("-G" ,(string-join supplementary-groups ","))
+ '())
+ ,@(if comment `("-c" ,comment) '())
+ ;; Don't use '--move-home', so ignore HOME.
+ ,@(if shell `("-s" ,shell) '())
+ ,name)))
+ (zero? (apply system* "usermod" args))))
+
+(define* (ensure-user name group
+ #:key uid comment home shell password system?
+ (supplementary-groups '())
+ (log-port (current-error-port))
+ #:rest rest)
+ "Make sure user NAME exists and has the relevant settings."
+ (if (false-if-exception (getpwnam name))
+ (apply modify-user name group rest)
+ (apply add-user name group rest)))
+
(define (activate-users+groups users groups)
"Make sure the accounts listed in USERS and the user groups listed in GROUPS
are all available.
@@ -101,23 +128,22 @@ numeric gid or #f."
(define activate-user
(match-lambda
((name uid group supplementary-groups comment home shell password system?)
- (unless (false-if-exception (getpwnam name))
- (let ((profile-dir (string-append "/var/guix/profiles/per-user/"
- name)))
- (add-user name group
- #:uid uid
- #:system? system?
- #:supplementary-groups supplementary-groups
- #:comment comment
- #:home home
- #:shell shell
- #:password password)
-
- (unless system?
- ;; Create the profile directory for the new account.
- (let ((pw (getpwnam name)))
- (mkdir-p profile-dir)
- (chown profile-dir (passwd:uid pw) (passwd:gid pw)))))))))
+ (let ((profile-dir (string-append "/var/guix/profiles/per-user/"
+ name)))
+ (ensure-user name group
+ #:uid uid
+ #:system? system?
+ #:supplementary-groups supplementary-groups
+ #:comment comment
+ #:home home
+ #:shell shell
+ #:password password)
+
+ (unless system?
+ ;; Create the profile directory for the new account.
+ (let ((pw (getpwnam name)))
+ (mkdir-p profile-dir)
+ (chown profile-dir (passwd:uid pw) (passwd:gid pw))))))))
;; 'groupadd' aborts if the file doesn't already exist.
(touch "/etc/group")
diff --git a/gnu/build/file-systems.scm b/gnu/build/file-systems.scm
index 5c04771e19..4ac7a7f8c6 100644
--- a/gnu/build/file-systems.scm
+++ b/gnu/build/file-systems.scm
@@ -233,7 +233,7 @@ the following:
(define fsck
(string-append "fsck." type))
- (let ((status (system* fsck "-v" "-p" device)))
+ (let ((status (system* fsck "-v" "-p" "-C" "0" device)))
(match (status:exit-val status)
(0
#t)
diff --git a/gnu/build/linux-boot.scm b/gnu/build/linux-boot.scm
index fbc683c798..a58232c815 100644
--- a/gnu/build/linux-boot.scm
+++ b/gnu/build/linux-boot.scm
@@ -339,24 +339,21 @@ bailing out.~%root contents: ~s~%" (scandir "/"))
(define* (boot-system #:key
(linux-modules '())
qemu-guest-networking?
- guile-modules-in-chroot?
volatile-root?
+ pre-mount
(mounts '()))
"This procedure is meant to be called from an initrd. Boot a system by
first loading LINUX-MODULES (a list of absolute file names of '.ko' files),
then setting up QEMU guest networking if QEMU-GUEST-NETWORKING? is true,
-mounting the file systems specified in MOUNTS, and finally booting into the
-new root if any. The initrd supports kernel command-line options '--load',
-'--root', and '--repl'.
+calling PRE-MOUNT, mounting the file systems specified in MOUNTS, and finally
+booting into the new root if any. The initrd supports kernel command-line
+options '--load', '--root', and '--repl'.
Mount the root file system, specified by the '--root' command-line argument,
if any.
MOUNTS must be a list suitable for 'mount-file-system'.
-When GUILE-MODULES-IN-CHROOT? is true, make core Guile modules available in
-the new root.
-
When VOLATILE-ROOT? is true, the root file system is writable but any changes
to it are lost."
(define root-mount-point?
@@ -407,23 +404,15 @@ to it are lost."
(mkdir "/root/dev")
(make-essential-device-nodes #:root "/root"))
+ (when (procedure? pre-mount)
+ ;; Do whatever actions are needed before mounting--e.g., installing
+ ;; device mappings.
+ (pre-mount))
+
;; Mount the specified file systems.
(for-each mount-file-system
(remove root-mount-point? mounts))
- (when guile-modules-in-chroot?
- ;; Copy the directories that contain .scm and .go files so that the
- ;; child process in the chroot can load modules (we would bind-mount
- ;; them but for some reason that fails with EINVAL -- XXX).
- (mkdir-p "/root/share")
- (mkdir-p "/root/lib")
- (mount "none" "/root/share" "tmpfs")
- (mount "none" "/root/lib" "tmpfs")
- (copy-recursively "/share" "/root/share"
- #:log (%make-void-port "w"))
- (copy-recursively "/lib" "/root/lib"
- #:log (%make-void-port "w")))
-
(if to-load
(begin
(switch-root "/root")
diff --git a/gnu/packages/algebra.scm b/gnu/packages/algebra.scm
index 7fc31abae7..53382eb67b 100644
--- a/gnu/packages/algebra.scm
+++ b/gnu/packages/algebra.scm
@@ -205,6 +205,49 @@ fast arithmetic.")
(license gpl2+)
(home-page "http://flintlib.org/")))
+(define-public arb
+ (package
+ (name "arb")
+ (version "2.2.0")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append
+ "https://github.com/fredrik-johansson/arb/archive/"
+ version ".tar.gz"))
+ (sha256 (base32
+ "0a8cgzznkmr59ngj4di9a37b5h4i00gbnixnxlwd34bcbflvjzyr"))))
+ (build-system gnu-build-system)
+ (inputs
+ `(("flint" ,flint)
+ ("gmp" ,gmp)
+ ("mpfr" ,mpfr)))
+ (arguments
+ `(#:phases
+ (alist-replace
+ 'configure
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let ((out (assoc-ref outputs "out"))
+ (flint (assoc-ref inputs "flint"))
+ (gmp (assoc-ref inputs "gmp"))
+ (mpfr (assoc-ref inputs "mpfr")))
+ ;; do not pass "--enable-fast-install", which makes the
+ ;; homebrew configure process fail
+ (zero? (system*
+ "./configure"
+ (string-append "--prefix=" out)
+ (string-append "--with-flint=" flint)
+ (string-append "--with-gmp=" gmp)
+ (string-append "--with-mpfr=" mpfr)))))
+ %standard-phases)))
+ (synopsis "Arbitrary precision floating-point ball arithmetic")
+ (description
+ "Arb is a C library for arbitrary-precision floating-point ball
+arithmetic. It supports efficient high-precision computation with
+polynomials, power series, matrices and special functions over the
+real and complex numbers, with automatic, rigorous error control.")
+ (license gpl2+)
+ (home-page "http://fredrikj.net/arb/")))
+
(define-public bc
(package
(name "bc")
diff --git a/gnu/packages/backup.scm b/gnu/packages/backup.scm
index 5c44786af3..d6e106071f 100644
--- a/gnu/packages/backup.scm
+++ b/gnu/packages/backup.scm
@@ -34,6 +34,7 @@
#:use-module (gnu packages nettle)
#:use-module (gnu packages pcre)
#:use-module (gnu packages python)
+ #:use-module (gnu packages linux)
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages rsync)
#:use-module (gnu packages ssh)
@@ -56,7 +57,8 @@
"0l14nrhbgkyjgvh339bbhnm6hrdwrjadphq1jmpi0mcgcdbdfh8x"))))
(build-system python-build-system)
(native-inputs
- `(("python2-setuptools" ,python2-setuptools)))
+ `(("python2-setuptools" ,python2-setuptools)
+ ("util-linux" ,util-linux))) ;setsid command, for the tests
(inputs
`(("python" ,python-2)
("librsync" ,librsync)
diff --git a/gnu/packages/cdrom.scm b/gnu/packages/cdrom.scm
index 518cfc3c2b..7c62e59626 100644
--- a/gnu/packages/cdrom.scm
+++ b/gnu/packages/cdrom.scm
@@ -163,7 +163,7 @@ files.")
(synopsis "audio CD reading utility which includes extra data verification features")
(description "Cdparanoia retrieves audio tracks from CDDA capable CDROM
drives. The data can be saved to a file or directed to standard output
-in WAV, AIFF, AIFF-C or raw format. Most ATAPI, SCSI and several
+in WAV, AIFF, AIFF-C or raw format. Most ATAPI, SCSI and several
proprietary CDROM drive makes are supported; cdparanoia can determine if the
target drive is CDDA capable. In addition to simple reading, cdparanoia adds
extra-robust data verification, synchronization, error handling and scratch
diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 1a37bef657..a788bd8fde 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -79,7 +79,7 @@
;; TODO: Add the optional dependencies.
("xlibs" ,libx11)
- ("gtk+" ,gtk+-2)
+ ("gtk+" ,gtk+)
("libXft" ,libxft)
("libtiff" ,libtiff)
("giflib" ,giflib)
diff --git a/gnu/packages/guile.scm b/gnu/packages/guile.scm
index 1169158113..e928c311e4 100644
--- a/gnu/packages/guile.scm
+++ b/gnu/packages/guile.scm
@@ -359,27 +359,25 @@ http:://json.org specification. These are the main features:
(define-public guile-charting
(package
(name "guile-charting")
- (version "0.1.1")
+ (version "0.2.0")
(source (origin
(method url-fetch)
(uri (string-append "http://wingolog.org/pub/guile-charting/"
"guile-charting-" version ".tar.gz"))
(sha256
(base32
- "1l8xcqq4cp67jzxnmf07ivsgq23mfmi00zz1s8bnv2zkb0ab9475"))
+ "0w5qiyv9v0ip5li22x762bm48g8xnw281w66iyw094zdw611pb2m"))
(modules '((guix build utils)))
(snippet
- ;; Remove dependency from guile-charting.texi to
- ;; guile-chartingscmfiles to avoid rebuild the doc (which is
- ;; unnecessary and fails with "failed to match any pattern in
- ;; form define-macro-with-docs" as of Guile 2.0.11.)
- '(substitute* "doc/Makefile.in"
- (("^(.+):(.*) \\$\\(doc\\)scmfiles(.*$)" _ target dep1 dep2)
- (string-append target ":" dep1 " " dep2 "\n"))))))
+ '(begin
+ ;; Use the standard location for modules.
+ (substitute* "Makefile.in"
+ (("godir = .*$")
+ "godir = $(moddir)\n"))))))
(build-system gnu-build-system)
(native-inputs `(("pkg-config" ,pkg-config)))
- (inputs `(("guile" ,guile-2.0)
- ("guile-cairo" ,guile-cairo)))
+ (inputs `(("guile" ,guile-2.0)))
+ (propagated-inputs `(("guile-cairo" ,guile-cairo)))
(home-page "http://wingolog.org/software/guile-charting/")
(synopsis "Create charts and graphs in Guile")
(description
diff --git a/gnu/packages/image.scm b/gnu/packages/image.scm
index 149720e5e8..a55a5456af 100644
--- a/gnu/packages/image.scm
+++ b/gnu/packages/image.scm
@@ -22,10 +22,12 @@
#:use-module (gnu packages fontutils)
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages xml)
+ #:use-module (gnu packages ghostscript) ;lcms
#:use-module ((guix licenses) #:renamer (symbol-prefix-proc 'license:))
#:use-module (guix packages)
#:use-module (guix download)
- #:use-module (guix build-system gnu))
+ #:use-module (guix build-system gnu)
+ #:use-module (guix build-system cmake))
(define-public libpng
(package
@@ -146,3 +148,68 @@ the W3C's XML-based Scaleable Vector Graphic (SVG) format.")
;; 'COPYING' is the GPLv2, but file headers say LGPLv2.0+.
(license license:lgpl2.0+)))
+
+(define-public jbig2dec
+ (package
+ (name "jbig2dec")
+ (version "0.11")
+ (source
+ (origin
+ (method url-fetch)
+ (uri ;; The link on the homepage is dead.
+ (string-append "http://distfiles.gentoo.org/distfiles/" name "-"
+ version ".tar.gz"))
+ (sha256
+ (base32 "1ffhgmf2fqzk0h4k736pp06z7q5y4x41fg844bd6a9vgncq86bby"))
+ (patches (list (search-patch "jbig2dec-ignore-testtest.patch")))))
+
+ (build-system gnu-build-system)
+ (synopsis "Decoder of the JBIG2 image compression format")
+ (description
+ "JBIG2 is designed for lossy or lossless encoding of 'bilevel'
+(1-bit monochrome) images at moderately high resolution, and in
+particular scanned paper documents. In this domain it is very
+efficient, offering compression ratios on the order of 100:1.
+
+This is a decoder only implementation, and currently is in the alpha
+stage, meaning it doesn't completely work yet. However, it is
+maintaining parity with available encoders, so it is useful for real
+work.")
+ (home-page "http://jbig2dec.sourceforge.net/")
+ (license license:gpl2+)))
+
+(define-public openjpeg
+ (package
+ (name "openjpeg")
+ (version "2.0.0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri
+ (string-append "http://openjpeg.googlecode.com/files/" name "-"
+ version ".tar.gz"))
+ (sha256
+ (base32 "1n05yrmscpgksrh2kfh12h18l0lw9j03mgmvwcg3hm8m0lwgak9k"))))
+
+ (build-system cmake-build-system)
+ (arguments
+ ;; Trying to run `$ make check' results in a no rule fault.
+ '(#:tests? #f))
+ (inputs
+ `(("lcms" ,lcms)
+ ("libpng" ,libpng)
+ ("libtiff" ,libtiff)
+ ("zlib" ,zlib)))
+ (synopsis "JPEG 2000 codec")
+ (description
+ "The OpenJPEG library is a JPEG 2000 codec written in C. It has
+been developed in order to promote the use of JPEG 2000, the new
+still-image compression standard from the Joint Photographic Experts
+Group (JPEG).
+
+In addition to the basic codec, various other features are under
+development, among them the JP2 and MJ2 (Motion JPEG 2000) file formats,
+an indexing tool useful for the JPIP protocol, JPWL-tools for
+error-resilience, a Java-viewer for j2k-images, ...")
+ (home-page "http://jbig2dec.sourceforge.net/")
+ (license license:bsd-2)))
diff --git a/gnu/packages/libcanberra.scm b/gnu/packages/libcanberra.scm
index 1106a8aa83..764c3272a2 100644
--- a/gnu/packages/libcanberra.scm
+++ b/gnu/packages/libcanberra.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
+;;; Copyright © 2014 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -24,7 +25,9 @@
#:use-module (gnu packages autotools)
#:use-module (gnu packages gstreamer)
#:use-module (gnu packages gtk)
+ #:use-module (gnu packages glib)
#:use-module (gnu packages linux)
+ #:use-module (gnu packages pulseaudio)
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages xiph))
@@ -35,19 +38,24 @@
(source
(origin
(method url-fetch)
- (uri (string-append "http://0pointer.de/lennart/projects/libcanberra/libcanberra-"
- version ".tar.xz"))
+
+ ;; This used to be at 0pointer.de but it vanished.
+ (uri (string-append
+ "http://pkgs.fedoraproject.org/repo/pkgs/libcanberra/libcanberra-"
+ version ".tar.xz/34cb7e4430afaf6f447c4ebdb9b42072/libcanberra-"
+ version ".tar.xz"))
(sha256
(base32
"0wps39h8rx2b00vyvkia5j40fkak3dpipp1kzilqla0cgvk73dn2"))))
(build-system gnu-build-system)
(inputs
- ;; FIXME: Add optional inputs udev and pulse.
`(("alsa-lib" ,alsa-lib)
("gstreamer" ,gstreamer)
("gtk+" ,gtk+)
("libtool" ,libtool)
- ("libvorbis" ,libvorbis)))
+ ("libvorbis" ,libvorbis)
+ ("pulseaudio" ,pulseaudio)
+ ("udev" ,eudev)))
(native-inputs
`(("pkg-config" ,pkg-config)))
(home-page "http://0pointer.de/lennart/projects/libcanberra/")
@@ -59,3 +67,23 @@ Specifications, for generating event sounds on free desktops, such as
GNOME. It comes with several backends (ALSA, PulseAudio, OSS, GStreamer,
null) and is designed to be portable.")
(license lgpl2.1+)))
+
+(define-public sound-theme-freedesktop
+ (package
+ (name "sound-theme-freedesktop")
+ (version "0.8")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "http://people.freedesktop.org/~mccann/dist/"
+ name "-" version ".tar.bz2"))
+ (sha256
+ (base32
+ "054abv4gmfk9maw93fis0bf605rc56dah7ys5plc4pphxqh8nlfb"))))
+ (build-system gnu-build-system)
+ (native-inputs `(("intltool" ,intltool)))
+ (synopsis "Audio samples for use as a desktop sound theme")
+ (description
+ "This package provides audio samples that can be used by libcanberra as
+sounds for various system events.")
+ (license #f)
+ (home-page "http://www.freedesktop.org/wiki/Specifications/sound-theme-spec/")))
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index dd4ed85a64..561275c05f 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -190,7 +190,7 @@ for SYSTEM, or #f if there is no configuration for SYSTEM."
#f)))
(define-public linux-libre
- (let* ((version "3.16.2")
+ (let* ((version "3.16.3")
(build-phase
'(lambda* (#:key system inputs #:allow-other-keys #:rest args)
;; Apply the neat patch.
@@ -263,7 +263,7 @@ for SYSTEM, or #f if there is no configuration for SYSTEM."
(uri (linux-libre-urls version))
(sha256
(base32
- "1p08cqy6427yi808fpbwbb4zbwhnkibj2i1wbrfa5rjhd4vnnffz"))))
+ "1480wnk1j18rxhp8hi7dd4d706lkgplwhvskx3z2mj39vg46v1zk"))))
(build-system gnu-build-system)
(native-inputs `(("perl" ,perl)
("bc" ,bc)
diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index 5f30afe433..af9feff040 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -273,7 +273,7 @@ plotting engine by third-party applications like Octave.")
%standard-phases)))
(outputs '("out" "bin" "lib" "include"))
(home-page "http://www.hdfgroup.org")
- (synopsis "Management suite for extremely large and complex data")
+ (synopsis "Management suite for extremely large and complex data")
(description "HDF5 is a suite that makes possible the management of
extremely large and complex data collections.")
(license (license:x11-style
diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index bcd4c196c5..b4e48ccc4c 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -23,7 +23,11 @@
#:use-module (guix download)
#:use-module (guix build-system gnu)
#:use-module (gnu packages)
- #:use-module (gnu packages perl))
+ #:use-module (gnu packages perl)
+ #:use-module (gnu packages python)
+ #:use-module (gnu packages ncurses)
+ #:use-module (gnu packages version-control)
+ #:use-module (gnu packages curl))
(define-public ocaml
(package
@@ -78,3 +82,64 @@ an emphasis on expressiveness and safety. Developed for more than 20 years at
Inria it benefits from one of the most advanced type systems and supports
functional, imperative and object-oriented styles of programming.")
(license (list qpl gpl2))))
+
+(define-public opam
+ (package
+ (name "opam")
+ (version "1.1.1")
+ (source (origin
+ (method url-fetch)
+ ;; Use the '-full' version, which includes all the dependencies.
+ (uri (string-append
+ "https://github.com/ocaml/opam/releases/download/"
+ version "/opam-full-" version ".tar.gz")
+ ;; (string-append "https://github.com/ocaml/opam/archive/"
+ ;; version ".tar.gz")
+ )
+ (sha256
+ (base32
+ "1frzqkx6yn1pnyd9qz3bv3rbwv74bmc1xji8kl41r1dkqzfl3xqv"))))
+ (build-system gnu-build-system)
+ (arguments
+ '(;; Sometimes, 'make -jX' would fail right after ./configure with
+ ;; "Fatal error: exception End_of_file".
+ #:parallel-build? #f
+
+ ;; For some reason, 'ocp-build' needs $TERM to be set.
+ #:make-flags '("TERM=screen")
+ #:test-target "tests"
+
+ ;; FIXME: There's an obscure test failure:
+ ;; …/_obuild/opam/opam.asm install P1' failed.
+ #:tests? #f
+
+ #:phases (alist-cons-before
+ 'build 'pre-build
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let ((bash (assoc-ref inputs "bash")))
+ (substitute* "src/core/opamSystem.ml"
+ (("\"/bin/sh\"")
+ (string-append "\"" bash "/bin/sh\"")))))
+ (alist-cons-before
+ 'check 'pre-check
+ (lambda _
+ (setenv "HOME" (getcwd))
+ (and (system "git config --global user.email guix@gnu.org")
+ (system "git config --global user.name Guix")))
+ %standard-phases))))
+ (native-inputs
+ `(("git" ,git) ;for the tests
+ ("python" ,python))) ;for the tests
+ (inputs
+ `(("ocaml" ,ocaml)
+ ("ncurses" ,ncurses)
+ ("curl" ,curl)))
+ (home-page "http://opam.ocamlpro.com/")
+ (synopsis "Package manager for OCaml")
+ (description
+ "OPAM is a tool to manage OCaml packages. It supports multiple
+simultaneous compiler installations, flexible package constraints, and a
+Git-friendly development workflow.")
+
+ ;; The 'LICENSE' file waives some requirements compared to LGPLv3.
+ (license lgpl3)))
diff --git a/gnu/packages/ots.scm b/gnu/packages/ots.scm
index cd2bf8585b..4404841375 100644
--- a/gnu/packages/ots.scm
+++ b/gnu/packages/ots.scm
@@ -45,6 +45,10 @@
(list (search-patch "ots-no-include-missing-file.patch")))))
(build-system gnu-build-system)
+ (arguments
+ ;; With '-jN', the rule to build the 'ots' command can be triggered
+ ;; before libots-1.la has been built.
+ '(#:parallel-build? #f))
(inputs
`(("glib" ,glib)
("popt" ,popt)
diff --git a/gnu/packages/patches/jbig2dec-ignore-testtest.patch b/gnu/packages/patches/jbig2dec-ignore-testtest.patch
new file mode 100644
index 0000000000..1bf8f7ad76
--- /dev/null
+++ b/gnu/packages/patches/jbig2dec-ignore-testtest.patch
@@ -0,0 +1,14 @@
+Do not run the "testtest script", it doesn't seem to do anything and reports
+failiute. TODO: Actually fix the test instead of ignoring it.
+
+--- a/Makefile.in 2010-02-02 20:13:56.000000000 +0100
++++ b/Makefile.in 2014-09-13 17:50:10.957816767 +0200
+@@ -181,7 +181,7 @@
+
+ MAINTAINERCLEANFILES = config_types.h.in
+
+-TESTS = test_sha1 test_jbig2dec.py test_huffman test_arith
++TESTS = test_sha1 test_huffman test_arith
+
+ test_sha1_SOURCES = sha1.c sha1.h
+ test_sha1_CFLAGS = -DTEST
diff --git a/gnu/packages/patches/mupdf-buildsystem-fix.patch b/gnu/packages/patches/mupdf-buildsystem-fix.patch
new file mode 100644
index 0000000000..0b17dda911
--- /dev/null
+++ b/gnu/packages/patches/mupdf-buildsystem-fix.patch
@@ -0,0 +1,69 @@
+Since openjpeg doesn't seem to ship with a .pc file, provide an alternative.
+
+--- a/ojp2_cppflags.sh 1970-01-01 01:00:00.000000000 +0100
++++ b/ojp2_cppflags.sh 2014-09-13 22:56:38.842418777 +0200
+@@ -0,0 +1,7 @@
++#!/bin/sh
++
++# Return the preprocessor flags to link against openjpeg.
++
++cpppath=$(echo ${NIX_STORE}/*-openjpeg-*/include/openjpeg-*)
++
++echo -I$cpppath
+
+--- a/ojp2_ldflags.sh 1970-01-01 01:00:00.000000000 +0100
++++ b/ojp2_ldflags.sh 2014-09-13 22:56:38.842418777 +0200
+@@ -0,0 +1,7 @@
++#!/bin/sh
++
++# Return the linker flags to link against openjpeg.
++
++ldpath=$(echo ${NIX_STORE}/*-openjpeg-*/lib)
++
++echo -L$ldpath -lopenjp2
+
+Make use of the above alternatives, compile with gcc.
+
+--- a/Makerules 2014-09-14 09:13:40.729149860 +0200
++++ b/Makerules 2014-09-14 09:17:06.425156595 +0200
+@@ -75,12 +75,14 @@
+
+ SYS_FREETYPE_CFLAGS = $(shell pkg-config --cflags freetype2)
+ SYS_FREETYPE_LIBS = $(shell pkg-config --libs freetype2)
+-SYS_OPENJPEG_CFLAGS = $(shell pkg-config --cflags libopenjp2)
+-SYS_OPENJPEG_LIBS = $(shell pkg-config --libs libopenjp2)
++SYS_OPENJPEG_CFLAGS = $(shell ./ojp2_cppflags.sh)
++SYS_OPENJPEG_LIBS = $(shell ./ojp2_ldflags.sh)
+ SYS_JBIG2DEC_LIBS = -ljbig2dec
+ SYS_JPEG_LIBS = -ljpeg
+ SYS_ZLIB_LIBS = -lz
+
++CC = gcc
++
+ endif
+
+ # The following section is an example of how to simply do cross-compilation
+
+Remove the -x11 from the built binaries, since X11 is implied on GNU. (This
+might change when Wayland gets more popular)
+
+--- a/Makefile 2014-06-10 17:09:28.000000000 +0200
++++ b/Makefile 2014-09-14 09:57:10.381235299 +0200
+@@ -255,7 +255,7 @@
+ $(LINK_CMD)
+
+ ifeq "$(HAVE_X11)" "yes"
+-MUVIEW_X11 := $(OUT)/mupdf-x11
++MUVIEW_X11 := $(OUT)/mupdf
+ MUVIEW_X11_OBJ := $(addprefix $(OUT)/platform/x11/, x11_main.o x11_image.o pdfapp.o)
+ $(MUVIEW_X11_OBJ) : $(FITZ_HDR) $(PDF_HDR)
+ $(MUVIEW_X11) : $(MUPDF_LIB) $(THIRD_LIBS)
+@@ -263,7 +263,7 @@
+ $(LINK_CMD) $(X11_LIBS)
+
+ ifeq "$(HAVE_CURL)" "yes"
+-MUVIEW_X11_CURL := $(OUT)/mupdf-x11-curl
++MUVIEW_X11_CURL := $(OUT)/mupdf-curl
+ MUVIEW_X11_CURL_OBJ := $(addprefix $(OUT)/platform/x11/curl/, x11_main.o x11_image.o pdfapp.o curl_stream.o)
+ $(MUVIEW_X11_CURL_OBJ) : $(FITZ_HDR) $(PDF_HDR)
+ $(MUVIEW_X11_CURL) : $(MUPDF_LIB) $(THIRD_LIBS) $(CURL_LIB)
diff --git a/gnu/packages/patches/valgrind-glibc.patch b/gnu/packages/patches/valgrind-glibc.patch
deleted file mode 100644
index 47a415bb8f..0000000000
--- a/gnu/packages/patches/valgrind-glibc.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-Accept glibc 2.19 as valid.
-
---- a/configure 2013-10-10 22:27:20.331223000 +0200
-+++ b/configure 2013-10-10 22:27:55.055223000 +0200
-@@ -6604,6 +6604,16 @@
- DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
- DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
- ;;
-+ 2.19)
-+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: 2.19 family" >&5
-+$as_echo "2.19 family" >&6; }
-+
-+$as_echo "#define GLIBC_2_18 1" >>confdefs.h
-+
-+ DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
-+ DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
-+ DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
-+ ;;
- darwin)
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: Darwin" >&5
- $as_echo "Darwin" >&6; }
diff --git a/gnu/packages/pdf.scm b/gnu/packages/pdf.scm
index 82331a1d0a..c3cb755f4d 100644
--- a/gnu/packages/pdf.scm
+++ b/gnu/packages/pdf.scm
@@ -35,6 +35,7 @@
#:use-module (gnu packages glib)
#:use-module (gnu packages gtk)
#:use-module (gnu packages lua)
+ #:use-module (gnu packages curl)
#:use-module (srfi srfi-1))
(define-public poppler
@@ -159,3 +160,69 @@ it easy to modify them and write the changes to disk. It is primarily useful
for applications that wish to do lower level manipulation of PDF, such as
extracting content or merging files.")
(license license:lgpl2.0+)))
+
+(define-public mupdf
+ (package
+ (name "mupdf")
+ (version "1.5")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (string-append "http://mupdf.com/downloads/" name "-" version
+ "-source.tar.gz"))
+ (sha256
+ (base32 "0sl47zqf4c9fhs4h5zg046vixjmwgy4vhljhr5g4md733nash7z4"))
+ (patches
+ (list (search-patch "mupdf-buildsystem-fix.patch")))
+ (modules '((guix build utils)))
+ (snippet
+ '(begin
+ ;; Don't build the bundled-in third party libraries.
+ (delete-file-recursively "thirdparty")
+
+ ;; Make the scripts for finding openjpeg build details executable.
+ (chmod "ojp2_cppflags.sh" #o0755)
+ (chmod "ojp2_ldflags.sh" #o0755)))))
+
+ (build-system gnu-build-system)
+ (inputs
+ `(("curl" ,curl)
+ ("freetype" ,freetype)
+ ("jbig2dec" ,jbig2dec)
+ ("libjpeg" ,libjpeg)
+ ("libx11" ,libx11)
+ ("libxext" ,libxext)
+ ("openjpeg" ,openjpeg)
+ ("openssl" ,openssl)
+ ("zlib" ,zlib)))
+ (native-inputs
+ `(("pkg-config" ,pkg-config)))
+ (arguments
+ ;; Trying to run `$ make check' results in a no rule fault.
+ '(#:tests? #f
+
+ #:modules ((guix build gnu-build-system)
+ (guix build utils)
+ (srfi srfi-1))
+ #:phases (alist-replace
+ 'build
+ (lambda _ (zero? (system* "make" "XCFLAGS=-fpic")))
+ (alist-replace
+ 'install
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let ((out (assoc-ref outputs "out")))
+ (zero? (system* "make" (string-append "prefix=" out)
+ "install"))))
+ (alist-delete 'configure %standard-phases)))))
+ (home-page "http://mupdf.com")
+ (synopsis "Lightweight PDF viewer and toolkit")
+ (description
+ "MuPDF is a C library that implements a PDF and XPS parsing and
+rendering engine. It is used primarily to render pages into bitmaps,
+but also provides support for other operations such as searching and
+listing the table of contents and hyperlinks.
+
+The library ships with a rudimentary X11 viewer, and a set of command
+line tools for batch rendering (pdfdraw), examining the file structure
+(pdfshow), and rewriting files (pdfclean).")
+ (license license:agpl3+)))
diff --git a/gnu/packages/pulseaudio.scm b/gnu/packages/pulseaudio.scm
index e37f7c07e3..b17ee6987f 100644
--- a/gnu/packages/pulseaudio.scm
+++ b/gnu/packages/pulseaudio.scm
@@ -121,7 +121,14 @@ rates. ")
version ".tar.xz"))
(sha256
(base32
- "0fgrr8v7yfh0byhzdv4c87v9lkj8g7gpjm8r9xrbvpa92a5kmhcr"))))
+ "0fgrr8v7yfh0byhzdv4c87v9lkj8g7gpjm8r9xrbvpa92a5kmhcr"))
+ (modules '((guix build utils)))
+ (snippet
+ ;; Disable console-kit support by default since it's deprecated
+ ;; anyway.
+ '(substitute* "src/daemon/default.pa.in"
+ (("load-module module-console-kit" all)
+ (string-append "#" all "\n"))))))
(build-system gnu-build-system)
(arguments
`(#:configure-flags '("--localstatedir=/var" ;"--sysconfdir=/etc"
diff --git a/gnu/packages/skribilo.scm b/gnu/packages/skribilo.scm
index e9c213cbb2..6971e792d0 100644
--- a/gnu/packages/skribilo.scm
+++ b/gnu/packages/skribilo.scm
@@ -43,6 +43,22 @@
'(#:configure-flags (list (string-append "--with-guilemoduledir="
(assoc-ref %outputs "out")
"/share/guile/site/2.0"))
+
+ #:phases (alist-cons-before
+ 'configure 'pre-configure
+ (lambda* (#:key inputs #:allow-other-keys)
+ ;; Make sure the 'skribilo' command gets to see
+ ;; Guile-Reader, even if Guile-Reader is not in the search
+ ;; path.
+ (let ((reader (assoc-ref inputs "guile-reader")))
+ (substitute* "src/skribilo.in"
+ (("^exec (.*) -c" _ things)
+ (string-append "exec " things
+ " -L " reader "/share/guile/site/2.0"
+ " -C " reader "/share/guile/site/2.0"
+ " -c")))))
+ %standard-phases)
+
#:parallel-build? #f))
;; TODO: Add Ploticus.
(inputs `(("guile" ,guile-2.0)
diff --git a/gnu/packages/tcl.scm b/gnu/packages/tcl.scm
index d7ac10cb16..099bad25f9 100644
--- a/gnu/packages/tcl.scm
+++ b/gnu/packages/tcl.scm
@@ -161,8 +161,8 @@ X11 GUIs.")
(home-page "http://www.tcl.tk/")
(synopsis "Graphical user interface toolkit for Tcl")
(description
- "Tk is a graphical toolkit for building graphical user interfaces
-(GUIs) in the Tcl language.")
+ "Tk is a graphical toolkit for building graphical user
+interfaces (GUIs) in the Tcl language.")
(license (package-license tcl))))
(define-public perl-tk
@@ -185,7 +185,10 @@ X11 GUIs.")
("libjpeg" ,libjpeg)))
(arguments
`(#:make-maker-flags `(,(string-append
- "X11=" (assoc-ref %build-inputs "libx11")))))
+ "X11=" (assoc-ref %build-inputs "libx11")))
+
+ ;; Fails to build in parallel: <http://bugs.gnu.org/18262>.
+ #:parallel-build? #f))
(synopsis "Graphical user interface toolkit for Perl")
(description
"Tk is a Graphical User Interface ToolKit.")
diff --git a/gnu/packages/valgrind.scm b/gnu/packages/valgrind.scm
index 183adb0271..82e3b80f7f 100644
--- a/gnu/packages/valgrind.scm
+++ b/gnu/packages/valgrind.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2013 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2013, 2014 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -28,15 +28,14 @@
(define-public valgrind
(package
(name "valgrind")
- (version "3.9.0")
+ (version "3.10.0")
(source (origin
(method url-fetch)
(uri (string-append "http://valgrind.org/downloads/valgrind-"
version ".tar.bz2"))
(sha256
(base32
- "1w6n5qvxy2ssbczcl1c2yd2ggjn3ipay2hvpn10laly2dfh73bz6"))
- (patches (list (search-patch "valgrind-glibc.patch")))))
+ "1jgd42vsx0bcblp91bd61hd5wpy0gghh09wxgm65m666vy17y103"))))
(build-system gnu-build-system)
(arguments
'(#:phases (alist-cons-after
diff --git a/gnu/services.scm b/gnu/services.scm
index 6bb21722b6..37ecc019ec 100644
--- a/gnu/services.scm
+++ b/gnu/services.scm
@@ -17,6 +17,7 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (gnu services)
+ #:use-module (guix gexp)
#:use-module (guix records)
#:export (service?
service
@@ -47,9 +48,9 @@
(default '()))
(respawn? service-respawn? ; Boolean
(default #t))
- (start service-start) ; g-expression
- (stop service-stop ; g-expression
- (default #f))
+ (start service-start) ; g-expression (procedure)
+ (stop service-stop ; g-expression (procedure)
+ (default #~(const #f)))
(user-accounts service-user-accounts ; list of <user-account>
(default '()))
(user-groups service-user-groups ; list of <user-groups>
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index c40bc1a4c2..57a79a7749 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -39,6 +39,7 @@
#:export (root-file-system-service
file-system-service
device-mapping-service
+ swap-service
user-processes-service
host-name-service
console-font-service
@@ -137,6 +138,10 @@ names such as device-mapping services."
(stop #~(lambda args
;; Normally there are no processes left at this point, so
;; TARGET can be safely unmounted.
+
+ ;; Make sure PID 1 doesn't keep TARGET busy.
+ (chdir "/")
+
(umount #$target)
#f))))))
@@ -182,6 +187,8 @@ stopped before 'kill' is called."
(@ (ice-9 rdelim) read-string))))
'()))
+ (define lset= (@ (srfi srfi-1) lset=))
+
;; When this happens, all the processes have been
;; killed, including 'deco', so DMD-OUTPUT-PORT and
;; thus CURRENT-OUTPUT-PORT are dangling.
@@ -206,6 +213,15 @@ stopped before 'kill' is called."
(kill-except omitted-pids SIGKILL)
(delete-file #$%do-not-kill-file)))
+ (let wait ()
+ (let ((pids (processes)))
+ (unless (lset= = pids (cons 1 omitted-pids))
+ (format #t "waiting for process termination\
+ (processes left: ~s)~%"
+ pids)
+ (sleep 2)
+ (wait))))
+
(display "all processes have been terminated\n")
#f))
(respawn? #f)))))
@@ -402,7 +418,7 @@ starting at FIRST-UID, and under GID."
;; guix-daemon expects GROUP to be listed as a
;; supplementary group too:
;; <http://lists.gnu.org/archive/html/bug-guix/2013-01/msg00239.html>.
- (supplementary-groups (list group))
+ (supplementary-groups (list group "kvm"))
(comment (format #f "Guix Build User ~2d" n))
(home-directory "/var/empty")
@@ -510,10 +526,31 @@ item of @var{packages}."
(guix build utils))
#:local-build? #t))
+(define* (kvm-udev-rule)
+ "Return a directory with a udev rule that changes the group of
+@file{/dev/kvm} to \"kvm\" and makes it #o660."
+ ;; Apparently QEMU-KVM used to ship this rule, but now we have to add it by
+ ;; ourselves.
+ (gexp->derivation "kvm-udev-rules"
+ #~(begin
+ (use-modules (guix build utils))
+
+ (define rules.d
+ (string-append #$output "/lib/udev/rules.d"))
+
+ (mkdir-p rules.d)
+ (call-with-output-file
+ (string-append rules.d "/90-kvm.rules")
+ (lambda (port)
+ (display "\
+KERNEL==\"kvm\", GROUP=\"kvm\", MODE=\"0660\"\n" port))))
+ #:modules '((guix build utils))))
+
(define* (udev-service #:key (udev eudev) (rules '()))
"Run @var{udev}, which populates the @file{/dev} directory dynamically. Get
extra rules from the packages listed in @var{rules}."
- (mlet* %store-monad ((rules (udev-rules-union (cons udev rules)))
+ (mlet* %store-monad ((kvm (kvm-udev-rule))
+ (rules (udev-rules-union (cons* udev kvm rules)))
(udev.conf (text-file* "udev.conf"
"udev_rules=\"" rules
"/lib/udev/rules.d\"\n")))
@@ -558,7 +595,8 @@ extra rules from the packages listed in @var{rules}."
;; The first one is for udev, the second one for eudev.
(setenv "UDEV_CONFIG_FILE" #$udev.conf)
- (setenv "EUDEV_RULES_DIRECTORY" #$rules)
+ (setenv "EUDEV_RULES_DIRECTORY"
+ (string-append #$rules "/lib/udev/rules.d"))
(let ((pid (primitive-fork)))
(case pid
@@ -578,21 +616,46 @@ extra rules from the packages listed in @var{rules}."
(system* (string-append #$udev "/bin/udevadm")
"settle")
pid)))))
- (stop #~(make-kill-destructor))))))
+ (stop #~(make-kill-destructor))
+
+ ;; When halting the system, 'udev' is actually killed by
+ ;; 'user-processes', i.e., before its own 'stop' method was
+ ;; called. Thus, make sure it is not respawned.
+ (respawn? #f)))))
-(define (device-mapping-service target command)
+(define (device-mapping-service target open close)
"Return a service that maps device @var{target}, a string such as
-@code{\"home\"} (meaning @code{/dev/mapper/home}), by executing @var{command},
-a gexp."
+@code{\"home\"} (meaning @code{/dev/mapper/home}). Evaluate @var{open}, a
+gexp, to open it, and evaluate @var{close} to close it."
(with-monad %store-monad
(return (service
(provision (list (symbol-append 'device-mapping-
(string->symbol target))))
(requirement '(udev))
(documentation "Map a device node using Linux's device mapper.")
+ (start #~(lambda () #$open))
+ (stop #~(lambda _ (not #$close)))
+ (respawn? #f)))))
+
+(define (swap-service device)
+ "Return a service that uses @var{device} as a swap device."
+ (define requirement
+ (if (string-prefix? "/dev/mapper/" device)
+ (list (symbol-append 'device-mapping-
+ (string->symbol (basename device))))
+ '()))
+
+ (with-monad %store-monad
+ (return (service
+ (provision (list (symbol-append 'swap- (string->symbol device))))
+ (requirement `(udev ,@requirement))
+ (documentation "Enable the given swap device.")
(start #~(lambda ()
- #$command))
- (stop #~(const #f))
+ (swapon #$device)
+ #t))
+ (stop #~(lambda _
+ (swapoff #$device)
+ #f))
(respawn? #f)))))
(define %base-services
diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm
index 6a7d194659..d532fc8d99 100644
--- a/gnu/services/networking.scm
+++ b/gnu/services/networking.scm
@@ -25,6 +25,7 @@
#:use-module (guix gexp)
#:use-module (guix monads)
#:export (static-networking-service
+ dhcp-client-service
tor-service))
;;; Commentary:
@@ -50,9 +51,15 @@ gateway."
(with-monad %store-monad
(return
(service
+
+ ;; Unless we're providing the loopback interface, wait for udev to be up
+ ;; and running so that INTERFACE is actually usable.
+ (requirement (if (memq 'loopback provision)
+ '()
+ '(udev)))
+
(documentation
- (string-append "Set up networking on the '" interface
- "' interface using a static IP address."))
+ "Bring up the networking interface using a static IP address.")
(provision provision)
(start #~(lambda _
;; Return #t if successfully started.
@@ -88,6 +95,45 @@ gateway."
#t)))))
(respawn? #f)))))
+(define* (dhcp-client-service #:key (dhcp isc-dhcp))
+ "Return a service that runs @var{dhcp}, a Dynamic Host Configuration
+Protocol (DHCP) client, on all the non-loopback network interfaces."
+
+ (define dhclient
+ #~(string-append #$dhcp "/sbin/dhclient"))
+
+ (define pid-file
+ "/var/run/dhclient.pid")
+
+ (with-monad %store-monad
+ (return (service
+ (documentation "Set up networking via DHCP.")
+ (requirement '(user-processes udev))
+
+ ;; XXX: Running with '-nw' ("no wait") avoids blocking for a
+ ;; minute when networking is unavailable, but also means that the
+ ;; interface is not up yet when 'start' completes. To wait for
+ ;; the interface to be ready, one should instead monitor udev
+ ;; events.
+ (provision '(networking))
+
+ (start #~(lambda _
+ ;; When invoked without any arguments, 'dhclient'
+ ;; discovers all non-loopback interfaces *that are
+ ;; up*. However, the relevant interfaces are
+ ;; typically down at this point. Thus we perform our
+ ;; own interface discovery here.
+ (let* ((valid? (negate loopback-network-interface?))
+ (ifaces (filter valid?
+ (all-network-interfaces)))
+ (pid (fork+exec-command
+ (cons* #$dhclient "-nw"
+ "-pf" #$pid-file
+ ifaces))))
+ (and (zero? (cdr (waitpid pid)))
+ (call-with-input-file #$pid-file read)))))
+ (stop #~(make-kill-destructor))))))
+
(define* (tor-service #:key (tor tor))
"Return a service to run the @uref{https://torproject.org,Tor} daemon.
diff --git a/gnu/system.scm b/gnu/system.scm
index db7b7e7a2f..d15c864384 100644
--- a/gnu/system.scm
+++ b/gnu/system.scm
@@ -105,6 +105,8 @@
(mapped-devices operating-system-mapped-devices ; list of <mapped-device>
(default '()))
(file-systems operating-system-file-systems) ; list of fs
+ (swap-devices operating-system-swap-devices ; list of strings
+ (default '()))
(users operating-system-users ; list of user accounts
(default '()))
@@ -160,13 +162,24 @@ file."
;;; Services.
;;;
-(define (luks-device-mapping source target)
+(define (open-luks-device source target)
"Return a gexp that maps SOURCE to TARGET as a LUKS device, using
'cryptsetup'."
#~(zero? (system* (string-append #$cryptsetup "/sbin/cryptsetup")
"open" "--type" "luks"
#$source #$target)))
+(define (close-luks-device source target)
+ "Return a gexp that closes TARGET, a LUKS device."
+ #~(zero? (system* (string-append #$cryptsetup "/sbin/cryptsetup")
+ "close" #$target)))
+
+(define luks-device-mapping
+ ;; The type of LUKS mapped devices.
+ (mapped-device-kind
+ (open open-luks-device)
+ (close close-luks-device)))
+
(define (other-file-system-services os)
"Return file system services for the file systems of OS that are not marked
as 'needed-for-boot'."
@@ -203,16 +216,52 @@ as 'needed-for-boot'."
#:flags flags))))
file-systems)))
+(define (mapped-device-user device file-systems)
+ "Return a file system among FILE-SYSTEMS that uses DEVICE, or #f."
+ (let ((target (string-append "/dev/mapper/" (mapped-device-target device))))
+ (find (lambda (fs)
+ (string=? (file-system-device fs) target))
+ file-systems)))
+
+(define (operating-system-user-mapped-devices os)
+ "Return the subset of mapped devices that can be installed in
+user-land--i.e., those not needed during boot."
+ (let ((devices (operating-system-mapped-devices os))
+ (file-systems (operating-system-file-systems os)))
+ (filter (lambda (md)
+ (let ((user (mapped-device-user md file-systems)))
+ (or (not user)
+ (not (file-system-needed-for-boot? user)))))
+ devices)))
+
+(define (operating-system-boot-mapped-devices os)
+ "Return the subset of mapped devices that must be installed during boot,
+from the initrd."
+ (let ((devices (operating-system-mapped-devices os))
+ (file-systems (operating-system-file-systems os)))
+ (filter (lambda (md)
+ (let ((user (mapped-device-user md file-systems)))
+ (and user (file-system-needed-for-boot? user))))
+ devices)))
+
(define (device-mapping-services os)
"Return the list of device-mapping services for OS as a monadic list."
(sequence %store-monad
(map (lambda (md)
- (let ((source (mapped-device-source md))
- (target (mapped-device-target md))
- (command (mapped-device-command md)))
+ (let* ((source (mapped-device-source md))
+ (target (mapped-device-target md))
+ (type (mapped-device-type md))
+ (open (mapped-device-kind-open type))
+ (close (mapped-device-kind-close type)))
(device-mapping-service target
- (command source target))))
- (operating-system-mapped-devices os))))
+ (open source target)
+ (close source target))))
+ (operating-system-user-mapped-devices os))))
+
+(define (swap-services os)
+ "Return the list of swap services for OS as a monadic list."
+ (sequence %store-monad
+ (map swap-service (operating-system-swap-devices os))))
(define (essential-services os)
"Return the list of essential services for OS. These are special services
@@ -221,13 +270,14 @@ bookkeeping."
(mlet* %store-monad ((mappings (device-mapping-services os))
(root-fs (root-file-system-service))
(other-fs (other-file-system-services os))
+ (swaps (swap-services os))
(procs (user-processes-service
(map (compose first service-provision)
other-fs)))
(host-name (host-name-service
(operating-system-host-name os))))
(return (cons* host-name procs root-fs
- (append other-fs mappings)))))
+ (append other-fs mappings swaps)))))
(define (operating-system-services os)
"Return all the services of OS, including \"internal\" services that do not
@@ -539,10 +589,14 @@ we're running in the final root."
boot?))
(operating-system-file-systems os)))
- ;; TODO: Pass the mapped devices required by boot-time file systems to the
- ;; initrd.
- (mlet %store-monad
- ((initrd ((operating-system-initrd os) boot-file-systems)))
+ (define mapped-devices
+ (operating-system-boot-mapped-devices os))
+
+ (define make-initrd
+ (operating-system-initrd os))
+
+ (mlet %store-monad ((initrd (make-initrd boot-file-systems
+ #:mapped-devices mapped-devices)))
(return #~(string-append #$initrd "/initrd"))))
(define (kernel->grub-label kernel)
diff --git a/gnu/system/file-systems.scm b/gnu/system/file-systems.scm
index 90e2b0c796..ed9d70587f 100644
--- a/gnu/system/file-systems.scm
+++ b/gnu/system/file-systems.scm
@@ -17,6 +17,7 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (gnu system file-systems)
+ #:use-module (guix gexp)
#:use-module (guix records)
#:export (<file-system>
file-system
@@ -43,7 +44,12 @@
mapped-device?
mapped-device-source
mapped-device-target
- mapped-device-command))
+ mapped-device-type
+
+ mapped-device-kind
+ mapped-device-kind?
+ mapped-device-kind-open
+ mapped-device-kind-close))
;;; Commentary:
;;;
@@ -145,6 +151,13 @@
mapped-device?
(source mapped-device-source) ;string
(target mapped-device-target) ;string
- (command mapped-device-command)) ;source target -> gexp
+ (type mapped-device-type)) ;<mapped-device-kind>
+
+(define-record-type* <mapped-device-type> mapped-device-kind
+ make-mapped-device-kind
+ mapped-device-kind?
+ (open mapped-device-kind-open) ;source target -> gexp
+ (close mapped-device-kind-close ;source target -> gexp
+ (default (const #~(const #f)))))
;;; file-systems.scm ends here
diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm
index 93f751b757..d1b1216f9d 100644
--- a/gnu/system/linux-initrd.scm
+++ b/gnu/system/linux-initrd.scm
@@ -126,15 +126,16 @@ initrd code."
(define* (base-initrd file-systems
#:key
+ (mapped-devices '())
qemu-networking?
virtio?
volatile-root?
- (extra-modules '())
- guile-modules-in-chroot?)
- ;; TODO: Support boot-time device mappings.
+ (extra-modules '()))
"Return a monadic derivation that builds a generic initrd. FILE-SYSTEMS is
a list of file-systems to be mounted by the initrd, possibly in addition to
the root file system specified on the kernel command line via '--root'.
+MAPPED-DEVICES is a list of device mappings to realize before FILE-SYSTEMS are
+mounted.
When QEMU-NETWORKING? is true, set up networking with the standard QEMU
parameters. When VIRTIO? is true, load additional modules so the initrd can
@@ -146,12 +147,7 @@ to it are lost.
The initrd is automatically populated with all the kernel modules necessary
for FILE-SYSTEMS and for the given options. However, additional kernel
modules can be listed in EXTRA-MODULES. They will be added to the initrd, and
-loaded at boot time in the order in which they appear.
-
-When GUILE-MODULES-IN-CHROOT? is true, make core Guile modules available in
-the new root. This is necessary is the file specified as '--load' needs
-access to these modules (which is the case if it wants to even just print an
-exception and backtrace!)."
+loaded at boot time in the order in which they appear."
(define virtio-modules
;; Modules for Linux para-virtualized devices, for use in QEMU guests.
'("virtio.ko" "virtio_ring.ko" "virtio_pci.ko"
@@ -197,6 +193,16 @@ exception and backtrace!)."
(list unionfs-fuse/static)
'())))
+ (define device-mapping-commands
+ ;; List of gexps to open the mapped devices.
+ (map (lambda (md)
+ (let* ((source (mapped-device-source md))
+ (target (mapped-device-target md))
+ (type (mapped-device-type md))
+ (open (mapped-device-kind-open type)))
+ (open source target)))
+ mapped-devices))
+
(mlet %store-monad ((kodir (flat-linux-module-directory linux-libre
linux-modules)))
(expression->initrd
@@ -211,11 +217,12 @@ exception and backtrace!)."
'#$helper-packages)))
(boot-system #:mounts '#$(map file-system->spec file-systems)
+ #:pre-mount (lambda ()
+ (and #$@device-mapping-commands))
#:linux-modules (map (lambda (file)
(string-append #$kodir "/" file))
'#$linux-modules)
#:qemu-guest-networking? #$qemu-networking?
- #:guile-modules-in-chroot? '#$guile-modules-in-chroot?
#:volatile-root? '#$volatile-root?))
#:name "base-initrd"
#:modules '((guix build utils)
diff --git a/gnu/system/shadow.scm b/gnu/system/shadow.scm
index 5d638398d1..6970021e1f 100644
--- a/gnu/system/shadow.scm
+++ b/gnu/system/shadow.scm
@@ -95,6 +95,7 @@
(system-group (name "tty") (id %tty-gid))
(system-group (name "dialout"))
(system-group (name "kmem"))
+ (system-group (name "input")) ; input devices, from udev
(system-group (name "video"))
(system-group (name "audio"))
(system-group (name "netdev")) ; used in avahi-dbus.conf
@@ -102,7 +103,8 @@
(system-group (name "disk"))
(system-group (name "floppy"))
(system-group (name "cdrom"))
- (system-group (name "tape")))))
+ (system-group (name "tape"))
+ (system-group (name "kvm"))))) ; for /dev/kvm
(define (default-skeletons)
"Return the default skeleton files for /etc/skel. These files are copied by
diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm
index 4ee8dc5cf2..799ab51d41 100644
--- a/gnu/system/vm.scm
+++ b/gnu/system/vm.scm
@@ -159,8 +159,7 @@ made available under the /xchg CIFS share."
(return initrd)
(base-initrd %linux-vm-file-systems
#:virtio? #t
- #:qemu-networking? #t
- #:guile-modules-in-chroot? #t))))
+ #:qemu-networking? #t))))
(define builder
;; Code that launches the VM that evaluates EXP.
@@ -290,9 +289,11 @@ to USB sticks meant to be read-only."
;; Since this is meant to be used on real hardware, don't
;; install QEMU networking or anything like that, but make sure
;; USB mass storage devices are available.
- (initrd (cut base-initrd <>
- #:volatile-root? #t
- #:extra-modules '("usb-storage.ko")))
+ (initrd (lambda (file-systems . rest)
+ (apply base-initrd file-systems
+ #:volatile-root? #t
+ #:extra-modules '("usb-storage.ko")
+ rest)))
;; Force our own root file system.
(file-systems (cons (file-system
@@ -334,9 +335,11 @@ of the GNU system as described by OS."
(let ((os (operating-system (inherit os)
;; Use an initrd with the whole QEMU shebang.
- (initrd (cut base-initrd <>
- #:virtio? #t
- #:qemu-networking? #t))
+ (initrd (lambda (file-systems . rest)
+ (apply base-initrd file-systems
+ #:virtio? #t
+ #:qemu-networking? #t
+ rest)))
;; Force our own root file system.
(file-systems (cons (file-system
@@ -359,10 +362,12 @@ of the GNU system as described by OS."
"Return an operating system based on OS suitable for use in a virtualized
environment with the store shared with the host."
(operating-system (inherit os)
- (initrd (cut base-initrd <>
- #:volatile-root? #t
- #:virtio? #t
- #:qemu-networking? #t))
+ (initrd (lambda (file-systems . rest)
+ (apply base-initrd file-systems
+ #:volatile-root? #t
+ #:virtio? #t
+ #:qemu-networking? #t
+ rest)))
(file-systems (cons* (file-system
(mount-point "/")
(device "/dev/vda1")