nixos: gaming: gamemode: integrate with offloading

This commit is contained in:
Guanran Wang 2023-12-19 08:29:37 +08:00
parent c0178f4393
commit 5cd54c4323
Signed by: nyancat
SSH key fingerprint: SHA256:8oWGKciPALWut/6WA27oFKofX+6Wtc0gQnsefXLQx/8

View file

@ -1,6 +1,7 @@
{
pkgs,
lib,
config,
...
}: {
myFlake.hardware.accessories.xboxOneController.enable = lib.mkDefault true;
@ -13,6 +14,18 @@
};
};
# Integrate with NVIDIA Optimus offloading.
# https://github.com/FeralInteractive/gamemode#note-for-hybrid-gpu-users
# https://github.com/NixOS/nixpkgs/pull/273177
environment.sessionVariables = {
"GAMEMODERUNEXEC" = let
inherit (config.hardware.nvidia.prime) offload;
in
lib.mkIf
(builtins.elem "nvidia" config.services.xserver.videoDrivers || offload.enable || offload.enableOffloadCmd)
(lib.mkDefault "nvidia-offload");
};
### https://wiki.archlinux.org/title/Gaming#Improving_performance
systemd.tmpfiles.rules = [
# Path Mode UID GID Age Argument