mirror of
https://github.com/nestriness/nestri.git
synced 2026-11-03 22:22:39 +02:00
feat(image): PulseAudio in the box, and the GL dispatcher for 32-bit helpers
Most desktop applications and games speak PulseAudio, and the box served only PipeWire, so they played no sound. pipewire-pulse now runs beside PipeWire, on a socket the workload can reach, and the workload is told its address. A 32-bit launcher helper also has a 32-bit overlay preloaded into it that links libGL.so.1; libglvnd's dispatcher alone satisfies that, with Mesa assumed rather than installed.
This commit is contained in:
@@ -193,6 +193,9 @@ pub const SERVICE_GID: u32 = 1000;
|
|||||||
/// workload, which is the property [`crate::ticket::Untrusted`] depends on.
|
/// workload, which is the property [`crate::ticket::Untrusted`] depends on.
|
||||||
pub const AUDIO_DIR: &str = "/run/pipewire";
|
pub const AUDIO_DIR: &str = "/run/pipewire";
|
||||||
|
|
||||||
|
/// The PulseAudio socket PipeWire serves, beside its own in [`AUDIO_DIR`].
|
||||||
|
pub const PULSE_SOCKET: &str = "/run/pipewire/pulse-native";
|
||||||
|
|
||||||
/// Where a service's runtime sockets live.
|
/// Where a service's runtime sockets live.
|
||||||
pub const RUNTIME_DIR: &str = "/run/user/1000";
|
pub const RUNTIME_DIR: &str = "/run/user/1000";
|
||||||
|
|
||||||
@@ -354,6 +357,26 @@ pub const STACK: &[Service] = &[
|
|||||||
ready: Some("/run/pipewire/pipewire-0"),
|
ready: Some("/run/pipewire/pipewire-0"),
|
||||||
ready_name: None,
|
ready_name: None,
|
||||||
},
|
},
|
||||||
|
Service {
|
||||||
|
name: "pipewire-pulse",
|
||||||
|
argv: &["/usr/bin/pipewire-pulse"],
|
||||||
|
env: &[
|
||||||
|
("XDG_RUNTIME_DIR", RUNTIME_DIR),
|
||||||
|
("PIPEWIRE_RUNTIME_DIR", AUDIO_DIR),
|
||||||
|
("DBUS_SESSION_BUS_ADDRESS", "unix:path=/run/user/1000/bus"),
|
||||||
|
],
|
||||||
|
user: Some((SERVICE_UID, SERVICE_GID)),
|
||||||
|
// Most desktop applications and games speak PulseAudio, not PipeWire.
|
||||||
|
cost: "applications that speak PulseAudio play no sound",
|
||||||
|
required: false,
|
||||||
|
// Beside PipeWire's socket and open to the workload the same way: its
|
||||||
|
// address is set in pipewire-pulse.conf.d and handed to the workload as
|
||||||
|
// PULSE_SERVER.
|
||||||
|
umask: Some(0),
|
||||||
|
realtime: true,
|
||||||
|
ready: Some(PULSE_SOCKET),
|
||||||
|
ready_name: None,
|
||||||
|
},
|
||||||
Service {
|
Service {
|
||||||
name: "wireplumber",
|
name: "wireplumber",
|
||||||
argv: &["/usr/bin/wireplumber"],
|
argv: &["/usr/bin/wireplumber"],
|
||||||
|
|||||||
@@ -1005,6 +1005,8 @@ const GRAPHICS: &[(&str, &str)] = &[
|
|||||||
// reach and both are told where. Without this a game renders and plays
|
// reach and both are told where. Without this a game renders and plays
|
||||||
// silently, having looked under its own uid and found nothing.
|
// silently, having looked under its own uid and found nothing.
|
||||||
("PIPEWIRE_RUNTIME_DIR", crate::services::AUDIO_DIR),
|
("PIPEWIRE_RUNTIME_DIR", crate::services::AUDIO_DIR),
|
||||||
|
// And the same for PulseAudio, which most applications speak.
|
||||||
|
("PULSE_SERVER", concat!("unix:", "/run/pipewire/pulse-native")),
|
||||||
];
|
];
|
||||||
|
|
||||||
/// Mount one share where the descriptor says to put it.
|
/// Mount one share where the descriptor says to put it.
|
||||||
|
|||||||
+14
-6
@@ -393,7 +393,7 @@ RUN pacman -Syu --noconfirm --needed \
|
|||||||
libglvnd libdrm libepoxy libxxf86vm libinput wayland \
|
libglvnd libdrm libepoxy libxxf86vm libinput wayland \
|
||||||
expat zlib llvm-libs lm_sensors elfutils libva shaderc vulkan-icd-loader \
|
expat zlib llvm-libs lm_sensors elfutils libva shaderc vulkan-icd-loader \
|
||||||
pixman libxkbcommon xcb-util-keysyms xorg-xwayland \
|
pixman libxkbcommon xcb-util-keysyms xorg-xwayland \
|
||||||
pipewire pipewire-audio wireplumber opus \
|
pipewire pipewire-audio pipewire-pulse wireplumber opus \
|
||||||
python libunwind sdl2-compat \
|
python libunwind sdl2-compat \
|
||||||
python-xlib python-urllib3 python-pyzstd \
|
python-xlib python-urllib3 python-pyzstd \
|
||||||
libvpx speex libtheora libvdpau jsoncpp \
|
libvpx speex libtheora libvdpau jsoncpp \
|
||||||
@@ -685,22 +685,30 @@ RUN umu-run --help >/dev/null 2>&1 \
|
|||||||
|| { echo "umu-run does not start; run it by hand to see the module or interpreter it lacks" >&2; \
|
|| { echo "umu-run does not start; run it by hand to see the module or interpreter it lacks" >&2; \
|
||||||
umu-run --help >&2 || true; exit 1; }
|
umu-run --help >&2 || true; exit 1; }
|
||||||
|
|
||||||
# The 32-bit C library, and nothing else 32-bit. A launcher's process helper
|
# The 32-bit C library and GL dispatcher, and nothing else 32-bit. A launcher's process helper
|
||||||
# is still a 32-bit program even in a 64-bit client -- Steam's `reaper`, which
|
# is still a 32-bit program even in a 64-bit client -- Steam's `reaper`, which
|
||||||
# every game is started through, needs only libc and libpthread -- and with no
|
# every game is started through, needs only libc and libpthread -- and with no
|
||||||
# 32-bit loader every launch exits 255 before the game runs, with no message.
|
# 32-bit loader every launch exits 255 before the game runs, with no message.
|
||||||
# No graphics stack comes with it: games bring their own runtime.
|
# The launcher also preloads its 32-bit overlay into that helper, and the overlay
|
||||||
|
# links libGL.so.1: libglvnd's dispatcher satisfies the link, and Mesa is
|
||||||
|
# assumed rather than installed because the helper never draws. No graphics
|
||||||
|
# driver comes with it: games bring their own runtime.
|
||||||
RUN printf '\n[multilib]\nInclude = /etc/pacman.d/mirrorlist\n' >> /etc/pacman.conf \
|
RUN printf '\n[multilib]\nInclude = /etc/pacman.d/mirrorlist\n' >> /etc/pacman.conf \
|
||||||
&& pacman -Sy --noconfirm --needed lib32-glibc \
|
&& pacman -Sy --noconfirm --needed lib32-glibc \
|
||||||
|
&& pacman -S --noconfirm --needed \
|
||||||
|
--assume-installed lib32-mesa --assume-installed lib32-opengl-driver \
|
||||||
|
lib32-libglvnd \
|
||||||
&& pacman -Scc --noconfirm \
|
&& pacman -Scc --noconfirm \
|
||||||
&& test -x /usr/lib32/ld-linux.so.2
|
&& test -x /usr/lib32/ld-linux.so.2 \
|
||||||
|
&& test -e /usr/lib32/libGL.so.1
|
||||||
|
|
||||||
# No other 32-bit libraries. The distribution's umu package would have brought a
|
# No other 32-bit libraries. The distribution's umu package would have brought a
|
||||||
# long list of them for the container runtime this image never runs, which is
|
# long list of them for the container runtime this image never runs, which is
|
||||||
# why it is built instead of installed; this is the check that stays true if
|
# why it is built instead of installed; this is the check that stays true if
|
||||||
# somebody swaps it back.
|
# somebody swaps it back.
|
||||||
RUN ! pacman -Qq | grep '^lib32-' | grep -qvx 'lib32-glibc' \
|
RUN ! pacman -Qq | grep '^lib32-' \
|
||||||
|| { echo "a lib32 package other than lib32-glibc is installed:" >&2; \
|
| grep -qvxE 'lib32-(glibc|libglvnd|libx11|libxext|libxcb|libxau|libxdmcp)' \
|
||||||
|
|| { echo "a lib32 package beyond the helper's libc and GL dispatcher is installed:" >&2; \
|
||||||
pacman -Qq | grep '^lib32-' >&2; exit 1; }
|
pacman -Qq | grep '^lib32-' >&2; exit 1; }
|
||||||
|
|
||||||
# ───────────────────────────────────────────────────────────
|
# ───────────────────────────────────────────────────────────
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
# Serve PulseAudio beside PipeWire's own socket, where the workload -- another
|
||||||
|
# user -- can reach it. The workload is told this address in PULSE_SERVER.
|
||||||
|
pulse.properties = {
|
||||||
|
server.address = [ "unix:/run/pipewire/pulse-native" ]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user