160 lines
4.6 KiB
Nix
160 lines
4.6 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}: let
|
|
cfg = config.gaming;
|
|
in {
|
|
options.gaming = {
|
|
steam = {
|
|
enable = lib.mkEnableOption "Steam gaming platform";
|
|
|
|
firewall = {
|
|
remotePlay = lib.mkOption {
|
|
type = lib.types.bool;
|
|
default = true;
|
|
description = "Open firewall ports for Steam Remote Play";
|
|
};
|
|
|
|
localNetworkGameTransfers = lib.mkOption {
|
|
type = lib.types.bool;
|
|
default = true;
|
|
description = "Open firewall ports for local network game transfers";
|
|
};
|
|
};
|
|
};
|
|
|
|
gamemode = {
|
|
enable = lib.mkEnableOption "Gamemode performance optimization";
|
|
config = lib.mkOption {
|
|
type = lib.types.attrs;
|
|
default = {};
|
|
description = "Custom Gamemode configuration options";
|
|
};
|
|
};
|
|
|
|
gamescope = {
|
|
enable = lib.mkEnableOption "Gamescope gaming compositor";
|
|
settings = {
|
|
resolution = lib.mkOption {
|
|
type = lib.types.nullOr (lib.types.submodule {
|
|
options = {
|
|
width = lib.mkOption {
|
|
type = lib.types.int;
|
|
description = "Gamescope rendering width";
|
|
};
|
|
height = lib.mkOption {
|
|
type = lib.types.int;
|
|
description = "Gamescope rendering height";
|
|
};
|
|
};
|
|
});
|
|
default = null;
|
|
description = "Gamescope rendering resolution";
|
|
};
|
|
|
|
refreshRate = lib.mkOption {
|
|
type = lib.types.nullOr lib.types.int;
|
|
default = null;
|
|
description = "Gamescope rendering refresh rate";
|
|
};
|
|
};
|
|
};
|
|
|
|
lutris = {
|
|
enable = lib.mkEnableOption "Lutris game manager and launcher";
|
|
package = lib.mkOption {
|
|
type = lib.types.package;
|
|
default = pkgs.lutris;
|
|
description = "Lutris package to use (allows for custom or alternative packages)";
|
|
};
|
|
|
|
wine = {
|
|
enable = lib.mkEnableOption "Enable Wine support for Lutris";
|
|
package = lib.mkOption {
|
|
type = lib.types.package;
|
|
default = pkgs.wine-staging;
|
|
description = "Wine package to use with Lutris";
|
|
};
|
|
};
|
|
|
|
# Compatibility layers for Lutris
|
|
compatibility = {
|
|
protonSupport = lib.mkOption {
|
|
type = lib.types.bool;
|
|
default = true;
|
|
description = "Enable Proton-like compatibility layers for Lutris";
|
|
};
|
|
|
|
extraTools = lib.mkOption {
|
|
type = lib.types.listOf lib.types.package;
|
|
default = [];
|
|
description = "Additional compatibility tools for Lutris";
|
|
};
|
|
};
|
|
|
|
# Additional system packages for Lutris
|
|
extraPackages = lib.mkOption {
|
|
type = lib.types.listOf lib.types.package;
|
|
default = [];
|
|
description = "Additional packages to install alongside Lutris";
|
|
};
|
|
};
|
|
|
|
minecraft = {
|
|
enable = lib.mkEnableOption "Minecraft in the form of PrismLauncher, a tool for launching Minecraft";
|
|
};
|
|
ffxiv = {
|
|
enable = lib.mkEnableOption "Final Fantasy XIV and it's accompanied (unofficial) launcher";
|
|
};
|
|
};
|
|
|
|
config = {
|
|
programs.steam = lib.mkIf cfg.steam.enable {
|
|
enable = true;
|
|
remotePlay.openFirewall = cfg.steam.firewall.remotePlay;
|
|
localNetworkGameTransfers.openFirewall = cfg.steam.firewall.localNetworkGameTransfers;
|
|
};
|
|
|
|
programs.gamemode = lib.mkIf cfg.gamemode.enable {
|
|
enable = true;
|
|
settings = cfg.gamemode.config;
|
|
};
|
|
|
|
programs.gamescope = lib.mkIf cfg.gamescope.enable {
|
|
enable = true;
|
|
|
|
# Apply custom resolution if specified
|
|
args =
|
|
lib.optional (cfg.gamescope.settings.resolution != null) [
|
|
"-w"
|
|
(toString cfg.gamescope.settings.resolution.width)
|
|
"-h"
|
|
(toString cfg.gamescope.settings.resolution.height)
|
|
]
|
|
++ lib.optional (cfg.gamescope.settings.refreshRate != null) [
|
|
"-r"
|
|
(toString cfg.gamescope.settings.refreshRate)
|
|
];
|
|
};
|
|
|
|
environment.systemPackages =
|
|
(lib.optionals cfg.lutris.enable (
|
|
[cfg.lutris.package] ++
|
|
(lib.optionals cfg.lutris.wine.enable [
|
|
cfg.lutris.wine.package
|
|
pkgs.winetricks
|
|
]) ++
|
|
(lib.optionals cfg.lutris.compatibility.protonSupport [
|
|
pkgs.protonup-ng
|
|
pkgs.protonup-qt
|
|
]) ++
|
|
cfg.lutris.compatibility.extraTools ++
|
|
cfg.lutris.extraPackages
|
|
)) ++
|
|
(lib.optionals cfg.minecraft.enable [pkgs.prismlauncher]) ++
|
|
(lib.optionals cfg.ffxiv.enable [pkgs.xivlauncher]);
|
|
};
|
|
}
|