add gaming

This commit is contained in:
LordGrimmauld 2024-03-16 22:16:24 +01:00
parent 5e620c1215
commit e560d70af8
2 changed files with 54 additions and 0 deletions

View File

@ -57,6 +57,12 @@ in {
default = false; default = false;
description = "whether to enable graphical components"; description = "whether to enable graphical components";
}; };
gaming = mkOption {
type = types.bool;
default = false;
description = "enables steam, heroic, prism and gamemoded"
};
}; };
imports = [ imports = [
@ -67,5 +73,6 @@ in {
./modules/toolchains.nix ./modules/toolchains.nix
./modules/sound.nix ./modules/sound.nix
./modules/opengl.nix ./modules/opengl.nix
./modules/gaming.nix
]; ];
} }

47
modules/gaming.nix Normal file
View File

@ -0,0 +1,47 @@
{ pkgs, config, lib, ... }: let
cfg = config.grimmShared;
in {
config = with cfg; lib.mkIf (enable && gaming) {
programs.steam = {
enable = true;
gamescopeSession.enable = true;
gamescopeSession.env = {
DRI_PRIME = "1";
};
};
programs.gamemode = {
enable = true;
settings = {
general = {
inhibit_screensaver=0;
renice = 10;
};
custom = {
start = "${pkgs.libnotify}/bin/notify-send 'GameMode started'";
end = "${pkgs.libnotify}/bin/notify-send 'GameMode ended'";
};
};
};
services.udev.packages = [ pkgs.wooting-udev-rules ];
environment.sessionVariables = {
GAMEMODERUNEXEC="env DRI_PRIME=1";
};
environment.systemPackages = with pkgs; [
heroic
prismlauncher
wootility
(pkgs.symlinkJoin {
name = "osu";
paths = [
(pkgs.writeShellScriptBin "osu!" ''exec gamemoderun ${pkgs.osu-lazer-bin}/bin/'osu!'
'')
pkgs.osu-lazer-bin
];
})
];
};
}