aboutsummaryrefslogtreecommitdiff
path: root/gnu/system
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/system')
-rw-r--r--gnu/system/examples/bare-bones.tmpl (renamed from gnu/system/os-config.tmpl)23
-rw-r--r--gnu/system/examples/desktop.tmpl43
-rw-r--r--gnu/system/file-systems.scm18
-rw-r--r--gnu/system/grub.scm3
-rw-r--r--gnu/system/install.scm79
-rw-r--r--gnu/system/linux-initrd.scm18
-rw-r--r--gnu/system/nss.scm23
-rw-r--r--gnu/system/vm.scm1
8 files changed, 177 insertions, 31 deletions
diff --git a/gnu/system/os-config.tmpl b/gnu/system/examples/bare-bones.tmpl
index e14c95733a..8f4faca2d3 100644
--- a/gnu/system/os-config.tmpl
+++ b/gnu/system/examples/bare-bones.tmpl
@@ -1,12 +1,13 @@
-;; This is an operating system configuration template.
+;; This is an operating system configuration template
+;; for a "bare bones" setup, with no X11 display server.
(use-modules (gnu))
-(use-service-modules xorg networking dbus avahi)
-(use-package-modules xorg avahi)
+(use-service-modules networking ssh)
+(use-package-modules admin)
(operating-system
- (host-name "antelope")
- (timezone "Europe/Paris")
+ (host-name "komputilo")
+ (timezone "Europe/Berlin")
(locale "en_US.UTF-8")
;; Assuming /dev/sdX is the target hard disk, and "root" is
@@ -36,12 +37,10 @@
(home-directory "/home/alice"))))
;; Globally-installed packages.
- (packages (cons xterm %base-packages))
+ (packages (cons tcpdump %base-packages))
- ;; Add services to the baseline: the SLiM log-in manager
- ;; for Xorg sessions, a DHCP client, Avahi, and D-Bus.
- (services (cons* (slim-service)
- (dhcp-client-service)
- (avahi-service)
- (dbus-service (list avahi))
+ ;; Add services to the baseline: a DHCP client and
+ ;; an SSH server.
+ (services (cons* (dhcp-client-service)
+ (lsh-service #:port-number 2222)
%base-services)))
diff --git a/gnu/system/examples/desktop.tmpl b/gnu/system/examples/desktop.tmpl
new file mode 100644
index 0000000000..c78188eb61
--- /dev/null
+++ b/gnu/system/examples/desktop.tmpl
@@ -0,0 +1,43 @@
+;; This is an operating system configuration template
+;; for a "desktop" setup with X11.
+
+(use-modules (gnu) (gnu system nss))
+(use-service-modules desktop)
+(use-package-modules xfce ratpoison wicd avahi xorg certs)
+
+(operating-system
+ (host-name "antelope")
+ (timezone "Europe/Paris")
+ (locale "en_US.UTF-8")
+
+ ;; Assuming /dev/sdX is the target hard disk, and "root" is
+ ;; the label of the target root file system.
+ (bootloader (grub-configuration (device "/dev/sdX")))
+ (file-systems (cons (file-system
+ (device "root")
+ (title 'label)
+ (mount-point "/")
+ (type "ext4"))
+ %base-file-systems))
+
+ (users (list (user-account
+ (name "bob")
+ (comment "Alice's brother")
+ (group "users")
+ (supplementary-groups '("wheel" "netdev"
+ "audio" "video"))
+ (home-directory "/home/bob"))))
+
+ ;; Add Xfce and Ratpoison; that allows us to choose
+ ;; sessions using either of these at the log-in screen.
+ (packages (cons* xfce ratpoison ;desktop environments
+ xterm wicd avahi ;useful tools
+ nss-certs ;for HTTPS access
+ %base-packages))
+
+ ;; Use the "desktop" services, which include the X11
+ ;; log-in service, networking with Wicd, and more.
+ (services %desktop-services)
+
+ ;; Allow resolution of '.local' host names with mDNS.
+ (name-service-switch %mdns-host-lookup-nss))
diff --git a/gnu/system/file-systems.scm b/gnu/system/file-systems.scm
index 4760821840..db861baed2 100644
--- a/gnu/system/file-systems.scm
+++ b/gnu/system/file-systems.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2013, 2014 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -19,6 +19,7 @@
(define-module (gnu system file-systems)
#:use-module (guix gexp)
#:use-module (guix records)
+ #:use-module (guix store)
#:export (<file-system>
file-system
file-system?
@@ -37,6 +38,7 @@
%shared-memory-file-system
%pseudo-terminal-file-system
%devtmpfs-file-system
+ %immutable-store
%base-file-systems
@@ -139,12 +141,24 @@ file system."
(options "size=50%") ;TODO: make size configurable
(create-mount-point? #t)))
+(define %immutable-store
+ ;; Read-only store to avoid users or daemons accidentally modifying it.
+ ;; 'guix-daemon' has provisions to remount it read-write in its own name
+ ;; space.
+ (file-system
+ (device (%store-prefix))
+ (mount-point (%store-prefix))
+ (type "none")
+ (check? #f)
+ (flags '(read-only bind-mount))))
+
(define %base-file-systems
;; List of basic file systems to be mounted. Note that /proc and /sys are
;; currently mounted by the initrd.
(list %devtmpfs-file-system
%pseudo-terminal-file-system
- %shared-memory-file-system))
+ %shared-memory-file-system
+ %immutable-store))
diff --git a/gnu/system/grub.scm b/gnu/system/grub.scm
index 17b08aa9b7..e49b6dbe54 100644
--- a/gnu/system/grub.scm
+++ b/gnu/system/grub.scm
@@ -80,7 +80,8 @@
(define %background-image
(grub-image
(aspect-ratio 4/3)
- (file #~(string-append #$%artwork-repository "/grub/GuixSD-4-3.svg"))))
+ (file #~(string-append #$%artwork-repository
+ "/grub/GuixSD-fully-black-4-3.svg"))))
(define %default-theme
;; Default theme contributed by Felipe López.
diff --git a/gnu/system/install.scm b/gnu/system/install.scm
index 2e7e4eafad..007bd25ae6 100644
--- a/gnu/system/install.scm
+++ b/gnu/system/install.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2014, 2015 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -22,7 +23,9 @@
#:use-module (guix store)
#:use-module (guix monads)
#:use-module ((guix store) #:select (%store-prefix))
+ #:use-module (guix profiles)
#:use-module (gnu packages admin)
+ #:use-module (gnu packages bash)
#:use-module (gnu packages linux)
#:use-module (gnu packages cryptsetup)
#:use-module (gnu packages package-management)
@@ -30,7 +33,10 @@
#:use-module (gnu packages grub)
#:use-module (gnu packages texinfo)
#:use-module (gnu packages compression)
- #:export (installation-os))
+ #:use-module (ice-9 match)
+ #:use-module (srfi srfi-26)
+ #:export (self-contained-tarball
+ installation-os))
;;; Commentary:
;;;
@@ -39,6 +45,49 @@
;;;
;;; Code:
+
+(define* (self-contained-tarball #:key (guix guix))
+ "Return a self-contained tarball containing a store initialized with the
+closure of GUIX. The tarball contains /gnu/store, /var/guix, and a profile
+under /root/.guix-profile where GUIX is installed."
+ (mlet %store-monad ((profile (profile-derivation
+ (manifest
+ (list (package->manifest-entry guix))))))
+ (define build
+ #~(begin
+ (use-modules (guix build utils)
+ (gnu build install))
+
+ (define %root "root")
+
+ (setenv "PATH"
+ (string-append #$guix "/sbin:" #$tar "/bin:" #$xz "/bin"))
+
+ (populate-single-profile-directory %root
+ #:profile #$profile
+ #:closure "profile")
+
+ ;; Create the tarball. Use GNU format so there's no file name
+ ;; length limitation.
+ (with-directory-excursion %root
+ (zero? (system* "tar" "--xz" "--format=gnu"
+ "--owner=root:0" "--group=root:0"
+ "-cvf" #$output
+ ;; Avoid adding /, /var, or /root to the tarball,
+ ;; so that the ownership and permissions of those
+ ;; directories will not be overwritten when
+ ;; extracting the archive.
+ "./root/.guix-profile"
+ "./var/guix"
+ "./gnu")))))
+
+ (gexp->derivation "guix-tarball.tar.xz" build
+ #:references-graphs `(("profile" ,profile))
+ #:modules '((guix build utils)
+ (guix build store-copy)
+ (gnu build install)))))
+
+
(define (log-to-info)
"Return a script that spawns the Info reader on the right section of the
manual."
@@ -134,12 +183,17 @@ the given target.")
"Return a dummy service whose purpose is to install an operating system
configuration template file in the installation system."
- (define local-template
- "/etc/configuration-template.scm")
- (define template
- (search-path %load-path "gnu/system/os-config.tmpl"))
+ (define search
+ (cut search-path %load-path <>))
+ (define templates
+ (map (match-lambda
+ ((file '-> target)
+ (list (local-file (search file))
+ (string-append "/etc/configuration/" target))))
+ '(("gnu/system/examples/bare-bones.tmpl" -> "bare-bones.scm")
+ ("gnu/system/examples/desktop.tmpl" -> "desktop.scm"))))
- (mlet %store-monad ((template (interned-file template)))
+ (with-monad %store-monad
(return (service
(requirement '(root-file-system))
(provision '(os-config-template))
@@ -148,8 +202,16 @@ configuration template file in the installation system."
(start #~(const #t))
(stop #~(const #f))
(activate
- #~(unless (file-exists? #$local-template)
- (copy-file #$template #$local-template)))))))
+ #~(begin
+ (use-modules (ice-9 match)
+ (guix build utils))
+
+ (mkdir-p "/etc/configuration")
+ (for-each (match-lambda
+ ((file target)
+ (unless (file-exists? target)
+ (copy-file file target))))
+ '#$templates)))))))
(define %nscd-minimal-caches
;; Minimal in-memory caching policy for nscd.
@@ -279,6 +341,7 @@ Use Alt-F2 for documentation.
;; 2.0.0a, that pulls Guile 1.8, which takes unreasonable
;; space; furthermore util-linux's fdisk is already
;; available here, so we keep that.
+ bash-completion
%base-packages))))
;; Return it here so 'guix system' can consume it directly.
diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm
index 9feb8f73e6..83685adcbc 100644
--- a/gnu/system/linux-initrd.scm
+++ b/gnu/system/linux-initrd.scm
@@ -143,20 +143,22 @@ initrd code."
(define* (base-initrd file-systems
#:key
+ (linux linux-libre)
(mapped-devices '())
qemu-networking?
- virtio?
+ (virtio? #t)
volatile-root?
(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.
+ "Return a monadic derivation that builds a generic initrd, with kernel
+modules taken from LINUX. 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
-be used as a QEMU guest with para-virtualized I/O drivers.
+be used as a QEMU guest with the root file system on a para-virtualized block
+device.
When VOLATILE-ROOT? is true, the root file system is writable but any changes
to it are lost.
@@ -224,7 +226,7 @@ loaded at boot time in the order in which they appear."
(open source target)))
mapped-devices))
- (mlet %store-monad ((kodir (flat-linux-module-directory linux-libre
+ (mlet %store-monad ((kodir (flat-linux-module-directory linux
linux-modules)))
(expression->initrd
#~(begin
diff --git a/gnu/system/nss.scm b/gnu/system/nss.scm
index ec2d2517e7..f4d2855289 100644
--- a/gnu/system/nss.scm
+++ b/gnu/system/nss.scm
@@ -29,6 +29,8 @@
lookup-specification
%default-nss
+ %mdns-host-lookup-nss
+
%files
%compat
%dns
@@ -148,6 +150,27 @@
;; Default NSS configuration.
(name-service-switch))
+(define %mdns-host-lookup-nss
+ (name-service-switch
+ (hosts (list %files ;first, check /etc/hosts
+
+ ;; If the above did not succeed, try with 'mdns_minimal'.
+ (name-service
+ (name "mdns_minimal")
+
+ ;; 'mdns_minimal' is authoritative for '.local'. When it
+ ;; returns "not found", no need to try the next methods.
+ (reaction (lookup-specification
+ (not-found => return))))
+
+ ;; Then fall back to DNS.
+ (name-service
+ (name "dns"))
+
+ ;; Finally, try with the "full" 'mdns'.
+ (name-service
+ (name "mdns"))))))
+
;;;
;;; Serialization.
diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm
index c93e26d65f..e194ed6cf1 100644
--- a/gnu/system/vm.scm
+++ b/gnu/system/vm.scm
@@ -149,6 +149,7 @@ made available under the /xchg CIFS share."
(initrd (if initrd ; use the default initrd?
(return initrd)
(base-initrd %linux-vm-file-systems
+ #:linux linux
#:virtio? #t
#:qemu-networking? #t))))