~ruther/guix-local

a69576ea858863574252cbefbcef91db98773d60 — Ludovic Courtès 11 years ago 7cb9666
system: Add '%devtmpfs-file-system' for udev, and '%base-file-systems'.

Suggested by Adam Pribyl <pribyl@lowlevel.cz>.

* gnu/services/base.scm (udev-service)[requirement]: Add
  'file-system-/dev'.
* gnu/system/file-systems.scm (%devtmpfs-file-system,
  %base-file-systems): New variables.
* gnu/system/install.scm (installation-services)[file-systems]: Use
  %base-file-systems.
* build-aux/hydra/demo-os.scm (file-systems): Likewise.
* doc/guix.texi (System Installation): Show %BASE-FILE-SYSTEMS in the
  example.
  (Using the Configuration System): Likewise.
  (File Systems): Document %base-file-systems, %devtmpfs-file-system,
  %binary-format-file-system, and %fuse-control-file-system.
M build-aux/hydra/demo-os.scm => build-aux/hydra/demo-os.scm +7 -7
@@ 44,13 44,13 @@
 (file-systems
  ;; We provide a dummy file system for /, but that's OK because the VM build
  ;; code will automatically declare the / file system for us.
  (list (file-system
          (mount-point "/")
          (device "dummy")
          (type "dummy"))
        ;; %fuse-control-file-system   ; needs fuse.ko
        ;; %binary-format-file-system  ; needs binfmt.ko
        ))
  (cons* (file-system
           (mount-point "/")
           (device "dummy")
           (type "dummy"))
         ;; %fuse-control-file-system   ; needs fuse.ko
         ;; %binary-format-file-system  ; needs binfmt.ko
         %base-file-systems))

 (users (list (user-account
               (name "guest")

M doc/guix.texi => doc/guix.texi +33 -4
@@ 2826,10 2826,11 @@ only a root account would look like this:
  ;; Assuming /dev/sdX is the target hard disk, and /dev/sdX1 the
  ;; target root file system.
  (bootloader (grub-configuration (device "/dev/sdX")))
  (file-systems (list (file-system
  (file-systems (cons (file-system
                        (device "/dev/sdX1")
                        (mount-point "/")
                        (type "ext4")))))
                        (type "ext4"))
                      %base-file-systems)))
@end example

@noindent


@@ 2925,10 2926,11 @@ kernel, initial RAM disk, and boot loader looks like this:
  (locale "fr_FR.UTF-8")
  (bootloader (grub-configuration
                (device "/dev/sda")))
  (file-systems (list (file-system
  (file-systems (cons (file-system
                        (device "/dev/sda1") ; or partition label
                        (mount-point "/")
                        (type "ext3"))))
                        (type "ext3"))
                      %base-file-systems))
  (users (list (user-account
                (name "alice")
                (password "")


@@ 3055,6 3057,32 @@ errors before being mounted.
@end table
@end deftp

The @code{(gnu system file-systems)} exports the following useful
variables.

@defvr {Scheme Variable} %base-file-systems
These are essential file systems that are required on normal systems,
such as @var{%devtmpfs-file-system} (see below.)  Operating system
declarations should always contain at least these.
@end defvr

@defvr {Scheme Variable} %devtmpfs-file-system
The @code{devtmpfs} file system to be mounted on @file{/dev}.  This is a
requirement for udev (@pxref{Base Services, @code{udev-service}}).
@end defvr

@defvr {Scheme Variable} %binary-format-file-system
The @code{binfmt_misc} file system, which allows handling of arbitrary
executable file types to be delegated to user space.  This requires the
@code{binfmt.ko} kernel module to be loaded.
@end defvr

@defvr {Scheme Variable} %fuse-control-file-system
The @code{fusectl} file system, which allows unprivileged users to mount
and unmount user-space FUSE file systems.  This requires the
@code{fuse.ko} kernel module to be loaded.
@end defvr

@node User Accounts
@subsection User Accounts



@@ 3245,6 3273,7 @@ passed to @command{guix-daemon}.
Run @var{udev}, which populates the @file{/dev} directory dynamically.
@end deffn


@node Networking Services
@subsubsection Networking Services


M gnu/services/base.scm => gnu/services/base.scm +7 -2
@@ 473,8 473,13 @@ passed to @command{guix-daemon}."
  (with-monad %store-monad
    (return (service
             (provision '(udev))
             (requirement '(root-file-system))
             (documentation "Populate the /dev directory.")

             ;; Udev needs /dev to be a 'devtmpfs' mount so that new device
             ;; nodes can be added: see
             ;; <http://www.linuxfromscratch.org/lfs/view/development/chapter07/udev.html>.
             (requirement '(root-file-system file-system-/dev))

             (documentation "Populate the /dev directory, dynamically.")
             (start #~(lambda ()
                        (define udevd
                          (string-append #$udev "/libexec/udev/udevd"))

M gnu/system/file-systems.scm => gnu/system/file-systems.scm +17 -1
@@ 30,7 30,10 @@
            file-system-options

            %fuse-control-file-system
            %binary-format-file-system))
            %binary-format-file-system
            %devtmpfs-file-system

            %base-file-systems))

;;; Commentary:
;;;


@@ 72,4 75,17 @@
    (type "binfmt_misc")
    (check? #f)))

(define %devtmpfs-file-system
  ;; /dev as a 'devtmpfs' file system, needed for udev.
  (file-system
    (device "none")
    (mount-point "/dev")
    (type "devtmpfs")
    (check? #f)))

(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))

;;; file-systems.scm ends here

M gnu/system/install.scm => gnu/system/install.scm +3 -2
@@ 117,10 117,11 @@ Use Alt-F2 for documentation.
    (file-systems
     ;; Note: the disk image build code overrides this root file system with
     ;; the appropriate one.
     (list (file-system
     (cons (file-system
             (mount-point "/")
             (device "gnu-disk-image")
             (type "ext4"))))
             (type "ext4"))
           %base-file-systems))

    (users (list (user-account
                  (name "guest")