* [PATCH v3 1/6] img/app: allow waiting for GPU to appear
2023-07-21 18:00 [PATCH v3 0/6] Initial support for VM Wayland Alyssa Ross
@ 2023-07-21 18:00 ` Alyssa Ross
2023-07-28 12:10 ` Alyssa Ross
2023-07-21 18:00 ` [PATCH v3 2/6] vm-lib: add mesa drivers to VM Alyssa Ross
` (4 subsequent siblings)
5 siblings, 1 reply; 13+ messages in thread
From: Alyssa Ross @ 2023-07-21 18:00 UTC (permalink / raw)
To: devel
This will be important for Wayland applications.
Signed-off-by: Alyssa Ross <hi@alyssa.is>
---
img/app/etc/mdev.conf | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/img/app/etc/mdev.conf b/img/app/etc/mdev.conf
index e370da8..2a3882b 100644
--- a/img/app/etc/mdev.conf
+++ b/img/app/etc/mdev.conf
@@ -1,6 +1,7 @@
# SPDX-License-Identifier: EUPL-1.2+
-# SPDX-FileCopyrightText: 2021-2022 Alyssa Ross <hi@alyssa.is>
+# SPDX-FileCopyrightText: 2021-2023 Alyssa Ross <hi@alyssa.is>
-$MODALIAS=.* 0:0 660 +importas -iu MODALIAS MODALIAS modprobe -q $MODALIAS
$INTERFACE=.* 0:0 660 ! +/etc/mdev/iface
$MODALIAS=virtio:d0000001Av.* 0:0 660 ! +/etc/mdev/virtiofs
+dri/card0 0:0 660 +background { /etc/mdev/listen card0 }
--
2.40.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v3 2/6] vm-lib: add mesa drivers to VM
2023-07-21 18:00 [PATCH v3 0/6] Initial support for VM Wayland Alyssa Ross
2023-07-21 18:00 ` [PATCH v3 1/6] img/app: allow waiting for GPU to appear Alyssa Ross
@ 2023-07-21 18:00 ` Alyssa Ross
2023-07-28 12:10 ` Alyssa Ross
2023-07-21 18:00 ` [PATCH v3 3/6] img/app: add support for testing virtio-gpu Alyssa Ross
` (3 subsequent siblings)
5 siblings, 1 reply; 13+ messages in thread
From: Alyssa Ross @ 2023-07-21 18:00 UTC (permalink / raw)
To: devel
From: Alyssa Ross <alyssa.ross@unikie.com>
Signed-off-by: Alyssa Ross <alyssa.ross@unikie.com>
Signed-off-by: Alyssa Ross <hi@alyssa.is>
---
vm-lib/make-vm.nix | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/vm-lib/make-vm.nix b/vm-lib/make-vm.nix
index 85a0ce6..80e6ef5 100644
--- a/vm-lib/make-vm.nix
+++ b/vm-lib/make-vm.nix
@@ -33,7 +33,8 @@ runCommand "spectrum-vm" {
mkdir -p "$out"/{blk,providers,shared-dirs}
${../scripts/make-erofs.sh} -L ext -- "$out/blk/run.img" ${run} run \
- $(comm -23 <(sort ${writeReferencesToFile run}) \
+ ${pkgs.pkgsMusl.mesa.drivers} / \
+ $(comm -23 <(sort ${writeReferencesToFile run} ${writeReferencesToFile pkgs.pkgsMusl.mesa.drivers}) \
<(sort ${writeReferencesToFile basePaths}) | sed p)
pushd "$out"
--
2.40.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v3 3/6] img/app: add support for testing virtio-gpu
2023-07-21 18:00 [PATCH v3 0/6] Initial support for VM Wayland Alyssa Ross
2023-07-21 18:00 ` [PATCH v3 1/6] img/app: allow waiting for GPU to appear Alyssa Ross
2023-07-21 18:00 ` [PATCH v3 2/6] vm-lib: add mesa drivers to VM Alyssa Ross
@ 2023-07-21 18:00 ` Alyssa Ross
2023-07-28 12:10 ` Alyssa Ross
2023-07-21 18:00 ` [PATCH v3 4/6] vm: add support for testing in crosvm Alyssa Ross
` (2 subsequent siblings)
5 siblings, 1 reply; 13+ messages in thread
From: Alyssa Ross @ 2023-07-21 18:00 UTC (permalink / raw)
To: devel
From: Alyssa Ross <alyssa.ross@unikie.com>
crosvm sadly doesn't support socket activation or readiness
notification, hence the sleep loop here.
Signed-off-by: Alyssa Ross <alyssa.ross@unikie.com>
Signed-off-by: Alyssa Ross <hi@alyssa.is>
---
img/app/Makefile | 13 ++++++++++++-
img/app/shell.nix | 2 +-
lib/common.mk | 2 ++
3 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/img/app/Makefile b/img/app/Makefile
index 1ea0d66..0742440 100644
--- a/img/app/Makefile
+++ b/img/app/Makefile
@@ -1,5 +1,6 @@
# SPDX-License-Identifier: EUPL-1.2+
# SPDX-FileCopyrightText: 2021-2023 Alyssa Ross <hi@alyssa.is>
+# SPDX-FileCopyrightText: 2022 Unikie
include ../../lib/common.mk
@@ -77,6 +78,15 @@ build/etc/s6-rc: $(VM_S6_RC_FILES)
s6-rc-compile $@ $$dir; \
exit=$$?; rm -r $$dir; exit $$exit
+start-vhost-user-gpu:
+ rm -f build/vhost-user-gpu.sock
+ $(CROSVM_DEVICE_GPU) \
+ --socket build/vhost-user-gpu.sock \
+ --wayland-sock "$$XDG_RUNTIME_DIR/$$WAYLAND_DISPLAY" \
+ --params '{"context-types":"cross-domain"}' &
+ while ! [ -S build/vhost-user-gpu.sock ] && sleep .1; do :; done
+.PHONY: start-vhost-user-gpu
+
start-virtiofsd:
mkdir -p build
$(S6_IPCSERVER_SOCKETBINDER) -B build/virtiofsd.sock \
@@ -100,7 +110,7 @@ run-qemu: $(imgdir)/appvm/blk/root.img start-virtiofsd
-device virtconsole,chardev=virtiocon0
.PHONY: run-qemu
-run-cloud-hypervisor: $(imgdir)/appvm/blk/root.img start-virtiofsd
+run-cloud-hypervisor: $(imgdir)/appvm/blk/root.img start-vhost-user-gpu start-virtiofsd
rm -f build/vmm.sock
@../../scripts/run-cloud-hypervisor.sh \
--api-socket path=build/vmm.sock \
@@ -108,6 +118,7 @@ run-cloud-hypervisor: $(imgdir)/appvm/blk/root.img start-virtiofsd
--disk path=$(imgdir)/appvm/blk/root.img,readonly=on \
--disk path=$(RUN_IMG),readonly=on \
--fs tag=virtiofs0,socket=build/virtiofsd.sock \
+ --gpu socket=build/vhost-user-gpu.sock \
--kernel $(KERNEL) \
--cmdline "root=PARTLABEL=root" \
--console tty \
diff --git a/img/app/shell.nix b/img/app/shell.nix
index ba75fcc..0c94f1d 100644
--- a/img/app/shell.nix
+++ b/img/app/shell.nix
@@ -15,7 +15,7 @@ with config.pkgs;
# so we have to list virtiofsd first.
virtiofsd
- cloud-hypervisor execline jq qemu_kvm reuse s6
+ cloud-hypervisor crosvm execline jq qemu_kvm reuse s6
];
runDef = import run { inherit config; };
diff --git a/lib/common.mk b/lib/common.mk
index e32fecb..81754b9 100644
--- a/lib/common.mk
+++ b/lib/common.mk
@@ -11,6 +11,8 @@ QEMU_KVM = qemu-kvm
BACKGROUND = background
CPIO = cpio
CPIOFLAGS = --reproducible -R +0:+0 -H newc
+CROSVM = crosvm
+CROSVM_DEVICE_GPU = $(CROSVM) device gpu
MCOPY = mcopy
MKFS_FAT = mkfs.fat
MMD = mmd
--
2.40.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v3 4/6] vm: add support for testing in crosvm
2023-07-21 18:00 [PATCH v3 0/6] Initial support for VM Wayland Alyssa Ross
` (2 preceding siblings ...)
2023-07-21 18:00 ` [PATCH v3 3/6] img/app: add support for testing virtio-gpu Alyssa Ross
@ 2023-07-21 18:00 ` Alyssa Ross
2023-07-28 12:10 ` Alyssa Ross
2023-07-21 18:00 ` [PATCH v3 5/6] host: add support for Wayland in VMs Alyssa Ross
2023-07-21 18:00 ` [PATCH v3 6/6] vm/app: add hello-wayland demo VM Alyssa Ross
5 siblings, 1 reply; 13+ messages in thread
From: Alyssa Ross @ 2023-07-21 18:00 UTC (permalink / raw)
To: devel
From: Alyssa Ross <alyssa.ross@unikie.com>
This is useful because it allows comparing how our patched
cloud-hypervisor behaves against crosvm's implementation.
Signed-off-by: Alyssa Ross <alyssa.ross@unikie.com>
Co-authored-by: Alyssa Ross <hi@alyssa.is>
Signed-off-by: Alyssa Ross <hi@alyssa.is>
---
img/app/Makefile | 12 ++++++++++++
lib/common.mk | 1 +
vm/sys/net/Makefile | 11 +++++++++++
vm/sys/net/shell.nix | 2 +-
4 files changed, 25 insertions(+), 1 deletion(-)
diff --git a/img/app/Makefile b/img/app/Makefile
index 0742440..35db476 100644
--- a/img/app/Makefile
+++ b/img/app/Makefile
@@ -125,6 +125,18 @@ run-cloud-hypervisor: $(imgdir)/appvm/blk/root.img start-vhost-user-gpu start-vi
--serial pty
.PHONY: run-cloud-hypervisor
+run-crosvm: $(imgdir)/appvm/blk/root.img start-vhost-user-gpu start-virtiofsd
+ $(CROSVM_RUN) \
+ --disk $(imgdir)/appvm/blk/root.img \
+ --disk $(RUN_IMG) \
+ -p "console=ttyS0 root=PARTLABEL=root" \
+ --vhost-user-fs build/virtiofsd.sock:virtiofs0 \
+ --vhost-user-gpu build/vhost-user-gpu.sock \
+ --serial type=file,hardware=serial,path=build/crosvm.log \
+ --serial type=stdout,hardware=virtio-console,stdin=true \
+ $(KERNEL)
+.PHONY: run-crosvm
+
run: run-$(VMM)
.PHONY: run
diff --git a/lib/common.mk b/lib/common.mk
index 81754b9..bba7f22 100644
--- a/lib/common.mk
+++ b/lib/common.mk
@@ -13,6 +13,7 @@ CPIO = cpio
CPIOFLAGS = --reproducible -R +0:+0 -H newc
CROSVM = crosvm
CROSVM_DEVICE_GPU = $(CROSVM) device gpu
+CROSVM_RUN = $(CROSVM) run
MCOPY = mcopy
MKFS_FAT = mkfs.fat
MMD = mmd
diff --git a/vm/sys/net/Makefile b/vm/sys/net/Makefile
index bbeb40b..d31477a 100644
--- a/vm/sys/net/Makefile
+++ b/vm/sys/net/Makefile
@@ -119,6 +119,17 @@ run-cloud-hypervisor: build/host/data/netvm/blk/root.img
--serial pty
.PHONY: run-cloud-hypervisor
+run-crosvm: build/host/data/netvm/blk/root.img
+ $(CROSVM_RUN) \
+ --disk build/host/data/netvm/blk/root.img \
+ -p "console=ttyS0 root=PARTLABEL=root" \
+ --net tap-name=tap0 \
+ --net tap-name=tap1,mac=0A:B3:EC:80:00:00 \
+ --serial type=file,hardware=serial,path=build/crosvm.log \
+ --serial type=stdout,hardware=virtio-console,stdin=true \
+ $(KERNEL)
+.PHONY: run-crosvm
+
run: run-$(VMM)
.PHONY: run
diff --git a/vm/sys/net/shell.nix b/vm/sys/net/shell.nix
index 7710438..39ba520 100644
--- a/vm/sys/net/shell.nix
+++ b/vm/sys/net/shell.nix
@@ -7,5 +7,5 @@ import ../../../lib/eval-config.nix ({ config, ... }: with config.pkgs;
{ nativeBuildInputs ? [], ... }:
{
- nativeBuildInputs = nativeBuildInputs ++ [ cloud-hypervisor jq qemu_kvm reuse ];
+ nativeBuildInputs = nativeBuildInputs ++ [ cloud-hypervisor crosvm jq qemu_kvm reuse ];
}))
--
2.40.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v3 5/6] host: add support for Wayland in VMs
2023-07-21 18:00 [PATCH v3 0/6] Initial support for VM Wayland Alyssa Ross
` (3 preceding siblings ...)
2023-07-21 18:00 ` [PATCH v3 4/6] vm: add support for testing in crosvm Alyssa Ross
@ 2023-07-21 18:00 ` Alyssa Ross
2023-07-28 12:10 ` Alyssa Ross
2023-07-21 18:00 ` [PATCH v3 6/6] vm/app: add hello-wayland demo VM Alyssa Ross
5 siblings, 1 reply; 13+ messages in thread
From: Alyssa Ross @ 2023-07-21 18:00 UTC (permalink / raw)
To: devel
From: Alyssa Ross <alyssa.ross@unikie.com>
When a VM is configured with Wayland support, the ext-rc-init service
will create an additional service to supervise the crosvm GPU backend,
and start-vm will pass the required arguments to cloud-hypervisor to
tell it how to connect to crosvm.
Signed-off-by: Alyssa Ross <alyssa.ross@unikie.com>
Signed-off-by: Alyssa Ross <hi@alyssa.is>
---
Documentation/using-spectrum/creating-vms.adoc | 5 +++++
host/rootfs/Makefile | 4 ++++
host/rootfs/default.nix | 6 +++---
host/rootfs/etc/s6-rc/ext-rc-init/up | 7 +++++++
host/rootfs/etc/template/gpu/data/check | 5 +++++
host/rootfs/etc/template/gpu/notification-fd | 1 +
host/rootfs/etc/template/gpu/notification-fd.license | 2 ++
host/rootfs/etc/template/gpu/run | 9 +++++++++
host/rootfs/etc/template/gpu/type | 1 +
host/rootfs/etc/template/gpu/type.license | 2 ++
host/start-vm/lib.rs | 10 ++++++++++
vm-lib/make-vm.nix | 9 ++++++++-
12 files changed, 57 insertions(+), 4 deletions(-)
create mode 100755 host/rootfs/etc/template/gpu/data/check
create mode 100644 host/rootfs/etc/template/gpu/notification-fd
create mode 100644 host/rootfs/etc/template/gpu/notification-fd.license
create mode 100755 host/rootfs/etc/template/gpu/run
create mode 100644 host/rootfs/etc/template/gpu/type
create mode 100644 host/rootfs/etc/template/gpu/type.license
diff --git a/Documentation/using-spectrum/creating-vms.adoc b/Documentation/using-spectrum/creating-vms.adoc
index f7560f0..9e37856 100644
--- a/Documentation/using-spectrum/creating-vms.adoc
+++ b/Documentation/using-spectrum/creating-vms.adoc
@@ -3,6 +3,7 @@
:page-nav_order: 2
// SPDX-FileCopyrightText: 2022 Alyssa Ross <hi@alyssa.is>
+// SPDX-FileCopyrightText: 2022 Unikie
// SPDX-License-Identifier: GFDL-1.3-no-invariants-or-later OR CC-BY-SA-4.0
== Configuration
@@ -33,6 +34,10 @@ providers/net:: A directory containing a file named for each VM that
should provide networking to this VM. The contents of these files are
ignored.
+wayland:: An empty file, whose presence indicates that the host should
+set up a virtio-gpu device supporting the cross-domain context type,
+for the VM to send Wayland messages over.
+
=== Example
A configuration directory for a VM called "appvm-lynx" dedicated to
diff --git a/host/rootfs/Makefile b/host/rootfs/Makefile
index be31fc3..64decbc 100644
--- a/host/rootfs/Makefile
+++ b/host/rootfs/Makefile
@@ -27,6 +27,10 @@ FILES = \
etc/template/fs/notification-fd \
etc/template/fs/run \
etc/template/fs/type \
+ etc/template/gpu/data/check \
+ etc/template/gpu/notification-fd \
+ etc/template/gpu/run \
+ etc/template/gpu/type \
etc/xdg/weston/autolaunch \
etc/xdg/weston/weston.ini \
usr/bin/lsvm \
diff --git a/host/rootfs/default.nix b/host/rootfs/default.nix
index 85a1331..16477f4 100644
--- a/host/rootfs/default.nix
+++ b/host/rootfs/default.nix
@@ -46,8 +46,8 @@ let
foot = pkgsGui.foot.override { allowPgo = false; };
packages = [
- cloud-hypervisor e2fsprogs execline jq kmod mdevd s6 s6-linux-init s6-rc
- socat start-vm virtiofsd
+ cloud-hypervisor e2fsprogs execline jq kmod mdevd
+ s6 s6-linux-init s6-rc socat start-vm virtiofsd
(cryptsetup.override {
programs = {
@@ -73,7 +73,7 @@ let
CONFIG_RMMOD n
'';
})
- ] ++ (with pkgsGui; [ foot westonLite ]);
+ ] ++ (with pkgsGui; [ crosvm foot westonLite ]);
nixosAllHardware = nixos ({ modulesPath, ... }: {
imports = [ (modulesPath + "/profiles/all-hardware.nix") ];
diff --git a/host/rootfs/etc/s6-rc/ext-rc-init/up b/host/rootfs/etc/s6-rc/ext-rc-init/up
index 8b5c29e..cd5d2d0 100644
--- a/host/rootfs/etc/s6-rc/ext-rc-init/up
+++ b/host/rootfs/etc/s6-rc/ext-rc-init/up
@@ -26,6 +26,13 @@ if {
touch -- ${name}/dependencies.d/${name}-fs-${fsname}
}
+ if {
+ if -t { test -e ${dir}/wayland }
+ if { cp -R -- /etc/template/gpu ${name}-gpu }
+ if { mkdir -- ${name}-gpu/env }
+ touch -- ${name}/dependencies.d/${name}-gpu
+ }
+
elglob -0 paths /ext/svc/data/${name}/providers/net/*
forx -po0 -E path { $paths }
backtick -E dep { basename -- $path }
diff --git a/host/rootfs/etc/template/gpu/data/check b/host/rootfs/etc/template/gpu/data/check
new file mode 100755
index 0000000..113dcf0
--- /dev/null
+++ b/host/rootfs/etc/template/gpu/data/check
@@ -0,0 +1,5 @@
+#!/bin/execlineb -P
+# SPDX-License-Identifier: EUPL-1.2+
+# SPDX-FileCopyrightText: 2022 Unikie
+
+test -S env/crosvm.sock
diff --git a/host/rootfs/etc/template/gpu/notification-fd b/host/rootfs/etc/template/gpu/notification-fd
new file mode 100644
index 0000000..00750ed
--- /dev/null
+++ b/host/rootfs/etc/template/gpu/notification-fd
@@ -0,0 +1 @@
+3
diff --git a/host/rootfs/etc/template/gpu/notification-fd.license b/host/rootfs/etc/template/gpu/notification-fd.license
new file mode 100644
index 0000000..2241beb
--- /dev/null
+++ b/host/rootfs/etc/template/gpu/notification-fd.license
@@ -0,0 +1,2 @@
+SPDX-License-Identifier: CC0-1.0
+SPDX-FileCopyrightText: 2022 Unikie
diff --git a/host/rootfs/etc/template/gpu/run b/host/rootfs/etc/template/gpu/run
new file mode 100755
index 0000000..eaac8d6
--- /dev/null
+++ b/host/rootfs/etc/template/gpu/run
@@ -0,0 +1,9 @@
+#!/bin/execlineb -P
+# SPDX-License-Identifier: EUPL-1.2+
+# SPDX-FileCopyrightText: 2022 Unikie
+
+s6-notifyoncheck -d
+crosvm --no-syslog device gpu
+ --socket env/crosvm.sock
+ --wayland-sock /run/user/0/wayland-1
+ --params "{\"context-types\":\"cross-domain\"}"
diff --git a/host/rootfs/etc/template/gpu/type b/host/rootfs/etc/template/gpu/type
new file mode 100644
index 0000000..5883cff
--- /dev/null
+++ b/host/rootfs/etc/template/gpu/type
@@ -0,0 +1 @@
+longrun
diff --git a/host/rootfs/etc/template/gpu/type.license b/host/rootfs/etc/template/gpu/type.license
new file mode 100644
index 0000000..2241beb
--- /dev/null
+++ b/host/rootfs/etc/template/gpu/type.license
@@ -0,0 +1,2 @@
+SPDX-License-Identifier: CC0-1.0
+SPDX-FileCopyrightText: 2022 Unikie
diff --git a/host/start-vm/lib.rs b/host/start-vm/lib.rs
index adf9915..8834202 100644
--- a/host/start-vm/lib.rs
+++ b/host/start-vm/lib.rs
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: EUPL-1.2+
// SPDX-FileCopyrightText: 2022-2023 Alyssa Ross <hi@alyssa.is>
+// SPDX-FileCopyrightText: 2022 Unikie
mod ch;
mod net;
@@ -127,6 +128,15 @@ pub fn vm_command(
Err(e) => return Err(format!("reading directory {:?}: {}", blk_dir, e)),
}
+ if config_dir.join("wayland").exists() {
+ command.arg("--gpu").arg({
+ let mut gpu = OsString::from("socket=../");
+ gpu.push(vm_name);
+ gpu.push("-gpu/env/crosvm.sock");
+ gpu
+ });
+ }
+
let shared_dirs_dir = config_dir.join("shared-dirs");
match shared_dirs_dir.read_dir() {
Ok(entries) => {
diff --git a/vm-lib/make-vm.nix b/vm-lib/make-vm.nix
index 80e6ef5..c3533ec 100644
--- a/vm-lib/make-vm.nix
+++ b/vm-lib/make-vm.nix
@@ -1,5 +1,6 @@
# SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: 2022 Alyssa Ross <hi@alyssa.is>
+# SPDX-FileCopyrightText: 2022 Unikie
{ pkgs ? import <nixpkgs> {}
@@ -13,7 +14,7 @@ pkgs.pkgsStatic.callPackage (
{ lib, runCommand, writeReferencesToFile, erofs-utils }:
-{ run, providers ? {}, sharedDirs ? {} }:
+{ run, providers ? {}, sharedDirs ? {}, wayland ? false }:
let
inherit (lib)
@@ -26,6 +27,8 @@ assert !(any (hasInfix "\n") (concatLists (attrValues providers)));
runCommand "spectrum-vm" {
nativeBuildInputs = [ erofs-utils ];
+ inherit wayland;
+
providerDirs = concatStrings (concatLists
(mapAttrsToList (kind: map (vm: "${kind}/${vm}\n")) providers));
passAsFile = [ "providerDirs" ];
@@ -53,6 +56,10 @@ runCommand "spectrum-vm" {
popd
+ if [ -n "$wayland" ]; then
+ touch "$out/wayland"
+ fi
+
ln -s /usr/img/appvm/blk/root.img "$out/blk"
ln -s /usr/img/appvm/vmlinux "$out"
''
--
2.40.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v3 6/6] vm/app: add hello-wayland demo VM
2023-07-21 18:00 [PATCH v3 0/6] Initial support for VM Wayland Alyssa Ross
` (4 preceding siblings ...)
2023-07-21 18:00 ` [PATCH v3 5/6] host: add support for Wayland in VMs Alyssa Ross
@ 2023-07-21 18:00 ` Alyssa Ross
2023-07-28 12:10 ` Alyssa Ross
5 siblings, 1 reply; 13+ messages in thread
From: Alyssa Ross @ 2023-07-21 18:00 UTC (permalink / raw)
To: devel
From: Alyssa Ross <alyssa.ross@unikie.com>
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>
Signed-off-by: Alyssa Ross <hi@alyssa.is>
---
host/initramfs/extfs.nix | 4 +++-
vm/app/hello-wayland.nix | 29 +++++++++++++++++++++++++++++
2 files changed, 32 insertions(+), 1 deletion(-)
create mode 100644 vm/app/hello-wayland.nix
diff --git a/host/initramfs/extfs.nix b/host/initramfs/extfs.nix
index 6f32bca..174fc81 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; };
appvm-mg = import ../../vm/app/mg.nix { inherit config; };
in
@@ -17,13 +18,14 @@ in
runCommand "ext.ext4" {
nativeBuildInputs = [ e2fsprogs ];
} ''
- mkdir -p root/svc/data/appvm-{catgirl,lynx,mg}
+ mkdir -p root/svc/data/appvm-{catgirl,hello-wayland,lynx,mg}
cd root
tar -C ${netvm} -c data | tar -C svc -x
chmod +w svc/data
tar -C ${appvm-catgirl} -c . | tar -C svc/data/appvm-catgirl -x
+ tar -C ${appvm-hello-wayland} -c . | tar -C svc/data/appvm-hello-wayland -x
tar -C ${appvm-lynx} -c . | tar -C svc/data/appvm-lynx -x
tar -C ${appvm-mg} -c . | tar -C svc/data/appvm-mg -x
diff --git a/vm/app/hello-wayland.nix b/vm/app/hello-wayland.nix
new file mode 100644
index 0000000..e10f05e
--- /dev/null
+++ b/vm/app/hello-wayland.nix
@@ -0,0 +1,29 @@
+# SPDX-License-Identifier: MIT
+# SPDX-FileCopyrightText: 2022 Unikie
+# SPDX-FileCopyrightText: 2023 Alyssa Ross <hi@alyssa.is>
+
+import ../../lib/eval-config.nix ({ config, ... }:
+
+import ../make-vm.nix { inherit config; } {
+ wayland = true;
+ run = config.pkgs.pkgsStatic.callPackage (
+ { writeScript, hello-wayland }:
+ writeScript "run-hello-wayland" ''
+ #!/bin/execlineb -P
+ foreground { ln -ns /run/ext /run/opengl-driver }
+ foreground { mkdir /run/user }
+ foreground {
+ umask 077
+ mkdir /run/user/0
+ }
+ if { /etc/mdev/wait card0 }
+ export XDG_RUNTIME_DIR /run/user/0
+
+ # No pkgsStatic.wayland-proxy-virtwl:
+ # https://github.com/nix-ocaml/nix-overlays/issues/698
+ ${config.pkgs.pkgsMusl.wayland-proxy-virtwl}/bin/wayland-proxy-virtwl --virtio-gpu
+
+ ${hello-wayland}/bin/hello-wayland
+ ''
+ ) { };
+})
--
2.40.1
^ permalink raw reply [flat|nested] 13+ messages in thread