mirror of
https://github.com/youwen5/nixos.git
synced 2025-01-18 05:02:10 -08:00
refactor: change gaming options to be more fine grained
This commit is contained in:
parent
ab0ccf2519
commit
005fa17ee1
1 changed files with 90 additions and 63 deletions
|
@ -10,7 +10,19 @@ in
|
|||
{
|
||||
options.liminalOS.extras.gaming = {
|
||||
enable = lib.mkEnableOption "gaming";
|
||||
utilities.hamachi.enable = lib.mkEnableOption "hamachi";
|
||||
utilities = {
|
||||
hamachi.enable = lib.mkEnableOption "hamachi";
|
||||
gamemode = {
|
||||
enable = lib.mkEnableOption "gamemode";
|
||||
gamemodeUsers = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.string;
|
||||
default = [ ];
|
||||
description = ''
|
||||
List of users to add to the gamemode group. Gamemode will likely not work unless you add your user to the group!
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
roblox.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = config.liminalOS.extras.gaming && cfg.enable;
|
||||
|
@ -19,7 +31,11 @@ in
|
|||
'';
|
||||
};
|
||||
};
|
||||
config = lib.mkIf cfg.enable {
|
||||
config = lib.mkIf cfg.enable (
|
||||
let
|
||||
forAllGamemodeUsers = lib.genAttrs cfg.utilities.gamemode.gamemodeUsers;
|
||||
in
|
||||
{
|
||||
environment.systemPackages = with pkgs; [
|
||||
ryujinx
|
||||
lutris
|
||||
|
@ -65,7 +81,9 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
users.users.${config.liminalOS.username}.extraGroups = [ "gamemode" ];
|
||||
users.users = forAllGamemodeUsers (username: {
|
||||
${username}.extraGroups = [ "gamemode" ];
|
||||
});
|
||||
|
||||
services.logmein-hamachi.enable = cfg.utilities.hamachi.enable;
|
||||
programs.haguichi.enable = cfg.utilities.hamachi.enable;
|
||||
|
@ -91,5 +109,14 @@ in
|
|||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
warnings =
|
||||
if cfg.utilities.gamemode.enable && (builtins.length cfg.utilities.gamemode.gamemodeUsers == 0) then
|
||||
[
|
||||
''You enabled gamemode without setting any gamemode users in `liminalOS.extras.gaming.utilities.gamemode.gamemodeUsers. Gamemode is unlikely to work unless you add your user to gamemodeUsers.''
|
||||
]
|
||||
else
|
||||
[ ];
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue