aboutsummaryrefslogtreecommitdiff
path: root/gnu/system/examples/vm-image.tmpl
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2021-05-15 22:55:24 +0200
committerLudovic Courtès <ludo@gnu.org>2021-05-15 22:55:24 +0200
commit25487c3fe6a41dd62f6e53f256392224a3be2a08 (patch)
tree1051a1716d962ba0a7bbbf9dc8f7b67aa2674400 /gnu/system/examples/vm-image.tmpl
parent4a9597e4516ec5ca58df3e007fcd5ef1d3fd2e54 (diff)
parent46eac03e720e9b21d225e2ec1c41299c09202d18 (diff)
downloadguix-25487c3fe6a41dd62f6e53f256392224a3be2a08.tar
guix-25487c3fe6a41dd62f6e53f256392224a3be2a08.tar.gz
Merge branch 'master' into core-updates
Diffstat (limited to 'gnu/system/examples/vm-image.tmpl')
-rw-r--r--gnu/system/examples/vm-image.tmpl26
1 files changed, 25 insertions, 1 deletions
diff --git a/gnu/system/examples/vm-image.tmpl b/gnu/system/examples/vm-image.tmpl
index bcb2ba614c..697019e877 100644
--- a/gnu/system/examples/vm-image.tmpl
+++ b/gnu/system/examples/vm-image.tmpl
@@ -5,7 +5,7 @@
;;
(use-modules (gnu) (guix) (srfi srfi-1))
-(use-service-modules desktop networking ssh xorg)
+(use-service-modules desktop mcron networking spice ssh xorg)
(use-package-modules bootloaders certs fonts nvi
package-management wget xorg)
@@ -24,6 +24,18 @@ Run '\x1b[1;37minfo guix\x1b[0m' to browse documentation.
accounts.\x1b[0m
"))
+;;; XXX: Xfce does not implement what is needed for the SPICE dynamic
+;;; resolution to work (see:
+;;; https://gitlab.xfce.org/xfce/xfce4-settings/-/issues/142). Workaround it
+;;; by manually invoking xrandr every second.
+(define auto-update-resolution-crutch
+ #~(job '(next-second)
+ (lambda ()
+ (setenv "DISPLAY" ":0.0")
+ (setenv "XAUTHORITY" "/home/guest/.Xauthority")
+ (execl (string-append #$xrandr "/bin/xrandr") "xrandr" "-s" "0"))
+ #:user "guest"))
+
(operating-system
(host-name "gnu")
(timezone "Etc/UTC")
@@ -75,11 +87,23 @@ root ALL=(ALL) ALL
(default-user "guest")
(xorg-configuration
(xorg-configuration
+ ;; The QXL virtual GPU driver is added to provide
+ ;; a better SPICE experience.
+ (modules (cons xf86-video-qxl
+ %default-xorg-modules))
(keyboard-layout keyboard-layout)))))
;; Uncomment the line below to add an SSH server.
;;(service openssh-service-type)
+ ;; 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)
+
+ (simple-service 'cron-jobs mcron-service-type
+ (list auto-update-resolution-crutch))
+
;; Use the DHCP client service rather than NetworkManager.
(service dhcp-client-service-type))