nix/modules/stuff/gaming.nix

45 lines
1.2 KiB
Nix
Raw Normal View History

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