mirror of
https://github.com/nestriness/nestri.git
synced 2025-12-12 08:45:38 +02:00
feat: Controller support, performance enchancements, multi-stage images, fixes (#304)
## Description Oops.. another massive PR 🥲 This PR contains multiple improvements and changes. Firstly, thanks gst-wayland-display's PR [here](https://github.com/games-on-whales/gst-wayland-display/pull/20). NVIDIA path is now way more efficient than before. Secondly, adding controller support was a massive hurdle, requiring me to start another project [vimputti](https://github.com/DatCaptainHorse/vimputti) - which allows simple virtual controller inputs in isolated containers. Well, it's not simple, it includes LD_PRELOAD shims and other craziness, but the library API is simple to use.. Thirdly, split runner image into 3 separate stages, base + build + runtime, should help keep things in check in future, also added GitHub Actions CI builds for v2 to v4 builds (hopefully they pass..). Fourth, replaced the runner's runtime Steam patching with better and simpler bubblewrap patch, massive thanks to `games-on-whales` to figuring it out better! Fifth, relay for once needed some changes, the new changes are still mostly WIP, but I'll deal with them next time I have energy.. I'm spent now. Needed to include these changes as relay needed a minor change to allow rumble events to flow back to client peer. Sixth.. tons of package updates, minor code improvements and the usual. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * End-to-end gamepad/controller support (attach/detach, buttons, sticks, triggers, rumble) with client/server integration and virtual controller plumbing. * Optional Prometheus metrics endpoint and WebTransport support. * Background vimputti manager process added for controller handling. * **Improvements** * Multi-variant container image builds and streamlined runtime images. * Zero-copy video pipeline and encoder improvements for lower latency. * Updated Steam compat mapping and dependency/toolchain refreshes. * **Bug Fixes** * More robust GPU detection, input/fullscreen lifecycle, startup/entrypoint, and container runtime fixes. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: DatCaptainHorse <DatCaptainHorse@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
a3ee9aadd9
commit
c62a22b552
@@ -1,125 +1,13 @@
|
||||
# Container build arguments #
|
||||
ARG BASE_IMAGE=docker.io/cachyos/cachyos:latest
|
||||
ARG RUNNER_BASE_IMAGE=runner-base:latest
|
||||
ARG RUNNER_BUILDER_IMAGE=runner-builder:latest
|
||||
|
||||
#******************************************************************************
|
||||
# Base Stage - Updates system packages
|
||||
#******************************************************************************
|
||||
FROM ${BASE_IMAGE} AS base
|
||||
|
||||
RUN --mount=type=cache,target=/var/cache/pacman/pkg \
|
||||
pacman --noconfirm -Syu
|
||||
|
||||
#******************************************************************************
|
||||
# Base Builder Stage - Prepares core build environment
|
||||
#******************************************************************************
|
||||
FROM base AS base-builder
|
||||
|
||||
# Environment setup for Rust and Cargo
|
||||
ENV CARGO_HOME=/usr/local/cargo \
|
||||
ARTIFACTS=/artifacts \
|
||||
PATH="${CARGO_HOME}/bin:${PATH}" \
|
||||
RUSTFLAGS="-C link-arg=-fuse-ld=mold"
|
||||
|
||||
# Install build essentials and caching tools
|
||||
RUN --mount=type=cache,target=/var/cache/pacman/pkg \
|
||||
pacman -Sy --noconfirm mold rustup && \
|
||||
mkdir -p "${ARTIFACTS}"
|
||||
|
||||
# Install latest Rust using rustup
|
||||
RUN rustup default stable
|
||||
|
||||
# Install cargo-chef with proper caching
|
||||
RUN --mount=type=cache,target=${CARGO_HOME}/registry \
|
||||
cargo install -j $(nproc) cargo-chef cargo-c --locked
|
||||
|
||||
#******************************************************************************
|
||||
# Nestri Server Build Stages
|
||||
#******************************************************************************
|
||||
FROM base-builder AS nestri-server-deps
|
||||
WORKDIR /builder
|
||||
|
||||
# Install build dependencies
|
||||
RUN --mount=type=cache,target=/var/cache/pacman/pkg \
|
||||
pacman -Sy --noconfirm meson pkgconf cmake git gcc make \
|
||||
gstreamer gst-plugins-base gst-plugins-good gst-plugin-rswebrtc
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
FROM nestri-server-deps AS nestri-server-planner
|
||||
WORKDIR /builder/nestri
|
||||
|
||||
COPY packages/server/Cargo.toml packages/server/Cargo.lock ./
|
||||
|
||||
# Prepare recipe for dependency caching
|
||||
RUN --mount=type=cache,target=${CARGO_HOME}/registry \
|
||||
cargo chef prepare --recipe-path recipe.json
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
FROM nestri-server-deps AS nestri-server-cached-builder
|
||||
WORKDIR /builder/nestri
|
||||
|
||||
COPY --from=nestri-server-planner /builder/nestri/recipe.json .
|
||||
|
||||
# Cache dependencies using cargo-chef
|
||||
RUN --mount=type=cache,target=${CARGO_HOME}/registry \
|
||||
cargo chef cook --release --recipe-path recipe.json
|
||||
|
||||
|
||||
ENV CARGO_TARGET_DIR=/builder/target
|
||||
|
||||
COPY packages/server/ ./
|
||||
|
||||
# Build and install directly to artifacts
|
||||
RUN --mount=type=cache,target=${CARGO_HOME}/registry \
|
||||
--mount=type=cache,target=/builder/target \
|
||||
cargo build --release && \
|
||||
cp "${CARGO_TARGET_DIR}/release/nestri-server" "${ARTIFACTS}"
|
||||
|
||||
#******************************************************************************
|
||||
# GST-Wayland Plugin Build Stages
|
||||
#******************************************************************************
|
||||
FROM base-builder AS gst-wayland-deps
|
||||
WORKDIR /builder
|
||||
|
||||
# Install build dependencies
|
||||
RUN --mount=type=cache,target=/var/cache/pacman/pkg \
|
||||
pacman -Sy --noconfirm meson pkgconf cmake git gcc make \
|
||||
libxkbcommon wayland gstreamer gst-plugins-base gst-plugins-good libinput
|
||||
|
||||
# Clone repository
|
||||
RUN git clone --depth 1 --rev "dfeebb19b48f32207469e166a3955f5d65b5e6c6" https://github.com/games-on-whales/gst-wayland-display.git
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
FROM gst-wayland-deps AS gst-wayland-planner
|
||||
WORKDIR /builder/gst-wayland-display
|
||||
|
||||
# Prepare recipe for dependency caching
|
||||
RUN --mount=type=cache,target=${CARGO_HOME}/registry \
|
||||
cargo chef prepare --recipe-path recipe.json
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
FROM gst-wayland-deps AS gst-wayland-cached-builder
|
||||
WORKDIR /builder/gst-wayland-display
|
||||
|
||||
COPY --from=gst-wayland-planner /builder/gst-wayland-display/recipe.json .
|
||||
|
||||
# Cache dependencies using cargo-chef
|
||||
RUN --mount=type=cache,target=${CARGO_HOME}/registry \
|
||||
cargo chef cook --release --recipe-path recipe.json
|
||||
|
||||
|
||||
ENV CARGO_TARGET_DIR=/builder/target
|
||||
|
||||
COPY --from=gst-wayland-planner /builder/gst-wayland-display/ .
|
||||
|
||||
# Build and install directly to artifacts
|
||||
RUN --mount=type=cache,target=${CARGO_HOME}/registry \
|
||||
--mount=type=cache,target=/builder/target \
|
||||
cargo cinstall --prefix=${ARTIFACTS} --release
|
||||
|
||||
#******************************************************************************
|
||||
# Final Runtime Stage
|
||||
#******************************************************************************
|
||||
FROM base AS runtime
|
||||
#*********************#
|
||||
# Final Runtime Stage #
|
||||
#*********************#
|
||||
FROM ${RUNNER_BASE_IMAGE} AS runtime
|
||||
FROM ${RUNNER_BUILDER_IMAGE} AS builder
|
||||
FROM runtime
|
||||
|
||||
### Package Installation ###
|
||||
# Core system components
|
||||
@@ -127,20 +15,17 @@ RUN --mount=type=cache,target=/var/cache/pacman/pkg \
|
||||
pacman -Sy --needed --noconfirm \
|
||||
vulkan-intel lib32-vulkan-intel vpl-gpu-rt \
|
||||
vulkan-radeon lib32-vulkan-radeon \
|
||||
mesa steam-native-runtime proton-cachyos lib32-mesa \
|
||||
mesa lib32-mesa \
|
||||
steam gtk3 lib32-gtk3 \
|
||||
sudo xorg-xwayland seatd libinput gamescope mangohud wlr-randr \
|
||||
libssh2 curl wget \
|
||||
pipewire pipewire-pulse pipewire-alsa wireplumber \
|
||||
noto-fonts-cjk supervisor jq chwd lshw pacman-contrib \
|
||||
noto-fonts-cjk supervisor jq pacman-contrib \
|
||||
hwdata openssh \
|
||||
# GStreamer stack
|
||||
gstreamer gst-plugins-base gst-plugins-good \
|
||||
gst-plugins-good \
|
||||
gst-plugins-bad gst-plugin-pipewire \
|
||||
gst-plugin-webrtchttp gst-plugin-rswebrtc gst-plugin-rsrtp \
|
||||
gst-plugin-va gst-plugin-qsv \
|
||||
# lib32 GStreamer stack to fix some games with videos
|
||||
lib32-gstreamer lib32-gst-plugins-base lib32-gst-plugins-good && \
|
||||
gst-plugin-va gst-plugin-qsv && \
|
||||
# Cleanup
|
||||
paccache -rk1 && \
|
||||
rm -rf /usr/share/{info,man,doc}/*
|
||||
@@ -153,6 +38,7 @@ ENV NESTRI_USER="nestri" \
|
||||
NESTRI_LANG=en_US.UTF-8 \
|
||||
NESTRI_XDG_RUNTIME_DIR=/run/user/1000 \
|
||||
NESTRI_HOME=/home/nestri \
|
||||
NESTRI_VIMPUTTI_PATH=/tmp/vimputti-1000 \
|
||||
NVIDIA_DRIVER_CAPABILITIES=all
|
||||
|
||||
RUN mkdir -p "/home/${NESTRI_USER}" && \
|
||||
@@ -174,29 +60,33 @@ RUN mkdir -p /run/dbus && \
|
||||
-e '/wants = \[/{s/hooks\.node\.suspend\s*//; s/,\s*\]/]/}' \
|
||||
/usr/share/wireplumber/wireplumber.conf
|
||||
|
||||
### Audio Systems Configs - Latency optimizations + Loopback ###
|
||||
## Audio Systems Configs - Latency optimizations + Loopback ##
|
||||
RUN mkdir -p /etc/pipewire/pipewire.conf.d && \
|
||||
mkdir -p /etc/wireplumber/wireplumber.conf.d
|
||||
|
||||
COPY packages/configs/wireplumber.conf.d/* /etc/wireplumber/wireplumber.conf.d/
|
||||
COPY packages/configs/pipewire.conf.d/* /etc/pipewire/pipewire.conf.d/
|
||||
|
||||
## Steam Configs - Proton (CachyOS flavor) ##
|
||||
## Steam Configs - Proton (Experimental flavor) ##
|
||||
RUN mkdir -p "${NESTRI_HOME}/.local/share/Steam/config"
|
||||
|
||||
COPY packages/configs/steam/config.vdf "${NESTRI_HOME}/.local/share/Steam/config/"
|
||||
|
||||
### Artifacts and Verification ###
|
||||
COPY --from=nestri-server-cached-builder /artifacts/nestri-server /usr/bin/
|
||||
COPY --from=gst-wayland-cached-builder /artifacts/lib/ /usr/lib/
|
||||
COPY --from=gst-wayland-cached-builder /artifacts/include/ /usr/include/
|
||||
RUN which nestri-server && ls -la /usr/lib/ | grep 'gstwaylanddisplay'
|
||||
### Artifacts from Builder ###
|
||||
COPY --from=builder /artifacts/bin/nestri-server /usr/bin/
|
||||
COPY --from=builder /artifacts/bin/bwrap /usr/bin/
|
||||
COPY --from=builder /artifacts/lib/ /usr/lib/
|
||||
COPY --from=builder /artifacts/lib32/ /usr/lib32/
|
||||
COPY --from=builder /artifacts/lib64/ /usr/lib64/
|
||||
COPY --from=builder /artifacts/bin/vimputti-manager /usr/bin/
|
||||
|
||||
### Scripts and Final Configuration ###
|
||||
COPY packages/scripts/ /etc/nestri/
|
||||
RUN chmod +x /etc/nestri/{envs.sh,entrypoint*.sh} && \
|
||||
chown -R "${NESTRI_USER}:${NESTRI_USER}" "${NESTRI_HOME}" && \
|
||||
sed -i 's/^#\(en_US\.UTF-8\)/\1/' /etc/locale.gen && \
|
||||
setcap cap_net_admin+ep /usr/bin/vimputti-manager && \
|
||||
dbus-uuidgen > /etc/machine-id && \
|
||||
LANG=en_US.UTF-8 locale-gen
|
||||
|
||||
# Root for most container engines, nestri-user compatible for apptainer without fakeroot
|
||||
|
||||
Reference in New Issue
Block a user