Next: , Up: System Configuration   [Contents][Index]

6.2.1 Using the Configuration System

The operating system is configured by providing an operating-system declaration in a file that can then be passed to the guix system command (see Invoking guix system). A simple setup, with the default system services, the default Linux-Libre kernel, initial RAM disk, and boot loader looks like this:

(use-modules (gnu)   ; for 'user-account', '%base-services', etc.
             (gnu packages emacs)  ; for 'emacs'
             (gnu services ssh))   ; for 'lsh-service'

  (host-name "komputilo")
  (timezone "Europe/Paris")
  (locale "fr_FR.utf8")
  (bootloader (grub-configuration
                (device "/dev/sda")))
  (file-systems (cons (file-system
                        (device "/dev/sda1") ; or partition label
                        (mount-point "/")
                        (type "ext3"))
  (users (list (user-account
                (name "alice")
                (group "users")
                (comment "Bob's sister")
                (home-directory "/home/alice"))))
  (packages (cons emacs %base-packages))
  (services (cons (lsh-service #:port 2222 #:root-login? #t)

This example should be self-describing. Some of the fields defined above, such as host-name and bootloader, are mandatory. Others, such as packages and services, can be omitted, in which case they get a default value.

The packages field lists packages that will be globally visible on the system, for all user accounts—i.e., in every user’s PATH environment variable—in addition to the per-user profiles (see Invoking guix package). The %base-packages variable provides all the tools one would expect for basic user and administrator tasks—including the GNU Core Utilities, the GNU Networking Utilities, the GNU Zile lightweight text editor, find, grep, etc. The example above adds Emacs to those, taken from the (gnu packages emacs) module (see Package Modules).

The services field lists system services to be made available when the system starts (see Services). The operating-system declaration above specifies that, in addition to the basic services, we want the lshd secure shell daemon listening on port 2222, and allowing remote root logins (see Invoking lshd in GNU lsh Manual). Under the hood, lsh-service arranges so that lshd is started with the right command-line options, possibly with supporting configuration files generated as needed (see Defining Services). See operating-system Reference, for details about the available operating-system fields.

Assuming the above snippet is stored in the my-system-config.scm file, the guix system reconfigure my-system-config.scm command instantiates that configuration, and makes it the default GRUB boot entry (see Invoking guix system). The normal way to change the system’s configuration is by updating this file and re-running the guix system command.

At the Scheme level, the bulk of an operating-system declaration is instantiated with the following monadic procedure (see The Store Monad):

Monadic Procedure: operating-system-derivation os

Return a derivation that builds os, an operating-system object (see Derivations).

The output of the derivation is a single directory that refers to all the packages, configuration files, and other supporting files needed to instantiate os.

Next: , Up: System Configuration   [Contents][Index]