Hi all, I recently built a new PC and decided to try NixOS instead of my old Arch + Windows dual boot setup. However, I have been unable to get games to work well. I am able to launch them, but they run extremely poorly.
On using MangoHUD, it seems like my GPU utilization is at 0%. I’ve ensured that MangoHUD is indeed looking at my RTX 4070 by having it display gpu_name
, and games that were working well with a much much older GPU are now struggling to run on my new machine. It may be relevant that I am using Hyprland with Wayland. Here are the relevant parts of my /etc/nixos/configuration.nix
.
# despite having the NVIDIA modeset, my PC is stuck on booting without this
boot.kernelParams = [ "nomodeset" ];
nixpkgs.config.allowUnfree = true;
environment.systemPackages = with pkgs; [
nvidia-vaapi-driver
# tried because of https://github.com/NixOS/nixpkgs/issues/108598#issuecomment-917682592
# but either way, no difference
# (steam.override {
# extraProfile = ''
# export VK_ICD_FILENAMES=${config.hardware.nvidia.package}/share/vulkan/icd.d/nvidia_icd.json:${config.hardware.nvidia.package.lib32}/share/vulkan/icd.d/nvidia_icd32.json:$VK_ICD_FILENAMES
# '';
# })
];
# most of the NVIDIA stuff is lifted from https://nixos.wiki/wiki/Nvidia
hardware.opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
extraPackages = with pkgs; [
vaapiVdpau
libvdpau-va-gl
];
extraPackages32 = with pkgs.pkgsi686Linux; [ libva ];
setLdLibraryPath = true;
};
services.xserver = {
enable = true;
videoDrivers = [ "nvidia" ];
displayManager.gdm = {
enable = true;
wayland = true;
};
};
hardware.nvidia = {
modesetting.enable = true;
open = false;
nvidiaSettings = true;
package = config.boot.kernelPackages.nvidiaPackages.stable;
};
programs.hyprland = {
enable = true;
nvidiaPatches = true;
xwayland = {
hidpi = true;
enable = true;
};
};
# either way, gamescope doesn't make a difference
# programs.gamescope.enable = true;
programs.steam = {
enable = true;
remotePlay.openFirewall = true;
dedicatedServer.openFirewall = true;
};
environment.sessionVariables = {
LIBVA_DRIVER_NAME = "nvidia";
XDG_SESSION_TYPE = "wayland";
GBM_BACKEND = "nvidia-drm";
__GLX_VENDOR_LIBRARY_NAME = "nvidia";
WLR_NO_HARDWARE_CURSORS = "1";
NIXOS_OZONE_WL = "1";
MOZ_ENABLE_WAYLAND = "1";
# setting the SDL_VIDEODRIVER to wayland or x11 doesn't make a difference
# a lot of these came from https://github.com/NixOS/nixpkgs/issues/162562#issuecomment-1523177264
# SDL_VIDEODRIVER = "wayland";
_JAVA_AWT_WM_NONREPARENTING = "1";
CLUTTER_BACKEND = "wayland";
WLR_RENDERER = "vulkan";
XDG_CURRENT_DESKTOP = "Hyprland";
XDG_SESSION_DESKTOP = "Hyprland";
GTK_USE_PORTAL = "1";
NIXOS_XDG_OPEN_USE_PORTAL = "1";
GDK_BACKEND = "wayland,x11";
QT_QPA_PLATFORM = "wayland;xcb";
ENABLE_VKBASALT = "1";
};
I included my Steam configuration, but my issues don’t just come from Steam: when launching programs like glxgears
or vkcube
or Minecraft, my GPU utilization still sits at 0%. Interestingly, on programs that display what graphics device they are using (like vkcube
), they say they are using my RTX 4070. Regardless though, their performance ends up still being much poorer than it should be were they actually utilizing the GPU to the extent they should be.
For additional info, here is the first part of the output of nvidia-smi
, which seems to clearly indicate some sort of problem. The GPU-Util
field is unsurprisingly always 0%.
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.86.05 Driver Version: 535.86.05 CUDA Version: 12.2 |
|-----------------------------------------+----------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+======================+======================|
| 0 NVIDIA GeForce RTX 4070 Off | 00000000:01:00.0 On | N/A |
|ERR! 52C P0 20W / 200W | 1268MiB / 12282MiB | 0% Default |
| | | N/A |
+-----------------------------------------+----------------------+----------------------+
My NVIDIA drivers version is 535.86.05
and my NVML Version is 12.535.86.05
. I tried installing newer NVIDIA drivers from their website (the version would be 535.98
), but running their .run
file gave me the output
Verifying archive integrity... OK
Uncompressing NVIDIA Accelerated Graphics Driver for Linux-x86_64 535.98......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
./NVIDIA-Linux-x86_64-535.98.run: line 732: ./nvidia-installer: cannot execute: required file not found
I don’t know how to run this file in NixOS, so I’m uncertain as to whether newer drivers would fix my issue.
Some odd things that stand out to me.
- I cannot boot without the
nomodeset
kernel parameter, even though I have the NVIDIA modeset enabled in my config. This suggests that maybe there is some issue with the installed NVIDIA drivers. Thenvidia-smi
output also seems to indicate something is wrong. - My sole monitor is connected through my one of my GPU’s DisplayPort ports, so the GPU isn’t doing nothing.
- I tried testing with Steam through the nixpkgs and Steam through FlatPak, and I tried lots of different versions of Proton, but regardless, launched games would run slow; the issue lies not in Steam anways as I have problems with Minecraft, a non-Steam game. Minecraft interestingly can see the RTX 4070, and it says it is utilizing 100% or nearly 100% of the GPU, but it still ends up being quite laggy, and at the same time, MangoHUD still claims the CPU is doing some work but the GPU is at 0% load.
In summary, my GPU is not being utilized in games seemingly. I am running a new NixOS system with an NVIDIA RTX 4070 on Hyprland and Wayland. MangoHUD and nvidia-smi
say that my GPU utilization is at 0%, and while games claim to use my GPU, their performance doesn’t seem to indicate it. I believe there is some drivers issue, but I don’t know what the issue is or how to fix it, and I would greatly appreciate help so I don’t need to resort to dual-booting again or changing significant aspects of my system.