From 05920f60b7059b19f69148c53fe4d02729e909f2 Mon Sep 17 00:00:00 2001 From: alexion Date: Wed, 21 Oct 2026 19:03:20 -0400 Subject: [PATCH] refactor(steam): scope VR configuration to Zeus --- configs/nixos/hosts/neogaia/default.nix | 1 - configs/nixos/hosts/zeus/default.nix | 30 ++++++-- configs/nixos/modules/desktop/apps/steam.nix | 74 +++++--------------- 3 files changed, 45 insertions(+), 60 deletions(-) diff --git a/configs/nixos/hosts/neogaia/default.nix b/configs/nixos/hosts/neogaia/default.nix index b8b6ba0..a5abe84 100644 --- a/configs/nixos/hosts/neogaia/default.nix +++ b/configs/nixos/hosts/neogaia/default.nix @@ -40,7 +40,6 @@ modules.desktop.enable = true; modules.desktop.apps.firefox.uiScale = "1.25"; modules.desktop.apps.obsidian.enable = true; - modules.desktop.apps.steam.enable = true; registry.waybar.neogaia.battery = { order = 70; diff --git a/configs/nixos/hosts/zeus/default.nix b/configs/nixos/hosts/zeus/default.nix index 09fb600..8590f38 100644 --- a/configs/nixos/hosts/zeus/default.nix +++ b/configs/nixos/hosts/zeus/default.nix @@ -1,11 +1,15 @@ { config, lib, + pkgs, ... }: # zeus — Ryzen desktop with AMD graphics. # Disk layout is in ./disk.nix. # `fileSystems` are derived from it, none declared here. +let + steamVrLauncher = "/home/${config.user.name}/.local/share/Steam/steamapps/common/SteamVR/bin/linux64/vrcompositor-launcher"; +in { imports = [ ./disk.nix @@ -46,12 +50,30 @@ modules.desktop.apps.r2modman.enable = true; modules.desktop.emulation.enable = true; modules.desktop.apps.signal.enable = true; - modules.desktop.apps.steam = { - enable = true; - vr.enable = true; - }; + modules.desktop.apps.steam.enable = true; modules.desktop.apps.vencord.enable = true; + networking.firewall.allowedUDPPorts = [ 10400 ]; + + programs.gamescope.capSysNice = true; + + systemd.paths.steamvr-capabilities = { + wantedBy = [ "multi-user.target" ]; + pathConfig = { + PathChanged = steamVrLauncher; + Unit = "steamvr-capabilities.service"; + }; + }; + + systemd.services.steamvr-capabilities = { + wantedBy = [ "multi-user.target" ]; + path = [ pkgs.libcap ]; + script = '' + setcap cap_sys_nice=eip ${lib.escapeShellArg steamVrLauncher} + ''; + serviceConfig.Type = "oneshot"; + }; + home-manager.users.${config.user.name}.wayland.windowManager.hyprland.settings.monitor = [ { output = "HDMI-A-1"; diff --git a/configs/nixos/modules/desktop/apps/steam.nix b/configs/nixos/modules/desktop/apps/steam.nix index df6d380..8ffe66f 100644 --- a/configs/nixos/modules/desktop/apps/steam.nix +++ b/configs/nixos/modules/desktop/apps/steam.nix @@ -6,62 +6,26 @@ ... }: # Steam game launcher and runtime integration. -let - cfg = config.modules.desktop.apps.steam; - steamVrLauncher = "/home/${config.user.name}/.local/share/Steam/steamapps/common/SteamVR/bin/linux64/vrcompositor-launcher"; -in { - options.modules.desktop.apps.steam = { - enable = lib.mkEnableOption "Steam game launcher"; + options.modules.desktop.apps.steam.enable = lib.mkEnableOption "Steam game launcher"; - vr.enable = lib.mkEnableOption "SteamVR with VRLink"; + config = lib.mkIf config.modules.desktop.apps.steam.enable { + programs.gamemode.enable = true; + + programs.steam = { + enable = true; + package = pkgs.steam.override { + extraEnv.STEAM_FORCE_DESKTOPUI_SCALING = "1.5"; + }; + }; + + hardware.steam-hardware.enable = true; + + programs.gamescope.enable = true; + + registry.window-icon.${config.networking.hostName}.steam = { + class = "[Ss]team"; + icon = util.glyph "f1b6"; + }; }; - - config = lib.mkIf cfg.enable ( - lib.mkMerge [ - { - programs.gamemode.enable = true; - - programs.steam = { - enable = true; - package = pkgs.steam.override { - extraEnv.STEAM_FORCE_DESKTOPUI_SCALING = "1.5"; - }; - }; - - hardware.steam-hardware.enable = true; - - programs.gamescope.enable = true; - - registry.window-icon.${config.networking.hostName}.steam = { - class = "[Ss]team"; - icon = util.glyph "f1b6"; - }; - } - (lib.mkIf cfg.vr.enable { - networking.firewall.allowedUDPPorts = [ 10400 ]; - - programs.gamescope.capSysNice = true; - - systemd.paths.steamvr-capabilities = { - wantedBy = [ "multi-user.target" ]; - pathConfig = { - PathChanged = steamVrLauncher; - Unit = "steamvr-capabilities.service"; - }; - }; - - systemd.services.steamvr-capabilities = { - wantedBy = [ "multi-user.target" ]; - path = [ pkgs.libcap ]; - script = '' - if [ -e ${lib.escapeShellArg steamVrLauncher} ]; then - setcap cap_sys_nice=eip ${lib.escapeShellArg steamVrLauncher} - fi - ''; - serviceConfig.Type = "oneshot"; - }; - }) - ] - ); }