Skip to content

Commit

Permalink
add wolf configs
Browse files Browse the repository at this point in the history
  • Loading branch information
detiber committed Dec 4, 2024
1 parent fc2241d commit be5c625
Show file tree
Hide file tree
Showing 7 changed files with 425 additions and 0 deletions.
14 changes: 14 additions & 0 deletions files/scripts/debugging/wolf/steam-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
sudo podman run --rm -it \
--device=/dev/dri/renderD128 \
--device=/dev/dri/card1 \
-ipc=host \
-privileged \
-cap-add=ALL \
-security-opt seccomp=unconfined \
-e XDG_RUNTIME_DIR=/tmp \
-v ${XDG_RUNTIME_DIR}/${WAYLAND_DISPLAY}:/tmp/${WAYLAND_DISPLAY}:rw \
-e XDG_SESSION_TYPE=wayland \
-e WAYLAND_DISPLAY=${WAYLAND_DISPLAY} \
-e RUN_SWAY=true \
-v /tmp/SteamGOWData:/home/retro/ \
ghcr.io/games-on-whales/steam:fix-steam-mesa
1 change: 1 addition & 0 deletions files/scripts/debugging/wolf/wolf-api.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
curl --unix-socket /var/run/wolf/wolf.sock http://localhost/api/v1/sessions | jq
23 changes: 23 additions & 0 deletions files/scripts/debugging/wolf/wolf.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
sudo podman stop WolfPulseAudio || true
sudo podman rm WolfPulseAudio || true
sudo podman run --rm \
--name wolf \
--privileged \
--network=host \
--ipc=host \
--cap-add=ALL \
--device-cgroup-rule "c 13:* rmw" \
--device /dev/dri \
--device /dev/uinput \
--device /dev/uhid \
-v /tmp/sockets:/tmp/sockets:rw \
-v /etc/wolf:/etc/wolf:rw \
-v /run/podman/podman.sock:/var/run/docker.sock:ro \
-v /dev/input:/dev/input:ro \
-v /run/udev:/run/udev:rw \
--security-opt seccomp=unconfined \
ghcr.io/games-on-whales/wolf:stable


# -e WOLF_RENDER_NODE=/dev/dri/renderD129 \
# -e WOLF_ENCODER_NODE=/dev/dri/renderD129 \
58 changes: 58 additions & 0 deletions files/system/etc/containers/systemd/wolf.container
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# wolf.container
# modified from: https://github.com/games-on-whales/wolf/pull/92/files
[Unit]
Description=Podman Wolf Gamestreaming

[Service]
Environment=PATH=/usr/bin
TimeoutStartSec=900

# TODO: Look into using systemd-tmpfiles here:
# https://wiki.archlinux.org/title/Systemd#systemd-tmpfiles_-_temporary_filesd
# look into config directive/setting for /var/run abstraction
ExecStartPre=-mkdir -p %T/sockets
ExecStartPre=-mkdir -p /var/run/wolf
ExecStartPre=-podman rm --force WolfPulseAudio
Restart=on-failure
RestartSec=5
StartLimitBurst=5

[Install]
WantedBy=multi-user.target

[Container]
# Avoid needing to use systemctl daemon-reload for trivial env var changes
# /etc/sysconfig is the default on Fedora based systems, /etc/default on ubuntu
# TODO: is there a better way to genericize this, or maybe just dump it into /etc/wolf?
EnvironmentFile=/etc/sysconfig/wolf

Image=ghcr.io/games-on-whales/wolf:stable
AutoUpdate=registry

HostName=%N # TODO: is this the hostname we actually want?

# Figure out what is actually really required here
#AddCapability=CAP_SYS_PTRACE
#AddCapability=CAP_NET_ADMIN
AddCapability=ALL

Network=host

# TODO: figure out tightening back down security
SecurityLabelDisable=true
# same as adding '--security-opt seccomp=unconfined' to PodmanArgs
SeccompProfile=unconfined

PodmanArgs=--ipc=host --device-cgroup-rule "c 13:* rmw"

AddDevice=/dev/dri
AddDevice=/dev/uinput
AddDevice=/dev/uhid

Volume=/dev/input:/dev/input:ro
Volume=/dev/:/dev/:ro
Volume=/run/udev:/run/udev:ro
Volume=%T/sockets:/tmp/sockets:rw
Volume=%t/podman/podman.sock:/var/run/docker.sock:ro
Volume=/etc/wolf:/etc/wolf:rw
Volume=/var/run/wolf:/var/run/wolf:rw
11 changes: 11 additions & 0 deletions files/system/etc/sysconfig/wolf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Environment variables for Podman Wolf Gamestreaming

# Temporary debugging vars
#WOLF_LOG_LEVEL=DEBUG
#WOLF_STOP_CONTAINER_ON_EXIT=true
#WOLF_RENDER_NODE=SOFTWARE

# TODO: figure out how to propagate TZ to created containers
TZ=America/New_York

WOLF_SOCKET_PATH=/var/run/wolf/wolf.sock
14 changes: 14 additions & 0 deletions files/system/etc/udev/rules.d/85-wolf.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Allows Wolf to access /dev/uinput
KERNEL=="uinput", SUBSYSTEM=="misc", MODE="0660", GROUP="input", OPTIONS+="static_node=uinput"

# Allows Wolf to access /dev/uhid
KERNEL=="uhid", TAG+="uaccess"

# Move virtual keyboard and mouse into a different seat
SUBSYSTEMS=="input", ATTRS{id/vendor}=="ab00", MODE="0660", GROUP="input", ENV{ID_SEAT}="seat9"

# Joypads
SUBSYSTEMS=="input", ATTRS{name}=="Wolf X-Box One (virtual) pad", MODE="0660", GROUP="input"
SUBSYSTEMS=="input", ATTRS{name}=="Wolf PS5 (virtual) pad", MODE="0660", GROUP="input"
SUBSYSTEMS=="input", ATTRS{name}=="Wolf gamepad (virtual) motion sensors", MODE="0660", GROUP="input"
SUBSYSTEMS=="input", ATTRS{name}=="Wolf Nintendo (virtual) pad", MODE="0660", GROUP="input"
Loading

0 comments on commit be5c625

Please sign in to comment.