play.nix/modules/nixos/steam.nix
Chris Toph 38dad223cf Optimize wrapper commands; Directly call proton-cachyos pkg
- Prioritize explicit command over package executable in wrappers
- Import and include proton-cachyos in default Steam compatibility packages
2025-06-30 10:45:19 -04:00

90 lines
2.2 KiB
Nix

# Steam module with gaming optimizations
# Automatically includes proton-cachyos package
{
pkgs,
lib,
config,
...
}:
let
cfg = config.play.steam;
# Import proton-cachyos package directly
proton-cachyos = pkgs.callPackage ../../pkgs/proton-cachyos { };
# Default compatibility packages
defaultCompatPackages = [
pkgs.proton-ge-custom
proton-cachyos
];
# Combine defaults with user extras
finalCompatPackages = defaultCompatPackages ++ cfg.extraCompatPackages;
# Create the configured steam package
configuredSteam = pkgs.steam.override {
extraPkgs = cfg.extraPkgs;
};
in
{
options.play.steam = {
enable = lib.mkEnableOption "Steam with gaming optimizations";
extraCompatPackages = lib.mkOption {
type = lib.types.listOf lib.types.package;
default = [ ];
example = with pkgs; [ proton-ge-bin ];
description = "Additional Proton compatibility packages to add to the defaults";
};
extraPkgs = lib.mkOption {
type = lib.types.functionTo (lib.types.listOf lib.types.package);
default =
pkgs: with pkgs; [
# X11 libraries
xorg.libXcursor
xorg.libXi
xorg.libXinerama
xorg.libXScrnSaver
# System libraries
stdenv.cc.cc.lib
gamemode
gperftools
keyutils
libkrb5
libpng
libpulseaudio
libvorbis
mangohud
];
description = "Extra packages to include in Steam's runtime";
};
package = lib.mkOption {
type = lib.types.package;
readOnly = true;
default = configuredSteam;
description = "The configured Steam package with extra packages";
};
};
config = lib.mkIf cfg.enable {
programs.steam = {
enable = true;
remotePlay.openFirewall = lib.mkDefault false;
dedicatedServer.openFirewall = lib.mkDefault false;
protontricks = {
enable = lib.mkDefault true;
package = lib.mkDefault pkgs.protontricks;
};
package = lib.mkDefault cfg.package;
# Use the combined list of default + user extras
extraCompatPackages = finalCompatPackages;
};
};
}