Files
nixpkgs/pkgs/development/python-modules/cuda-bindings/patch-nvidia-libs-paths_13_1.patch
Connor Baker 6254244afd python3Packages.cuda-bindings: search LD_LIBRARY_PATH before the driver link
cuda-bindings loads libcuda and libnvidia-ml by absolute path from the
NixOS driver link. Unlike libraries that carry the driver link in their
RUNPATH, that ignores LD_LIBRARY_PATH, so on non-NixOS hosts where the
driver is exposed that way (nixglhost, container runtimes) every
cuda.bindings driver and NVML call fails. Packages that probe the GPU
through cuda.bindings then silently fall back: CUTLASS DSL, for one,
compiles for its default sm_100a and the kernels fail to launch with
cudaErrorNoKernelImageForDevice.

Try the soname first and fall back to the configured path, matching the
dynamic linker's order for RUNPATH-linked libraries. On NixOS the soname
lookup finds nothing and the driver link is used as before.

This affects NVML in the 12.9 and 13.1 through 13.4 patches, and libcuda
in the 13.4 patch only; earlier versions load libcuda by soname, which
the patches leave alone. 13.0 has no NVML module.

Assisted-by: Claude Code (Claude Opus 5.5, claude-opus-5-5)
2026-10-13 10:02:52 -07:00

6.1 KiB