@@ -0,0 +1,45 @@
1+{ stdenv
2+, requireFile
3+, cudatoolkit
4+}:
5+
6+stdenv.mkDerivation rec {
7+ version = "5.0";
8+ cudatoolkit_version = "8.0";
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 = "af80eb1ce0cb51e6a734b2bdc599e6d50b676eab3921e5bddfe5443485df86b6";
21+ };
22+
23+ installPhase = ''
24+ function fixRunPath {
25+ p=$(patchelf --print-rpath $1)
26+ patchelf --set-rpath "$p:${stdenv.lib.makeLibraryPath [ stdenv.cc.cc ]}" $1
27+ }
28+ fixRunPath lib64/libcudnn.so
29+
30+ mkdir -p $out
31+ cp -a include $out/include
32+ cp -a lib64 $out/lib64
33+ '';
34+
35+ propagatedBuildInputs = [
36+ cudatoolkit
37+ ];
38+
39+ meta = with stdenv.lib; {
40+ description = "NVIDIA CUDA Deep Neural Network library (cuDNN)";
41+ homepage = "https://developer.nvidia.com/cudnn";
42+ license = stdenv.lib.licenses.unfree;
43+ maintainers = with maintainers; [ mdaiter ];
44+ };
45+}