nixos/system/optional/gaming.nix
2026-01-15 14:33:49 +01:00

65 lines
1.6 KiB
Nix

{
pkgs,
config,
lib,
...
}:
{
options.gaming.enable = lib.mkEnableOption "Enable steam and related software";
config =
lib.mkIf config.desktop.enable { programs.steam.enable = true; }
// lib.mkIf config.gaming.enable {
programs = {
gamescope = {
enable = true;
capSysNice = true;
};
steam = {
enable = true;
gamescopeSession.enable = true;
remotePlay.openFirewall = true;
dedicatedServer.openFirewall = true;
localNetworkGameTransfers.openFirewall = true;
};
gamemode.enable = true;
};
hardware.steam-hardware.enable = true;
environment = {
systemPackages = with pkgs; [
mangohud
protonup-ng
protontricks
];
};
systemd.user.services.steam = {
enable = true;
description = "Open Steam in the background at boot";
serviceConfig = {
ExecStart = "${pkgs.steam}/bin/steam -nochatui -nofriendsui -silent %U";
wantedBy = [ "graphical-session.target" ];
Restart = "on-failure";
RestartSec = "5s";
};
};
# SteamVR kernel patch for AMDGPU
# boot.kernelPatches = [
# {
# name = "amdgpu-ignore-ctx-privileges";
# patch = pkgs.fetchpatch {
# name = "cap_sys_nice_begone.patch";
# url = "https://github.com/Frogging-Family/community-patches/raw/master/linux61-tkg/cap_sys_nice_begone.mypatch";
# hash = "sha256-Y3a0+x2xvHsfLax/uwycdJf3xLxvVfkfDVqjkxNaYEo=";
# };
# }
# ];
};
}