@@ -22,7 +22,7 @@ let
2222 }
2323 else throw "cudatoolkit does not support platform ${stdenv.system}";
2424
25− outputs = [ "out" "doc" ];
25+ outputs = [ "out" "lib" "doc" ];
2626
2727 buildInputs = [ perl ];
2828
@@ -51,7 +51,11 @@ let
5151 patchelf \
5252 --set-interpreter "''$(cat $NIX_CC/nix-support/dynamic-linker)" $i
5353 fi
54− rpath2=$rpath:$lib/lib:$out/jre/lib/amd64/jli:$out/lib:$out/lib64:$out/nvvm/lib:$out/nvvm/lib64
54+ if [[ $i =~ libcudart ]]; then
55+ rpath2=
56+ else
57+ rpath2=$rpath:$lib/lib:$out/jre/lib/amd64/jli:$out/lib:$out/lib64:$out/nvvm/lib:$out/nvvm/lib64
58+ fi
5559 patchelf --set-rpath $rpath2 --force-rpath $i
5660 done < <(find . -type f -print0)
5761 '';
@@ -80,6 +84,11 @@ let
8084 mkdir -p $out/nix-support
8185 echo "cmakeFlags+=' -DCUDA_TOOLKIT_ROOT_DIR=$out'" >> $out/nix-support/setup-hook
8286
87+ # Move some libraries to the lib output so that programs that
88+ # depend on them don't pull in this entire monstrosity.
89+ mkdir -p $lib/lib
90+ mv -v $out/lib64/libcudart* $lib/lib/
91+
8392 # Remove OpenCL libraries as they are provided by ocl-icd and driver.
8493 rm -f $out/lib64/libOpenCL*
8594