From 6cd0324cbfbd1808ba11573ffb6ef0e74d3daf3c Mon Sep 17 00:00:00 2001 From: "Alexander \"PapaTutuWawa" Date: Mon, 23 Aug 2021 20:28:54 +0200 Subject: [PATCH] miku: Fix gajim and gamemode --- hosts/miku.nix | 88 ++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 67 insertions(+), 21 deletions(-) diff --git a/hosts/miku.nix b/hosts/miku.nix index 622b90c..c1e53dd 100644 --- a/hosts/miku.nix +++ b/hosts/miku.nix @@ -27,27 +27,43 @@ in { #})) # Steam overlay - (final: prev: - let - # NOTE: This is a really messy solution - buildFHSUserEnvBubblewrap = prev.callPackage ../packages/build-support/build-fhs-userenv-bubblewrap {}; - in { - steamPackages = prev.steamPackages.override { - buildFHSUserEnv = buildFHSUserEnvBubblewrap; - # Include gamemode in the FHS - #extraPkgs = (pkgs: with pkgs; [ gamemode ]); - }; + # TODO: Replace with the commented out version below + (final: prev: let + buildFHSUserEnvBubblewrap = prev.callPackage ../packages/build-support/build-fhs-userenv-bubblewrap {}; + steamPackages = lib.dontRecurseIntoAttrs (prev.callPackage ../packages/games/steam { + buildFHSUserEnv = buildFHSUserEnvBubblewrap; + }); + in { + buildFHSUserEnvBubblewrap = buildFHSUserEnvBubblewrap; + steamPackages = steamPackages; + steam = steamPackages.steam-fhsenv.override { + extraPkgs = pkgs: with pkgs; [ gamemode ]; + }; + }) + #(final: prev: + # let + # # NOTE: This is a really messy solution + # buildFHSUserEnvBubblewrap = prev.callPackage ../packages/build-support/build-fhs-userenv-bubblewrap {}; + # in { + # steamPackages = prev.steamPackages.override { + # buildFHSUserEnv = buildFHSUserEnvBubblewrap; + # # Include gamemode in the FHS + # #extraPkgs = (pkgs: with pkgs; [ gamemode ]); + # }; - steam = final.steamPackages.steam-fhsenv.overrideAttrs (old: { - specifyHomeDirs = true; - chdirTo = "/home/$USER"; - }); - steam-run = final.steam.run; - steam-run-native = (final.steam.override { - nativeOnly = true; - }); - steamcmd = final.steamPackages.steamcmd; - }) + # steam = prev.steamPackages.steam-fhsenv.overrideAttrs (old: { + # specifyHomeDirs = true; + # chdirTo = "/home/$USER"; + # }); + # #steam = final.steamPackages.steam-fhsenv.override { + # # extraPkgs = pkgs: with pkgs; [ gamemode ]; + # #}; + # steam-run = final.steam.run; + # steam-run-native = (final.steam.override { + # nativeOnly = true; + # }); + # steamcmd = final.steamPackages.steamcmd; + # }) # Simple overrides (final: prev: { @@ -57,6 +73,11 @@ in { "--set" "DRI_PRIME" "1" ]; }; + + gajim = prev.gajim.overrideAttrs (old: { + # Enable notification sounds + propagatedBuildInputs = old.propagatedBuildInputs ++ [ prev.gsound ]; + }); }) customPkgs @@ -66,6 +87,23 @@ in { unstable = unstable; nur = (import ../modules/nur.nix pkgs); }; + + security = { + pam.loginLimits = [ + { + domain = "@gamemode"; + item = "-"; + type = "nice"; + value = "-10"; + } + ]; + wrappers = { + gamemoded = { + source = "${pkgs.gamemode}/bin/gamemoded"; + capabilities = "cap_sys_nice+ep"; + }; + }; + }; environment = { systemPackages = with pkgs; [ @@ -298,12 +336,20 @@ in { Restart = "always"; }; }; + # TODO: Remove once in stable or I decide to use unstable gamemode = { description = "A daemon/lib combo for Linux that allows games to request a set of optimisations be temporarily applied to the host OS."; wantedBy = [ "default.target" ]; + environment.PATH = lib.mkForce (pkgs.linkFarm "pkexec" [ + { + name = "pkexec"; + path = "${config.security.wrapperDir}/pkexec"; + } + ]); serviceConfig = { Type = "simple"; - ExecStart = "${pkgs.gamemode}/bin/gamemoded"; + #ExecStart = "${pkgs.gamemode}/bin/gamemoded"; + ExecStart = "${config.security.wrapperDir}/gamemoded"; Restart = "always"; }; };