Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
306 changes: 201 additions & 105 deletions bun.lock

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions containerfiles/desktop-hyprland-runner.Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Container build arguments #
ARG RUNNER_COMMON_IMAGE=runner-common:latest

#*********************#
# Final Runtime Stage #
#*********************#
FROM ${RUNNER_COMMON_IMAGE}

### FLAVOR/VARIANT CONFIGURATION ###
## Hyprland Desktop ##p
RUN --mount=type=cache,target=/var/cache/pacman/pkg \
pacman -S --noconfirm --needed hyprland hyprpaper hyprlock hypridle hyprpicker waybar waypaper xdg-desktop-portal-gtk xdg-desktop-portal-hyprland && \
# Cleanup
paccache -rk1 && \
rm -rf /usr/share/{info,man,doc}/*

## FLAVOR/VARIANT LAUNCH COMMAND ##
ENV NESTRI_LAUNCH_COMPOSITOR="Hyprland"
### END OF FLAVOR/VARIANT CONFIGURATION ###

### REQUIRED DEFAULT ENTRYPOINT FOR FLAVOR/VARIANT ###
USER root
ENTRYPOINT ["supervisord", "-c", "/etc/nestri/supervisord.conf"]
39 changes: 39 additions & 0 deletions containerfiles/desktop-kdeplasma-runner.Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Container build arguments #
ARG RUNNER_COMMON_IMAGE=runner-common:latest

#*********************#
# Final Runtime Stage #
#*********************#
FROM ${RUNNER_COMMON_IMAGE}

### FLAVOR/VARIANT CONFIGURATION ###
## KDE Plasma Desktop ##
RUN --mount=type=cache,target=/var/cache/pacman/pkg \
pacman -S --noconfirm --needed plasma-desktop plasma-wayland-protocols kscreen konsole && \
# Cleanup
paccache -rk1 && \
rm -rf /usr/share/{info,man,doc}/*

## Custom wrapper launch script
COPY <<-'EOT' /tmp/nestri/plasmadesktop-launcher
#!/bin/bash
set -euo pipefail

mkdir -p /tmp/nestri
sudo -E chown -R "${NESTRI_USER}:${NESTRI_USER}" /tmp/nestri
cat <<EOF > /tmp/nestri/kwin_wayland_wrapper
#!/bin/sh
/usr/bin/kwin_wayland_wrapper --no-lockscreen --width $WIDTH --height $HEIGHT --xwayland \$@
EOF
chmod a+x /tmp/nestri/kwin_wayland_wrapper
export PATH=/tmp/nestri/:$PATH

dbus-launch startplasma-wayland

rm /tmp/nestri/kwin_wayland_wrapper
EOT
RUN chmod +x /tmp/nestri/plasmadesktop-launcher

## FLAVOR/VARIANT LAUNCH COMMAND ##
ENV NESTRI_LAUNCH_COMPOSITOR="/tmp/nestri/plasmadesktop-launcher"
### END OF FLAVOR/VARIANT CONFIGURATION ###
4 changes: 0 additions & 4 deletions containerfiles/heroic-runner.Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,3 @@ RUN --mount=type=cache,target=/var/cache/pacman/pkg \
## FLAVOR/VARIANT LAUNCH COMMAND ##
ENV NESTRI_LAUNCH_CMD="heroic"
### END OF FLAVOR/VARIANT CONFIGURATION ###

### REQUIRED DEFAULT ENTRYPOINT FOR FLAVOR/VARIANT ###
USER root
ENTRYPOINT ["supervisord", "-c", "/etc/nestri/supervisord.conf"]
4 changes: 0 additions & 4 deletions containerfiles/minecraft-runner.Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,3 @@ RUN --mount=type=cache,target=/var/cache/pacman/pkg \
## FLAVOR/VARIANT LAUNCH COMMAND ##
ENV NESTRI_LAUNCH_CMD="minecraft-launcher"
### END OF FLAVOR/VARIANT CONFIGURATION ###

### REQUIRED DEFAULT ENTRYPOINT FOR FLAVOR/VARIANT ###
USER root
ENTRYPOINT ["supervisord", "-c", "/etc/nestri/supervisord.conf"]
4 changes: 1 addition & 3 deletions containerfiles/relay.Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ WORKDIR /builder
COPY packages/relay/ /builder/
RUN go build

FROM docker.io/golang:1.25-alpine
FROM docker.io/alpine:3.23
COPY --from=go-build /builder/relay /relay/relay
WORKDIR /relay

# TODO: Switch running layer to just alpine (doesn't need golang dev stack)

# ENV flags
ENV REGEN_IDENTITY=false
ENV VERBOSE=false
Expand Down
2 changes: 1 addition & 1 deletion containerfiles/runner-base.Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ FROM ${BASE_IMAGE} AS bases
# Only lightweight stuff needed by both builder and runtime
RUN --mount=type=cache,target=/var/cache/pacman/pkg \
pacman -Sy --noconfirm \
libssh2 curl wget libevdev libc++abi \
libssh2 curl wget libevdev libc++abi libselinux \
gstreamer gst-plugins-base
17 changes: 9 additions & 8 deletions containerfiles/runner-builder.Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ ENV CARGO_HOME=/usr/local/cargo \

# Install build essentials and caching tools
RUN --mount=type=cache,target=/var/cache/pacman/pkg \
pacman -S --noconfirm rustup git base-devel mold \
pacman -S --noconfirm rustup git base-devel \
meson pkgconf cmake git gcc make

# Override various linker with symlink so mold is forcefully used (ld, ld.lld, lld)
RUN ln -sf /usr/bin/mold /usr/bin/ld && \
ln -sf /usr/bin/mold /usr/bin/ld.lld && \
ln -sf /usr/bin/mold /usr/bin/lld
# Override various linkers with symlink so wild is forcefully used (ld, ld.lld, lld)
# Removed for time being until Wild is more stable
#RUN ln -sf /usr/bin/wild /usr/bin/ld && \
# ln -sf /usr/bin/wild /usr/bin/ld.lld && \
# ln -sf /usr/bin/wild /usr/bin/lld

# Install latest Rust using rustup
RUN rustup default stable
Expand All @@ -41,7 +42,7 @@ RUN --mount=type=cache,target=/var/cache/pacman/pkg \
pacman -S --noconfirm lib32-gcc-libs

# Clone repository
RUN git clone --depth 1 --rev "2fde5376b6b9a38cdbd94ccc6a80c9d29a81a417" https://github.com/DatCaptainHorse/vimputti.git
RUN git clone --depth 1 --rev "cd306e954842082916107f12d3940e1093662033" https://github.com/DatCaptainHorse/vimputti.git

#--------------------------------------------------------------------
FROM vimputti-manager-deps AS vimputti-manager-planner
Expand Down Expand Up @@ -130,7 +131,7 @@ RUN --mount=type=cache,target=${CARGO_HOME}/registry \
cargo install cargo-c

# Clone repository
RUN git clone --depth 1 --rev "67b1183997fd7aaf57398e4b01bd64c4d2433c45" https://github.com/games-on-whales/gst-wayland-display.git
RUN git clone --depth 1 --rev "fd620860f260f051fd731bb9feaac8632cbe3c9e" https://github.com/games-on-whales/gst-wayland-display.git

#--------------------------------------------------------------------
FROM gst-wayland-deps AS gst-wayland-planner
Expand Down Expand Up @@ -168,7 +169,7 @@ WORKDIR /builder

# Install build dependencies
RUN --mount=type=cache,target=/var/cache/pacman/pkg \
pacman -S --noconfirm libtool libcap libselinux
pacman -S --noconfirm libtool libcap

# Copy patch file from host
COPY packages/patches/bubblewrap/ /builder/patches/
Expand Down
53 changes: 32 additions & 21 deletions containerfiles/runner-common.Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@ FROM runtime
### Package Installation ###
# Core system components
RUN --mount=type=cache,target=/var/cache/pacman/pkg \
pacman -S --needed --noconfirm \
vulkan-intel lib32-vulkan-intel vpl-gpu-rt \
vulkan-radeon lib32-vulkan-radeon \
mesa lib32-mesa vulkan-mesa-layers lib32-vulkan-mesa-layers \
gtk3 lib32-gtk3 \
sudo xorg-xwayland seatd libinput gamescope mangohud wlr-randr \
pipewire pipewire-pulse pipewire-alsa wireplumber \
noto-fonts-cjk supervisor jq pacman-contrib \
hwdata openssh \
pacman -S --needed --noconfirm --assume-installed bubblewrap \
vulkan-intel vpl-gpu-rt \
vulkan-radeon \
mesa vulkan-mesa-layers \
gtk3 \
sudo xorg-xwayland seatd libinput gamescope mangohud wlr-randr \
pipewire pipewire-pulse pipewire-alsa wireplumber \
noto-fonts-cjk jq pacman-contrib \
hwdata openssh \
# GStreamer stack
gst-plugins-good \
gst-plugins-bad gst-plugin-pipewire \
gst-plugin-webrtchttp gst-plugin-rswebrtc gst-plugin-rsrtp \
gst-plugin-va gst-plugin-qsv && \
gst-plugins-good \
gst-plugins-bad gst-plugin-pipewire \
gst-plugin-webrtchttp gst-plugin-rswebrtc gst-plugin-rsrtp \
gst-plugin-va gst-plugin-qsv && \
# Cleanup
paccache -rk1 && \
rm -rf /usr/share/{info,man,doc}/*
Expand Down Expand Up @@ -56,33 +56,44 @@ RUN mkdir -p "/home/${NESTRI_USER}" && \
RUN mkdir -p /run/dbus && \
# Wireplumber suspend disable
sed -i -z \
-e 's/{[[:space:]]*name = node\/suspend-node\.lua,[[:space:]]*type = script\/lua[[:space:]]*provides = hooks\.node\.suspend[[:space:]]*}[[:space:]]*//g' \
-e '/wants = \[/{s/hooks\.node\.suspend\s*//; s/,\s*\]/]/}' \
/usr/share/wireplumber/wireplumber.conf
-e 's/{[[:space:]]*name = node\/suspend-node\.lua,[[:space:]]*type = script\/lua[[:space:]]*provides = hooks\.node\.suspend[[:space:]]*}[[:space:]]*//g' \
-e '/wants = \[/{s/hooks\.node\.suspend\s*//; s/,\s*\]/]/}' \
/usr/share/wireplumber/wireplumber.conf

## 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/
COPY packages/configs/wireplumber.conf.d/*.conf /etc/wireplumber/wireplumber.conf.d/
COPY packages/configs/pipewire.conf.d/*.conf /etc/pipewire/pipewire.conf.d/

## MangoHud Config ##
COPY packages/configs/MangoHud/MangoHud.conf /etc/nestri/configs/MangoHud/

### Artifacts from Builder ###
COPY --from=builder /artifacts/bin/nestri-server /usr/bin/
COPY --from=builder /artifacts/bin/bwrap /usr/bin/
COPY --from=builder /artifacts/bin/bwrap /usr/sbin/
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 ###
## Scripts ##
COPY packages/scripts/ /etc/nestri/
RUN chmod +x /etc/nestri/{envs.sh,entrypoint*.sh} && \
RUN chmod +x /etc/nestri/{envs.sh,entrypoint*.sh,pressure-vent.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 && \
setcap cap_mknod+ep /usr/bin/vimputti-manager && \
dbus-uuidgen > /etc/machine-id && \
LANG=en_US.UTF-8 locale-gen

## s6-overlay ##
ADD https://github.com/just-containers/s6-overlay/releases/download/v3.2.2.0/s6-overlay-noarch.tar.xz /tmp
ADD https://github.com/just-containers/s6-overlay/releases/download/v3.2.2.0/s6-overlay-x86_64.tar.xz /tmp
RUN tar -C / -Jxpf /tmp/s6-overlay-noarch.tar.xz && tar -C / -Jxpf /tmp/s6-overlay-x86_64.tar.xz

COPY packages/configs/s6-overlay/ /etc/s6-overlay/s6-rc.d/
RUN chmod +x /etc/s6-overlay/s6-rc.d/*/run

ENTRYPOINT ["/init"]
11 changes: 5 additions & 6 deletions containerfiles/steam-runner.Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ FROM ${RUNNER_COMMON_IMAGE}
### FLAVOR/VARIANT CONFIGURATION ###
## STEAM ##
RUN --mount=type=cache,target=/var/cache/pacman/pkg \
pacman -S --noconfirm steam && \
pacman -S --noconfirm --assume-installed bubblewrap \
steam \
lib32-mesa lib32-vulkan-mesa-layers lib32-vulkan-intel lib32-vulkan-radeon && \
# Cleanup
paccache -rk1 && \
rm -rf /usr/share/{info,man,doc}/*
Expand All @@ -19,9 +21,6 @@ RUN mkdir -p "${NESTRI_HOME}/.local/share/Steam/config"
COPY packages/configs/steam/config.vdf "${NESTRI_HOME}/.local/share/Steam/config/"

## FLAVOR/VARIANT LAUNCH COMMAND ##
ENV NESTRI_LAUNCH_CMD="steam -tenfoot -cef-force-gpu"
ENV NESTRI_LAUNCH_COMPOSITOR="gamescope --backend wayland --force-grab-cursor -g -f -W \$WIDTH -H \$HEIGHT -r \$FRAMERATE --mangoapp -e"
ENV NESTRI_LAUNCH_CMD="env DISPLAY=:0 steam -tenfoot -cef-force-gpu"
### END OF FLAVOR/VARIANT CONFIGURATION ###

### REQUIRED DEFAULT ENTRYPOINT FOR FLAVOR/VARIANT ###
USER root
ENTRYPOINT ["supervisord", "-c", "/etc/nestri/supervisord.conf"]
Empty file.
Empty file.
Empty file.
1 change: 1 addition & 0 deletions packages/configs/s6-overlay/application/notification-fd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3
25 changes: 25 additions & 0 deletions packages/configs/s6-overlay/application/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/command/with-contenv bash
set -euo pipefail

if [[ -f /etc/nestri/common.sh ]]; then
source /etc/nestri/common.sh
else
exit 1
fi

# check if NESTRI_LAUNCH_CMD is unset or empty
if [[ -z "${NESTRI_LAUNCH_CMD:-}" ]]; then
# exit with 0 so s6 doesn't think the service failed and try to restart it repeatedly
exit 0
fi

export LD_PRELOAD="/usr/lib64/libvimputti_shim.so:/usr/lib32/libvimputti_shim.so"

s6-setuidgid ${NESTRI_USER} ${NESTRI_LAUNCH_CMD} &
PROCESS_PID=$!

# notify
printf 'ready\n' >&3

# wait till process exits
wait "${PROCESS_PID}"
1 change: 1 addition & 0 deletions packages/configs/s6-overlay/application/type
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
longrun
Empty file.
Empty file.
1 change: 1 addition & 0 deletions packages/configs/s6-overlay/compositor/notification-fd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3
44 changes: 44 additions & 0 deletions packages/configs/s6-overlay/compositor/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/command/with-contenv bash
set -euo pipefail

if [[ -f /etc/nestri/common.sh ]]; then
source /etc/nestri/common.sh
else
exit 1
fi

# check if NESTRI_LAUNCH_COMPOSITOR is unset or empty
if [[ -z "${NESTRI_LAUNCH_COMPOSITOR:-}" ]]; then
# exit with 0 so s6 doesn't think the service failed and try to restart it repeatedly
exit 0
fi

export LD_PRELOAD="/usr/lib64/libvimputti_shim.so:/usr/lib32/libvimputti_shim.so"

# Set socket based on compositor type
COMPOSITOR_SOCKET="${NESTRI_XDG_RUNTIME_DIR}/wayland-0"

# Check if this is gamescope
if [[ "${NESTRI_LAUNCH_COMPOSITOR}" == *"gamescope"* ]]; then
COMPOSITOR_SOCKET="${NESTRI_XDG_RUNTIME_DIR}/gamescope-0"
fi

# remove possibly stale socket
rm -f "${COMPOSITOR_SOCKET}"

# expand internal variables
FINAL_LAUNCH_COMPOSITOR=$(echo "${NESTRI_LAUNCH_COMPOSITOR}" | envsubst)

WAYLAND_DISPLAY=wayland-1 s6-setuidgid ${NESTRI_USER} $FINAL_LAUNCH_COMPOSITOR &
PROCESS_PID=$!

# wait for socket
while ! test -S "${COMPOSITOR_SOCKET}"; do
sleep 1
done

# notify
printf 'ready\n' >&3

# wait till process exits
wait "${PROCESS_PID}"
1 change: 1 addition & 0 deletions packages/configs/s6-overlay/compositor/type
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
longrun
Empty file.
1 change: 1 addition & 0 deletions packages/configs/s6-overlay/dbus-session/notification-fd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3
25 changes: 25 additions & 0 deletions packages/configs/s6-overlay/dbus-session/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/command/with-contenv bash
set -euo pipefail

if [[ -f /etc/nestri/common.sh ]]; then
source /etc/nestri/common.sh
else
exit 1
fi

# remove possibly stale socket
rm -f "${NESTRI_XDG_RUNTIME_DIR}/bus"

s6-setuidgid ${NESTRI_USER} dbus-daemon --session --address=unix:path="${NESTRI_XDG_RUNTIME_DIR}/bus" --nofork --nopidfile &
PROCESS_PID=$!

# wait for socket
while ! test -S "${NESTRI_XDG_RUNTIME_DIR}/bus"; do
sleep 0.5
done

# notify
printf 'ready\n' >&3

# wait till process exits
wait "${PROCESS_PID}"
1 change: 1 addition & 0 deletions packages/configs/s6-overlay/dbus-session/type
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
longrun
Empty file.
1 change: 1 addition & 0 deletions packages/configs/s6-overlay/dbus-system/notification-fd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3
Loading