Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at release-16.03 112 lines 3.6 kB view raw
1{ lib, stdenv, fetchurl, patchelf, perl, ncurses, expat, python26, python27, zlib 2, xorg, gtk2, glib, fontconfig, freetype, unixODBC, alsaLib, glibc 3}: 4 5let 6 7 common = 8 { version, url, sha256 9 , python ? python27 10 }: 11 12 stdenv.mkDerivation rec { 13 name = "cudatoolkit-${version}"; 14 15 dontPatchELF = true; 16 dontStrip = true; 17 18 src = 19 if stdenv.system == "x86_64-linux" then 20 fetchurl { 21 inherit url sha256; 22 } 23 else throw "cudatoolkit does not support platform ${stdenv.system}"; 24 25 outputs = [ "out" "sdk" ]; 26 27 buildInputs = [ perl ]; 28 29 runtimeDependencies = [ 30 ncurses expat python zlib glibc 31 xorg.libX11 xorg.libXext xorg.libXrender xorg.libXt xorg.libXtst xorg.libXi xorg.libXext 32 gtk2 glib fontconfig freetype unixODBC alsaLib 33 ]; 34 35 rpath = "${stdenv.lib.makeLibraryPath runtimeDependencies}:${stdenv.cc.cc}/lib64"; 36 37 unpackPhase = '' 38 sh $src --keep --noexec 39 cd pkg/run_files 40 sh cuda-linux64-rel-${version}-*.run --keep --noexec 41 sh cuda-samples-linux-${version}-*.run --keep --noexec 42 cd pkg 43 ''; 44 45 buildPhase = '' 46 find . -type f -executable -exec patchelf \ 47 --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ 48 '{}' \; || true 49 find . -type f -exec patchelf \ 50 --set-rpath $rpath:$out/jre/lib/amd64/jli:$out/lib:$out/lib64:$out/nvvm/lib:$out/nvvm/lib64:$(cat $NIX_CC/nix-support/orig-cc)/lib \ 51 --force-rpath \ 52 '{}' \; || true 53 ''; 54 55 installPhase = '' 56 mkdir $out $sdk 57 perl ./install-linux.pl --prefix="$out" 58 rm $out/tools/CUDA_Occupancy_Calculator.xls 59 perl ./install-sdk-linux.pl --prefix="$sdk" --cudaprefix="$out" 60 61 # let's remove the 32-bit libraries, they confuse the lib64->lib mover 62 rm -rf $out/lib 63 64 # Fixup path to samples (needed for cuda 6.5 or else nsight will not find them) 65 if [ -d "$out"/cuda-samples ]; then 66 mv "$out"/cuda-samples "$out"/samples 67 fi 68 69 # Change the #error on GCC > 4.9 to a #warning. 70 sed -i $out/include/host_config.h -e 's/#error\(.*unsupported GNU version\)/#warning\1/' 71 ''; 72 73 meta = { 74 license = lib.licenses.unfree; 75 }; 76 }; 77 78in { 79 80 cudatoolkit5 = common { 81 version = "5.5.22"; 82 url = http://developer.download.nvidia.com/compute/cuda/5_5/rel/installers/cuda_5.5.22_linux_64.run; 83 sha256 = "b997e1dbe95704e0e806e0cedc5fd370a385351fef565c7bae0917baf3a29aa4"; 84 python = python26; 85 }; 86 87 cudatoolkit6 = common { 88 version = "6.0.37"; 89 url = http://developer.download.nvidia.com/compute/cuda/6_0/rel/installers/cuda_6.0.37_linux_64.run; 90 sha256 = "991e436c7a6c94ec67cf44204d136adfef87baa3ded270544fa211179779bc40"; 91 }; 92 93 cudatoolkit65 = common { 94 version = "6.5.19"; 95 url = http://developer.download.nvidia.com/compute/cuda/6_5/rel/installers/cuda_6.5.19_linux_64.run; 96 sha256 = "1x9zdmk8z784d3d35vr2ak1l4h5v4jfjhpxfi9fl9dvjkcavqyaj"; 97 }; 98 99 cudatoolkit7 = common { 100 version = "7.0.28"; 101 url = http://developer.download.nvidia.com/compute/cuda/7_0/Prod/local_installers/cuda_7.0.28_linux.run; 102 sha256 = "1km5hpiimx11jcazg0h3mjzk220klwahs2vfqhjavpds5ff2wafi"; 103 }; 104 105 cudatoolkit75 = common { 106 version = "7.5.18"; 107 url = http://developer.download.nvidia.com/compute/cuda/7.5/Prod/local_installers/cuda_7.5.18_linux.run; 108 sha256 = "1v2ylzp34ijyhcxyh5p6i0cwawwbbdhni2l5l4qm21s1cx9ish88"; 109 }; 110 111} 112