modularized all the things
part one (?)
This commit is contained in:
180
modules/apps/gaming.nix
Normal file
180
modules/apps/gaming.nix
Normal file
@ -0,0 +1,180 @@
|
||||
{
|
||||
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.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = "Enable Wine support for Lutris";
|
||||
};
|
||||
|
||||
package = lib.mkOption {
|
||||
type = lib.types.package;
|
||||
default = pkgs.wineWow;
|
||||
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 = lib.mkOption {
|
||||
enable = lib.mkEnableOption "Minecraft in the form of PrismLauncher, a tool for launching Minecraft";
|
||||
};
|
||||
ffxiv = lib.mkOption {
|
||||
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.mkIf cfg.lutris.enable (
|
||||
# Base Lutris package
|
||||
[cfg.lutris.package]
|
||||
++
|
||||
# Wine packages if enabled
|
||||
(lib.optionals cfg.lutris.wine.enable [
|
||||
cfg.lutris.wine.package
|
||||
pkgs.winetricks
|
||||
])
|
||||
++
|
||||
# Proton and compatibility tools
|
||||
(lib.optionals cfg.lutris.compatibility.protonSupport [
|
||||
pkgs.proton-ge-custom
|
||||
])
|
||||
++
|
||||
# Extra compatibility tools
|
||||
cfg.lutris.compatibility.extraTools
|
||||
++
|
||||
# User-specified extra packages
|
||||
cfg.lutris.extraPackages
|
||||
)
|
||||
lib.mkIf
|
||||
cfg.minecraft.enable [pkgs.prismlauncher]
|
||||
lib.mkIf
|
||||
cfg.ffxiv.enable [pkgs.xivlauncher];
|
||||
|
||||
# Wine configuration
|
||||
programs.wine = lib.mkIf (cfg.lutris.enable && cfg.lutris.wine.enable) {
|
||||
enable = true;
|
||||
package = cfg.lutris.wine.package;
|
||||
};
|
||||
};
|
||||
}
|
0
modules/apps/xdg.nix
Normal file
0
modules/apps/xdg.nix
Normal file
Reference in New Issue
Block a user