Files
jungle/pkgs/cudainfo/default.nix
Rodrigo Arias Mallo f4563008b1 Add cudainfo program to test CUDA in sandbox
The cudainfo program is executed inside the build sandbox so we can see
if it works properly. It uses the autoAddDriverRunpath hook to inject in
the runpath the location of the library directory for CUDA libraries.
2025-07-22 15:27:28 +02:00

34 lines
630 B
Nix

{
stdenv
, cudatoolkit
, cudaPackages
, autoAddDriverRunpath
, strace
}:
stdenv.mkDerivation {
name = "cudainfo";
src = ./.;
requiredSystemFeatures = [ "cuda" ];
buildInputs = [
cudatoolkit # Required for nvcc
cudaPackages.cuda_cudart.static # Required for -lcudart_static
autoAddDriverRunpath
strace
];
doInstallCheck = true;
installPhase = ''
mkdir -p $out/bin
cp -a cudainfo $out/bin
'';
installCheckPhase = ''
if ! $out/bin/cudainfo; then
set -x
ldd $out/bin/cudainfo
readelf -d $out/bin/cudainfo
strace -f $out/bin/cudainfo
set +x
fi
'';
}