# Steam + Proton, gamescope, gamemode and MangoHud. { config, lib, pkgs, ... }: let cfg = config.my.gaming; in { options.my.gaming.enable = lib.mkEnableOption "the gaming stack (Steam, Proton-GE, gamescope, gamemode)"; config = lib.mkIf cfg.enable { programs = { steam = { enable = true; remotePlay.openFirewall = true; localNetworkGameTransfers.openFirewall = true; dedicatedServer.openFirewall = false; gamescopeSession.enable = true; extraCompatPackages = [ pkgs.proton-ge-bin ]; protontricks.enable = true; # Steam Input on Wayland (controllers acting as keyboard/mouse). extest.enable = true; }; gamescope = { enable = true; # Lets gamescope raise its own priority. capSysNice = true; }; gamemode = { enable = true; settings = { general.renice = 10; gpu = { apply_gpu_optimisations = "accept-responsibility"; gpu_device = 0; amd_performance_level = "high"; }; }; }; }; hardware.steam-hardware.enable = true; environment.systemPackages = with pkgs; [ mangohud protonplus ]; # Some Proton games exhaust the default map count and crash. boot.kernel.sysctl."vm.max_map_count" = 2147483642; }; }