From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on atuin.qyliss.net X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.6 Received: from atuin.qyliss.net (localhost [IPv6:::1]) by atuin.qyliss.net (Postfix) with ESMTP id 07D0B41F6E; Wed, 30 Nov 2022 07:13:21 +0000 (UTC) Received: by atuin.qyliss.net (Postfix, from userid 496) id 085AB41F56; Wed, 30 Nov 2022 07:13:19 +0000 (UTC) Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) by atuin.qyliss.net (Postfix) with ESMTPS id 448B141F50 for ; Wed, 30 Nov 2022 07:13:16 +0000 (UTC) Received: by mail-lj1-x22b.google.com with SMTP id z4so19880774ljq.6 for ; Tue, 29 Nov 2022 23:13:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unikie.com; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Rrhf4KTmWoDzfCp67lWy7tYNG4XcajfX5iFMuhsy/Sc=; b=A2PdCkRjVPDj+1V6hl8/4W1/rrT2u6KeUrF7okbg4FVRhFsNO151QLnbJPibAq+jC5 S5wdlbP48Cgd1A+96cJuNJn7DL8YlKZ7gt1qb7REzn4XiWXbxbqJIdwI+FZgy5XfWbb1 l1DBgIpohcdHDujso7qSY9FHok1mATjBZBTG2ZjRFuC8huejCplop/S82hNs6+1rPmi4 MDxCmSk+4zMPHelxYw7YLZnH2Mdww4sSN0ns5OPsM1TvsdlVcOzaPV8GplcMwZdcYJvF xjbKt/1R21Vys3TPJywUzdOBJ/XmIHnh+qJ22HOBk+aHFFkAJf/vwY8zdBqYBmO8bOPq oYQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Rrhf4KTmWoDzfCp67lWy7tYNG4XcajfX5iFMuhsy/Sc=; b=mAinbNLJCe0asleErior+qs7IkmwH57ftO+fQpAVHw7fM5CB+UwMrZm0D+v6pIixc4 lQKHZZNHd/126PeIEonp1pZjjFrcbMX9wiAzec2SkVJcwRyWgLehNHYHHpxzhX6fXafq dH6PgzQqezlCPc1h/Qse+1Teba8wx8GI0jvxonwmpaqwlpLaNMhxIZTkpk7LnByhApQR xhnkgYVEDSQlb1qxyaaGKqVNKKdkM37ab+swgKPRNP44S35jbjoI2hkt4XiBPCLqPraO 5xav6AtNBdGcipFjVygXX2z5O34KOYP6Ib6ADe9dtrvJgfTY8oFOzXpIhTPMClJOOyPW rbqQ== X-Gm-Message-State: ANoB5pl4EkL14H9G0Oe1vJ/X1VJnMxTspeKjero3VlHl1v3JjUPYx95D mqxvgcK+E15qCdI15qQxYaSUP9k1J3PFDuCk X-Google-Smtp-Source: AA0mqf5U8Yi6m71OJ+Z7em9GIqJlHfEVqz3GQP2RPsXvsi0k9BcQQBkuA14MCNXBeO8jYGxDeb1cnA== X-Received: by 2002:a05:651c:178d:b0:278:a59c:390c with SMTP id bn13-20020a05651c178d00b00278a59c390cmr19101121ljb.512.1669792395385; Tue, 29 Nov 2022 23:13:15 -0800 (PST) Received: from majava.open.technopolis.internet ([193.64.211.192]) by smtp.gmail.com with ESMTPSA id u11-20020a2e9b0b000000b0027712379ec8sm45012lji.28.2022.11.29.23.13.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Nov 2022 23:13:15 -0800 (PST) From: vadim likholetov To: devel@spectrum-os.org Subject: [PATCH] Enables forwarding Wayland from appVM to host with waypipe Date: Wed, 30 Nov 2022 09:13:06 +0200 Message-Id: <20221130071306.1364939-1-vadim.likholetov@unikie.com> X-Mailer: git-send-email 2.36.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: KGSIRUGI6AHOIJDEKN7LTGQBOBQEHMEX X-Message-ID-Hash: KGSIRUGI6AHOIJDEKN7LTGQBOBQEHMEX X-MailFrom: vadim.likholetov@unikie.com X-Mailman-Rule-Hits: header-match-devel.spectrum-os.org-0 X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1 CC: vadim likholetov X-Mailman-Version: 3.3.5 Precedence: list List-Id: Patches and low-level development discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Signed-off-by: vadim likholetov --- host/initramfs/extfs.nix | 4 +++- host/rootfs/Makefile | 1 + host/rootfs/default.nix | 4 ++-- host/rootfs/usr/bin/vm-start-way | 10 ++++++++++ img/app/default.nix | 3 +++ vm/app/hello-waypipe.nix | 23 +++++++++++++++++++++++ 6 files changed, 42 insertions(+), 3 deletions(-) create mode 100755 host/rootfs/usr/bin/vm-start-way create mode 100644 vm/app/hello-waypipe.nix diff --git a/host/initramfs/extfs.nix b/host/initramfs/extfs.nix index 5c5850f..f49e519 100644 --- a/host/initramfs/extfs.nix +++ b/host/initramfs/extfs.nix @@ -11,12 +11,13 @@ let appvm-catgirl = import ../../vm/app/catgirl.nix { inherit config; }; appvm-lynx = import ../../vm/app/lynx.nix { inherit config; }; + appvm-hello-waypipe = import ../../vm/app/hello-waypipe.nix { inherit config; }; in runCommand "ext.ext4" { nativeBuildInputs = [ e2fsprogs ]; } '' - mkdir -p root/svc/data/appvm-{catgirl,lynx} + mkdir -p root/svc/data/appvm-{catgirl,lynx,hello-waypipe} cd root tar -C ${netvm} -c data | tar -C svc -x @@ -24,6 +25,7 @@ runCommand "ext.ext4" { tar -C ${appvm-catgirl} -c . | tar -C svc/data/appvm-catgirl -x tar -C ${appvm-lynx} -c . | tar -C svc/data/appvm-lynx -x + tar -C ${appvm-hello-waypipe} -c . | tar -C svc/data/appvm-hello-waypipe -x mkfs.ext4 -d . $out 16T resize2fs -M $out diff --git a/host/rootfs/Makefile b/host/rootfs/Makefile index 9559c06..06e3e8e 100644 --- a/host/rootfs/Makefile +++ b/host/rootfs/Makefile @@ -39,6 +39,7 @@ FILES = \ usr/bin/lsvm \ usr/bin/vm-console \ usr/bin/vm-start \ + usr/bin/vm-start-way \ usr/bin/vm-stop DIRS = dev etc/s6-linux-init/env ext run proc sys diff --git a/host/rootfs/default.nix b/host/rootfs/default.nix index 0a84f55..de4a6b6 100644 --- a/host/rootfs/default.nix +++ b/host/rootfs/default.nix @@ -7,7 +7,7 @@ pkgs.pkgsStatic.callPackage ( { lib, stdenvNoCC, nixos, runCommand, writeReferencesToFile, s6-rc, tar2ext4 , busybox, cloud-hypervisor, cryptsetup, execline, e2fsprogs, jq, kmod -, mdevd, s6, s6-linux-init, socat, util-linuxMinimal, xorg +, mdevd, s6, s6-linux-init, socat, util-linuxMinimal, xorg, waypipe }: let @@ -49,7 +49,7 @@ let packages = [ cloud-hypervisor e2fsprogs execline jq kmod mdevd s6 s6-linux-init s6-rc - socat start-vm + socat start-vm waypipe (cryptsetup.override { programs = { diff --git a/host/rootfs/usr/bin/vm-start-way b/host/rootfs/usr/bin/vm-start-way new file mode 100755 index 0000000..bda9934 --- /dev/null +++ b/host/rootfs/usr/bin/vm-start-way @@ -0,0 +1,10 @@ +#!/bin/sh +# SPDX-License-Identifier: EUPL-1.2+ + +s6-rc -bu change ext-rc +s6-rc -l /run/s6-rc.ext -u change $1 +ch-remote --api-socket /run/service/ext-${1}/env/cloud-hypervisor.sock add-vsock cid=4,socket=/run/u.${1}.socket +cd /run +nohup waypipe --socket /run/waypipe.sock client & +nohup socat unix-listen:/run/u.${1}.socket_5000,reuseaddr,fork unix-connect:/run/waypipe.sock & + diff --git a/img/app/default.nix b/img/app/default.nix index e7d5366..80f23c2 100644 --- a/img/app/default.nix +++ b/img/app/default.nix @@ -59,6 +59,9 @@ let DRM_BOCHS = yes; DRM = yes; AGP = yes; + VSOCKETS = yes; + VIRTIO_VSOCKETS = yes; + VIRTIO_VSOCKETS_COMMON = yes; }; }; in diff --git a/vm/app/hello-waypipe.nix b/vm/app/hello-waypipe.nix new file mode 100644 index 0000000..601b638 --- /dev/null +++ b/vm/app/hello-waypipe.nix @@ -0,0 +1,23 @@ +# SPDX-License-Identifier: MIT +# SPDX-FileCopyrightText: 2021-2022 Alyssa Ross + +{ config ? import ../../../nix/eval-config.nix {} }: + +import ../make-vm.nix { inherit config; } { + providers.net = [ "netvm" ]; + run = config.pkgs.callPackage ( + { writeScript, waypipe, havoc, foot, hello-wayland, socat}: + writeScript "run-waypipe-app" '' + #!/bin/sh + mkdir /run/0 + export XDG_RUNTIME_DIR=/run/0 + ${socat}/bin/socat unix-listen:/run/waypipe.sock,reuseaddr,fork vsock-connect:2:5000 & + sleep 1 + ${waypipe}/bin/waypipe --display wayland-local --socket /run/waypipe.sock server -- sleep inf & + export WAYLAND_DISPLAY=wayland-local + ${havoc}/bin/havoc + ${hello-wayland}/bin/hello-wayland + ${foot}/bin/foot + '' + ) { }; +} -- 2.36.2