Files
nixos/modules/gaming.nix
Melvin Ragusa b53c2ecaa9 fix formatting
2026-02-03 11:14:57 +01:00

97 lines
4.4 KiB
Nix

# modules/gaming.nix
# Full gaming setup: Steam, Gamemode, Lutris, Heroic, Wine, Proton
{
config,
pkgs,
lib,
username,
...
}:
{
# ═══════════════════════════════════════════════════════════════
# STEAM
# ═══════════════════════════════════════════════════════════════
programs.steam = {
enable = true;
remotePlay.openFirewall = true; # Steam Remote Play
dedicatedServer.openFirewall = true; # Dedicated servers
localNetworkGameTransfers.openFirewall = true; # LAN game transfers
# Extra compatibility packages for Proton
extraCompatPackages = with pkgs; [
proton-ge-bin # GloriousEggroll's Proton fork - better compatibility
];
};
# Steam hardware support (controllers, VR, etc.)
hardware.steam-hardware.enable = true;
# ═══════════════════════════════════════════════════════════════
# GAMEMODE
# ═══════════════════════════════════════════════════════════════
# Optimize system for gaming
programs.gamemode = {
enable = true;
enableRenice = true; # Allow renice for priority boost
settings = {
general = {
renice = 10;
softrealtime = "auto";
inhibit_screensaver = 1;
};
gpu = {
apply_gpu_optimisations = "accept-responsibility";
gpu_device = 0;
amd_performance_level = "high";
};
};
};
# ═══════════════════════════════════════════════════════════════
# GAMING PACKAGES
# ═══════════════════════════════════════════════════════════════
# NOTE: Game launchers (lutris, heroic, protonup-qt) are in `nix profile`
environment.systemPackages = with pkgs; [
# Wine for non-Steam games
wineWowPackages.stagingFull # Latest Wine with all features
winetricks # Wine helper scripts
protontricks # Proton helper scripts (like winetricks for Proton)
# Gaming utilities (system integration)
gamemode # CLI tool to trigger gamemode
gamescope # Micro-compositor for games (fixes some issues)
# Launchers
faugus-launcher
lutris
heroic
];
# ═══════════════════════════════════════════════════════════════
# KERNEL TWEAKS
# ═══════════════════════════════════════════════════════════════
boot.kernel.sysctl = {
# Increase file watchers for large games
"fs.inotify.max_user_watches" = 524288;
# Better memory management for gaming
"vm.swappiness" = 10;
"vm.vfs_cache_pressure" = 50;
};
# ═══════════════════════════════════════════════════════════════
# CONTROLLER SUPPORT
# ═══════════════════════════════════════════════════════════════
# Udev rules for game controllers
services.udev.packages = with pkgs; [
game-devices-udev-rules # Support for various game controllers
];
# ═══════════════════════════════════════════════════════════════
# USER PERMISSIONS
# ═══════════════════════════════════════════════════════════════
# Add user to gamemode group
users.users.${username}.extraGroups = [ "gamemode" ];
}