I’ve been struggling for the past couple of days with getting my nvidia, hyprland, nixos setup to run properly and in doing so I’ve unfortunately not been successful. I am running a tuxedo stellaris laptop with both intel i9-13900HX as well as an NVIDIA 4070. Here are the problems I am facing:
if I am using iGPU i am able to make Hyprland use the graphics of my iGPU and hardware acceleration works as expected. Unfortunately I then run into the issue that Hyprland is not able to detect my display. Running the same setup with KDE under wayland everything works as expected. running this under sway with --use-unsupported-gpu works, but has crazy flickering.
Now since I cannot seem to be going the iGPU route I figured I was going to try to go the route of using a dGPU as at this point I mostly just want it to be running somehow. Switching the bios to dGPU makes the external monitors work and Hyprland as well as chromium now have to run under with the nvidia GPU. this works fine on Hyprland, but chromium seems to not properly know what to do. I’ve checked multiple places like Chromium - NixOS Wiki to try and get some intel on this. My current configuration looks like this:
nixpkgs.config.packageOverrides = pkgs: {
vaapiIntel = pkgs.vaapiIntel.override { enableHybridCodec = true; };
};
# Enable OpenGL
hardware.opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
extraPackages = with pkgs; [
# trying to fix `WLR_RENDERER=vulkan sway`
vulkan-validation-layers
# https://nixos.wiki/wiki/Accelerated_Video_Playback
intel-media-driver # LIBVA_DRIVER_NAME=iHD
vaapiIntel # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium)
vaapiVdpau
libvdpau-va-gl
];
};
hardware.nvidia = {
# Modesetting is required.
modesetting.enable = true;
# Nvidia power management. Experimental, and can cause sleep/suspend to fail.
powerManagement.enable = false;
# Fine-grained power management. Turns off GPU when not in use.
# Experimental and only works on modern Nvidia GPUs (Turing or newer).
powerManagement.finegrained = false;
# Use the NVidia open source kernel module (not to be confused with the
# independent third-party "nouveau" open source driver).
# Support is limited to the Turing and later architectures. Full list of
# supported GPUs is at:
# https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus
# Only available from driver 515.43.04+
# Currently alpha-quality/buggy, so false is currently the recommended setting.
open = false;
# Enable the Nvidia settings menu,
# accessible via `nvidia-settings`.
nvidiaSettings = true;
# Optionally, you may need to select the appropriate driver version for your specific GPU.
package = config.boot.kernelPackages.nvidiaPackages.stable;
prime = {
offload = {
enable = true;
enableOffloadCmd = true;
};
#reverseSync.enable = true;
intelBusId = "PCI:0:2:0";
nvidiaBusId = "PCI:1:0:0";
};
};
i only included the relevant parts here. my config files can be found here
I have also tried a combination of using prime.sync instead of offload as only the dGPU is available anyways without any luck. This is the output of nvidia-smi:
Thu Nov 30 13:35:23 2023
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 545.29.02 Driver Version: 545.29.02 CUDA Version: 12.3 |
|-----------------------------------------+----------------------+----------------------+
| 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 |
| N/A 41C P5 9W / 115W | 613MiB / 8188MiB | 4% Default |
| | | N/A |
+-----------------------------------------+----------------------+----------------------+
+---------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=======================================================================================|
| 0 N/A N/A 57092 G alacritty 23MiB |
| 0 N/A N/A 77164 G /run/current-system/sw/bin/Hyprland 381MiB |
| 0 N/A N/A 79871 G alacritty 29MiB |
| 0 N/A N/A 81549 G alacritty 21MiB |
| 0 N/A N/A 89350 G alacritty 21MiB |
+---------------------------------------------------------------------------------------+
I do however think that it is related to a faulty driver installation of some kind as running the command:
nix-shell -p libva-utils --run vainfo
results in this output:
Trying display: wayland
libva info: VA-API version 1.18.0
libva info: User environment variable requested driver 'nvidia'
libva info: Trying to open /run/opengl-driver/lib/dri/nvidia_drv_video.so
libva error: dlopen of /run/opengl-driver/lib/dri/nvidia_drv_video.so failed: /nix/store/whypqfa83z4bsn43n4byvmw80n4mg3r8-glibc-2.37-45/lib/libc.so.6: version `GLIBC_2.38' not found (required by /run/opengl-driver/lib/dri/nvidia_drv_video.so)
libva info: Trying to open /usr/lib/dri/nvidia_drv_video.so
libva info: Trying to open /usr/lib32/dri/nvidia_drv_video.so
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/nvidia_drv_video.so
libva info: Trying to open /usr/lib/i386-linux-gnu/dri/nvidia_drv_video.so
libva info: va_openDriver() returns -1
vaInitialize failed with error code -1 (unknown libva error),exit
output of ldd --version
ldd (GNU libc) 2.38
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.
It looks like it is unable to find the correct GLIBC, but I have no idea how to fix that. I would highly appreciate if anybody would be able to give me a lead!