@@ -0,0 +1,46 @@
1+{ stdenv
2+, requireFile
3+, cudatoolkit
4+}:
5+
6+stdenv.mkDerivation rec {
7+ version = "5.0";
8+ cudatoolkit_version = "7.5";
9+
10+ name = "cudatoolkit-${cudatoolkit_version}-cudnn-${version}";
11+
12+ src = requireFile rec {
13+ name = "cudnn-${cudatoolkit_version}-linux-x64-v${version}-ga.tgz";
14+ message = ''
15+ This nix expression requires that ${name} is already part of the store.
16+ Register yourself to NVIDIA Accelerated Computing Developer Program, retrieve the cuDNN library
17+ at https://developer.nvidia.com/cudnn, and run the following command in the download directory:
18+ nix-prefetch-url file://${name}
19+ '';
20+ sha256 = "c4739a00608c3b66a004a74fc8e721848f9112c5cb15f730c1be4964b3a23b3a";
21+ };
22+
23+ phases = "unpackPhase installPhase fixupPhase";
24+
25+ installPhase = ''
26+ function fixRunPath {
27+ p=$(patchelf --print-rpath $1)
28+ patchelf --set-rpath "$p:${stdenv.lib.makeLibraryPath [ stdenv.cc.cc ]}" $1
29+ }
30+ fixRunPath lib64/libcudnn.so
31+
32+ mkdir -p $out
33+ cp -a include $out/include
34+ cp -a lib64 $out/lib64
35+ '';
36+
37+ propagatedBuildInputs = [
38+ cudatoolkit
39+ ];
40+
41+ meta = {
42+ description = "NVIDIA CUDA Deep Neural Network library (cuDNN)";
43+ homepage = "https://developer.nvidia.com/cudnn";
44+ license = stdenv.lib.licenses.unfree;
45+ };
46+}