From 111352d376d5c2c7143527703ffc9f31e290bf80 Mon Sep 17 00:00:00 2001 From: Chris Toph Date: Mon, 19 May 2025 16:32:07 -0400 Subject: [PATCH] Cleanup gaming configs and fix gamescope --- home/toph/common/optional/gaming/default.nix | 84 ++++++++++---------- home/toph/common/optional/gaming/switch.nix | 7 -- hosts/global/common/gaming.nix | 27 ++++--- 3 files changed, 58 insertions(+), 60 deletions(-) diff --git a/home/toph/common/optional/gaming/default.nix b/home/toph/common/optional/gaming/default.nix index 936fcf2..65a17f2 100644 --- a/home/toph/common/optional/gaming/default.nix +++ b/home/toph/common/optional/gaming/default.nix @@ -1,5 +1,3 @@ -# This module just provides a customized .desktop file with gamescope args dynamically created based on the -# host's monitors configuration { pkgs, config, @@ -7,50 +5,51 @@ ... }: -let - monitor = lib.head (lib.filter (m: m.primary) config.monitors); - steam-session = - let - gamescope = lib.concatStringsSep " " [ - (lib.getExe pkgs.gamescope) - "--rt" - "--output-width ${toString monitor.width}" - "--output-height ${toString monitor.height}" - "--framerate-limit ${toString monitor.refreshRate}" - "--prefer-output ${monitor.name}" - "--adaptive-sync" - "--expose-wayland" - "--backend wayland" - "--force-grab-cursor" - "--steam" - # "--hdr-enabled" - ]; - steam = lib.concatStringsSep " " [ - "steam" - #"steam://open/bigpicture" - "-forcedesktopscaling ${toString monitor.scale}" - "-nofriendsui" - "-noschatui" - ]; - in - pkgs.writeTextDir "share/applications/steam-session.desktop" '' - [Desktop Entry] - Name=Steam Session - Comment=Steam with Gamescope - Exec=${gamescope} -- ${steam} - Icon=steam - Type=Application - Categories=Network;FileTransfer;Game; - MimeType=x-scheme-handler/steam;x-scheme-handler/steamlink; - PrefersNonDefaultGPU = true; - ''; -in +#INFO: Gamescope is REALLY broken rn, this wont work +# let +# monitor = lib.head (lib.filter (m: m.primary) config.monitors); +# steam-session = +# let +# gamescope = lib.concatStringsSep " " [ +# (lib.getExe pkgs.gamescope) +# "--rt" +# "--output-width ${toString monitor.width}" +# "--output-height ${toString monitor.height}" +# "--framerate-limit ${toString monitor.refreshRate}" +# "--prefer-output ${monitor.name}" +# "--adaptive-sync" +# "--expose-wayland" +# "--backend wayland" +# "--force-grab-cursor" +# "--steam" +# # "--hdr-enabled" +# ]; +# steam = lib.concatStringsSep " " [ +# "steam" +# #"steam://open/bigpicture" +# "-forcedesktopscaling ${toString monitor.scale}" +# "-nofriendsui" +# "-noschatui" +# ]; +# in +# pkgs.writeTextDir "share/applications/steam-session.desktop" '' +# [Desktop Entry] +# Name=Steam Session +# Comment=Steam with Gamescope +# Exec=${gamescope} -- ${steam} +# Icon=steam +# Type=Application +# Categories=Network;FileTransfer;Game; +# MimeType=x-scheme-handler/steam;x-scheme-handler/steamlink; +# PrefersNonDefaultGPU = true; +# ''; +# in { imports = lib.custom.scanPaths ./.; home.packages = with pkgs; [ prismlauncher - steam-session + # steam-session # modrinth-app (lutris.override { extraLibraries = pkgs: [ @@ -62,3 +61,6 @@ in }) ]; } + +# INFO: Example working command for running gamescope +# gamescope --adaptive-sync --backend sdl --expose-wayland --force-grab-cursor --framerate-limit 120 --immediate-flips --output-height 2160 --output-width 3840 --prefer-output DP-3 --rt -- gamemoderun %command% diff --git a/home/toph/common/optional/gaming/switch.nix b/home/toph/common/optional/gaming/switch.nix index 0f74e13..aab36ad 100644 --- a/home/toph/common/optional/gaming/switch.nix +++ b/home/toph/common/optional/gaming/switch.nix @@ -8,13 +8,6 @@ }: let - # citron-emu = pkgs.callPackage (lib.custom.relativeToRoot "pkgs/common/citron-emu/package.nix") { - # inherit pkgs; - # }; - # borgtui = pkgs.callPackage (lib.custom.relativeToRoot "pkgs/common/borgtui/package.nix") { - # inherit pkgs; - # }; - homeDir = hostSpec.home; borg-wrapper = pkgs.writeScript "borg-wrapper" '' diff --git a/hosts/global/common/gaming.nix b/hosts/global/common/gaming.nix index 947e28c..e77fcb6 100644 --- a/hosts/global/common/gaming.nix +++ b/hosts/global/common/gaming.nix @@ -7,6 +7,13 @@ { hardware.xone.enable = true; # xbox controller + hardware.opengl = { + enable = true; + driSupport32Bit = true; + }; + + services.xserver.videoDrivers = [ "amdgpu" ]; + programs = { steam = { enable = true; @@ -31,30 +38,24 @@ ; inherit (pkgs) + gamemode + gamescope # !!!: DO NOT ADD GAMESCOPE ANYWHERE ELSE IN CONFIG, IT WILL BREAK! + gperftools + keyutils + libkrb5 libpng libpulseaudio libvorbis - libkrb5 - keyutils - gperftools - gamemode ; }); }; extraCompatPackages = [ pkgs.unstable.proton-ge-bin ]; gamescopeSession.enable = true; }; - #gamescope launch args set dynamically in home//common/optional/gaming - gamescope = { - enable = true; - capSysNice = true; - }; - # to run steam games in game mode, add the following to the game's properties from within steam - # gamemoderun %command% + gamemode = { enable = true; settings = { - #see gamemode man page for settings info general = { softrealtime = "auto"; inhibit_screensaver = 1; @@ -73,3 +74,5 @@ }; }; } + +# gamescope --adaptive-sync --backend sdl --expose-wayland --force-grab-cursor --framerate-limit 120 --immediate-flips --output-height 2160 --output-width 3840 --prefer-output DP-1 --rt -- gamemoderun %command%