small module improvements + sunshine module

This commit is contained in:
xunuwu 2024-09-08 11:00:35 +02:00
parent 543c890c9e
commit d983b9ad92
Signed by: xun
SSH key fingerprint: SHA256:Uot/1WoAjWAeqLOHA5vYy4phhVydsH7jCPmBjaPZfgI
3 changed files with 49 additions and 23 deletions

View file

@ -6,21 +6,35 @@
}: let
cfg = config.xun.gaming;
in {
options.xun.gaming = {
options.xun.gaming = let
mkBool = lib.mkOption {type = lib.types.bool;};
in {
enable = lib.mkEnableOption "gaming";
steam.enable = lib.mkEnableOption "steam";
gamemode.enable = lib.mkEnableOption "gamemode";
gamescope.enable = lib.mkEnableOption "gamescope";
sunshine = {
enable = lib.mkEnableOption "sunshine";
openFirewall = mkBool;
};
};
config = lib.mkIf cfg.enable ({
programs.gamescope = lib.mkIf cfg.gamescope.enable {
config = lib.mkIf cfg.enable (lib.mkMerge [
(lib.mkIf cfg.gamescope.enable {
programs.gamescope = {
enable = true;
capSysNice = false; # doesnt work with steam & heroic
};
programs.gamemode.enable = cfg.gamemode.enable;
}
// lib.mkIf cfg.steam.enable {
})
(lib.mkIf cfg.sunshine.enable {
services.sunshine = {
enable = true;
capSysAdmin = true;
openFirewall = cfg.sunshine.openFirewall;
};
})
(lib.mkIf cfg.gamemode.enable {programs.gamemode.enable = true;})
(lib.mkIf cfg.steam.enable {
# TODO: protontricks & steamtinkerlaunch
programs.steam = {
enable = true;
@ -43,5 +57,6 @@ in {
keyutils
];
};
});
})
]);
}