From e560d70af89e8e7c306cc65fb8fa7ee9964c5d90 Mon Sep 17 00:00:00 2001 From: LordGrimmauld Date: Sat, 16 Mar 2024 22:16:24 +0100 Subject: [PATCH] add gaming --- default.nix | 7 +++++++ modules/gaming.nix | 47 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 modules/gaming.nix diff --git a/default.nix b/default.nix index 461b15b..3ffaa3b 100644 --- a/default.nix +++ b/default.nix @@ -57,6 +57,12 @@ in { default = false; description = "whether to enable graphical components"; }; + + gaming = mkOption { + type = types.bool; + default = false; + description = "enables steam, heroic, prism and gamemoded" + }; }; imports = [ @@ -67,5 +73,6 @@ in { ./modules/toolchains.nix ./modules/sound.nix ./modules/opengl.nix + ./modules/gaming.nix ]; } diff --git a/modules/gaming.nix b/modules/gaming.nix new file mode 100644 index 0000000..dd35c7e --- /dev/null +++ b/modules/gaming.nix @@ -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 + ]; + }) + ]; + }; +}