diff options
| author | Maxim Cournoyer <maxim.cournoyer@gmail.com> | 2021-05-09 23:40:34 -0400 |
|---|---|---|
| committer | Maxim Cournoyer <maxim.cournoyer@gmail.com> | 2021-05-10 10:18:19 -0400 |
| commit | 945ad48cd8029fa77a643e00c7fd350e98cacca0 (patch) | |
| tree | 0ef4de6039c24e7c4ec7ddef68e337398a7c0035 /gnu | |
| parent | 3a0fcaa0fe721792d1543e863c3fba805376bdac (diff) | |
system: vm-image.tmpl: Add a crutch to allow refreshing the resolution.
Inspired by
https://github.com/jollheef/appvm/commit/1270b2e209bc002e69bbe6351ad5b04b7facfcc8.
The price to pay is about 5% of a CPU core usage in the guest in the worst
scenario.
* gnu/system/examples/vm-image.tmpl
(auto-update-resolution-crutch): New mcron job.
[services]: Extend the mcron-service with it.
Diffstat (limited to 'gnu')
| -rw-r--r-- | gnu/system/examples/vm-image.tmpl | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/gnu/system/examples/vm-image.tmpl b/gnu/system/examples/vm-image.tmpl index 1a2dfca4528..697019e877d 100644 --- a/gnu/system/examples/vm-image.tmpl +++ b/gnu/system/examples/vm-image.tmpl | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ;; | 5 | ;; |
| 6 | 6 | ||
| 7 | (use-modules (gnu) (guix) (srfi srfi-1)) | 7 | (use-modules (gnu) (guix) (srfi srfi-1)) |
| 8 | (use-service-modules desktop networking spice ssh xorg) | 8 | (use-service-modules desktop mcron networking spice ssh xorg) |
| 9 | (use-package-modules bootloaders certs fonts nvi | 9 | (use-package-modules bootloaders certs fonts nvi |
| 10 | package-management wget xorg) | 10 | package-management wget xorg) |
| 11 | 11 | ||
| @@ -24,6 +24,18 @@ Run '\x1b[1;37minfo guix\x1b[0m' to browse documentation. | |||
| 24 | accounts.\x1b[0m | 24 | accounts.\x1b[0m |
| 25 | ")) | 25 | ")) |
| 26 | 26 | ||
| 27 | ;;; XXX: Xfce does not implement what is needed for the SPICE dynamic | ||
| 28 | ;;; resolution to work (see: | ||
| 29 | ;;; https://gitlab.xfce.org/xfce/xfce4-settings/-/issues/142). Workaround it | ||
| 30 | ;;; by manually invoking xrandr every second. | ||
| 31 | (define auto-update-resolution-crutch | ||
| 32 | #~(job '(next-second) | ||
| 33 | (lambda () | ||
| 34 | (setenv "DISPLAY" ":0.0") | ||
| 35 | (setenv "XAUTHORITY" "/home/guest/.Xauthority") | ||
| 36 | (execl (string-append #$xrandr "/bin/xrandr") "xrandr" "-s" "0")) | ||
| 37 | #:user "guest")) | ||
| 38 | |||
| 27 | (operating-system | 39 | (operating-system |
| 28 | (host-name "gnu") | 40 | (host-name "gnu") |
| 29 | (timezone "Etc/UTC") | 41 | (timezone "Etc/UTC") |
| @@ -89,6 +101,9 @@ root ALL=(ALL) ALL | |||
| 89 | ;; integration with the host, etc. | 101 | ;; integration with the host, etc. |
| 90 | (service spice-vdagent-service-type) | 102 | (service spice-vdagent-service-type) |
| 91 | 103 | ||
| 104 | (simple-service 'cron-jobs mcron-service-type | ||
| 105 | (list auto-update-resolution-crutch)) | ||
| 106 | |||
| 92 | ;; Use the DHCP client service rather than NetworkManager. | 107 | ;; Use the DHCP client service rather than NetworkManager. |
| 93 | (service dhcp-client-service-type)) | 108 | (service dhcp-client-service-type)) |
| 94 | 109 | ||
