Files
dotfiles/hosts/mainframe/systemd/sway-headless.service
T
connor de78118624 Streaming stack is on-demand, not always-on
Measured rather than assumed: the compositor and Sunshine together hold
220 MiB on the 3060 — sway ~112, Sunshine ~108. That card also runs the
local LLM, and with an 11.3 GB model resident on a 12 GB card the free
headroom goes from 992 MiB to 772. Losing a fifth of what is left matters
for KV cache growth, so leaving it running was the wrong default.

sway-headless and sunshine no longer start at boot. `stream on` brings them
up, `stream status` reports state and VRAM, and sunshine-idle-stop.timer
checks every five minutes whether any Moonlight client still holds a
connection to 47984/47989/48010 — stopping the stack after 15 idle minutes
so a forgotten session does not sit on memory the inference stack wants.

Note for future edits: `systemctl --user disable` on a unit dotbot has
symlinked into ~/.config/systemd/user deletes the symlink itself, because
systemd treats it as a linked unit. Re-run ./install after disabling one.
2026-09-14 15:46:32 -04:00

24 lines
939 B
Desktop File

[Unit]
Description=Headless Wayland compositor for Sunshine
Documentation=https://docs.lizardbyte.dev/projects/sunshine/
ConditionHost=mainframe
[Service]
Type=simple
# headless backend: no seat, no input devices, one virtual output.
Environment=WLR_BACKENDS=headless
Environment=WLR_LIBINPUT_NO_DEVICES=1
# Pin the compositor to the NVIDIA card (card0 = 01:00.0, renderD129), which is
# also what sunshine.conf names as its encoder. Without this wlroots picks the
# Intel iGPU and every captured frame crosses GPUs.
Environment=WLR_DRM_DEVICES=/dev/dri/card0
Environment=XDG_CURRENT_DESKTOP=sway
ExecStart=/usr/bin/sway -c %h/.config/sway/headless.conf
ExecStopPost=/usr/bin/systemctl --user stop sunshine.service
Restart=on-failure
RestartSec=5s
# Deliberately NOT WantedBy=default.target. The 3060 also holds the local LLM,
# and this stack costs ~220 MiB of VRAM. Start it with `stream on`; the
# idle-stop timer puts it away again.