projects/guix·blob python-team · refs

135 lines · 5.1 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 packages package-management)
14 (gnu system image))
15(use-service-modules desktop mcron networking spice ssh xorg sddm)
16(use-package-modules bootloaders fonts
17 package-management xdisorg xorg)
18
19(define vm-image-motd (plain-file "motd" "
20\x1b[1;37mThis is the GNU system. Welcome!\x1b[0m
21
22This instance of Guix is a template for virtualized environments.
23You can reconfigure the whole system by adjusting /etc/config.scm
24and running:
25
26 guix system reconfigure /etc/config.scm
27
28Run '\x1b[1;37minfo guix\x1b[0m' to browse documentation.
29
30\x1b[1;33mConsider setting a password for the 'root' and 'guest' \
31accounts.\x1b[0m
32"))
33
34(operating-system
35 (host-name "gnu")
36 (timezone "Etc/UTC")
37 (locale "en_US.utf8")
38 (keyboard-layout (keyboard-layout "us" "altgr-intl"))
39
40 ;; Label for the GRUB boot menu.
41 (label (string-append "GNU Guix "
42 (or (getenv "GUIX_DISPLAYED_VERSION")
43 (package-version guix))))
44
45 (firmware '())
46
47 ;; Below we assume /dev/vda is the VM's hard disk.
48 ;; Adjust as needed.
49 (bootloader (bootloader-configuration
50 (bootloader grub-bootloader)
51 (targets '("/dev/vda"))
52 (terminal-outputs '(console))))
53 (file-systems (cons (file-system
54 (mount-point "/")
55 (device (file-system-label root-label))
56 (type "ext4"))
57 %base-file-systems))
58
59 (users (cons (user-account
60 (name "guest")
61 (comment "GNU Guix Live")
62 (password "") ;no password
63 (group "users")
64 (supplementary-groups '("wheel" "netdev"
65 "audio" "video")))
66 %base-user-accounts))
67
68 ;; Our /etc/sudoers file. Since 'guest' initially has an empty password,
69 ;; allow for password-less sudo.
70 (sudoers-file (plain-file "sudoers" "\
71root ALL=(ALL) ALL
72%wheel ALL=NOPASSWD: ALL\n"))
73
74 (pam-services
75 ;; Explicitly allow for empty passwords.
76 (base-pam-services #:allow-empty-passwords? #t))
77
78 (packages
79 (append (list font-bitstream-vera)
80 %base-packages))
81
82 (services
83 (append (list (service xfce-desktop-service-type)
84
85 ;; Choose SLiM, which is lighter than the default GDM.
86 (service slim-service-type
87 (slim-configuration
88 (auto-login? #t)
89 (default-user "guest")
90 (xorg-configuration
91 (xorg-configuration
92 ;; The QXL virtual GPU driver is added to provide
93 ;; a better SPICE experience.
94 (modules (cons xf86-video-qxl
95 %default-xorg-modules))
96 (keyboard-layout keyboard-layout)))))
97
98 ;; Uncomment the line below to add an SSH server.
99 ;;(service openssh-service-type)
100
101 ;; Add support for the SPICE protocol, which enables dynamic
102 ;; resizing of the guest screen resolution, clipboard
103 ;; integration with the host, etc.
104 (service spice-vdagent-service-type)
105
106 ;; Use the DHCP client service rather than NetworkManager.
107 (service dhcpcd-service-type))
108
109 ;; Remove some services that don't make sense in a VM.
110 (remove (lambda (service)
111 (let ((type (service-kind service)))
112 (or (memq type
113 (list gdm-service-type
114 sddm-service-type
115 wpa-supplicant-service-type
116 cups-pk-helper-service-type
117 network-manager-service-type
118 modem-manager-service-type))
119 (eq? 'network-manager-applet
120 (service-type-name type)))))
121 (modify-services %desktop-services
122 (login-service-type config =>
123 (login-configuration
124 (inherit config)
125 (motd vm-image-motd)))
126
127 ;; Install and run the current Guix rather than an older
128 ;; snapshot.
129 (guix-service-type config =>
130 (guix-configuration
131 (inherit config)
132 (guix (current-guix))))))))
133
134 ;; Allow resolution of '.local' host names with mDNS.
135 (name-service-switch %mdns-host-lookup-nss))