summaryrefslogtreecommitdiff
path: root/gnu/system
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/system')
-rw-r--r--gnu/system/examples/vm-image.tmpl116
-rw-r--r--gnu/system/install.scm1
-rw-r--r--gnu/system/vm.scm19
3 files changed, 97 insertions, 39 deletions
diff --git a/gnu/system/examples/vm-image.tmpl b/gnu/system/examples/vm-image.tmpl
index 6dc67b0901..95cfcb6865 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 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 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))
diff --git a/gnu/system/install.scm b/gnu/system/install.scm
index f20d94f385..45c6051732 100644
--- a/gnu/system/install.scm
+++ b/gnu/system/install.scm
@@ -84,6 +84,7 @@
;; usually not available at run time, hence this hack.
'(("de" . "Systeminstallation")
("en" . "System Installation")
+ ("es" . "Instalación del sistema")
("fr" . "Installation du système")))
(define (log-to-info tty user)
diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm
index 22e3fcc522..92b03b01ad 100644
--- a/gnu/system/vm.scm
+++ b/gnu/system/vm.scm
@@ -617,7 +617,7 @@ to USB sticks meant to be read-only."
;; Volume name of the root file system.
(normalize-label "Guix_image"))
- (define root-uuid
+ (define (root-uuid os)
;; UUID of the root file system, computed in a deterministic fashion.
;; This is what we use to locate the root file system so it has to be
;; different from the user's own file system UUIDs.
@@ -647,17 +647,26 @@ to USB sticks meant to be read-only."
(bootloader grub-mkrescue-bootloader))
(operating-system-bootloader os)))
- ;; Force our own root file system.
+ ;; Force our own root file system. (We need a "/" file system
+ ;; to call 'root-uuid'.)
(file-systems (cons (file-system
(mount-point "/")
- (device root-uuid)
+ (device "/dev/placeholder")
+ (type file-system-type))
+ file-systems-to-keep))))
+ (uuid (root-uuid os))
+ (os (operating-system
+ (inherit os)
+ (file-systems (cons (file-system
+ (mount-point "/")
+ (device uuid)
(type file-system-type))
file-systems-to-keep))))
(bootcfg (operating-system-bootcfg os)))
(if (string=? "iso9660" file-system-type)
(iso9660-image #:name name
#:file-system-label root-label
- #:file-system-uuid root-uuid
+ #:file-system-uuid uuid
#:os os
#:register-closures? #t
#:bootcfg-drv bootcfg
@@ -674,7 +683,7 @@ to USB sticks meant to be read-only."
#:disk-image-format "raw"
#:file-system-type file-system-type
#:file-system-label root-label
- #:file-system-uuid root-uuid
+ #:file-system-uuid uuid
#:copy-inputs? #t
#:register-closures? #t
#:inputs `(("system" ,os)