From 95b849420edbc8367a16863a698076b05dace98b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ryan4yin=20=7C=20=E4=BA=8C=E8=8A=B1?= Date: Wed, 7 Oct 2026 13:14:42 +0800 Subject: [PATCH] feat(gaming): declarative Proton and dGPU game rendering (#393) --- WORKAROUNDS.md | 1 + hosts/idols-ai/hardware-nvidia.nix | 11 +++++++++++ hosts/idols-ai/preservation.nix | 1 + modules/nixos/desktop/gaming.nix | 24 ++++++++++++++++++++---- 4 files changed, 33 insertions(+), 4 deletions(-) diff --git a/WORKAROUNDS.md b/WORKAROUNDS.md index 1ddd15b5..f8fe54c0 100644 --- a/WORKAROUNDS.md +++ b/WORKAROUNDS.md @@ -38,6 +38,7 @@ A setting that works around a bug or a hardware quirk. | WA-011 | Kernel module blacklist (`esp4`, `esp6`, `rxrpc`) — `hardening/kernel-hardening.nix` | attack surface for the Dirty Frag LPE (CVE-2026-43284 / CVE-2026-43500) | Kept as defence in depth; drop only if something needs those modules | 2026-10-03 | rarely | active | | WA-017 | keyd right-hand modifier passthrough — `modules/nixos/desktop/peripherals.nix` | keyd folds right Ctrl/Shift/Meta into their left keys | Drop once keyd or fcitx5 keeps right-hand modifiers distinct | 2026-10-05 | on keyd bump | active | | WA-018 | user-owned `~/.ssh/config` + disabled systemd ssh-proxy include — `home/base/tui/ssh.nix`, `modules/nixos/base/ssh.nix` | bwrap exposes root-owned store files as `nobody` | Drop once sandboxes preserve store ownership | 2026-10-06 | when sandbox layout changes | active | +| WA-019 | programs.steam.extraCompatPackages = [ pkgs-x64.dwproton-bin pkgs-x64.proton-ge-bin ] — modules/nixos/desktop/gaming.nix | ACE games fail on GE/mainline Proton, work with DW-Proton | Drop once mainline or GE-Proton runs these games (GE-Proton#433) | 2026-10-07 | on Proton/GE bump | active | If WA-008 freezes recur, the fallback is to restore `nvme_core.default_ps_max_latency_us=0 nvme_core.io_timeout=4294967295 pcie_aspm=off`; this is a diff --git a/hosts/idols-ai/hardware-nvidia.nix b/hosts/idols-ai/hardware-nvidia.nix index 1ef30f75..3f208bbb 100644 --- a/hosts/idols-ai/hardware-nvidia.nix +++ b/hosts/idols-ai/hardware-nvidia.nix @@ -22,6 +22,17 @@ nvidiaBusId = "PCI:2@0:0:0"; }; + # Games launched through GameScope should use the dGPU. prime.offload keeps the + # Intel iGPU as the default renderer so the dGPU stays free for LLM workloads, + # so opt GameScope games into PRIME render offload here. Games launched outside + # GameScope need `nvidia-offload %command%` in their Steam launch options. + programs.gamescope.env = { + __NV_PRIME_RENDER_OFFLOAD = "1"; + __NV_PRIME_RENDER_OFFLOAD_PROVIDER = "NVIDIA-G0"; + __GLX_VENDOR_LIBRARY_NAME = "nvidia"; + __VK_LAYER_NV_optimus = "NVIDIA_only"; + }; + boot.kernelParams = [ # Since NVIDIA does not load kernel mode setting by default, # enabling it is required to make Wayland compositors function properly. diff --git a/hosts/idols-ai/preservation.nix b/hosts/idols-ai/preservation.nix index a6629409..383c65b8 100644 --- a/hosts/idols-ai/preservation.nix +++ b/hosts/idols-ai/preservation.nix @@ -265,6 +265,7 @@ in "Games" ".steam" + ".config/MangoHud" ".config/blender" ".local/share/umu" diff --git a/modules/nixos/desktop/gaming.nix b/modules/nixos/desktop/gaming.nix index f33a5790..307b6d24 100644 --- a/modules/nixos/desktop/gaming.nix +++ b/modules/nixos/desktop/gaming.nix @@ -40,10 +40,6 @@ in # ~/.steam - Some Symlinks & user info enable = true; package = pkgs-x64.steam; - # https://github.com/ValveSoftware/gamescope - # Run a GameScope driven Steam session from your display-manager - # fix resolution upscaling and stretched aspect ratios - gamescopeSession.enable = true; # https://github.com/Winetricks/winetricks # Whether to enable protontricks, a simple wrapper for running Winetricks commands for Proton-enabled games. protontricks.enable = true; @@ -52,6 +48,26 @@ in fontPackages = [ pkgs.wqy_zenhei # Need by steam for Chinese ]; + # DW-Proton (Dawn Winery's Proton fork) carries the anti-cheat and game + # patches that mainline Proton/GE-Proton lack, so it is what runs the anime + # gacha games (Wuthering Waves, Honkai: Star Rail, Arknights: Endfield, ...); + # GE-Proton is the general fallback. Both appear as compatibility tools in + # each game's Properties -> Compatibility. + # https://dawn.wine/dawn-winery/dwproton + extraCompatPackages = [ + pkgs-x64.dwproton-bin + pkgs-x64.proton-ge-bin + ]; + }; + + # GameScope: run a game in its own nested compositor and let it renice + # itself for steadier frame pacing. GPU-specific PRIME render offload belongs + # to the host, not here (see programs.gamescope.env in + # hosts/idols-ai/hardware-nvidia.nix). + # https://github.com/ValveSoftware/gamescope + programs.gamescope = { + enable = true; + capSysNice = true; }; # see https://github.com/fufexan/nix-gaming/#pipewire-low-latency