Hi, NixOS newbie here, I’m trying to set up HW acceleration using nvidia-vaapi-driver but I’m having some issues.
Here are my configs:
configuration.nix
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
./nvidia.nix
];
# Ntfs support
boot.supportedFilesystems = [ "ntfs" ];
# Install firefox.
programs.firefox.enable = true;
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# Flatpaks
services.flatpak.enable = true;
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
ffmpeg
fastfetch
ntfs3g
flatpak
nvidia-vaapi-driver
vaapiVdpau
libvdpau-va-gl
libva
libva-utils
gnome.gnome-tweaks
btop
# wget
];
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. It‘s perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "24.05"; # Did you read the comment?
}
nvidia.nix:
{ config, lib, pkgs, ... }:
{
# Enable OpenGL
hardware.opengl = {
enable = true;
};
services.xserver.videoDrivers = ["nvidia"];
hardware.nvidia = {
package = config.boot.kernelPackages.nvidiaPackages.mkDriver {
version = "560.35.03";
sha256_64bit = "sha256-8pMskvrdQ8WyNBvkU/xPc/CtcYXCa7ekP73oGuKfH+M=";
sha256_aarch64 = "sha256-s8ZAVKvRNXpjxRYqM3E5oss5FdqW+tv1qQC2pDjfG+s=";
openSha256 = "sha256-/32Zf0dKrofTmPZ3Ratw4vDM7B+OgpC4p7s+RHUjCrg=";
settingsSha256 = "sha256-kQsvDgnxis9ANFmwIwB7HX5MkIAcpEEAHc8IBOLdXvk=";
persistencedSha256 = "sha256-E2J2wYYyRu7Kc3MMZz/8ZIemcZg68rkzvqEwFAL3fFs=";
};
# The nvidia-settings build is currently broken due to a missing
# vulkan header; re-enable whenever
# 0384602eac8bc57add3227688ec242667df3ffe3the hits stable.
nvidiaSettings = false;
modesetting.enable = true;
powerManagement.enable = true;
open = true;
};
environment.variables = {
GBM_BACKEND = "nvidia-drm";
__GLX_VENDOR_LIBRARY_NAME = "nvidia";
MOZ_DISABLE_RDD_SANDBOX= "1" ;
LIBVA_DRIVER_NAME = "nvidia";
};
}
and when I run the command vainfo I get this error:
Trying display: wayland
libva info: VA-API version 1.21.0
libva info: User environment variable requested driver 'nvidia'
libva info: Trying to open /run/opengl-driver/lib/dri/nvidia_drv_video.so
libva info: Found init function __vaDriverInit_1_0
libva error: /run/opengl-driver/lib/dri/nvidia_drv_video.so init failed
libva info: va_openDriver() returns 1
vaInitialize failed with error code 1 (operation failed),exit
I don’t know if this helps but if I run the command journalctl -xe | grep nvidia
the result is this:
set 11 20:54:35 nixos org.gnome.Shell.desktop[1583]: DRM kernel driver 'nvidia-drm' in use. NVK requires nouveau.
set 11 20:54:45 nixos .gnome-shell-wr[1927]: Added device '/dev/dri/card1' (nvidia-drm) using atomic mode setting.
set 11 20:54:48 nixos gnome-shell[2513]: DRM kernel driver 'nvidia-drm' in use. NVK requires nouveau.
I’ve set all the environment variables needed and also modified the about:config settings in firefox, what am I missing? Thx in advance.