summary refs log tree commit diff
path: root/gnu/system/examples
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/system/examples')
-rw-r--r--gnu/system/examples/asus-c201.tmpl60
-rw-r--r--gnu/system/examples/bare-bones.tmpl3
-rw-r--r--gnu/system/examples/beaglebone-black.tmpl3
-rw-r--r--gnu/system/examples/desktop.tmpl23
-rw-r--r--gnu/system/examples/docker-image.tmpl3
-rw-r--r--gnu/system/examples/lightweight-desktop.tmpl3
-rw-r--r--gnu/system/examples/vm-image.tmpl116
7 files changed, 161 insertions, 50 deletions
diff --git a/gnu/system/examples/asus-c201.tmpl b/gnu/system/examples/asus-c201.tmpl
new file mode 100644
index 0000000000..098958f4a2
--- /dev/null
+++ b/gnu/system/examples/asus-c201.tmpl
@@ -0,0 +1,60 @@
+;; This is an operating system configuration template
+;; for a "bare bones" setup for an ASUS C201PA.
+
+(use-modules (gnu) (gnu bootloader depthcharge))
+(use-service-modules networking ssh)
+(use-package-modules linux screen)
+
+(operating-system
+  (host-name "komputilo")
+  (timezone "Europe/Berlin")
+  (locale "en_US.utf8")
+
+  ;; Assuming /dev/mmcblk0p1 is the kernel partition, and
+  ;; "my-root" is the label of the target root file system.
+  (bootloader (bootloader-configuration
+                (bootloader depthcharge-bootloader)
+                (target "/dev/mmcblk0p1")))
+
+  ;; The ASUS C201PA requires a very particular kernel to boot,
+  ;; as well as the following arguments.
+  (kernel linux-libre-arm-veyron)
+  (kernel-arguments '("console=tty1"))
+
+  ;; We do not need any special modules for initrd, and the
+  ;; PrawnOS kernel does not include many of the normal ones.
+  (initrd-modules '())
+
+  (file-systems (cons (file-system
+                        (device (file-system-label "my-root"))
+                        (mount-point "/")
+                        (type "ext4"))
+                      %base-file-systems))
+
+  ;; This is where user accounts are specified.  The "root"
+  ;; account is implicit, and is initially created with the
+  ;; empty password.
+  (users (cons (user-account
+                (name "alice")
+                (comment "Bob's sister")
+                (group "users")
+
+                ;; Adding the account to the "wheel" group
+                ;; makes it a sudoer.  Adding it to "audio"
+                ;; and "video" allows the user to play sound
+                ;; and access the webcam.
+                (supplementary-groups '("wheel"
+                                        "audio" "video"))
+                (home-directory "/home/alice"))
+               %base-user-accounts))
+
+  ;; Globally-installed packages.
+  (packages (cons screen %base-packages))
+
+  ;; Add services to the baseline: a DHCP client and
+  ;; an SSH server.
+  (services (append (list (service dhcp-client-service-type)
+                          (service openssh-service-type
+                                   (openssh-configuration
+                                    (port-number 2222))))
+                    %base-services)))
diff --git a/gnu/system/examples/bare-bones.tmpl b/gnu/system/examples/bare-bones.tmpl
index a88bab034f..4f30a5b756 100644
--- a/gnu/system/examples/bare-bones.tmpl
+++ b/gnu/system/examples/bare-bones.tmpl
@@ -35,8 +35,7 @@
                 ;; and "video" allows the user to play sound
                 ;; and access the webcam.
                 (supplementary-groups '("wheel"
-                                        "audio" "video"))
-                (home-directory "/home/alice"))
+                                        "audio" "video")))
                %base-user-accounts))
 
   ;; Globally-installed packages.
diff --git a/gnu/system/examples/beaglebone-black.tmpl b/gnu/system/examples/beaglebone-black.tmpl
index 11678063b2..def05e807d 100644
--- a/gnu/system/examples/beaglebone-black.tmpl
+++ b/gnu/system/examples/beaglebone-black.tmpl
@@ -38,8 +38,7 @@
                 ;; and "video" allows the user to play sound
                 ;; and access the webcam.
                 (supplementary-groups '("wheel"
-                                        "audio" "video"))
-                (home-directory "/home/alice"))
+                                        "audio" "video")))
                %base-user-accounts))
 
   ;; Globally-installed packages.
diff --git a/gnu/system/examples/desktop.tmpl b/gnu/system/examples/desktop.tmpl
index c59bf92681..3931bad60d 100644
--- a/gnu/system/examples/desktop.tmpl
+++ b/gnu/system/examples/desktop.tmpl
@@ -3,7 +3,7 @@
 ;; root partition is encrypted with LUKS.
 
 (use-modules (gnu) (gnu system nss))
-(use-service-modules desktop)
+(use-service-modules desktop xorg)
 (use-package-modules certs gnome)
 
 (operating-system
@@ -11,11 +11,16 @@
   (timezone "Europe/Paris")
   (locale "en_US.utf8")
 
+  ;; Choose US English keyboard layout.  The "altgr-intl"
+  ;; variant provides dead keys for accented characters.
+  (keyboard-layout (keyboard-layout "us" "altgr-intl"))
+
   ;; Use the UEFI variant of GRUB with the EFI System
   ;; Partition mounted on /boot/efi.
   (bootloader (bootloader-configuration
                 (bootloader grub-efi-bootloader)
-                (target "/boot/efi")))
+                (target "/boot/efi")
+                (keyboard-layout keyboard-layout)))
 
   ;; Specify a mapped device for the encrypted root partition.
   ;; The UUID is that returned by 'cryptsetup luksUUID'.
@@ -42,8 +47,7 @@
                 (comment "Alice's brother")
                 (group "users")
                 (supplementary-groups '("wheel" "netdev"
-                                        "audio" "video"))
-                (home-directory "/home/bob"))
+                                        "audio" "video")))
                %base-user-accounts))
 
   ;; This is where we specify system-wide packages.
@@ -54,12 +58,15 @@
                      gvfs)
                     %base-packages))
 
-  ;; Add GNOME and/or Xfce---we can choose at the log-in
-  ;; screen with F1.  Use the "desktop" services, which
+  ;; Add GNOME and Xfce---we can choose at the log-in screen
+  ;; by clicking the gear.  Use the "desktop" services, which
   ;; include the X11 log-in service, networking with
   ;; NetworkManager, and more.
-  (services (append (list (gnome-desktop-service)
-                          (xfce-desktop-service))
+  (services (append (list (service gnome-desktop-service-type)
+                          (service xfce-desktop-service-type)
+                          (set-xorg-configuration
+                           (xorg-configuration
+                            (keyboard-layout keyboard-layout))))
                     %desktop-services))
 
   ;; Allow resolution of '.local' host names with mDNS.
diff --git a/gnu/system/examples/docker-image.tmpl b/gnu/system/examples/docker-image.tmpl
index 9690d651c1..ca633cc838 100644
--- a/gnu/system/examples/docker-image.tmpl
+++ b/gnu/system/examples/docker-image.tmpl
@@ -15,8 +15,7 @@
                 (comment "Bob's sister")
                 (group "users")
                 (supplementary-groups '("wheel"
-                                        "audio" "video"))
-                (home-directory "/home/alice"))
+                                        "audio" "video")))
                %base-user-accounts))
 
   ;; Globally-installed packages.
diff --git a/gnu/system/examples/lightweight-desktop.tmpl b/gnu/system/examples/lightweight-desktop.tmpl
index a234badd2b..45d9bf447f 100644
--- a/gnu/system/examples/lightweight-desktop.tmpl
+++ b/gnu/system/examples/lightweight-desktop.tmpl
@@ -35,8 +35,7 @@
                 (comment "Bob's sister")
                 (group "users")
                 (supplementary-groups '("wheel" "netdev"
-                                        "audio" "video"))
-                (home-directory "/home/alice"))
+                                        "audio" "video")))
                %base-user-accounts))
 
   ;; Add a bunch of window managers; we can choose one at
diff --git a/gnu/system/examples/vm-image.tmpl b/gnu/system/examples/vm-image.tmpl
index 6dc67b0901..a140082c0b 100644
--- a/gnu/system/examples/vm-image.tmpl
+++ b/gnu/system/examples/vm-image.tmpl
@@ -1,58 +1,106 @@
-;;; This is an operating system configuration template for a "bare-bones" setup,
-;;; suitable for booting in a virtualized environment, including virtual private
-;;; servers (VPS).
+;; This is an operating system configuration for a VM image.
+;; Modify it as you see fit and instantiate the changes by running:
+;;
+;;   guix system reconfigure /etc/config.scm
+;;
 
-(use-modules (gnu))
-(use-package-modules bootloaders disk nvi)
+(use-modules (gnu) (srfi srfi-1))
+(use-service-modules desktop networking ssh xorg)
+(use-package-modules bootloaders certs fonts nvi wget xorg)
 
 (define vm-image-motd (plain-file "motd" "
-This is the GNU system.  Welcome!
+\x1b[1;37mThis is the GNU system.  Welcome!\x1b[0m
 
-This instance of Guix System is a bare-bones template for virtualized environments.
+This instance of Guix is a template for virtualized environments.
+You can reconfigure the whole system by adjusting /etc/config.scm
+and running:
 
-You will probably want to do these things first if you booted in a virtual
-private server (VPS):
+  guix system reconfigure /etc/config.scm
+
+Run '\x1b[1;37minfo guix\x1b[0m' to browse documentation.
+
+\x1b[1;33mConsider setting a password for the 'root' and 'guest' \
+accounts.\x1b[0m
+"))
+
+(define this-file
+  (local-file (basename (assoc-ref (current-source-location) 'filename))
+              "config.scm"))
 
-* Set a password for 'root'.
-* Set up networking.
-* Expand the root partition to fill the space available by 0) deleting and
-recreating the partition with fdisk, 1) reloading the partition table with
-partprobe, and then 2) resizing the filesystem with resize2fs.\n"))
 
 (operating-system
   (host-name "gnu")
   (timezone "Etc/UTC")
   (locale "en_US.utf8")
+  (keyboard-layout (keyboard-layout "us" "altgr-intl"))
 
   (firmware '())
 
-  ;; Assuming /dev/sdX is the target hard disk, and "my-root" is
-  ;; the label of the target root file system.
+  ;; Below we assume /dev/vda is the VM's hard disk.
+  ;; Adjust as needed.
   (bootloader (bootloader-configuration
                (bootloader grub-bootloader)
-               (target "/dev/sda")
+               (target "/dev/vda")
                (terminal-outputs '(console))))
   (file-systems (cons (file-system
-                        (device (file-system-label "my-root"))
                         (mount-point "/")
+                        (device "/dev/vda1")
                         (type "ext4"))
                       %base-file-systems))
 
-  ;; This is where user accounts are specified.  The "root"
-  ;; account is implicit, and is initially created with the
-  ;; empty password.
-  (users %base-user-accounts)
-
-  ;; Globally-installed packages.
-  (packages (append (list nvi fdisk
-                          ;; mostly so xrefs to its manual work
-                          grub
-                          ;; partprobe
-                          parted)
+  (users (cons (user-account
+                (name "guest")
+                (comment "GNU Guix Live")
+                (password "")                     ;no password
+                (group "users")
+                (supplementary-groups '("wheel" "netdev"
+                                        "audio" "video")))
+               %base-user-accounts))
+
+  ;; Our /etc/sudoers file.  Since 'guest' initially has an empty password,
+  ;; allow for password-less sudo.
+  (sudoers-file (plain-file "sudoers" "\
+root ALL=(ALL) ALL
+%wheel ALL=NOPASSWD: ALL\n"))
+
+  (packages (append (list font-bitstream-vera nss-certs nvi wget)
                     %base-packages))
 
-  (services (modify-services %base-services
-              (login-service-type config =>
-                                  (login-configuration
-                                    (inherit config)
-                                    (motd vm-image-motd))))))
+  (services
+   (append (list (service xfce-desktop-service-type)
+
+                 ;; Copy this file to /etc/config.scm in the OS.
+                 (simple-service 'config-file etc-service-type
+                                 `(("config.scm" ,this-file)))
+
+                 ;; Choose SLiM, which is lighter than the default GDM.
+                 (service slim-service-type
+                          (slim-configuration
+                           (auto-login? #t)
+                           (default-user "guest")
+                           (xorg-configuration
+                            (xorg-configuration
+                             (keyboard-layout keyboard-layout)))))
+
+                 ;; Uncomment the line below to add an SSH server.
+                 ;;(service openssh-service-type)
+
+                 ;; Use the DHCP client service rather than NetworkManager.
+                 (service dhcp-client-service-type))
+
+           ;; Remove GDM, NetworkManager, and wpa-supplicant, which don't make
+           ;; sense in a VM.
+           (remove (lambda (service)
+                     (let ((type (service-kind service)))
+                       (memq type (list gdm-service-type
+                                        wpa-supplicant-service-type
+                                        cups-pk-helper-service-type
+                                        network-manager-service-type))))
+                   (modify-services %desktop-services
+                     (login-service-type config =>
+                                         (login-configuration
+                                          (inherit config)
+                                          (motd vm-image-motd)))))))
+
+  ;; Allow resolution of '.local' host names with mDNS.
+  (name-service-switch %mdns-host-lookup-nss))