Files
nixos/modules/gaming.nix
T
2025-06-30 14:20:06 -05:00

73 lines
2.1 KiB
Nix

# In your ~/.config/home-manager/home.nix (or a file imported by it)
{
config,
pkgs,
...
}:
# Home Manager modules usually get config and pkgs as arguments
let
# Define the custom Steam launcher script within Home Manager's scope.
# pkgs here refers to the pkgs available to your Home Manager environment.
steamGamescopeWrapper = pkgs.writeScriptBin "steam-gamescope-launcher" ''
#!/usr/bin/env bash
set -xeuo pipefail
gamescopeArgs=(
--adaptive-sync
--hdr-enabled
--mangoapp
--rt
--steam
)
steamArgs=(
-pipewire-dmabuf
-tenfoot
)
mangoConfig=(
cpu_temp
gpu_temp
ram
vram
)
mangoVars=(
MANGOHUD=1
MANGOHUD_CONFIG="$(IFS=,; echo "$${mangoConfig[*]}")"
)
export PATH="${pkgs.gamescope}/bin:${pkgs.mangohud}/bin:$PATH"
export "$${mangoVars[@]}"
exec ${pkgs.gamescope}/bin/gamescope "$${gamescopeArgs[@]}" -- ${pkgs.steam}/bin/steam "$${steamArgs[@]}"
'';
in {
# You don't need 'programs.xdg.enable = true;' explicitly here in Home Manager;
# xdg.desktopEntries will be available directly once Home Manager is active.
# Home Manager usually manages user-level packages under `home.packages`.
home.packages = with pkgs; [
protonup-qt
mangohud
goverlay
steamGamescopeWrapper # Add your wrapper script to your user's PATH
];
# Define the desktop entry within Home Manager's xdg.desktopEntries
xdg.desktopEntries.steam = {
name = "Steam (Gamescope)";
comment = "Launch Steam via Gamescope with MangoHud";
exec = "${steamGamescopeWrapper}";
icon = "steam";
terminal = false;
type = "Application";
categories = ["Game" "Application"];
startupNotify = true;
};
# If you previously had services.getty.autologinUser, that remains in configuration.nix.
# Likewise for hardware.xone.enable and boot.kernelPackages.
# Note: programs.steam.enable, programs.gamescope.enable, hardware.xone.enable
# usually remain in configuration.nix (system-wide), as they install the programs
# and drivers for the whole system.
}