This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

machines.coaxmetal: gamescope-session kiosk so games skip per-game gamescope

Replace the cage kiosk with a gamescope session on DRM (greetd autologin).
gamescope presents straight to the display, so there is no nested Wayland
swapchain for RADV to storm on this Vega iGPU - which crashed games like Baba
Is You when gamescope was nested under cage. Set STROM_NO_GAMESCOPE=1 so the
launcher runs <slug>.no-gamescope and each game renders directly in the session
compositor instead of nesting its own gamescope.

Runs the patched launcher from the /home/strom/strom checkout until the
STROM_NO_GAMESCOPE support lands upstream (github launcher lacks it).

+59 -25
+59 -25
machines/coaxmetal/strom.nix
··· 1 1 { 2 2 config, 3 - lib, 4 3 pkgs, 5 4 ... 6 5 }: 7 6 let 8 - # Always pull the newest launcher straight from the public flake instead of 9 - # pinning it as an input, so the game grid tracks upstream on every (re)launch. 10 - # The launcher itself only shells out to `nix run <flake>#<slug>` per game, so 11 - # its closure stays tiny; games bring their own nested gamescope/proton. 7 + # Run the patched launcher from the on-disk strom checkout at 8 + # /home/strom/strom (it carries STROM_NO_GAMESCOPE support until that lands 9 + # upstream). With the kiosk itself being a gamescope session (below), games 10 + # are launched as <slug>.no-gamescope so they render directly in the session 11 + # compositor instead of nesting a per-game gamescope. 12 12 strom-session = pkgs.writeShellScript "strom-session" '' 13 13 set -u 14 14 # xpadneo owns the Xbox pad's hidraw node, so force SDL (pygame launcher and ··· 23 23 # joystick (not keyboard) events while unfocused - so keyboard works but the 24 24 # pad does not. Allow joystick events regardless of focus. 25 25 export SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS=1 26 - # Relaunch whenever the couch launcher exits (gamepad B / Esc) so the kiosk 27 - # never drops to a blank tty. Keeping the loop as cage's child means the 28 - # compositor stays up across relaunches. 29 - while true; do 30 - ${config.nix.package}/bin/nix run --refresh github:kraftwerk-gaming/strom#scripts.launcher 31 - sleep 2 26 + # The kiosk compositor is already gamescope on DRM (see services.greetd 27 + # below), so tell the launcher to run games directly in it rather than 28 + # nesting a per-game gamescope (which double-nests and, on this GPU, storms 29 + # the Vulkan swapchain and crashes games like Baba Is You). 30 + export STROM_NO_GAMESCOPE=1 31 + # strom-run (the per-game supervisor) needs a delegated cgroup v2 so it can 32 + # mkdir a child cgroup and cgroup.kill the game tree atomically. The greetd 33 + # PAM session drops us into a root-owned logind session scope 34 + # (user-1011.slice/session-cN.scope) that is NOT delegated, so strom-run dies 35 + # with "could not create cgroup (Permission denied)" and the game never 36 + # launches. Re-parent into a delegated transient scope under the user manager 37 + # (user@UID.service, which logind DOES delegate). Wait for the user bus first: 38 + # on boot the PAM session opens slightly before the user manager's bus socket. 39 + rd="''${XDG_RUNTIME_DIR:-/run/user/$(id -u)}" 40 + for _ in $(seq 1 50); do 41 + [ -S "$rd/bus" ] && break 42 + sleep 0.2 32 43 done 44 + # Relaunch whenever the couch launcher exits (gamepad B / Esc) so the kiosk 45 + # never drops to a blank screen. The loop runs inside the delegated scope so 46 + # every game inherits a writable cgroup; the gamescope compositor stays up 47 + # (it is the session's other child) across relaunches. 48 + # 49 + # setpriv --ambient-caps=-all: the login session may carry an ambient 50 + # capability (e.g. cap_wake_alarm) that every child inherits. bwrap refuses 51 + # to start when it sees capabilities in its permitted set without being 52 + # setuid ("Unexpected capabilities but not setuid, old file caps config?"), 53 + # which instant-crashes every sandboxed game. Drop the ambient set for the 54 + # whole launcher tree so bwrap (and thus each game) starts clean. 55 + exec ${pkgs.systemd}/bin/systemd-run --user --scope -p Delegate=yes \ 56 + --quiet --collect -- \ 57 + ${pkgs.util-linux}/bin/setpriv --ambient-caps=-all \ 58 + ${pkgs.bash}/bin/bash -c 'while true; do 59 + ${config.nix.package}/bin/nix run /home/strom/strom#scripts.launcher 60 + sleep 2 61 + done' 33 62 ''; 34 63 35 64 # Bluetooth pairing helper for Xbox Wireless Controllers. Run `strom-pair` ··· 146 175 ]; 147 176 }; 148 177 149 - # Kiosk autostart. After the initrd ZFS/LUKS unlock hands off to the running 150 - # system, graphical.target pulls up cage on tty1, which logs the strom user 151 - # in with no prompt and runs the fullscreen launcher as its sole Wayland 152 - # client. This is the canonical NixOS single-app kiosk path. 153 - services.cage = { 178 + # Kiosk autostart: a gamescope session on DRM (via greetd autologin), 179 + # replacing cage. gamescope presents straight to the display, so there is no 180 + # nested Wayland swapchain for RADV to storm on this Vega iGPU. greetd gives 181 + # the strom user a real seat/VT (DRM master) and a delegated user manager, 182 + # which the launcher's systemd-run --user --scope relies on for game cgroups. 183 + services.greetd = { 154 184 enable = true; 155 - user = "strom"; 156 - program = strom-session; 157 - }; 158 - 159 - # Recover the compositor itself if it ever crashes (the session loop above 160 - # already handles a launcher exit without tearing cage down). 161 - systemd.services.cage-tty1.serviceConfig = { 162 - Restart = lib.mkDefault "always"; 163 - RestartSec = 2; 185 + settings = 186 + let 187 + session = { 188 + command = "${pkgs.gamescope}/bin/gamescope -- ${strom-session}"; 189 + user = "strom"; 190 + }; 191 + in 192 + { 193 + # initial_session autologins on boot with no prompt; default_session 194 + # re-runs it (also autologin) if the gamescope session ever exits. 195 + initial_session = session; 196 + default_session = session; 197 + }; 164 198 }; 165 199 166 200 # The panel comes up at ~1% backlight, unreadable for a couch setup. Ship