feat(steam): add compatibility utils

This commit is contained in:
Mohammad Rafiq 2025-04-27 21:12:20 +08:00
parent b62ca97ccb
commit ccde8e238e
No known key found for this signature in database
4 changed files with 85 additions and 17 deletions

View file

@ -2,6 +2,7 @@
config,
lib,
pkgs,
inputs,
...
}:
let
@ -9,34 +10,43 @@ let
cfg = config."${moduleName}";
in
{
imports = [
inputs.nix-gaming.nixosModules.platformOptimizations
];
options = {
"${moduleName}" = {
steam = {
enable = lib.mkEnableOption "Enable Steam.";
enableGamescope = lib.mkEnableOption "Enable the gamescope compositor.";
};
};
};
config = lib.mkMerge [
(lib.mkIf cfg.steam.enable {
programs.steam = {
enable = true;
remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play
protontricks.enable = true;
dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server
localNetworkGameTransfers.openFirewall = true; # Open ports in the firewall for Steam Local Network Game Transfers
programs = {
steam = {
enable = true;
remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play
protontricks.enable = true;
dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server
localNetworkGameTransfers.openFirewall = true; # Open ports in the firewall for Steam Local Network Game Transfers
gamescopeSession.enable = true;
extraCompatPackages = with pkgs; [ proton-ge-bin ];
platformOptimizations.enable = true;
};
gamescope = {
enable = true;
capSysNice = true;
};
gamemode.enable = true;
};
environment.systemPackages = with pkgs; [
steam-run
wineWowPackages.stable
wine64
wineWowPackages.waylandFull
];
})
(lib.mkIf cfg.steam.enableGamescope {
programs.steam.gamescopeSession.enable = true;
programs.gamescope = {
enable = true;
capSysNice = true;
};
})
];
}