nix/modules/stuff/gaming.nix
2024-09-01 14:52:53 +02:00

45 lines
1.3 KiB
Nix

{ lib, pkgs, config, ...}: let
inherit (lib) mkIf mkEnableOption mkOption types optionals forEach;
cfg = config.chuj.stuff.gaming;
user = config.chuj.system.user;
in {
options.chuj.stuff.gaming = {
enable = mkEnableOption "gaming";
quake = mkEnableOption "quake";
dosbox = mkEnableOption "dosbox";
ror2 = mkEnableOption "ror2";
steam = mkEnableOption "steam";
scripts = mkOption {
type = types.listOf (types.submodule {
options = {
name = mkOption { type = types.str; };
exe = mkOption { type = types.str; };
};
});
default = [];
};
};
config = mkIf cfg.enable {
programs.steam.enable = cfg.steam;
home-manager.users.${user}.home.packages = with pkgs; ([
wineWowPackages.stable
winetricks
protontricks
] ++ forEach cfg.scripts (s:
(pkgs.writeShellScriptBin s.name ''
cd ~/games/${s.name}
wine ${s.exe}
'')
)
++ optionals cfg.dosbox [ dosbox-staging ]
++ optionals cfg.ror2 [ r2modman ]
++ optionals cfg.quake [ vkquake ericw-tools-latest trenchbroom fteqcc gmqcc ]);
# Trenchbroom
nixpkgs.config.permittedInsecurePackages = optionals cfg.quake [
"freeimage-unstable-2021-11-01"
];
};
}