Skip to content

Conversation

@izelnakri
Copy link

@izelnakri izelnakri commented Aug 19, 2025

Hi there,

Currently I'm working on standardizing, further specifying and simplifying the build, test and release of all the GPU based software for nix: which should eventually allow all standard bodies and hardware/software vendors to further standardize their build workflows.

We already have khronos-ocl-icd-loader on nixpkgs here: https://github.com/NixOS/nixpkgs/blob/master/pkgs/by-name/kh/khronos-ocl-icd-loader/package.nix

This flake.nix serves as an additional release channel for a direct specific github branch on any machine that has nix via:

$ nix build github:KhronosGroup/OpenCL-ICD-Loader # or:
$ nix build github:KhronosGroup/OpenCL-ICD-Loader/ad770a1b64c6b8d5f2ed4e153f22e4f45939f27f # or:
$ nix build github:KhronosGroup/OpenCL-ICD-Loader/v2025.07.22

Also serves as a further documentation as code for all the important build targets.

It also standardizes the builds under a single command:

$ nix build ".#" # Runs the unit tests as well, nix testing convention, there is doCheck = true
$ tree ./result
result
├── bin
│   └── cllayerinfo
├── lib
│   ├── libOpenCL.so -> libOpenCL.so.1
│   ├── libOpenCL.so.1 -> libOpenCL.so.1.0.0
│   ├── libOpenCL.so.1.0.0
│   └── pkgconfig
│       └── OpenCL.pc
└── share
    └── cmake
        └── OpenCLICDLoader
            ├── OpenCLICDLoaderConfig.cmake
            ├── OpenCLICDLoaderConfigVersion.cmake
            ├── OpenCLICDLoaderTargets.cmake
            └── OpenCLICDLoaderTargets-release.cmake

7 directories, 9 files

A contributor can have standardized development environment via:

$ nix develop # Could also automatically if the developer has `direnv` installed & configured
# With the current flake.nix, then developer can see the output:
$ pkg-config --list-all --cflags
OpenCL-Headers OpenCL-Headers - Khronos OpenCL Headers
OpenCL         OpenCL - Khronos OpenCL ICD Loader

Lastly, in the future, if there is enough interest, this could enhance the existing CI workflow(with additional PRs) via:

$ nix flake check --all-systems # Runs all the checks(unit tests, pkg-config checks etc) on all CPU architectures

On a corollary note, I suggest all software developers to install and use nix for all its benefits. I think there is enough documentation online, however I currently find the documentation lacking for conventions around testing. So I documented it here for the ones interested: https://gist.github.com/izelnakri/06d7286fe9ab5f15acee9cbeace1c1b1

@CLAassistant
Copy link

CLAassistant commented Aug 19, 2025

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants