diff --git a/nixos/common/steam.nix b/nixos/common/steam.nix index f3dd670..e01ae7e 100644 --- a/nixos/common/steam.nix +++ b/nixos/common/steam.nix @@ -1,9 +1,18 @@ -{ pkgs, lib, ... }: +{ pkgs, lib, config, ... }: { programs.gamemode.enable = true; programs.gamescope = { enable = true; - capSysNice = true; + # Wrappers don't work in steams FHSEnv cause security reasons (ig valid) + capSysNice = false; + }; + + # Therefore we wrap gamescope with the capability under an alias + security.wrappers.gamescope-nice = { + owner = "root"; + group = "root"; + source = "${pkgs.gamescope}/bin/gamescope"; + capabilities = "cap_sys_nice+pie"; }; environment.systemPackages = with pkgs; [ @@ -18,6 +27,8 @@ p.libkrb5 p.keyutils ]; + # this is the worst thing I have written in ages, but it works + buildFHSEnv = x: pkgs.buildFHSEnv (x // { extraBwrapArgs = x.extraBwrapArgs ++ [ "--cap-add CAP_SYS_NICE --cap-add CAP_SETPCAP" ]; }); }; };