selkies: GPU-accelerate 32-bit GW via mounted 32-bit nvidia GL + vglrun launcher

Mount config.hardware.nvidia.package.lib32 into the container (CDI only carries
64-bit driver libs) and add a `gw` launcher that runs Guild Wars through
VirtualGL on the M2000. Drops GW from ~18 software-rendered CPU cores to <1.
Also bump stream to 60fps.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
rope 2026-06-25 13:37:17 +01:00
parent 21b0fa15ae
commit 707f78c9d1

View file

@ -22,6 +22,12 @@ let
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
wine wine32 wine64 winbind cabextract ca-certificates wget \ wine wine32 wine64 winbind cabextract ca-certificates wget \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# `gw` launcher: GW is 32-bit, so it needs the 32-bit NVIDIA GL libs (mounted
# at /usr/lib/i386-linux-gnu/nvidia by the service) on the loader path, and
# VirtualGL (EGL backend) to render on the M2000. Without this GW falls back
# to llvmpipe (software) and pegs ~18 CPU cores at <20 fps.
RUN printf '#!/bin/bash\nexport LD_LIBRARY_PATH=/usr/lib/i386-linux-gnu/nvidia\nexport VGL_DISPLAY=egl VGL_FPS=60\ncd "$HOME/.wine/drive_c/Program Files (x86)/Guild Wars/"\nexec vglrun wine Gw.exe "$@"\n' > /usr/local/bin/gw \
&& chmod +x /usr/local/bin/gw
USER 1000 USER 1000
''; '';
in in
@ -29,8 +35,9 @@ in
config = lib.mkIf (config.networking.hostName == "FredOS-Mediaserver") { config = lib.mkIf (config.networking.hostName == "FredOS-Mediaserver") {
virtualisation.docker.enable = true; virtualisation.docker.enable = true;
# GPU into the container (CDI: nvidia.com/gpu=all) + 32-bit host GL libs so # GPU into the container via CDI (nvidia.com/gpu=all). The CDI spec only
# the toolkit can expose them to the 32-bit Wine/GW OpenGL stack. # carries the 64-bit driver libs, so the 32-bit set (for 32-bit Wine/GW) is
# bind-mounted separately below; enable32Bit makes them exist on the host.
hardware.nvidia-container-toolkit.enable = true; hardware.nvidia-container-toolkit.enable = true;
hardware.graphics.enable32Bit = true; hardware.graphics.enable32Bit = true;
@ -71,16 +78,17 @@ in
-p 65532-65535:65532-65535/udp \ -p 65532-65535:65532-65535/udp \
-e TZ=Europe/Stockholm \ -e TZ=Europe/Stockholm \
-e DISPLAY_SIZEW=1280 -e DISPLAY_SIZEH=720 \ -e DISPLAY_SIZEW=1280 -e DISPLAY_SIZEH=720 \
-e DISPLAY_REFRESH=30 -e DISPLAY_DPI=96 -e DISPLAY_CDEPTH=24 \ -e DISPLAY_REFRESH=60 -e DISPLAY_DPI=96 -e DISPLAY_CDEPTH=24 \
-e PASSWD=selkies \ -e PASSWD=selkies \
-e SELKIES_ENCODER=nvh264enc \ -e SELKIES_ENCODER=nvh264enc \
-e SELKIES_VIDEO_BITRATE=8000 \ -e SELKIES_VIDEO_BITRATE=8000 \
-e SELKIES_FRAMERATE=30 \ -e SELKIES_FRAMERATE=60 \
-e SELKIES_ENABLE_BASIC_AUTH=false \ -e SELKIES_ENABLE_BASIC_AUTH=false \
-e SELKIES_TURN_HOST=10.0.0.1 \ -e SELKIES_TURN_HOST=10.0.0.1 \
-e SELKIES_TURN_PROTOCOL=udp \ -e SELKIES_TURN_PROTOCOL=udp \
-e SELKIES_TURN_PORT=3478 \ -e SELKIES_TURN_PORT=3478 \
-e TURN_MIN_PORT=65532 -e TURN_MAX_PORT=65535 \ -e TURN_MIN_PORT=65532 -e TURN_MAX_PORT=65535 \
-v ${config.hardware.nvidia.package.lib32}/lib:/usr/lib/i386-linux-gnu/nvidia:ro \
-v /var/lib/selkies/home:/home/ubuntu \ -v /var/lib/selkies/home:/home/ubuntu \
selkies-gw:local selkies-gw:local
''; '';