From 6d60f8013c8ea5e0e777a04d2fc649cff68d82fd Mon Sep 17 00:00:00 2001 From: Filippo Berto Date: Mon, 17 Mar 2025 20:26:20 +0100 Subject: [PATCH] GameScope script --- instances/odin/configuration.nix | 44 ++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/instances/odin/configuration.nix b/instances/odin/configuration.nix index 4529655..3db715b 100644 --- a/instances/odin/configuration.nix +++ b/instances/odin/configuration.nix @@ -63,7 +63,6 @@ in }; }; - programs.gamemode = { enable = true; settings = { @@ -74,13 +73,49 @@ in }; }; - programs.steam.gamescopeSession.enable = true; programs.gamescope = { enable = true; capSysNice = true; }; services.getty.autologinUser = "tiziano"; + environment = { + systemPackages = pkgs.mangohud; + loginShellInit = + let + gs = pkgs.writeShellScript "gs" '' + set -xeuo pipefail + + gamescopeArgs=( + --adaptive-sync # VRR support + --hdr-enabled + --mangoapp # performance overlay + --rt + --steam + ) + steamArgs=( + -pipewire-dmabuf + -tenfoot + ) + mangoConfig=( + cpu_temp + gpu_temp + ram + vram + ) + mangoVars=( + MANGOHUD=1 + MANGOHUD_CONFIG="$(IFS=,; echo "''${mangoConfig[*]}")" + ) + + export "''${mangoVars[@]}" + exec gamescope "''${gamescopeArgs[@]}" -- steam "''${steamArgs[@]}" + ''; + in + '' + [[ "''$(tty) " = " /dev/tty1 " ]] && ${gs} + ''; + }; services = { avahi = { @@ -372,3 +407,8 @@ in system.stateVersion = "24.11"; } + + + + +