Opencl in a `steam-run` environment


A friend of mine needs to run a tool that requires opencl. To help him, I tried to package it locally, and to that end I activated opencl using the following (I have an integrated UHD Graphics 620):

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

Now, opencl seems to work, since I can run clinfo and get some results:

$ clinfo
Number of platforms                               1

Now, the tool is not trivial to package, so as a first step I run it in a steam-run environment. However, it turns out that inside the steam-run environment, clinfo does not detect it:

$ nix-build -E "with import <nixpkgs> {}; (steam.override {extraPkgs = pkgs: [ocl-icd gnome3.librsvg clinfo]; }).run" 
$ ./result/bin/steam-run bash
bash-4.4$ clinfo
Number of platforms                               0

What is the proper way to proceed? I saw that steam has some kind of withPrimus = true;, but I think that Primus is mostly for dual cards with nvidia, which is not my case.

1 Like

Try to add intel-ocl in extraPkgs

Thanks for your answer, and sorry for the time I spent to answer.

Sadly it does not work:

$ nix-build -E "with import <nixpkgs> {}; (steam.override {extraPkgs = pkgs: [ocl-icd clinfo intel-ocl]; }).run"

$ result/bin/steam-run bash
bash-4.4$ clinfo
Number of platforms                               0