mirror of
https://github.com/nestriness/nestri.git
synced 2026-03-17 11:53:08 +02:00
feat: WIP s6-overlay and friends
This commit is contained in:
35
packages/scripts/cloud/upcloud-rocky10.sh
Normal file
35
packages/scripts/cloud/upcloud-rocky10.sh
Normal file
@@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Setup package repos #
|
||||
dnf install epel-release -y
|
||||
dnf config-manager --enable crb
|
||||
|
||||
# Install dev packages #
|
||||
dnf groupinstall "Development Tools" -y
|
||||
dnf install kernel-devel-matched kernel-headers -y
|
||||
|
||||
# NVIDIA repo and driver install #
|
||||
dnf config-manager --add-repo http://developer.download.nvidia.com/compute/cuda/repos/rhel10/$(uname -m)/cuda-rhel10.repo
|
||||
dnf clean expire-cache
|
||||
dnf install nvidia-open -y
|
||||
|
||||
# Update to be safe #
|
||||
dnf update -y
|
||||
|
||||
# Install NVIDIA container toolkit and podman + SELinux helper #
|
||||
dnf install nvidia-container-toolkit podman container-selinux -y
|
||||
|
||||
# Setup required boot flags #
|
||||
grubby --args="nouveau.modeset=0 rd.driver.blacklist=nouveau nvidia-drm.modeset=1" --update-kernel=ALL
|
||||
|
||||
# ENSURE we have required packages, had a weird case where it didn't have kernel and caused modeset to fail??? #
|
||||
dnf update -y
|
||||
|
||||
# Reboot! #
|
||||
reboot now
|
||||
|
||||
# Make sure modeset is available #
|
||||
nvidia-modprobe -c 0 -u -m
|
||||
|
||||
# And make sure CDI devices are listed #
|
||||
systemctl restart nvidia-cdi-refresh.service
|
||||
@@ -21,3 +21,23 @@ if [[ ! -f /etc/nestri/gpu_helpers.sh ]]; then
|
||||
exit 1
|
||||
fi
|
||||
source /etc/nestri/gpu_helpers.sh || { log "Error: Failed to source /etc/nestri/gpu_helpers.sh"; exit 1; }
|
||||
|
||||
# Parses resolution string
|
||||
parse_resolution() {
|
||||
local resolution="$1"
|
||||
if [[ -z "$resolution" ]]; then
|
||||
log "Error: No resolution provided"
|
||||
return 1
|
||||
fi
|
||||
|
||||
IFS='x' read -r width height <<< "$resolution"
|
||||
if ! [[ "$width" =~ ^[0-9]+$ ]] || ! [[ "$height" =~ ^[0-9]+$ ]]; then
|
||||
log "Error: Invalid resolution format. Expected: WIDTHxHEIGHT (e.g., 1920x1080), got: $resolution"
|
||||
return 1
|
||||
fi
|
||||
|
||||
export WIDTH="$width"
|
||||
export HEIGHT="$height"
|
||||
return 0
|
||||
}
|
||||
parse_resolution "${RESOLUTION:-1280x720}" || exit 1
|
||||
|
||||
@@ -225,7 +225,7 @@ configure_ssh() {
|
||||
|
||||
main() {
|
||||
# Wait for required sockets
|
||||
wait_for_socket "${NESTRI_XDG_RUNTIME_DIR}/dbus-1" "DBus" || exit 1
|
||||
wait_for_socket "${NESTRI_XDG_RUNTIME_DIR}/bus" "DBus" || exit 1
|
||||
wait_for_socket "${NESTRI_XDG_RUNTIME_DIR}/pipewire-0" "PipeWire" || exit 1
|
||||
|
||||
# Start by getting the container we are running under
|
||||
|
||||
@@ -74,16 +74,9 @@ start_nestri_server() {
|
||||
|
||||
# Start nestri-server
|
||||
log "Starting nestri-server.."
|
||||
# Try with realtime scheduling first (chrt -f 80), if fails, launch normally
|
||||
if $ENTCMD_PREFIX chrt -f 80 true 2>/dev/null; then
|
||||
$ENTCMD_PREFIX chrt -f 80 nestri-server $NESTRI_PARAMS &
|
||||
NESTRI_PID=$!
|
||||
log "Started nestri-server with realtime scheduling"
|
||||
else
|
||||
$ENTCMD_PREFIX nestri-server $NESTRI_PARAMS &
|
||||
NESTRI_PID=$!
|
||||
log "Started nestri-server"
|
||||
fi
|
||||
$ENTCMD_PREFIX nestri-server $NESTRI_PARAMS &
|
||||
NESTRI_PID=$!
|
||||
log "Started nestri-server"
|
||||
|
||||
log "Waiting for Wayland display $WAYLAND_SOCKET.."
|
||||
for ((i=1; i<=15; i++)); do
|
||||
@@ -108,7 +101,7 @@ start_compositor() {
|
||||
|
||||
# Set default compositor if unset
|
||||
if [[ -z "${NESTRI_LAUNCH_COMPOSITOR+x}" ]]; then
|
||||
NESTRI_LAUNCH_COMPOSITOR="gamescope --backend wayland -g -f --rt -W ${WIDTH} -H ${HEIGHT} -r ${FRAMERATE:-60}"
|
||||
NESTRI_LAUNCH_COMPOSITOR="gamescope --backend wayland --force-grab-cursor -g -f --rt -W ${WIDTH} -H ${HEIGHT} -r ${FRAMERATE:-60}"
|
||||
fi
|
||||
|
||||
# If PRELOAD_SHIM_arch's are set and exist, set LD_PRELOAD for 32/64-bit apps
|
||||
@@ -118,13 +111,13 @@ start_compositor() {
|
||||
log "Using LD_PRELOAD shim(s)"
|
||||
fi
|
||||
|
||||
# Configure launch cmd with dbus if set
|
||||
# Configure launch cmd if set
|
||||
local launch_cmd=""
|
||||
if [[ -n "${NESTRI_LAUNCH_CMD+x}" ]]; then
|
||||
if $do_ld_preload; then
|
||||
launch_cmd="LD_PRELOAD='/usr/\$LIB/libvimputti_shim.so' dbus-launch $NESTRI_LAUNCH_CMD"
|
||||
launch_cmd="LD_PRELOAD='/usr/\$LIB/libvimputti_shim.so' $NESTRI_LAUNCH_CMD"
|
||||
else
|
||||
launch_cmd="dbus-launch $NESTRI_LAUNCH_CMD"
|
||||
launch_cmd="$NESTRI_LAUNCH_CMD"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
@@ -8,6 +8,10 @@ export XDG_RUNTIME_DIR=${NESTRI_XDG_RUNTIME_DIR}
|
||||
# Causes some setups to break
|
||||
export PROTON_NO_FSYNC=1
|
||||
|
||||
# Skip first core automatically, to allow nestri-server to work as best as it can
|
||||
export PROTON_CPU_TOPOLOGY=$(nproc | awk '{print $1-1 ":"}')$({ seq 1 $(($(nproc) - 1)) | paste -sd, -; })
|
||||
export WINE_CPU_TOPOLOGY=$(nproc | awk '{print $1-1 ":"}')$({ seq 1 $(($(nproc) - 1)) | paste -sd, -; })
|
||||
|
||||
# Make gstreamer GL elements work without display output (NVIDIA issue..)
|
||||
export GST_GL_API=gles2
|
||||
export GST_GL_WINDOW=surfaceless
|
||||
|
||||
54
packages/scripts/pressure-vent.sh
Normal file
54
packages/scripts/pressure-vent.sh
Normal file
@@ -0,0 +1,54 @@
|
||||
#!/bin/bash
|
||||
# Steam "Pressure Vessel" runtime eliminator.
|
||||
#
|
||||
# Valve ships various pre-packaged runtime environments for games to use.
|
||||
# They are cool, in a way: Most games "just work" with them.
|
||||
# However, such convenience comes at the cost of performance and sometimes reliability.
|
||||
#
|
||||
# Normally, I disable any and all such runtimes and install all the required dependencies myself.
|
||||
# However, running Windows games using Proton enforces use of a runtime.
|
||||
# That runtime is shipped in a "Pressure Vessel" container, which is more isolated.
|
||||
# The worst part is, user-supplied LD_PRELOAD and LD_LIBRARY_PATH are ignored due to that.
|
||||
# That means no primusrun/pvkrun/whatever for Windows games, which sucks.
|
||||
#
|
||||
# This little script's purpose is to cut "Pressure Vessel" out of game's command line.
|
||||
# Be warned that that gives you the ability *and responsibility* to manage the dependencies.
|
||||
# Place pressure-vent.sh after all " -- " in game's launch options, if any.
|
||||
# Placing e.g. "xterm -e" at the start of launch options is an easy way to see logs.
|
||||
# Examples:
|
||||
# primusrun ~/pressure-vent.sh %command%
|
||||
# xterm -e /full/path/to/pressure-vent.sh pvkrun %command%
|
||||
|
||||
|
||||
# Functions
|
||||
cmdprn() {
|
||||
printf '%s:\n%q' "$1" "$2"
|
||||
printf ' %q' "${@:3}"
|
||||
printf '\n\n'
|
||||
}
|
||||
err() {
|
||||
printf '%s\nPress Enter to quit.\n' "$1"
|
||||
read
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Debug
|
||||
cmdprn "Original command line" "$@"
|
||||
printf "LD_PRELOAD:\n%q\n\n" "$LD_PRELOAD"
|
||||
printf "LD_LIBRARY_PATH:\n%q\n\n" "$LD_LIBRARY_PATH"
|
||||
|
||||
# Find Pressure Vessel arguments (between two first "--")
|
||||
((left=1))
|
||||
while [[ left -le $# && "${!left}" != "--" ]]; do
|
||||
((left++))
|
||||
done
|
||||
((right=left+1))
|
||||
while [[ right -le $# && "${!right}" != "--" ]]; do
|
||||
((right++))
|
||||
done
|
||||
[[ right -gt $# ]] && err 'Error processing command line.'
|
||||
# Cut them out
|
||||
set -- "${@:1:left}" "${@:right+1}"
|
||||
cmdprn "Processed command line" "$@" # Debug
|
||||
|
||||
exec "$@" || err "Game terminated with code $?."
|
||||
Reference in New Issue
Block a user