nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1# autoAddCudaCompatRunpath hook must be added AFTER `setupCudaHook`. Both
2# hooks prepend a path with `libcuda.so` to the `DT_RUNPATH` section of
3# patched elf files, but `cuda_compat` path must take precedence (otherwise,
4# it doesn't have any effect) and thus appear first. Meaning this hook must be
5# executed last.
6{
7 autoFixElfFiles,
8 cuda_compat,
9 lib,
10 makeSetupHook,
11}:
12let
13 # cuda_compat can be null or broken, depending on the platform, CUDA release, and compute capability.
14 # To avoid requiring all consumers of this hook to do these checks, we do them here; the hook is a no-op if
15 # cuda_compat is not available.
16 enableHook = cuda_compat.meta.available or false;
17in
18makeSetupHook {
19 name = "auto-add-cuda-compat-runpath-hook";
20 propagatedBuildInputs = lib.optionals enableHook [ autoFixElfFiles ];
21
22 substitutions = {
23 libcudaPath = lib.optionalString enableHook "${cuda_compat}/compat";
24 };
25
26 passthru = {
27 inherit enableHook;
28 };
29} ./auto-add-cuda-compat-runpath.sh