[BREAKING] Switch to virtgpu-based D-Bus tunneling
This introduces support for drag&drop and printing portals, and later camera/screencasting should be possible as well. However we break backwards compatibility with already built closures because the nixosModule needs to be changed. In the next commit, the runtime environment related services will be removed from the nixosModule to prevent unnecessary future breakage.
This commit is contained in:
parent
e00609ce73
commit
604ebc1356
4 changed files with 30 additions and 23 deletions
26
munix
26
munix
|
|
@ -10,6 +10,7 @@ MICROVM_UID=1337
|
|||
MICROVM_GID=1337
|
||||
BWRAP_ARGS=()
|
||||
MUVM_ARGS=()
|
||||
SIDEBUS_ARGS=()
|
||||
GPU=1
|
||||
WAYLAND=1
|
||||
PIPEWIRE=1
|
||||
|
|
@ -31,10 +32,10 @@ while [ "$#" -gt 0 ]; do
|
|||
--no-pipewire) PIPEWIRE=0; shift 1;;
|
||||
--no-env-defaults) ENV_DEFAULTS=0; shift 1;;
|
||||
--x11) X11=1; shift 1;;
|
||||
-b|--bind) BWRAP_ARGS+=("--bind" "$2" "$3"); shift 3;;
|
||||
--ro-bind) BWRAP_ARGS+=("--ro-bind" "$2" "$3"); shift 3;;
|
||||
-e|--expose) BWRAP_ARGS+=("--bind" "$2" "$2"); shift 2;;
|
||||
--ro-expose) BWRAP_ARGS+=("--ro-bind" "$2" "$2"); shift 2;;
|
||||
-b|--bind) BWRAP_ARGS+=("--bind" "$2" "$3"); SIDEBUS_ARGS+=("--path-mapping" "$3=$2"); shift 3;;
|
||||
--ro-bind) BWRAP_ARGS+=("--ro-bind" "$2" "$3"); SIDEBUS_ARGS+=("--path-mapping" "$3=$2"); shift 3;;
|
||||
-e|--expose) BWRAP_ARGS+=("--bind" "$2" "$2"); SIDEBUS_ARGS+=("--path-mapping" "$2=$2"); shift 2;;
|
||||
--ro-expose) BWRAP_ARGS+=("--ro-bind" "$2" "$2"); SIDEBUS_ARGS+=("--path-mapping" "$2=$2"); shift 2;;
|
||||
-p|--publish) USING_PUBLISH=1; MUVM_ARGS+=("--publish=$2"); shift 2;;
|
||||
--host-opengl-driver) HOST_OPENGL_DRIVER="$2"; shift 2;;
|
||||
--munix-bin-dir) SCRIPT_PATH="$2"; shift 2;;
|
||||
|
|
@ -186,12 +187,20 @@ trap cleanup EXIT INT TERM
|
|||
HOST_RUNTIME_DIR="$XDG_RUNTIME_DIR/munix.$$"
|
||||
mkdir -p $HOST_RUNTIME_DIR
|
||||
rm $HOST_RUNTIME_DIR/*
|
||||
sidebus-broker --guest-mountpoint /mnt/munix-doc-portal/doc --runtime-dir "$HOST_RUNTIME_DIR" --unix-path "$HOST_RUNTIME_DIR/port.sock" >/dev/null 2>&1 &
|
||||
mkdir -p "$HOST_RUNTIME_DIR/home"
|
||||
RUST_LOG=debug sidebus-broker \
|
||||
--path-mapping "/home=$HOST_RUNTIME_DIR/home" \
|
||||
"${SIDEBUS_ARGS[@]}" \
|
||||
--guest-mountpoint /mnt/munix-doc-portal/doc \
|
||||
--runtime-dir "$HOST_RUNTIME_DIR" \
|
||||
--unix-path "$HOST_RUNTIME_DIR/port.sock" & # >/dev/null 2>&1 &
|
||||
BG_PIDS+=("$!")
|
||||
while [ ! -S "$HOST_RUNTIME_DIR/port.sock" ]; do sleep 0.1; done
|
||||
BWRAP_ARGS+=(
|
||||
BWRAP_ARGS=( # prepend home mount before other mounts to not override custom bind mounts under /home
|
||||
--bind "$HOST_RUNTIME_DIR/home" /home
|
||||
"${BWRAP_ARGS[@]}"
|
||||
--bind "$HOST_RUNTIME_DIR" /mnt/munix-doc-portal
|
||||
--bind "$HOST_RUNTIME_DIR/port.sock" "$XDG_RUNTIME_DIR/krun/socket/port-50000"
|
||||
--setenv "RUTABAGA_DBUS_CLIENT_SOCKET" /mnt/munix-doc-portal/port.sock
|
||||
)
|
||||
if [ "$ENV_DEFAULTS" -eq 1 ]; then
|
||||
MUVM_ARGS+=(
|
||||
|
|
@ -221,6 +230,7 @@ bwrap --unshare-all --share-net \
|
|||
--ro-bind "$MUVM_PATH/muvm-guest" /opt/bin/muvm-remote \
|
||||
--ro-bind "$MUVM_PATH/muvm-guest" /opt/bin/muvm-configure-network \
|
||||
--ro-bind "$MUVM_PATH/muvm-guest" /opt/bin/muvm-pwbridge \
|
||||
--ro-bind "$MUVM_PATH/muvm-guest" /opt/bin/muvm-dbusbridge \
|
||||
--symlink "$MICROVM_CLOSURE/etc" /etc \
|
||||
--symlink "$MICROVM_CLOSURE/sw/bin/sh" /bin/sh \
|
||||
--symlink "$MICROVM_CLOSURE/sw/bin/env" /usr/bin/env \
|
||||
|
|
@ -232,7 +242,7 @@ bwrap --unshare-all --share-net \
|
|||
--setenv PATH "/run/munix/muvm:/run/munix/passt:$MICROVM_CLOSURE/sw/bin" \
|
||||
"${BWRAP_ARGS[@]}" \
|
||||
muvm \
|
||||
--custom-init-cmdline "/opt/bin/micro-activate $MICROVM_CLOSURE/sw/sbin/init --log-target=console systemd.set_credential=sidebus.port:50000" \
|
||||
--custom-init-cmdline "/opt/bin/micro-activate $MICROVM_CLOSURE/sw/sbin/init --log-target=console" \
|
||||
"${MUVM_ARGS[@]}" \
|
||||
-e container=munix \
|
||||
-e MICROVM_CLOSURE="$MICROVM_CLOSURE" \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue