2022-12-15 13:39:35 -05:00
|
|
|
;; -*- mode: scheme; -*-
|
2019-04-26 05:39:53 -04:00
|
|
|
;; 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
|
|
|
|
;;
|
2017-05-13 20:44:36 -04:00
|
|
|
|
2019-04-30 17:12:03 -04:00
|
|
|
(use-modules (gnu) (guix) (srfi srfi-1))
|
2022-01-06 21:43:47 -05:00
|
|
|
(use-service-modules desktop mcron networking spice ssh xorg sddm)
|
2024-04-18 09:33:19 -04:00
|
|
|
(use-package-modules bootloaders fonts
|
2023-10-24 09:03:46 -04:00
|
|
|
package-management xdisorg xorg)
|
2017-05-13 20:44:36 -04:00
|
|
|
|
|
|
|
(define vm-image-motd (plain-file "motd" "
|
2019-04-26 05:39:53 -04:00
|
|
|
\x1b[1;37mThis is the GNU system. Welcome!\x1b[0m
|
2017-05-13 20:44:36 -04:00
|
|
|
|
2019-04-26 05:39:53 -04:00
|
|
|
This instance of Guix is a template for virtualized environments.
|
|
|
|
You can reconfigure the whole system by adjusting /etc/config.scm
|
|
|
|
and running:
|
2017-05-13 20:44:36 -04:00
|
|
|
|
2019-04-26 05:39:53 -04:00
|
|
|
guix system reconfigure /etc/config.scm
|
|
|
|
|
2019-04-27 08:58:27 -04:00
|
|
|
Run '\x1b[1;37minfo guix\x1b[0m' to browse documentation.
|
|
|
|
|
2019-04-26 05:39:53 -04:00
|
|
|
\x1b[1;33mConsider setting a password for the 'root' and 'guest' \
|
|
|
|
accounts.\x1b[0m
|
|
|
|
"))
|
|
|
|
|
2017-05-13 20:44:36 -04:00
|
|
|
(operating-system
|
|
|
|
(host-name "gnu")
|
|
|
|
(timezone "Etc/UTC")
|
|
|
|
(locale "en_US.utf8")
|
2019-04-26 05:39:53 -04:00
|
|
|
(keyboard-layout (keyboard-layout "us" "altgr-intl"))
|
2017-05-13 20:44:36 -04:00
|
|
|
|
2019-04-30 17:12:03 -04:00
|
|
|
;; Label for the GRUB boot menu.
|
2022-08-09 05:48:52 -04:00
|
|
|
(label (string-append "GNU Guix "
|
|
|
|
(or (getenv "GUIX_DISPLAYED_VERSION")
|
|
|
|
(package-version guix))))
|
2019-04-30 17:12:03 -04:00
|
|
|
|
2019-01-21 13:37:59 -05:00
|
|
|
(firmware '())
|
2018-12-11 09:42:56 -05:00
|
|
|
|
2019-04-26 05:39:53 -04:00
|
|
|
;; Below we assume /dev/vda is the VM's hard disk.
|
|
|
|
;; Adjust as needed.
|
2017-09-02 19:19:38 -04:00
|
|
|
(bootloader (bootloader-configuration
|
|
|
|
(bootloader grub-bootloader)
|
2021-08-07 15:07:47 -04:00
|
|
|
(targets '("/dev/vda"))
|
2017-09-02 19:19:38 -04:00
|
|
|
(terminal-outputs '(console))))
|
2017-05-13 20:44:36 -04:00
|
|
|
(file-systems (cons (file-system
|
|
|
|
(mount-point "/")
|
2019-04-26 05:39:53 -04:00
|
|
|
(device "/dev/vda1")
|
2017-05-13 20:44:36 -04:00
|
|
|
(type "ext4"))
|
|
|
|
%base-file-systems))
|
|
|
|
|
2019-04-26 05:39:53 -04:00
|
|
|
(users (cons (user-account
|
|
|
|
(name "guest")
|
|
|
|
(comment "GNU Guix Live")
|
2023-10-24 09:03:46 -04:00
|
|
|
(password "") ;no password
|
2019-04-26 05:39:53 -04:00
|
|
|
(group "users")
|
|
|
|
(supplementary-groups '("wheel" "netdev"
|
|
|
|
"audio" "video")))
|
|
|
|
%base-user-accounts))
|
|
|
|
|
2019-04-27 09:07:31 -04:00
|
|
|
;; 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"))
|
|
|
|
|
2023-10-24 09:03:46 -04:00
|
|
|
(packages
|
2024-04-18 09:33:19 -04:00
|
|
|
(append (list font-bitstream-vera
|
2023-10-24 09:03:46 -04:00
|
|
|
;; Auto-started script providing SPICE dynamic resizing for
|
|
|
|
;; Xfce (see:
|
|
|
|
;; https://gitlab.xfce.org/xfce/xfce4-settings/-/issues/142).
|
|
|
|
x-resize)
|
|
|
|
%base-packages))
|
2019-04-26 05:39:53 -04:00
|
|
|
|
|
|
|
(services
|
|
|
|
(append (list (service xfce-desktop-service-type)
|
|
|
|
|
|
|
|
;; 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
|
2021-05-05 12:07:39 -04:00
|
|
|
;; The QXL virtual GPU driver is added to provide
|
|
|
|
;; a better SPICE experience.
|
|
|
|
(modules (cons xf86-video-qxl
|
|
|
|
%default-xorg-modules))
|
2019-04-26 12:24:55 -04:00
|
|
|
(keyboard-layout keyboard-layout)))))
|
2019-04-26 05:39:53 -04:00
|
|
|
|
2019-04-27 04:15:34 -04:00
|
|
|
;; Uncomment the line below to add an SSH server.
|
|
|
|
;;(service openssh-service-type)
|
|
|
|
|
2021-05-05 12:07:39 -04:00
|
|
|
;; Add support for the SPICE protocol, which enables dynamic
|
|
|
|
;; resizing of the guest screen resolution, clipboard
|
|
|
|
;; integration with the host, etc.
|
|
|
|
(service spice-vdagent-service-type)
|
|
|
|
|
2019-04-26 12:24:55 -04:00
|
|
|
;; Use the DHCP client service rather than NetworkManager.
|
|
|
|
(service dhcp-client-service-type))
|
|
|
|
|
2022-01-06 21:43:47 -05:00
|
|
|
;; Remove some services that don't make sense in a VM.
|
2019-04-26 05:39:53 -04:00
|
|
|
(remove (lambda (service)
|
2019-04-26 12:24:55 -04:00
|
|
|
(let ((type (service-kind service)))
|
2019-05-16 08:37:23 -04:00
|
|
|
(or (memq type
|
|
|
|
(list gdm-service-type
|
2022-01-06 21:43:47 -05:00
|
|
|
sddm-service-type
|
2019-05-16 08:37:23 -04:00
|
|
|
wpa-supplicant-service-type
|
|
|
|
cups-pk-helper-service-type
|
2019-05-16 08:42:40 -04:00
|
|
|
network-manager-service-type
|
|
|
|
modem-manager-service-type))
|
2019-05-16 08:37:23 -04:00
|
|
|
(eq? 'network-manager-applet
|
|
|
|
(service-type-name type)))))
|
2019-04-26 05:39:53 -04:00
|
|
|
(modify-services %desktop-services
|
|
|
|
(login-service-type config =>
|
|
|
|
(login-configuration
|
|
|
|
(inherit config)
|
2022-08-09 04:46:07 -04:00
|
|
|
(motd vm-image-motd)))
|
|
|
|
|
|
|
|
;; Install and run the current Guix rather than an older
|
|
|
|
;; snapshot.
|
|
|
|
(guix-service-type config =>
|
|
|
|
(guix-configuration
|
|
|
|
(inherit config)
|
|
|
|
(guix (current-guix))))))))
|
2019-04-26 05:39:53 -04:00
|
|
|
|
|
|
|
;; Allow resolution of '.local' host names with mDNS.
|
|
|
|
(name-service-switch %mdns-host-lookup-nss))
|