dotfiles/nixos/common/steam.nix
magic_rb b284c90451
Finally get gamescope working properly in Steam
Signed-off-by: magic_rb <magic_rb@redalder.org>
2023-11-25 17:59:48 +01:00

42 lines
1.7 KiB
Nix

{ pkgs, lib, config, ... }:
{
programs.gamemode.enable = true;
programs.gamescope = {
enable = 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; [
mangohud
];
programs.steam = {
enable = true;
remotePlay.openFirewall = true;
package = pkgs.steam-small.override {
extraLibraries = p: with p; [
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" ]; });
};
};
services.udev.extraRules = ''
ACTION=="add", SUBSYSTEM=="block", ENV{ID_PART_ENTRY_UUID}=="a7588d17-2c04-4bb7-8c10-b2aaeed1826c" RUN{program}+="${pkgs.systemd}/bin/systemd-mount --no-block $devnode /media/steam_library/1"
ACTION=="remove", SUBSYSTEM=="block", ENV{ID_PART_ENTRY_UUID}=="a7588d17-2c04-4bb7-8c10-b2aaeed1826c" RUN{program}+="${pkgs.systemd}/bin/systemctl stop media-steam_library-1.mount"
ACTION=="add", SUBSYSTEM=="block", ENV{ID_PART_ENTRY_UUID}=="89910513-3f2d-4b49-bf0d-ec667d532c61" RUN{program}+="${pkgs.systemd}/bin/systemd-mount --no-block $devnode /media/steam_library/2"
ACTION=="remove", SUBSYSTEM=="block", ENV{ID_PART_ENTRY_UUID}=="89910513-3f2d-4b49-bf0d-ec667d532c61" RUN{program}+="${pkgs.systemd}/bin/systemctl stop media-steam_library-2.mount"
'';
}