@@ -53,22 +53,25 @@ let
5353 unpackPhase = ''
5454 sh $src --keep --noexec
5555
56− cd pkg/run_files
57− sh cuda-linux*.run --keep --noexec
58− sh cuda-samples*.run --keep --noexec
59− mv pkg ../../$(basename $src)
60− cd ../..
61− rm -rf pkg
62−
63− for patch in $runPatches; do
64− sh $patch --keep --noexec
65− mv pkg $(basename $patch)
66− done
56+ ${lib.optionalString (lib.versionOlder version "10.1") ''
57+ cd pkg/run_files
58+ sh cuda-linux*.run --keep --noexec
59+ sh cuda-samples*.run --keep --noexec
60+ mv pkg ../../$(basename $src)
61+ cd ../..
62+ rm -rf pkg
63+
64+ for patch in $runPatches; do
65+ sh $patch --keep --noexec
66+ mv pkg $(basename $patch)
67+ done
68+ ''}
6769 '';
6870
6971 installPhase = ''
7072 runHook preInstall
7173 mkdir $out
74+ ${lib.optionalString (lib.versionOlder version "10.1") ''
7275 cd $(basename $src)
7376 export PERL5LIB=.
7477 perl ./install-linux.pl --prefix="$out"
@@ -78,14 +81,22 @@ let
7881 perl ./install_patch.pl --silent --accept-eula --installdir="$out"
7982 cd ..
8083 done
84+ ''}
85+ ${lib.optionalString (lib.versionAtLeast version "10.1") ''
86+ cd pkg/builds/cuda-toolkit
87+ mv * $out/
88+ ''}
8189
8290 rm $out/tools/CUDA_Occupancy_Calculator.xls # FIXME: why?
8391
92+ ${lib.optionalString (lib.versionOlder version "10.1") ''
8493 # let's remove the 32-bit libraries, they confuse the lib64->lib mover
8594 rm -rf $out/lib
95+ ''}
8696
8797 # Remove some cruft.
88− ${lib.optionalString (lib.versionAtLeast version "7.0") "rm $out/bin/uninstall*"}
98+ ${lib.optionalString ((lib.versionAtLeast version "7.0") && (lib.versionOlder version "10.1"))
99+ "rm $out/bin/uninstall*"}
89100
90101 # Fixup path to samples (needed for cuda 6.5 or else nsight will not find them)
91102 if [ -d "$out"/cuda-samples ]; then
@@ -109,6 +120,9 @@ let
109120
110121 # Remove OpenCL libraries as they are provided by ocl-icd and driver.
111122 rm -f $out/lib64/libOpenCL*
123+ ${lib.optionalString (lib.versionAtLeast version "10.1") ''
124+ mv $out/lib64 $out/lib
125+ ''}
112126
113127 # Set compiler for NVCC.
114128 wrapProgram $out/bin/nvcc \
@@ -302,5 +316,13 @@ in rec {
302316 gcc = gcc7;
303317 };
304318
305− cudatoolkit_10 = cudatoolkit_10_0;
319+ cudatoolkit_10_1 = common {
320+ version = "10.1.243";
321+ url = "https://developer.download.nvidia.com/compute/cuda/10.1/Prod/local_installers/cuda_10.1.243_418.87.00_linux.run";
322+ sha256 = "0caxhlv2bdq863dfp6wj7nad66ml81vasq2ayf11psvq2b12vhp7";
323+
324+ gcc = gcc7;
325+ };
326+
327+ cudatoolkit_10 = cudatoolkit_10_1;
306328}