Enhance gaming configuration for Gamescope and Lutris support
- Added cursor theme and package for x11 environment - Updated environment variables for Gamescope and Lutris integration. - Improved Steam and Lutris desktop entries - Using _gid pkgs now, and gamescope-wsi
This commit is contained in:
parent
724e87bb98
commit
4ec5bc09c5
2 changed files with 100 additions and 12 deletions
|
@ -15,6 +15,9 @@ let
|
||||||
VRR = primaryMonitor.vrr or false;
|
VRR = primaryMonitor.vrr or false;
|
||||||
HDR = primaryMonitor.hdr or false;
|
HDR = primaryMonitor.hdr or false;
|
||||||
|
|
||||||
|
cursorTheme = config.home.pointerCursor.name or "Adwaita";
|
||||||
|
cursorPackage = config.home.pointerCursor.package or pkgs.gnome.adwaita-icon-theme;
|
||||||
|
|
||||||
# INFO: Example working commands for running games in steam-session
|
# INFO: Example working commands for running games in steam-session
|
||||||
## Rivals ##
|
## Rivals ##
|
||||||
# SteamDeck=1 LD_PRELOAD="" PROTON_ENABLE_NVAPI=1 PROTON_ENABLE_WAYLAND=1 VKD3D_DISABLE_EXTENSIONS=VK_KHR_present_wait gamemoderun %command% -PSOCompileMode=1 -dx12
|
# SteamDeck=1 LD_PRELOAD="" PROTON_ENABLE_NVAPI=1 PROTON_ENABLE_WAYLAND=1 VKD3D_DISABLE_EXTENSIONS=VK_KHR_present_wait gamemoderun %command% -PSOCompileMode=1 -dx12
|
||||||
|
@ -22,16 +25,28 @@ let
|
||||||
# gamemoderun mangohud %command%
|
# gamemoderun mangohud %command%
|
||||||
|
|
||||||
gamescope-env = ''
|
gamescope-env = ''
|
||||||
set -x CAP_SYS_NICE eip
|
|
||||||
set -x DXVK_HDR 1
|
set -x DXVK_HDR 1
|
||||||
set -x ENABLE_GAMESCOPE_WSI 1
|
set -x ENABLE_GAMESCOPE_WSI 1
|
||||||
set -x ENABLE_HDR_WSI 1
|
set -x ENABLE_HDR_WSI 1
|
||||||
set -x AMD_VULKAN_ICD RADV
|
set -x AMD_VULKAN_ICD RADV
|
||||||
set -x RADV_PERFTEST aco
|
set -x RADV_PERFTEST aco
|
||||||
set -x SDL_VIDEODRIVER wayland
|
set -x SDL_VIDEODRIVER wayland
|
||||||
|
set -x XCURSOR_THEME '${cursorTheme}'
|
||||||
|
set -x XCURSOR_PATH '${cursorPackage}/share/icons'
|
||||||
|
|
||||||
|
# Gamescope display identifier
|
||||||
|
set -x GAMESCOPE_WAYLAND_DISPLAY "gamescope-0"
|
||||||
|
|
||||||
|
# Steam specific environment variables
|
||||||
set -x STEAM_FORCE_DESKTOPUI_SCALING 1
|
set -x STEAM_FORCE_DESKTOPUI_SCALING 1
|
||||||
set -x STEAM_GAMEPADUI 1
|
set -x STEAM_GAMEPADUI 1
|
||||||
set -x STEAM_GAMESCOPE_CLIENT 1
|
set -x STEAM_GAMESCOPE_CLIENT 1
|
||||||
|
|
||||||
|
# Lutris specific environment variables
|
||||||
|
set -x LUTRIS_SKIP_INIT 1
|
||||||
|
set -x DISABLE_LAYER_AMD_SWITCHABLE_GRAPHICS_1 1
|
||||||
|
set -x DISABLE_LAYER_NV_OPTIMUS_1 1
|
||||||
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# Base gamescope options
|
# Base gamescope options
|
||||||
|
@ -46,7 +61,6 @@ let
|
||||||
"-r"
|
"-r"
|
||||||
"${toString REFRESH_RATE}"
|
"${toString REFRESH_RATE}"
|
||||||
"-f"
|
"-f"
|
||||||
"--expose-wayland"
|
|
||||||
"--backend"
|
"--backend"
|
||||||
"sdl"
|
"sdl"
|
||||||
"--rt"
|
"--rt"
|
||||||
|
@ -65,6 +79,13 @@ let
|
||||||
gamescope-run = pkgs.writeScriptBin "gamescope-run" ''
|
gamescope-run = pkgs.writeScriptBin "gamescope-run" ''
|
||||||
#!${lib.getExe pkgs.fish}
|
#!${lib.getExe pkgs.fish}
|
||||||
|
|
||||||
|
# Check if we're already inside a Gamescope session
|
||||||
|
if set -q GAMESCOPE_WAYLAND_DISPLAY
|
||||||
|
echo "Already inside Gamescope session ($GAMESCOPE_WAYLAND_DISPLAY), running command directly..."
|
||||||
|
# Skip gamescope and run the command directly
|
||||||
|
exec $argv
|
||||||
|
end
|
||||||
|
|
||||||
# Session Environment
|
# Session Environment
|
||||||
${gamescope-env}
|
${gamescope-env}
|
||||||
|
|
||||||
|
@ -99,7 +120,7 @@ let
|
||||||
end
|
end
|
||||||
|
|
||||||
# Execute gamescope with the final arguments and the command
|
# Execute gamescope with the final arguments and the command
|
||||||
exec ${lib.getExe pkgs.gamescope} $final_args -- $argv
|
exec ${lib.getExe pkgs.gamescope_git} $final_args -- $argv
|
||||||
'';
|
'';
|
||||||
|
|
||||||
## Effectively forces gamescope-run to be the default way to use Steam
|
## Effectively forces gamescope-run to be the default way to use Steam
|
||||||
|
@ -109,30 +130,51 @@ let
|
||||||
# This script wraps the original steam command to launch it
|
# This script wraps the original steam command to launch it
|
||||||
# with gamescope-run in a big picture mode.
|
# with gamescope-run in a big picture mode.
|
||||||
# All arguments passed to this script are forwarded.
|
# All arguments passed to this script are forwarded.
|
||||||
exec ${gamescope-run}/bin/gamescope-run -x "-e" ${lib.getExe pkgs.steam} -tenfoot -steamdeck -gamepadui $argv
|
exec ${lib.getExe gamescope-run} -x "-e" ${lib.getExe pkgs.steam} -tenfoot -steamdeck -gamepadui $argv
|
||||||
|
'';
|
||||||
|
|
||||||
|
## Ensures that all Lutris game launches go through Gamescope
|
||||||
|
## !!! This breaks the Lutris GUI, so use the overridden .desktop entry for opening Lutris itself
|
||||||
|
lutris-wrapper = pkgs.writeScriptBin "lutris" ''
|
||||||
|
#!${lib.getExe pkgs.fish}
|
||||||
|
# This script wraps the original lutris command to launch it
|
||||||
|
# with gamescope-run. All arguments passed to this script are forwarded.
|
||||||
|
exec ${lib.getExe gamescope-run} -x "--force-windows-fullscreen" ${lib.getExe pkgs.lutris} $argv
|
||||||
'';
|
'';
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
steam-run
|
steam-run
|
||||||
gamescope-run
|
|
||||||
steam-wrapper
|
steam-wrapper
|
||||||
|
gamescope-run
|
||||||
|
lutris-wrapper
|
||||||
];
|
];
|
||||||
|
|
||||||
xdg.desktopEntries =
|
xdg.desktopEntries =
|
||||||
let
|
let
|
||||||
steamBigPictureCmd = ''${lib.getExe gamescope-run} -x "-e" ${lib.getExe pkgs.steam} -tenfoot -steamdeck -gamepadui'';
|
steamBigPictureCmd = ''${lib.getExe gamescope-run} -x "-e" ${lib.getExe pkgs.steam} -tenfoot -steamdeck'';
|
||||||
heroicGamescopeCmd = ''${lib.getExe gamescope-run} -x "--force-windows-fullscreen" ${lib.getExe pkgs.heroic}'';
|
heroicGamescopeCmd = ''${lib.getExe gamescope-run} -x "--force-windows-fullscreen" ${lib.getExe pkgs.heroic}'';
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
steam = {
|
steam = {
|
||||||
name = "Steam";
|
name = "Steam";
|
||||||
comment = "Steam Big Picture (Gamescope)";
|
comment = "Steam Big Picture in Gamescope Session";
|
||||||
exec = steamBigPictureCmd;
|
exec = steamBigPictureCmd;
|
||||||
icon = "steam";
|
icon = "steam";
|
||||||
type = "Application";
|
type = "Application";
|
||||||
terminal = false;
|
terminal = false;
|
||||||
categories = [ "Game" ];
|
categories = [ "Game" ];
|
||||||
|
mimeType = [
|
||||||
|
"x-scheme-handler/steam"
|
||||||
|
"x-scheme-handler/steamlink"
|
||||||
|
];
|
||||||
|
settings = {
|
||||||
|
StartupNotify = "true";
|
||||||
|
StartupWMClass = "Steam";
|
||||||
|
PrefersNonDefaultGPU = "true";
|
||||||
|
X-KDE-RunOnDiscreteGpu = "true";
|
||||||
|
Keywords = "gaming;";
|
||||||
|
};
|
||||||
actions = {
|
actions = {
|
||||||
bigpicture = {
|
bigpicture = {
|
||||||
name = "Steam Client (No Gamescope)";
|
name = "Steam Client (No Gamescope)";
|
||||||
|
@ -141,8 +183,8 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
"com.heroicgameslauncher.hgl.desktop" = {
|
"com.heroicgameslauncher.hgl" = {
|
||||||
name = "Heroic Games Launcher (Gamescope)";
|
name = "Heroic Games Launcher";
|
||||||
comment = "Heroic in Gamescope Session";
|
comment = "Heroic in Gamescope Session";
|
||||||
exec = heroicGamescopeCmd;
|
exec = heroicGamescopeCmd;
|
||||||
icon = "com.heroicgameslauncher.hgl";
|
icon = "com.heroicgameslauncher.hgl";
|
||||||
|
@ -156,5 +198,28 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
"net.lutris.Lutris" = {
|
||||||
|
name = "Lutris";
|
||||||
|
comment = "Video Game Preservation Platform";
|
||||||
|
exec = "${lib.getExe pkgs.lutris} %U";
|
||||||
|
icon = "net.lutris.Lutris";
|
||||||
|
type = "Application";
|
||||||
|
terminal = false;
|
||||||
|
categories = [ "Game" ];
|
||||||
|
mimeType = [ "x-scheme-handler/lutris" ];
|
||||||
|
settings = {
|
||||||
|
StartupNotify = "true";
|
||||||
|
StartupWMClass = "Lutris";
|
||||||
|
Keywords = "gaming;wine;emulator;";
|
||||||
|
X-GNOME-UsesNotifications = "true";
|
||||||
|
};
|
||||||
|
actions = {
|
||||||
|
regular = {
|
||||||
|
name = "Lutris (Gamescope BROKEN)";
|
||||||
|
exec = ''${lib.getExe gamescope-run} -x "--force-windows-fullscreen --expose-wayland" ${lib.getExe pkgs.lutris} %U'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,8 +16,17 @@
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
lact # AMDgpu tool
|
lact # AMDgpu tool
|
||||||
gamescope
|
heroic
|
||||||
# gamescope-wsi # TODO: Test again in future updates, borked atm 06/21/25
|
gamescope_git
|
||||||
|
gamescope-wsi_git
|
||||||
|
(pkgs.lutris.override {
|
||||||
|
extraPkgs = pkgs: [
|
||||||
|
pkgs.wineWowPackages.waylandFull
|
||||||
|
pkgs.winetricks
|
||||||
|
vulkan-tools
|
||||||
|
xterm
|
||||||
|
];
|
||||||
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
systemd = {
|
systemd = {
|
||||||
|
@ -25,6 +34,19 @@
|
||||||
services.lactd.wantedBy = [ "multi-user.target" ];
|
services.lactd.wantedBy = [ "multi-user.target" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Instead of set -x CAP_SYS_NICE eip
|
||||||
|
services.ananicy = {
|
||||||
|
enable = true;
|
||||||
|
package = pkgs.ananicy-cpp;
|
||||||
|
rulesProvider = pkgs.ananicy-cpp;
|
||||||
|
extraRules = [
|
||||||
|
{
|
||||||
|
"name" = "gamescope";
|
||||||
|
"nice" = -20;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
programs = {
|
programs = {
|
||||||
steam = {
|
steam = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
@ -63,7 +85,8 @@
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
extraCompatPackages = [ pkgs.unstable.proton-ge-bin ];
|
extraCompatPackages = [ pkgs.unstable.proton-ge-bin ];
|
||||||
gamescopeSession.enable = true;
|
# Conflicting with gamescope_git
|
||||||
|
# gamescopeSession.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
gamemode = {
|
gamemode = {
|
||||||
|
|
Loading…
Add table
Reference in a new issue