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

59
flake.lock generated
View file

@ -138,6 +138,24 @@
}
},
"flake-parts_2": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib_2"
},
"locked": {
"lastModified": 1743550720,
"narHash": "sha256-hIshGgKZCgWh6AYJpJmRgFdR3WUbkY04o82X05xqQiY=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "c621e8422220273271f52058f618c94e405bb0f5",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-parts_3": {
"inputs": {
"nixpkgs-lib": [
"stylix",
@ -372,6 +390,27 @@
"type": "github"
}
},
"nix-gaming": {
"inputs": {
"flake-parts": "flake-parts",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1745718727,
"narHash": "sha256-Q+8ki5/0doymTb/6yZyB1IgKy7vIkWG5IILIzw9Vz1U=",
"owner": "fufexan",
"repo": "nix-gaming",
"rev": "f42092f4379fe71bf810a71c1c33f1f807b97746",
"type": "github"
},
"original": {
"owner": "fufexan",
"repo": "nix-gaming",
"type": "github"
}
},
"nix-index-database": {
"inputs": {
"nixpkgs": [
@ -438,9 +477,24 @@
"type": "github"
}
},
"nixpkgs-lib_2": {
"locked": {
"lastModified": 1743296961,
"narHash": "sha256-b1EdN3cULCqtorQ4QeWgLMrd5ZGOjLSLemfa00heasc=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "e4822aea2a6d1cdd36653c134cacfd64c97ff4fa",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixpkgs.lib",
"type": "github"
}
},
"nur": {
"inputs": {
"flake-parts": "flake-parts_2",
"flake-parts": "flake-parts_3",
"nixpkgs": [
"stylix",
"nixpkgs"
@ -463,7 +517,7 @@
},
"nvf": {
"inputs": {
"flake-parts": "flake-parts",
"flake-parts": "flake-parts_2",
"flake-utils": [
"flake-utils"
],
@ -498,6 +552,7 @@
"hyprcloser": "hyprcloser",
"hyprshaders": "hyprshaders",
"impermanence": "impermanence",
"nix-gaming": "nix-gaming",
"nix-index-database": "nix-index-database",
"nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs",

View file

@ -69,6 +69,10 @@
inputs.nixpkgs.follows = "nixpkgs";
url = "github:nix-community/nix-index-database";
};
nix-gaming = {
inputs.nixpkgs.follows = "nixpkgs";
url = "github:fufexan/nix-gaming";
};
nvf = {
inputs = {
flake-utils.follows = "flake-utils";

View file

@ -9,5 +9,4 @@
hardware-config.cpu = "amd";
hardware-config.gpu = "nvidia";
gaming.steam.enable = true;
gaming.steam.enableGamescope = true;
}

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;
};
})
];
}