nixpkgs/pkgs/development/libraries/ocl-icd/default.nix
Ryan Burns 437fa8d107 ocl-icd: fix ICD vendor path for NixOS
This fixes the vendor ICD load path to work with NixOS's opengl path.
Previously, the only workaround to load ICD files was to manually
override the load path at runtime using an environment variable.

Tested against Intel and Nvidia drivers using the clinfo package:

Before:

```
$ clinfo
Number of platforms                               0
```

After:

```
$ clinfo
Number of platforms                               1
  Platform Name                                   NVIDIA CUDA
  Platform Vendor                                 NVIDIA Corporation
<...>
```
2021-11-08 18:46:16 -08:00

39 lines
793 B
Nix

{ lib
, stdenv
, fetchFromGitHub
, ruby
, opencl-headers
, addOpenGLRunpath
, autoreconfHook
}:
stdenv.mkDerivation rec {
pname = "ocl-icd";
version = "2.3.1";
src = fetchFromGitHub {
owner = "OCL-dev";
repo = "ocl-icd";
rev = "v${version}";
sha256 = "1km2rqc9pw6xxkqp77a22pxfsb5kgw95w9zd15l5jgvyjb6rqqad";
};
nativeBuildInputs = [
autoreconfHook
ruby
];
buildInputs = [ opencl-headers ];
configureFlags = [
"--enable-custom-vendordir=/run/opengl-driver/etc/OpenCL/vendors"
];
meta = with lib; {
description = "OpenCL ICD Loader for ${opencl-headers.name}";
homepage = "https://github.com/OCL-dev/ocl-icd";
license = licenses.bsd2;
platforms = platforms.unix;
maintainers = with maintainers; [ r-burns ];
};
}