Opencl: how to properly configure opengl.extraPackages? (regression?)

Quick version: How can I properly configure the hardware.opengl.extraPackages variable, given the high number of possibilities? Just reading in this page of the wiki, I can see intel-media-driver, vaapiIntel, vaapiVdpau, libvdpau-va-gl, enableHybridCodec, but I’m also aware of intel-ocl, and I guess there is many more depending on your graphic card. Is there a tool that says “for this graphic card, use this module”?

My specific problem:
A while ago I was using the configuration:

  hardware.opengl.extraPackages = with pkgs; [ intel-ocl ];

It was working, as I was detecting one CPU when I was using clinfo. But I noticed recently that opencl does not work anymore: clinfo lists zero devices. Back when it was still working, I also had a strange experience: in NixOs, the clinfo command was listing my CPU, while in an ubuntu docker instance, clinfo was listing my GPU.

Any idea idea why opencl is not listed anymore? For more details, I have a Intel(R) Core(TM) i5-8365U CPU, which is supposed to be packed with Intel® UHD Graphics for 8th Generation Intel® Processors.

I have a Nvidia GPU and clinfo was not working too. I fixed that setting the env var OCL_ICD_VENDORS:

OCL_ICD_VENDORS=/run/opengl-driver/etc/OpenCL/vendors

Oh, thanks, that’s true! Actually, I reported the bug here Opencl regression: `OCL_ICD_VENDORS` not setup anymore? · Issue #153865 · NixOS/nixpkgs · GitHub and vcunat made me realized that it was solved in ocl-icd: fix ICD vendor path for NixOS by r-burns · Pull Request #145150 · NixOS/nixpkgs · GitHub

Also, the issue I had with undiscovered GPU is because I need both intel-ocl (proprietary, for GPU Gen 7 and it also seems to make my CPU appear) and intel-compute-runtime (for GPU, Gen 8). For Gen 7, there is also the deprecated open source beignet. I realized all of this was actually documented in NixOS - NixOS 21.11 manual and the documentation I was reading in the wiki Intel Graphics - NixOS Wiki should be updated accordingly.

I guess my problems are nearly solved, thanks a lot! There is just a remaining question about how to choose the appropriate things between vaapi, vaapiIntel libvdpau-va-gl vaapiVdpau, libvdpau-va-gl…

Hosted by Flying Circus.