summaryrefslogtreecommitdiff
path: root/gnu/system/examples
diff options
context:
space:
mode:
authorRutherther <rutherther@ditigal.xyz>2025-12-01 08:09:03 +0100
committerRutherther <rutherther@ditigal.xyz>2025-12-22 23:00:42 +0100
commitb7a12230525bb0a0481279d7d7c4447f8d01bf13 (patch)
tree45ba6bb6e2ca1982684555b5652e6ff84fbe97a5 /gnu/system/examples
parent9e7e40b8bd1410dfcad6cbface22b1c31e665401 (diff)
system: vm-image-efi.tmpl: Add example efi vm image.
This is a copy of vm-image.tmpl, but with efi bootloader. Since user ends up with this config in their /run/current-user/configuration.scm and the regular way to continue is to copy that file and reconfigure off of it, it seems better to just keep distinct configuration. Moreover xf86-video-intel is removed, because it doesn't compile on aarch64. * gnu/system/examples/vm-image-efi.tmpl Change-Id: I0f72ac5a775339ee84cb1a4046ca5a8deca0e2ea Signed-off-by: Rutherther <rutherther@ditigal.xyz>
Diffstat (limited to 'gnu/system/examples')
-rw-r--r--gnu/system/examples/vm-image-efi.tmpl161
1 files changed, 161 insertions, 0 deletions
diff --git a/gnu/system/examples/vm-image-efi.tmpl b/gnu/system/examples/vm-image-efi.tmpl
new file mode 100644
index 00000000000..1bde66c2dd8
--- /dev/null
+++ b/gnu/system/examples/vm-image-efi.tmpl
@@ -0,0 +1,161 @@
1;; -*- mode: scheme; -*-
2;; This is an operating system configuration for a VM image.
3;; Modify it as you see fit and instantiate the changes by running:
4;;
5;; guix system reconfigure /etc/config.scm
6;;
7
8(use-modules (gnu)
9 (guix)
10 (srfi srfi-1)
11 (ice-9 match)
12 (guix channels)
13 (gnu system image))
14(use-service-modules desktop mcron networking spice ssh xorg sddm)
15(use-package-modules bootloaders fonts
16 package-management xdisorg xorg)
17
18(define vm-image-motd (plain-file "motd" "
19\x1b[1;37mThis is the GNU system. Welcome!\x1b[0m
20
21This instance of Guix is a template for virtualized environments.
22You can reconfigure the whole system by adjusting /etc/config.scm
23and running:
24
25 guix system reconfigure /etc/config.scm
26
27Run '\x1b[1;37minfo guix\x1b[0m' to browse documentation.
28
29\x1b[1;33mConsider setting a password for the 'root' and 'guest' \
30accounts.\x1b[0m
31"))
32
33(define (guix-package-commit guix)
34 ;; Extract the commit of the GUIX package.
35 (match (package-source guix)
36 ((? channel? source)
37 (channel-commit source))
38 (_
39 (apply (lambda* (#:key commit #:allow-other-keys) commit)
40 (package-arguments guix)))))
41
42(operating-system
43 (host-name "gnu")
44 (timezone "Etc/UTC")
45 (locale "en_US.utf8")
46 (keyboard-layout (keyboard-layout "us" "altgr-intl"))
47
48 ;; Label for the GRUB boot menu.
49 (label (string-append "GNU Guix "
50 (or (getenv "GUIX_DISPLAYED_VERSION")
51 (package-version guix))))
52
53 (firmware '())
54
55 ;; On AArch64, support SCSI CDROMs and HDs.
56 (initrd-modules (cons* "sd_mod" "sr_mod"
57 %base-initrd-modules))
58
59 (bootloader
60 (bootloader-configuration
61 (bootloader grub-efi-bootloader)
62 (targets '("/boot/efi"))
63 (terminal-outputs '(console))))
64 (file-systems (cons* (file-system
65 (mount-point "/")
66 (device (file-system-label root-label))
67 (type "ext4"))
68 (file-system
69 (mount-point "/boot/efi")
70 (device (file-system-label "GNU-ESP"))
71 (type "vfat"))
72 %base-file-systems))
73
74 (users (cons (user-account
75 (name "guest")
76 (comment "GNU Guix Live")
77 (password "") ;no password
78 (group "users")
79 (supplementary-groups '("wheel" "netdev"
80 "audio" "video")))
81 %base-user-accounts))
82
83 ;; Our /etc/sudoers file. Since 'guest' initially has an empty password,
84 ;; allow for password-less sudo.
85 (sudoers-file (plain-file "sudoers" "\
86root ALL=(ALL) ALL
87%wheel ALL=NOPASSWD: ALL\n"))
88
89 (pam-services
90 ;; Explicitly allow for empty passwords.
91 (base-pam-services #:allow-empty-passwords? #t))
92
93 (packages
94 (append (list font-bitstream-vera
95 ;; Auto-started script providing SPICE dynamic resizing for
96 ;; Xfce (see:
97 ;; https://gitlab.xfce.org/xfce/xfce4-settings/-/issues/142).
98 x-resize)
99 %base-packages))
100
101 (services
102 (append (list (service xfce-desktop-service-type)
103
104 ;; Choose SLiM, which is lighter than the default GDM.
105 (service slim-service-type
106 (slim-configuration
107 (auto-login? #t)
108 (default-user "guest")
109 (xorg-configuration
110 (xorg-configuration
111 ;; The QXL virtual GPU driver is added to provide
112 ;; a better SPICE experience.
113 (modules (cons xf86-video-qxl
114 %default-xorg-modules))
115 (keyboard-layout keyboard-layout)))))
116
117 ;; Uncomment the line below to add an SSH server.
118 ;;(service openssh-service-type)
119
120 ;; Add support for the SPICE protocol, which enables dynamic
121 ;; resizing of the guest screen resolution, clipboard
122 ;; integration with the host, etc.
123 (service spice-vdagent-service-type)
124
125 ;; Use the DHCP client service rather than NetworkManager.
126 (service dhcpcd-service-type))
127
128 ;; Remove some services that don't make sense in a VM.
129 (remove (lambda (service)
130 (let ((type (service-kind service)))
131 (or (memq type
132 (list gdm-service-type
133 sddm-service-type
134 wpa-supplicant-service-type
135 cups-pk-helper-service-type
136 network-manager-service-type
137 modem-manager-service-type))
138 (eq? 'network-manager-applet
139 (service-type-name type)))))
140 (modify-services %desktop-services
141 (login-service-type config =>
142 (login-configuration
143 (inherit config)
144 (motd vm-image-motd)))
145
146 ;; Install and run the current Guix rather than an older
147 ;; snapshot.
148 (guix-service-type config =>
149 (guix-configuration
150 (inherit config)
151 (guix
152 (let ((guix (current-guix)))
153 (package
154 (inherit guix)
155 ;; Do not leak the local checkout URL.
156 (source (channel
157 (inherit %default-guix-channel)
158 (commit (guix-package-commit guix)))))))))))))
159
160 ;; Allow resolution of '.local' host names with mDNS.
161 (name-service-switch %mdns-host-lookup-nss))