@@ -69,26 +69,18 @@ backendStdenv.mkDerivation rec {
6969 "doc"
7070 ] ;
7171
72- nativeBuildInputs =
73- [
74- perl
75- makeWrapper
76- rsync
77- addDriverRunpath
78- autoPatchelfHook
79- autoAddDriverRunpath
80- markForCudatoolkitRootHook
81- ]
82- ++ lib . optionals ( lib . versionOlder version "11" ) [ libsForQt5 . wrapQtAppsHook ]
83- ++ lib . optionals ( lib . versionAtLeast version "11.8" ) [ qt6Packages . wrapQtAppsHook ] ;
72+ nativeBuildInputs = [
73+ perl
74+ makeWrapper
75+ rsync
76+ addDriverRunpath
77+ autoPatchelfHook
78+ autoAddDriverRunpath
79+ markForCudatoolkitRootHook
80+ ] ++ lib . optionals ( lib . versionAtLeast version "11.8" ) [ qt6Packages . wrapQtAppsHook ] ;
8481 propagatedBuildInputs = [ setupCudaHook ] ;
8582 buildInputs =
86- lib . optionals ( lib . versionOlder version "11" ) [
87- libsForQt5 . qt5 . qtwebengine
88- libglut
89- libGLU
90- ]
91- ++ [
83+ [
9284 # To get $GDK_PIXBUF_MODULE_FILE via setup-hook
9385 gdk-pixbuf
9486
@@ -168,105 +160,58 @@ backendStdenv.mkDerivation rec {
168160 "${ placeholder "out" } /nvvm/lib64"
169161 ] ;
170162
171- autoPatchelfIgnoreMissingDeps =
172- [
173- # This is the hardware-dependent userspace driver that comes from
174- # nvidia_x11 package. It must be deployed at runtime in
175- # /run/opengl-driver/lib or pointed at by LD_LIBRARY_PATH variable, rather
176- # than pinned in runpath
177- "libcuda.so.1"
163+ autoPatchelfIgnoreMissingDeps = [
164+ # This is the hardware-dependent userspace driver that comes from
165+ # nvidia_x11 package. It must be deployed at runtime in
166+ # /run/opengl-driver/lib or pointed at by LD_LIBRARY_PATH variable, rather
167+ # than pinned in runpath
168+ "libcuda.so.1"
178169
179- # The krb5 expression ships libcom_err.so.3 but cudatoolkit asks for the
180- # older
181- # This dependency is asked for by target-linux-x64/CollectX/RedHat/x86_64/libssl.so.10
182- # - do we even want to use nvidia-shipped libssl?
183- "libcom_err.so.2"
184- ]
185- ++ lib . optionals ( lib . versionOlder version "10.1" ) [
186- # For Cuda 10.0, nVidia also shipped a jre implementation which needed
187- # two old versions of ffmpeg which are not available in nixpkgs
188- "libavcodec.so.54"
189- "libavcodec.so.53"
190- "libavformat.so.54"
191- "libavformat.so.53"
192- ] ;
170+ # The krb5 expression ships libcom_err.so.3 but cudatoolkit asks for the
171+ # older
172+ # This dependency is asked for by target-linux-x64/CollectX/RedHat/x86_64/libssl.so.10
173+ # - do we even want to use nvidia-shipped libssl?
174+ "libcom_err.so.2"
175+ ] ;
193176
194- preFixup =
195- if ( lib . versionAtLeast version "10.1" && lib . versionOlder version "11" ) then
196- ''
197- ${ lib . getExe' patchelf "patchelf" } $out/targets/*/lib/libnvrtc.so --add-needed libnvrtc-builtins.so
198- ''
199- else
200- ''
201- ${ lib . getExe' patchelf "patchelf" } $out/lib64/libnvrtc.so --add-needed libnvrtc-builtins.so
202- '' ;
177+ preFixup = ''
178+ ${ lib . getExe' patchelf "patchelf" } $out/lib64/libnvrtc.so --add-needed libnvrtc-builtins.so
179+ '' ;
203180
204181 unpackPhase = ''
205182 sh $src --keep --noexec
206-
207- ${ lib . optionalString ( lib . versionOlder version "10.1" ) ''
208- cd pkg/run_files
209- sh cuda-linux*.run --keep --noexec
210- sh cuda-samples*.run --keep --noexec
211- mv pkg ../../$(basename $src)
212- cd ../..
213- rm -rf pkg
214-
215- for patch in $runPatches; do
216- sh $patch --keep --noexec
217- mv pkg $(basename $patch)
218- done
219- '' }
220183 '' ;
221184
222185 installPhase =
223186 ''
224187 runHook preInstall
225188 mkdir $out
226- ${ lib . optionalString ( lib . versionOlder version "10.1" ) ''
227- cd $(basename $src)
228- export PERL5LIB=.
229- perl ./install-linux.pl --prefix="$out"
230- cd ..
231- for patch in $runPatches; do
232- cd $(basename $patch)
233- perl ./install_patch.pl --silent --accept-eula --installdir="$out"
234- cd ..
235- done
236- '' }
237- ${ lib . optionalString ( lib . versionAtLeast version "10.1" && lib . versionOlder version "11" ) ''
238- cd pkg/builds/cuda-toolkit
239- mv * $out/
240- rm -f $out/nsight-systems-*/host-linux-x64/libstdc++.so*
241- '' }
242- ${ lib . optionalString ( lib . versionAtLeast version "11" ) ''
243- mkdir -p $out/bin $out/lib64 $out/include $doc
244- for dir in pkg/builds/* pkg/builds/cuda_nvcc/nvvm pkg/builds/cuda_cupti/extras/CUPTI; do
245- if [ -d $dir/bin ]; then
246- mv $dir/bin/* $out/bin
247- fi
248- if [ -d $dir/doc ]; then
249- (cd $dir/doc && find . -type d -exec mkdir -p $doc/\{} \;)
250- (cd $dir/doc && find . \( -type f -o -type l \) -exec mv \{} $doc/\{} \;)
251- fi
252- if [ -L $dir/include ] || [ -d $dir/include ]; then
253- (cd $dir/include && find . -type d -exec mkdir -p $out/include/\{} \;)
254- (cd $dir/include && find . \( -type f -o -type l \) -exec mv \{} $out/include/\{} \;)
255- fi
256- if [ -L $dir/lib64 ] || [ -d $dir/lib64 ]; then
257- (cd $dir/lib64 && find . -type d -exec mkdir -p $out/lib64/\{} \;)
258- (cd $dir/lib64 && find . \( -type f -o -type l \) -exec mv \{} $out/lib64/\{} \;)
259- fi
260- done
261- mv pkg/builds/cuda_nvcc/nvvm $out/nvvm
189+ mkdir -p $out/bin $out/lib64 $out/include $doc
190+ for dir in pkg/builds/* pkg/builds/cuda_nvcc/nvvm pkg/builds/cuda_cupti/extras/CUPTI; do
191+ if [ -d $dir/bin ]; then
192+ mv $dir/bin/* $out/bin
193+ fi
194+ if [ -d $dir/doc ]; then
195+ (cd $dir/doc && find . -type d -exec mkdir -p $doc/\{} \;)
196+ (cd $dir/doc && find . \( -type f -o -type l \) -exec mv \{} $doc/\{} \;)
197+ fi
198+ if [ -L $dir/include ] || [ -d $dir/include ]; then
199+ (cd $dir/include && find . -type d -exec mkdir -p $out/include/\{} \;)
200+ (cd $dir/include && find . \( -type f -o -type l \) -exec mv \{} $out/include/\{} \;)
201+ fi
202+ if [ -L $dir/lib64 ] || [ -d $dir/lib64 ]; then
203+ (cd $dir/lib64 && find . -type d -exec mkdir -p $out/lib64/\{} \;)
204+ (cd $dir/lib64 && find . \( -type f -o -type l \) -exec mv \{} $out/lib64/\{} \;)
205+ fi
206+ done
207+ mv pkg/builds/cuda_nvcc/nvvm $out/nvvm
262208
263- mv pkg/builds/cuda_sanitizer_api $out/cuda_sanitizer_api
264- ln -s $out/cuda_sanitizer_api/compute-sanitizer/compute-sanitizer $out/bin/compute-sanitizer
209+ mv pkg/builds/cuda_sanitizer_api $out/cuda_sanitizer_api
210+ ln -s $out/cuda_sanitizer_api/compute-sanitizer/compute-sanitizer $out/bin/compute-sanitizer
265211
266- mv pkg/builds/nsight_systems/target-linux-x64 $out/target-linux-x64
267- mv pkg/builds/nsight_systems/host-linux-x64 $out/host-linux-x64
268- rm $out/host-linux-x64/libstdc++.so*
269- '' }
212+ mv pkg/builds/nsight_systems/target-linux-x64 $out/target-linux-x64
213+ mv pkg/builds/nsight_systems/host-linux-x64 $out/host-linux-x64
214+ rm $out/host-linux-x64/libstdc++.so*
270215 ${
271216 lib . optionalString ( lib . versionAtLeast version "11.8" && lib . versionOlder version "12" )
272217 # error: auto-patchelf could not satisfy dependency libtiff.so.5 wanted by /nix/store/.......-cudatoolkit-12.0.1/host-linux-x64/Plugins/imageformats/libqtiff.so
@@ -301,20 +246,10 @@ backendStdenv.mkDerivation rec {
301246
302247 rm -f $out/tools/CUDA_Occupancy_Calculator.xls # FIXME: why?
303248
304- ${ lib . optionalString ( lib . versionOlder version "10.1" ) ''
305- # let's remove the 32-bit libraries, they confuse the lib64->lib mover
306- rm -rf $out/lib
307- '' }
308-
309249 ${ lib . optionalString ( lib . versionAtLeast version "12.0" ) ''
310250 rm $out/host-linux-x64/libQt6*
311251 '' }
312252
313- # Remove some cruft.
314- ${ lib . optionalString (
315- ( lib . versionAtLeast version "7.0" ) && ( lib . versionOlder version "10.1" )
316- ) "rm $out/bin/uninstall*" }
317-
318253 # Fixup path to samples (needed for cuda 6.5 or else nsight will not find them)
319254 if [ -d "$out"/cuda-samples ]; then
320255 mv "$out"/cuda-samples "$out"/samples
@@ -343,19 +278,11 @@ backendStdenv.mkDerivation rec {
343278
344279 # Remove OpenCL libraries as they are provided by ocl-icd and driver.
345280 rm -f $out/lib64/libOpenCL*
346- ${ lib . optionalString ( lib . versionAtLeast version "10.1" && ( lib . versionOlder version "11" ) ) ''
347- mv $out/lib64 $out/lib
348- mv $out/extras/CUPTI/lib64/libcupti* $out/lib
349- '' }
350281
351282 # nvprof do not find any program to profile if LD_LIBRARY_PATH is not set
352283 wrapProgram $out/bin/nvprof \
353284 --prefix LD_LIBRARY_PATH : $out/lib
354285 ''
355- + lib . optionalString ( lib . versionOlder version "8.0" ) ''
356- # Hack to fix building against recent Glibc/GCC.
357- echo "NIX_CFLAGS_COMPILE+=' -D_FORCE_INLINES'" >> $out/nix-support/setup-hook
358- ''
359286 # 11.8 includes a broken symlink, include/include, pointing to targets/x86_64-linux/include
360287 + lib . optionalString ( lib . versions . majorMinor version == "11.8" ) ''
361288 rm $out/include/include
@@ -365,7 +292,7 @@ backendStdenv.mkDerivation rec {
365292 '' ;
366293
367294 postInstall = ''
368- for b in nvvp ${ lib . optionalString ( lib . versionOlder version "11" ) "nsight" } ; do
295+ for b in nvvp; do
369296 wrapProgram "$out/bin/$b" \
370297 --set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE"
371298 done
0 commit comments