projects/guix·blob javascript-team · refs

145 lines · 5.5 KiB

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(operating-system
34 (host-name "gnu")
35 (timezone "Etc/UTC")
36 (locale "en_US.utf8")
37 (keyboard-layout (keyboard-layout "us" "altgr-intl"))
38
39 ;; Label for the GRUB boot menu.
40 (label (string-append "GNU Guix "
41 (or (getenv "GUIX_DISPLAYED_VERSION")
42 (package-version guix))))
43
44 (firmware '())
45
46 ;; On AArch64, support SCSI CDROMs and HDs.
47 (initrd-modules (cons* "sd_mod" "sr_mod"
48 %base-initrd-modules))
49
50 (bootloader
51 (bootloader-configuration
52 (bootloader grub-efi-bootloader)
53 (targets '("/boot/efi"))
54 (terminal-outputs '(console))))
55 (file-systems (cons* (file-system
56 (mount-point "/")
57 (device (file-system-label root-label))
58 (type "ext4"))
59 (file-system
60 (mount-point "/boot/efi")
61 (device (file-system-label "GNU-ESP"))
62 (type "vfat"))
63 %base-file-systems))
64
65 (users (cons (user-account
66 (name "guest")
67 (comment "GNU Guix Live")
68 (password "") ;no password
69 (group "users")
70 (supplementary-groups '("wheel" "netdev"
71 "audio" "video")))
72 %base-user-accounts))
73
74 ;; Our /etc/sudoers file. Since 'guest' initially has an empty password,
75 ;; allow for password-less sudo.
76 (sudoers-file (plain-file "sudoers" "\
77root ALL=(ALL) ALL
78%wheel ALL=NOPASSWD: ALL\n"))
79
80 (pam-services
81 ;; Explicitly allow for empty passwords.
82 (base-pam-services #:allow-empty-passwords? #t))
83
84 (packages
85 (append (list font-bitstream-vera
86 ;; Auto-started script providing SPICE dynamic resizing for
87 ;; Xfce (see:
88 ;; https://gitlab.xfce.org/xfce/xfce4-settings/-/issues/142).
89 x-resize)
90 %base-packages))
91
92 (services
93 (append (list (service xfce-desktop-service-type)
94
95 ;; Choose SLiM, which is lighter than the default GDM.
96 (service slim-service-type
97 (slim-configuration
98 (auto-login? #t)
99 (default-user "guest")
100 (xorg-configuration
101 (xorg-configuration
102 ;; The QXL virtual GPU driver is added to provide
103 ;; a better SPICE experience.
104 (modules (cons xf86-video-qxl
105 %default-xorg-modules))
106 (keyboard-layout keyboard-layout)))))
107
108 ;; Uncomment the line below to add an SSH server.
109 ;;(service openssh-service-type)
110
111 ;; Add support for the SPICE protocol, which enables dynamic
112 ;; resizing of the guest screen resolution, clipboard
113 ;; integration with the host, etc.
114 (service spice-vdagent-service-type)
115
116 ;; Use the DHCP client service rather than NetworkManager.
117 (service dhcpcd-service-type))
118
119 ;; Remove some services that don't make sense in a VM.
120 (remove (lambda (service)
121 (let ((type (service-kind service)))
122 (or (memq type
123 (list gdm-service-type
124 sddm-service-type
125 wpa-supplicant-service-type
126 cups-pk-helper-service-type
127 network-manager-service-type
128 modem-manager-service-type))
129 (eq? 'network-manager-applet
130 (service-type-name type)))))
131 (modify-services %desktop-services
132 (login-service-type config =>
133 (login-configuration
134 (inherit config)
135 (motd vm-image-motd)))
136
137 ;; Install and run the current Guix rather than an older
138 ;; snapshot.
139 (guix-service-type config =>
140 (guix-configuration
141 (inherit config)
142 (guix (current-guix))))))))
143
144 ;; Allow resolution of '.local' host names with mDNS.
145 (name-service-switch %mdns-host-lookup-nss))