Nvidia open breaks hardware acceleration

Thanks for the reply @TLATER

I’ve got it under “hardware.graphics.extraPackages”, but maybe that’s the issue?

https://github.com/randomizedcoder/nixos/blob/2a276d92e413973d1dbdfa6ea16cd949201f26ec/laptops/t/configuration.nix#L138

  hardware.graphics = {
    enable = true;
    extraPackages = with pkgs; [
      vdpauinfo             # sudo vainfo
      libva-utils           # sudo vainfo
      # https://discourse.nixos.org/t/nvidia-open-breaks-hardware-acceleration/58770/2
      nvidia-vaapi-driver
      vaapiVdpau
    ];
  };

The file nvidia_drv_video.so is there

[das@t:~]$ ls /run/opengl-driver/lib/dri/nvidia_drv_video.so
/run/opengl-driver/lib/dri/nvidia_drv_video.so

[das@t:~]$ ls -l /run/opengl-driver/lib/dri/nvidia_drv_video.so
lrwxrwxrwx 7 root root 98 Dec 31  1969 /run/opengl-driver/lib/dri/nvidia_drv_video.so -> /nix/store/0cj9k0b359qri6g5n5skf6hb1qghjd12-nvidia-vaapi-driver-0.0.13/lib/dri/nvidia_drv_video.so

[das@t:~]$ ls -la /nix/store/0cj9k0b359qri6g5n5skf6hb1qghjd12-nvidia-vaapi-driver-0.0.13/lib/dri/
total 120
dr-xr-xr-x 2 root root   4096 Dec 31  1969 .
dr-xr-xr-x 3 root root   4096 Dec 31  1969 ..
-r-xr-xr-x 2 root root 112696 Dec 31  1969 nvidia_drv_video.so

But vainfo seems unhappy about it for some reason(s):

[das@t:~]$ vainfo
The program 'vainfo' is not in your PATH. You can make it available in an
ephemeral shell by typing:
  nix-shell -p libva-utils

[das@t:~]$ nix-shell -p libva-utils

[nix-shell:~]$ vainfo
Trying display: wayland
libva info: VA-API version 1.22.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
[das@t:~]$ nvidia-smi
Thu Jan 30 11:02:50 2025
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 565.77                 Driver Version: 565.77         CUDA Version: 12.7     |
|-----------------------------------------+------------------------+----------------------+
| 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  Quadro T2000 with Max-Q ...    Off |   00000000:01:00.0  On |                  N/A |
| N/A   56C    P8              6W /   35W |     239MiB /   4096MiB |     11%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+

+-----------------------------------------------------------------------------------------+
| Processes:                                                                              |
|  GPU   GI   CI        PID   Type   Process name                              GPU Memory |
|        ID   ID                                                               Usage      |
|=========================================================================================|
|    0   N/A  N/A      4023      G   ...5p-gnome-shell-47.2/bin/gnome-shell        201MiB |
+-----------------------------------------------------------------------------------------+

[das@t:~]$ nix-info --markdown
 - system: `"x86_64-linux"`
 - host os: `Linux 6.6.72, NixOS, 24.11 (Vicuna), 24.11.20250128.2b4230b`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.24.12`
 - channels(root): `"home-manager-24.11.tar.gz, nixos-24.11"`
 - nixpkgs: `/nix/store/kk716acdv77mkpdmiv83apbamz639xia-source`

Ok, so the file is there… Relearning all the debug stuff around this, hope we can avoid having to strace.

The debug messages for this are enabled with NVD_LOG=1. Can you try NVD_LOG=1 vainfo?

environment.systemPackages = [ libva-utils ]; is completely fine if you want to use the libva-utils binaries, by the way, just don’t put it in your opengl driver package list.

Thanks again for a response.

Ahhh! Why is it talking about the i915 stupid built in Intel display? Should I blacklist it?

[das@t:~]$ vainfo
The program 'vainfo' is not in your PATH. You can make it available in an
ephemeral shell by typing:
  nix-shell -p libva-utils

[das@t:~]$ nix-shell -p libva-utils

[nix-shell:~]$ NVD_LOG=1 vainfo
Trying display: wayland
libva info: VA-API version 1.22.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
       139.129731900 [7589-7589] ../src/vabackend.c:2187       __vaDriverInit_1_0 Initialising NVIDIA VA-API Driver: 40
       139.129736204 [7589-7589] ../src/vabackend.c:2196       __vaDriverInit_1_0 Now have 0 (0 max) instances
       139.129738578 [7589-7589] ../src/vabackend.c:2222       __vaDriverInit_1_0 Selecting Direct backend
       139.155864736 [7589-7589] ../src/backend-common.c:  31            isNvidiaDrmFd Invalid driver for DRM device: i915
       139.155875299 [7589-7589] ../src/vabackend.c:2247       __vaDriverInit_1_0 Exporter failed
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

[nix-shell:~]$ uptime
 22:19:02  up   0:02,  2 users,  load average: 0.62, 0.37, 0.15

Full config here. ( Some slight and unrelated updates, cos I was testing a nixpkgs PR )

Full environment vars

[das@t:~]$ env
SHELL=/run/current-system/sw/bin/bash
SESSION_MANAGER=local/t:@/tmp/.ICE-unix/4278,unix/t:/tmp/.ICE-unix/4278
__ETC_PROFILE_DONE=1
GHOSTTY_BIN_DIR=/nix/store/l2qzmd8wmya86sg6ijd7l0ad8yq2rrp9-ghostty-1.0.1/bin
__HM_SESS_VARS_SOURCED=1
COLORTERM=truecolor
XDG_CONFIG_DIRS=/etc/xdg:/home/das/.nix-profile/etc/xdg:/nix/profile/etc/xdg:/home/das/.local/state/nix/profile/etc/xdg:/etc/profiles/per-user/das/etc/xdg:/nix/var/nix/profiles/default/etc/xdg:/run/current-system/sw/etc/xdg:/nix/store/f6sdm5pbbdhdh25q331jl2dbpsklpl00-gnome-settings-daemon-47.2/etc/xdg
XDG_MENU_PREFIX=gnome-
TERM_PROGRAM_VERSION=1.0.1
WLR_NO_HARDWARE_CURSORS=1
SPEECHD_CMD=/nix/store/xsshjsl2aj2kfaghx688f71fxcdx0sqg-speech-dispatcher-0.11.5/bin/speech-dispatcher
LC_ADDRESS=en_US.UTF-8
LC_NAME=en_US.UTF-8
SSH_AUTH_SOCK=/run/user/1000/keyring/ssh
GOPRIVATE=gitlab.com/sidenio/*
XCURSOR_PATH=/home/das/.icons:/home/das/.local/share/icons:/home/das/.nix-profile/share/icons:/home/das/.nix-profile/share/pixmaps:/nix/profile/share/icons:/nix/profile/share/pixmaps:/home/das/.local/state/nix/profile/share/icons:/home/das/.local/state/nix/profile/share/pixmaps:/etc/profiles/per-user/das/share/icons:/etc/profiles/per-user/das/share/pixmaps:/nix/var/nix/profiles/default/share/icons:/nix/var/nix/profiles/default/share/pixmaps:/run/current-system/sw/share/icons:/run/current-system/sw/share/pixmaps
MEMORY_PRESSURE_WRITE=c29tZSAyMDAwMDAgMjAwMDAwMAA=
LOCALE_ARCHIVE_2_27=/nix/store/yr4m7nrg1p1qbl7fr2n5h04qh3pnzbzh-glibc-locales-2.40-36/lib/locale/locale-archive
LIBVA_DRIVER_NAME=nvidia
DESKTOP_SESSION=gnome
LC_MONETARY=en_US.UTF-8
GDK_PIXBUF_MODULE_FILE=/nix/store/3i24agm03wmglwbyk0mg8d6wa7w7l214-librsvg-2.58.3/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache
GPG_TTY=/dev/pts/0
EDITOR=nano
GST_PLUGIN_SYSTEM_PATH_1_0=/nix/store/dy7mkaigag2fs7bdvnvn66f4x8syjwks-pipewire-1.2.7/lib/gstreamer-1.0:/nix/store/pklyg0rjlnrh8dvcn97krs6w14ywaa2c-gstreamer-1.24.10/lib/gstreamer-1.0:/nix/store/3gyzb6hhbgqw20hz150gw2abmwq0ybfa-gst-plugins-base-1.24.10/lib/gstreamer-1.0:/nix/store/rxk0gxkprhv17x5nciz7hg7minsa8hlp-gst-plugins-good-1.24.10/lib/gstreamer-1.0
NAUTILUS_4_EXTENSION_DIR=/nix/store/x64lhckakyhmx1h43dgxihdn5vqzrc5s-system-path/lib/nautilus/extensions-4
PWD=/home/das
NIX_PROFILES=/run/current-system/sw /nix/var/nix/profiles/default /etc/profiles/per-user/das /home/das/.local/state/nix/profile /nix/profile /home/das/.nix-profile
NIX_GSETTINGS_OVERRIDES_DIR=/nix/store/jlgyvc2dyp8mwvrhf340lq4z7533agbl-gnome-gsettings-overrides/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas
LOGNAME=das
XDG_SESSION_DESKTOP=gnome
XDG_SESSION_TYPE=wayland
CUPS_DATADIR=/nix/store/8mcj2pbx1dgf76sg78pz7v8cv22bs1wa-cups-progs/share/cups
NIX_PATH=/home/das/.nix-defexpr/channels:nixpkgs=flake:nixpkgs:/nix/var/nix/profiles/per-user/root/channels
SYSTEMD_EXEC_PID=4308
NIXPKGS_CONFIG=/etc/nix/nixpkgs-config.nix
XAUTHORITY=/run/user/1000/.mutter-Xwaylandauth.Q8T602
GJS_DEBUG_TOPICS=JS ERROR;JS LOG
GDM_LANG=en_US.UTF-8
GI_TYPELIB_PATH=/nix/store/6qkwbcx4q47dq4scz7rk4f3nlbr5937r-glib-2.82.1/lib/girepository-1.0:/nix/store/dlq0sl1589r70shf2q1l4v7gk2d3zzl0-gdk-pixbuf-2.42.12/lib/girepository-1.0:/nix/store/qxbclsjvhyswj547wkkv1gbmm9csn0b1-graphene-1.10.8/lib/girepository-1.0:/nix/store/jsg02pmrjzdmvf6lxn9g74yngb2v44qx-harfbuzz-10.0.1/lib/girepository-1.0:/nix/store/d11ikp74xfv8jn2h791hpirfz2qqm2a3-pango-1.54.0/lib/girepository-1.0:/nix/store/7dlg43i87gz0ayn05nj3qkxsx2l6cd2q-gsettings-desktop-schemas-47.1/lib/girepository-1.0:/nix/store/ps9mvh8kb66bg7158c62bk1kamr0dqjq-gtk4-4.16.7/lib/girepository-1.0:/nix/store/3i24agm03wmglwbyk0mg8d6wa7w7l214-librsvg-2.58.3/lib/girepository-1.0:/nix/store/914vcq7gayga9az2azh042f0p5sh49hp-gobject-introspection-wrapped-1.82.0/lib/girepository-1.0:/nix/store/b4jwsvx0q60gr3k2k0vqqmhvgiji6gpr-gobject-introspection-1.82.0/lib/girepository-1.0:/nix/store/8rpl9gfzkdm9p0bq1jm47a41pabgydp9-gcr-4.3.0/lib/girepository-1.0:/nix/store/w619kivxqg75b6wq1j7x60kfn86agfgs-accountsservice-23.13.9/lib/girepository-1.0:/nix/store/p5zl93ryfpf84h52bb9piff45mjkhr3p-libsecret-0.21.4/lib/girepository-1.0:/nix/store/22220hril5gfpn7kj3zma769dn94a9d8-polkit-124/lib/girepository-1.0:/nix/store/mivqnscxqznrxdz6d85dxxryrfpj9y1s-networkmanager-1.48.10/lib/girepository-1.0:/nix/store/90pr49768yv7i4r39h002wqq5i4lz5ch-libical-3.0.18/lib/girepository-1.0:/nix/store/8bvfzny1p7xy8y64sl7qybxngjv8147m-libsoup-3.6.1/lib/girepository-1.0:/nix/store/lls2w9czvyma1581b3grzwz6iripb2w7-json-glib-1.10.0/lib/girepository-1.0:/nix/store/4lfw1ba81amccs68lky2qjvqp85iw53x-evolution-data-server-3.54.2/lib/girepository-1.0:/nix/store/c3b58psd31ad3jnv2dyl9ss8w26lgg63-libadwaita-1.6.2/lib/girepository-1.0:/nix/store/z5wzf7mzm8acyn0xagl94p0xlglrldvf-gdm-47.0/lib/girepository-1.0:/nix/store/f6v5fvxp8x7i6dsql75fr4hw8dpyaivd-geoclue-2.7.2/lib/girepository-1.0:/nix/store/8r93rsr9qi20ac44qzwv27kwyza2lwb6-gnome-bluetooth-47.1/lib/girepository-1.0:/nix/store/yxv2diq8wpyvmi7dgjp0lqjbcl1y6236-at-spi2-core-2.54.0/lib/girepository-1.0:/nix/store/ihjb6749pmx6scp17cxaw96zgl217m4p-upower-1.90.4/lib/girepository-1.0:/nix/store/jqd5mk3x65dhis29b6kfwkmv5nwn6c91-ibus-1.5.30/lib/girepository-1.0:/nix/store/i3hg6ivcg13yphf40lgbzngchqyfkj0v-gnome-desktop-44.1/lib/girepository-1.0:/nix/store/pklyg0rjlnrh8dvcn97krs6w14ywaa2c-gstreamer-1.24.10/lib/girepository-1.0:/nix/store/3gyzb6hhbgqw20hz150gw2abmwq0ybfa-gst-plugins-base-1.24.10/lib/girepository-1.0:/nix/store/1730lwiwldjxc70p5zmnyigq15m9kc5w-libgweather-4.4.4/lib/girepository-1.0:/nix/store/w8yzbi42l3ry3w9s5d86x2i47crvry47-libnma-1.10.6/lib/girepository-1.0:/nix/store/9w6rc298kbiblf7an3w8i0xgwhjlns4j-gnome-autoar-0.4.5/lib/girepository-1.0:/run/current-system/sw/lib/girepository-1.0
HOME=/home/das
USERNAME=das
SSH_ASKPASS=/nix/store/7fvwy01a2as4hq7njm4j9xb3zx8lqq8f-seahorse-47.0.1/libexec/seahorse/ssh-askpass
LANG=en_US.UTF-8
LC_PAPER=en_US.UTF-8
NIXOS_OZONE_WL=1
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=00:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.7z=01;31:*.ace=01;31:*.alz=01;31:*.apk=01;31:*.arc=01;31:*.arj=01;31:*.bz=01;31:*.bz2=01;31:*.cab=01;31:*.cpio=01;31:*.crate=01;31:*.deb=01;31:*.drpm=01;31:*.dwm=01;31:*.dz=01;31:*.ear=01;31:*.egg=01;31:*.esd=01;31:*.gz=01;31:*.jar=01;31:*.lha=01;31:*.lrz=01;31:*.lz=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.lzo=01;31:*.pyz=01;31:*.rar=01;31:*.rpm=01;31:*.rz=01;31:*.sar=01;31:*.swm=01;31:*.t7z=01;31:*.tar=01;31:*.taz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tgz=01;31:*.tlz=01;31:*.txz=01;31:*.tz=01;31:*.tzo=01;31:*.tzst=01;31:*.udeb=01;31:*.war=01;31:*.whl=01;31:*.wim=01;31:*.xz=01;31:*.z=01;31:*.zip=01;31:*.zoo=01;31:*.zst=01;31:*.avif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:*~=00;90:*#=00;90:*.bak=00;90:*.crdownload=00;90:*.dpkg-dist=00;90:*.dpkg-new=00;90:*.dpkg-old=00;90:*.dpkg-tmp=00;90:*.old=00;90:*.orig=00;90:*.part=00;90:*.rej=00;90:*.rpmnew=00;90:*.rpmorig=00;90:*.rpmsave=00;90:*.swp=00;90:*.tmp=00;90:*.ucf-dist=00;90:*.ucf-new=00;90:*.ucf-old=00;90:
XDG_CURRENT_DESKTOP=GNOME
MEMORY_PRESSURE_WATCH=/sys/fs/cgroup/user.slice/user-1000.slice/user@1000.service/session.slice/org.gnome.Shell@wayland.service/memory.pressure
WAYLAND_DISPLAY=wayland-0
GIO_EXTRA_MODULES=/nix/store/lzcxvhh3wbd5fblh25hbs8jmdqknv39j-dconf-0.40.0-lib/lib/gio/modules:/nix/store/1bv1caadj8f0xrm66vh3z5bz539fcq4c-glib-networking-2.80.0/lib/gio/modules:/nix/store/lzcxvhh3wbd5fblh25hbs8jmdqknv39j-dconf-0.40.0-lib/lib/gio/modules:/nix/store/1bv1caadj8f0xrm66vh3z5bz539fcq4c-glib-networking-2.80.0/lib/gio/modules:/nix/store/lzcxvhh3wbd5fblh25hbs8jmdqknv39j-dconf-0.40.0-lib/lib/gio/modules:/nix/store/rq32n0rdjz6svc4g583870yz5132a66s-gvfs-1.56.1/lib/gio/modules:/nix/store/1bv1caadj8f0xrm66vh3z5bz539fcq4c-glib-networking-2.80.0/lib/gio/modules:/nix/store/lzcxvhh3wbd5fblh25hbs8jmdqknv39j-dconf-0.40.0-lib/lib/gio/modules
INVOCATION_ID=9275d6373eb0457982da69b4a8c8ddba
MANAGERPID=4174
MOZ_DISABLE_RDD_SANDBOX=1
EGL_PLATFORM=wayland
NIX_USER_PROFILE_DIR=/nix/var/nix/profiles/per-user/das
INFOPATH=/home/das/.nix-profile/info:/home/das/.nix-profile/share/info:/nix/profile/info:/nix/profile/share/info:/home/das/.local/state/nix/profile/info:/home/das/.local/state/nix/profile/share/info:/etc/profiles/per-user/das/info:/etc/profiles/per-user/das/share/info:/nix/var/nix/profiles/default/info:/nix/var/nix/profiles/default/share/info:/run/current-system/sw/info:/run/current-system/sw/share/info
GJS_DEBUG_OUTPUT=stderr
GNOME_SETUP_DISPLAY=:1
NVD_BACKEND=direct
GHOSTTY_RESOURCES_DIR=/nix/store/l2qzmd8wmya86sg6ijd7l0ad8yq2rrp9-ghostty-1.0.1/share/ghostty
XDG_SESSION_CLASS=user
TERM=xterm-ghostty
LC_IDENTIFICATION=en_US.UTF-8
TERMINFO=/nix/store/l2qzmd8wmya86sg6ijd7l0ad8yq2rrp9-ghostty-1.0.1/share/terminfo
GTK_PATH=/home/das/.nix-profile/lib/gtk-2.0:/home/das/.nix-profile/lib/gtk-3.0:/home/das/.nix-profile/lib/gtk-4.0:/nix/profile/lib/gtk-2.0:/nix/profile/lib/gtk-3.0:/nix/profile/lib/gtk-4.0:/home/das/.local/state/nix/profile/lib/gtk-2.0:/home/das/.local/state/nix/profile/lib/gtk-3.0:/home/das/.local/state/nix/profile/lib/gtk-4.0:/etc/profiles/per-user/das/lib/gtk-2.0:/etc/profiles/per-user/das/lib/gtk-3.0:/etc/profiles/per-user/das/lib/gtk-4.0:/nix/var/nix/profiles/default/lib/gtk-2.0:/nix/var/nix/profiles/default/lib/gtk-3.0:/nix/var/nix/profiles/default/lib/gtk-4.0:/run/current-system/sw/lib/gtk-2.0:/run/current-system/sw/lib/gtk-3.0:/run/current-system/sw/lib/gtk-4.0
LESSOPEN=|/nix/store/2dg0g8jj6qa499h7ajwlirmj5cjj3v1i-lesspipe-2.17/bin/lesspipe.sh %s
USER=das
TZDIR=/etc/zoneinfo
GHOSTTY_SHELL_INTEGRATION_NO_SUDO=1
DISPLAY=:0
SHLVL=1
MOZ_ENABLE_WAYLAND=1
PAGER=less
LC_TELEPHONE=en_US.UTF-8
QTWEBKIT_PLUGIN_PATH=/home/das/.nix-profile/lib/mozilla/plugins/:/nix/profile/lib/mozilla/plugins/:/home/das/.local/state/nix/profile/lib/mozilla/plugins/:/etc/profiles/per-user/das/lib/mozilla/plugins/:/nix/var/nix/profiles/default/lib/mozilla/plugins/:/run/current-system/sw/lib/mozilla/plugins/
LC_MEASUREMENT=en_US.UTF-8
__NIXOS_SET_ENVIRONMENT_DONE=1
LOCALE_ARCHIVE=/run/current-system/sw/lib/locale/locale-archive
LESSKEYIN_SYSTEM=/nix/store/dqb7s0ic4xn7s2fv1cskabfi6934y1ky-lessconfig
GDM_X_SERVER_EXTRA_ARGS=-config /nix/store/4fly55nbj24jqv3cg8p3dcf2m7khnq5a-xserver.conf -xkbdir /nix/store/8z9s7wcfm78awgfky443r7av94sxa4j2-xkeyboard-config-2.43/etc/X11/xkb -logfile /dev/null -nolisten tcp
TERMINFO_DIRS=/home/das/.nix-profile/share/terminfo:/nix/profile/share/terminfo:/home/das/.local/state/nix/profile/share/terminfo:/etc/profiles/per-user/das/share/terminfo:/nix/var/nix/profiles/default/share/terminfo:/run/current-system/sw/share/terminfo
XDG_RUNTIME_DIR=/run/user/1000
NIX_XDG_DESKTOP_PORTAL_DIR=/run/current-system/sw/share/xdg-desktop-portal/portals
LC_TIME=en_US.UTF-8
JOURNAL_STREAM=8:36041
XDG_DATA_DIRS=/nix/store/l2qzmd8wmya86sg6ijd7l0ad8yq2rrp9-ghostty-1.0.1/share:/nix/store/7dlg43i87gz0ayn05nj3qkxsx2l6cd2q-gsettings-desktop-schemas-47.1/share/gsettings-schemas/gsettings-desktop-schemas-47.1:/nix/store/ps9mvh8kb66bg7158c62bk1kamr0dqjq-gtk4-4.16.7/share/gsettings-schemas/gtk4-4.16.7:/nix/store/k176r1jha1ij2ayvzapj47k9km6dg612-shared-mime-info-2.4/share:/nix/store/n2xd3v1zzqyg5xmhm6fmrkvwbp4v8z5p-gnome-shell-47.2/share:/nix/store/7dlg43i87gz0ayn05nj3qkxsx2l6cd2q-gsettings-desktop-schemas-47.1/share/gsettings-schemas/gsettings-desktop-schemas-47.1:/nix/store/ps9mvh8kb66bg7158c62bk1kamr0dqjq-gtk4-4.16.7/share/gsettings-schemas/gtk4-4.16.7:/nix/store/11k9i54sqdfzmss6rxv1wv5zslln0bc8-gnome-keyring-46.2/share/gsettings-schemas/gnome-keyring-46.2:/nix/store/icvdh92jgc1z9c221whfxx28h0r23k3c-mutter-47.3/share/gsettings-schemas/mutter-47.3:/nix/store/4lfw1ba81amccs68lky2qjvqp85iw53x-evolution-data-server-3.54.2/share/gsettings-schemas/evolution-data-server-3.54.2:/nix/store/z5wzf7mzm8acyn0xagl94p0xlglrldvf-gdm-47.0/share/gsettings-schemas/gdm-47.0:/nix/store/4ip6arkfd4g3ckmclw2mfmaymwgsspzi-gnome-clocks-47.0/share/gsettings-schemas/gnome-clocks-47.0:/nix/store/jqd5mk3x65dhis29b6kfwkmv5nwn6c91-ibus-1.5.30/share/gsettings-schemas/ibus-1.5.30:/nix/store/f6sdm5pbbdhdh25q331jl2dbpsklpl00-gnome-settings-daemon-47.2/share/gsettings-schemas/gnome-settings-daemon-47.2:/nix/store/dy7mkaigag2fs7bdvnvn66f4x8syjwks-pipewire-1.2.7/share/gsettings-schemas/pipewire-1.2.7:/nix/store/1730lwiwldjxc70p5zmnyigq15m9kc5w-libgweather-4.4.4/share/gsettings-schemas/libgweather-4.4.4:/nix/store/w8yzbi42l3ry3w9s5d86x2i47crvry47-libnma-1.10.6/share/gsettings-schemas/libnma-1.10.6:/nix/store/n2xd3v1zzqyg5xmhm6fmrkvwbp4v8z5p-gnome-shell-47.2/share/gsettings-schemas/gnome-shell-47.2:/nix/store/r2jilf4j87999icpvnkm60xgmn9qd255-gnome-mimeapps/share:/nix/store/i39wlm0zz14jvkdqhyxghvr0m4iw5ahk-desktops/share:/home/das/.nix-profile/share:/nix/profile/share:/home/das/.local/state/nix/profile/share:/etc/profiles/per-user/das/share:/nix/var/nix/profiles/default/share:/run/current-system/sw/share:/nix/store/n2xd3v1zzqyg5xmhm6fmrkvwbp4v8z5p-gnome-shell-47.2/share/gsettings-schemas/gnome-shell-47.2:/nix/store/ja43a1p31p53b95h58x4hc9hd6r8ng9z-gnome-shell-extensions-47.2/share/gsettings-schemas/gnome-shell-extensions-47.2:/nix/store/rk3kpmbzjsc51bmlab5ygx5yml6gy3fy-gnome-session-47.0.1/share:/nix/store/7dlg43i87gz0ayn05nj3qkxsx2l6cd2q-gsettings-desktop-schemas-47.1/share/gsettings-schemas/gsettings-desktop-schemas-47.1:/nix/store/l9byw3fs59qb3m8wkvchjgii70v26d2s-gtk+3-3.24.43/share/gsettings-schemas/gtk+3-3.24.43:/nix/store/f6sdm5pbbdhdh25q331jl2dbpsklpl00-gnome-settings-daemon-47.2/share/gsettings-schemas/gnome-settings-daemon-47.2:/nix/store/rk3kpmbzjsc51bmlab5ygx5yml6gy3fy-gnome-session-47.0.1/share/gsettings-schemas/gnome-session-47.0.1:/nix/store/n2xd3v1zzqyg5xmhm6fmrkvwbp4v8z5p-gnome-shell-47.2/share
LIBEXEC_PATH=/home/das/.nix-profile/libexec:/nix/profile/libexec:/home/das/.local/state/nix/profile/libexec:/etc/profiles/per-user/das/libexec:/nix/var/nix/profiles/default/libexec:/run/current-system/sw/libexec
PATH=/run/wrappers/bin:/home/das/.nix-profile/bin:/nix/profile/bin:/home/das/.local/state/nix/profile/bin:/etc/profiles/per-user/das/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin:/nix/store/l2qzmd8wmya86sg6ijd7l0ad8yq2rrp9-ghostty-1.0.1/bin
__GLX_VENDOR_LIBRARY_NAME=nvidia
GDMSESSION=gnome
GBM_BACKEND=nvidia-drm
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
GIO_LAUNCHED_DESKTOP_FILE_PID=5484
GIO_LAUNCHED_DESKTOP_FILE=/etc/profiles/per-user/das/share/applications/com.mitchellh.ghostty.desktop
LC_NUMERIC=en_US.UTF-8
TERM_PROGRAM=ghostty
_=/run/current-system/sw/bin/env

[das@t:~]$ env | wc -l
98

Right, that has nothing to do with your display, it’s trying to run graphics operations against the intel driver, which unsurprisingly fails.

I don’t have a device to help test why this happens; consider however actually setting services.xserver.videoDrivers = [ "nvidia" ]; instead of manually adding the kernel driver to the kernel modules list like I suggested, it does way more than that…

Frankly, if you have an intel iGPU it’ll do a significantly better job at everything nvidia-vaapi does, it’ll have wider codec support and use less power, supports more front-ends than just firefox, and you wouldn’t need to compromise browser security. It’s more specialized to do stuff like video decoding. Use the intel implementation if you had an iGPU all along, why are you bothering with this hack?

I don’t use nixOS, but I have encountered the same issue on Arch.
I fixed it by forcing dracut to load the i915 driver early.
Put this in your dracut config force_drivers+=" i915 ".
If nix uses something different try and find the nix equivalent.

Changing the order in which the drivers load may indeed change what is considered the default device, but whether it works is up to the kernel’s mood and can change over time. It can technically be done with boot.kernelModules, but relying on it doesn’t seem wise.

If you have your heart set on it, there’s an upstream issue about this here which suggests some env variables that can change it at least for Firefox (and flags for vainfo if you want to show that output): DRM device recognition error on dual GPU devices · Issue #311 · elFarto/nvidia-vaapi-driver · GitHub

Nonetheless, if you have multiple GPUs, chances are your non-nvidia GPU will perform better with a wider set of codecs, and be more stable and safer to use.

Don’t use a third-party hack that struggles with multi-GPU setups to get your nvidia GPU to decode videos when you could just use the completely out-of-the-box, built-in VAAPI support for AMD and the properly supported intel-media-driver for intel.

1 Like

Thanks again @TLATER

Why Nvidia?

  • Maybe I’ve been suckered in by the marketing and it’s a bad idea. (Very possible)
  • In theory, Nvidia should work, and it should be able to drive my laptop screen and the x2 external screens
  • I’d like to run some ffmpeg vnenc encoding
  • But If I could get Intel working I guess I could live without ffmpeg

Thanks for the link to the thread. The other poor sole has the same issue I have.

I tried adding the intel support, and rebooted, but that didn’t work.

  hardware.graphics = {
    enable = true;
    extraPackages = with pkgs; [
      # https://discourse.nixos.org/t/nvidia-open-breaks-hardware-acceleration/58770/2
      nvidia-vaapi-driver
      vaapiVdpau
      libvdpau
      libvdpau-va-gl
      vdpauinfo
      libva
      libva-utils
      # https://wiki.nixos.org/wiki/Intel_Graphics
      vpl-gpu-rt   #<------------------------------------------ intel i915
    ];
  };

So I took this out again.

Just for fun, and cos Chrome is basically un-usable, I tried blacklisting i915

    blacklistedKernelModules = [
      "nouveau"
      "i915"
    ];

Full config in this branch
https://github.com/randomizedcoder/nixos/blob/d39cb72a4d47d7226178c0f5bed444bd3d59555e/laptops/t/configuration.nix#L80

Some progress! vainfo is happier!

[das@t:~]$ vainfo
Trying display: wayland
libva info: VA-API version 1.22.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 info: va_openDriver() returns 0
vainfo: VA-API version: 1.22 (libva 2.22.0)
vainfo: Driver version: VA-API NVDEC driver [direct backend]
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointVLD
      VAProfileVP8Version0_3          : VAEntrypointVLD
      VAProfileVP9Profile0            : VAEntrypointVLD
      VAProfileHEVCMain10             : VAEntrypointVLD
      VAProfileHEVCMain12             : VAEntrypointVLD
      VAProfileVP9Profile2            : VAEntrypointVLD
      VAProfileHEVCMain444            : VAEntrypointVLD
      VAProfileHEVCMain444_10         : VAEntrypointVLD
      VAProfileHEVCMain444_12         : VAEntrypointVLD

[das@t:~]$ ls -la /run/opengl-driver/lib/dri/nvidia_drv_video.so
lrwxrwxrwx 10 root root 98 Dec 31  1969 /run/opengl-driver/lib/dri/nvidia_drv_video.so -> /nix/store/0cj9k0b359qri6g5n5skf6hb1qghjd12-nvidia-vaapi-driver-0.0.13/lib/dri/nvidia_drv_video.so

Using the windowing system is now a lot faster, Chrome starts straight up, and so does slack.

However, the main display on the laptop which is 4k, is not recognized properly. It’s coming up as “Unknown 16”, and the resolution is 1366x768. To be honest, it’s not that bad, cos I just run my music player on that screen anyway… I think this is the best config yet. I’ll keep investigating.

I added some details about the physical output to readme here:
https://github.com/randomizedcoder/nixos/blob/d39cb72a4d47d7226178c0f5bed444bd3d59555e/laptops/t/readme.md#nvidia-nightmare

Yes, however this has nothing to do with the nvidia-vaapi-driver. You can use the nvidia GPU to drive your graphics and the intel GPU to de/encode videos, the latter will still do a better job.

To be clear, nvidia-vaapi-driver supports exactly these codecs, while intel-media-driver supports these. You will get a significantly better experience using the latter; more videos will be able to use hardware acceleration than with the nvidia hack.

And that’s before you consider all the benefits of using an actually supported workflow of a driver not held together by hot glue.

ffmpeg implements this by calling into the nvidia driver directly, using the same mechanisms as nvidia-vaapi-driver. There is no reason to set up vaapi to do this, vaapi does not support nvenc; the nvidia hack doesn’t even support encoding.

Nvidia don’t market this use case. They don’t even support it! You should sue them for false marketing if they did.

That’s the wrong package, from intel’s readme:

This runtime implementation is not self-sufficient. Application [sic] should use one of the available frontend dispatcher libraries

You need intel-media-driver, which depends on that package (and you certainly don’t need to add both, since intel-media-driver will come with the dependency included in its closure).

You also still have at least nvidia-vaapi-driver among like 7 other packages in there that all provide the same kinds of interfaces. You’ve likely still got the nvidia-vaapi-driver variables set up elsewhere, too.

I imagine even the correct package will not work because of this mess. You should really reduce your configuration to the minimum viable set before continuing with experimentation. I’d suggest removing everything that does not cause something that actually works to break, placing all the hardware acceleration cruft in a separate file, and then condensing that down to the minimum viable config for getting your chosen vaapi implementation to work (you can even have multiple files and switch between them for experimentation).

Does sound like you have more issues, then. That said, at least some of this will be placebo, you’ve already shown that at least GNOME was rendering with the nvidia GPU, so it should not be affected.

Chances are you’d get the same results by just configuring render offload for the applications you want to start up faster, though the effect should be pretty minimal.

That said, if you really don’t care for energy efficiency, disabling the intel driver is viable. At that point you should go into BIOS and just turn off intel hd graphics or whatever they call it these days.

Thanks again.

Seems like you are a bit fan of the Intel graphics, and you certainly know a lot more about this than I do, so I’ll give your suggestion a try and let you know!

Does this page need any updates?
https://nixos.wiki/wiki/Intel_Graphics

Do you have any experience/recommendations about video encoding with the Intel? I’m looking to take in 10Mb/s H264 and convert to HLS, with multiple bit rates. So I want to copy the 10Mb/s, and then create a few lower bit rates. Something like 10, 7.5, 5, 1 Mb/s. I was planning on using Nvidia, cos I’ve done this before, but as you say the “hot glue” really sucks.

Prefer wiki.nixos.org rather than the dead wiki :slight_smile:

Even if this is really off topic: I like to use the redirector firefox extension to auto redirect to the new wiki, because google somehow prefers the old one:

1 Like

None I can spot, but yeah, use the new wiki, and especially make sure to link to it when you post here, otherwise we’ll never defeat the page ranking of the abandoned one.

Not much of note, I’ve not used an intel CPU in a good 6 years :wink:

My opinion is restricted to VAAPI use, and my point around intel-media-driver over nvidia-vaapi-driver is focused on decoding, for which an intel iGPU will be sufficient for pretty much everything you can reasonably be expected to do.

As for encoding with VAAPI, nvidia-vaapi-driver does not support it at all, so if you want to use VAAPI (perhaps because you’re screensharing with Firefox) you must use the intel GPU, or fall back to software encoding with the CPU - there is no other option.

If you’re doing something more bespoke, such as using ffmpeg by hand, there are options besides VAAPI. In that case I agree you probably should just use nvenc directly - it’s solid and will be faster than using the iGPU. But I don’t do this a lot - you likely have more experience, and hey, maybe experiment with QSV.

Importantly though, nvidia-vaapi-driver is not used in this case, so you should still not touch that if you can use intel for VAAPI.