[RFC PATCH v2 09/10] vm/app: add hello-wayland demo VM

Alyssa Ross
2022-09-30T21:36:24Z

hello-wayland is the simplest possible Wayland client. This VM is
used to demonstrate Spectrum's new Wayland capabilities.

Signed-off-by: Alyssa Ross <alyssa.ross@unikie.com>
---
host/initramfs/extfs.nix | 3 +++
vm/app/hello-wayland.nix | 25 +++++++++++++++++++++++++
2 files changed, 28 insertions(+)
create mode 100644 vm/app/hello-wayland.nix

diff --git a/host/initramfs/extfs.nix b/host/initramfs/extfs.nix
index bfaaf17..3c4ac1c 100644
--- a/host/initramfs/extfs.nix
+++ b/host/initramfs/extfs.nix
@@ -10,6 +10,7 @@ let
};

appvm-catgirl = import ../../vm/app/catgirl.nix { inherit config; };
+ appvm-hello-wayland = import ../../vm/app/hello-wayland.nix { inherit config; };
appvm-lynx = import ../../vm/app/lynx.nix { inherit config; };
in

@@ -22,6 +23,8 @@ runCommand "ext.ext4" {
chmod +w svc/data
tar -C ${appvm-catgirl} -c data | tar -C svc -x
chmod +w svc/data
+ tar -C ${appvm-hello-wayland} -c data | tar -C svc -x
+ chmod +w svc/data
tar -C ${appvm-lynx} -c data | tar -C svc -x

tar -cf ext.tar svc
diff --git a/vm/app/hello-wayland.nix b/vm/app/hello-wayland.nix
new file mode 100644
index 0000000..410220d
--- /dev/null
+++ b/vm/app/hello-wayland.nix
@@ -0,0 +1,25 @@
+# SPDX-License-Identifier: MIT
+# SPDX-FileCopyrightText: 2022 Unikie
+
+{ config ? import ../../../nix/eval-config.nix {} }:
+
+import ../../vm-lib/make-vm.nix { inherit config; } {
+ name = "appvm-hello-wayland";
+ wayland = true;
+ run = config.pkgs.callPackage (
+ { writeScript, hello-wayland, wayland-proxy-virtwl }:
+ writeScript "run-hello-wayland" ''
+ #!/bin/execlineb -P
+ if { modprobe virtio-gpu }
+ foreground { ln -ns /run/ext /run/opengl-driver }
+ foreground { mkdir /run/user }
+ foreground {
+ umask 077
+ mkdir /run/user/0
+ }
+ export XDG_RUNTIME_DIR /run/user/0
+ ${wayland-proxy-virtwl}/bin/wayland-proxy-virtwl --virtio-gpu
+ ${hello-wayland}/bin/hello-wayland
+ ''
+ ) { };
+}
--
2.37.1