about summary refs log tree commit diff
path: root/pkgs/development/cuda-modules
diff options
context:
space:
mode:
authorSomeone Serge <sergei.kozlukov@aalto.fi>2023-12-22 00:33:55 +0000
committerSomeone Serge <sergei.kozlukov@aalto.fi>2023-12-24 23:56:00 +0000
commitcfa07014b6af63298365329c8ffc2a132941d985 (patch)
tree407699ece90ace73a3a329a9bc0d41c0f3085fa4 /pkgs/development/cuda-modules
parentdad9c990826e522976afca663de01ae75aa439ad (diff)
downloadnixlib-cfa07014b6af63298365329c8ffc2a132941d985.tar
nixlib-cfa07014b6af63298365329c8ffc2a132941d985.tar.gz
nixlib-cfa07014b6af63298365329c8ffc2a132941d985.tar.bz2
nixlib-cfa07014b6af63298365329c8ffc2a132941d985.tar.lz
nixlib-cfa07014b6af63298365329c8ffc2a132941d985.tar.xz
nixlib-cfa07014b6af63298365329c8ffc2a132941d985.tar.zst
nixlib-cfa07014b6af63298365329c8ffc2a132941d985.zip
cudaPackages.cuda_cudart: patch cuda-XX.Y.pc
Diffstat (limited to 'pkgs/development/cuda-modules')
-rw-r--r--pkgs/development/cuda-modules/cuda/overrides.nix16
1 files changed, 15 insertions, 1 deletions
diff --git a/pkgs/development/cuda-modules/cuda/overrides.nix b/pkgs/development/cuda-modules/cuda/overrides.nix
index bcb41f43e98e..b835b5350aee 100644
--- a/pkgs/development/cuda-modules/cuda/overrides.nix
+++ b/pkgs/development/cuda-modules/cuda/overrides.nix
@@ -1,4 +1,4 @@
-{cudaVersion, lib}:
+{cudaVersion, lib, addDriverRunpath}:
 let
   inherit (lib) attrsets lists strings;
   # cudaVersionOlder : Version -> Boolean
@@ -42,6 +42,20 @@ attrsets.filterAttrs (attr: _: (builtins.hasAttr attr prev)) {
     lists.optionals (cudaVersionAtLeast "12.0") [final.libnvjitlink.lib]
   );
 
+  cuda_cudart = prev.cuda_cudart.overrideAttrs (
+    prevAttrs: {
+
+      # The libcuda stub's pkg-config doesn't follow the general pattern:
+      postPatch = prevAttrs.postPatch or "" + ''
+        while IFS= read -r -d $'\0' path ; do
+          sed -i \
+            -e "s|^libdir\s*=.*/lib\$|libdir=''${!outputLib}/lib/stubs|" \
+            -e "s|^Libs\s*:\(.*\)\$|Libs: \1 -Wl,-rpath,${addDriverRunpath.driverLink}/lib|" \
+            "$path"
+        done < <(find -iname 'cuda-*.pc' -print0)
+      '';
+    });
+
   cuda_compat = prev.cuda_compat.overrideAttrs (
     prevAttrs: {
       env.autoPatchelfIgnoreMissingDeps =