depot/third_party/nixpkgs/pkgs/test/cuda/cuda-samples/generic.nix
Default email 07d6a74cbb Project import generated by Copybara.
GitOrigin-RevId: f5e8bdd07d1afaabf6b37afc5497b1e498b8046f
2021-03-19 18:17:44 +01:00

51 lines
1.1 KiB
Nix

{ lib, stdenv, fetchFromGitHub
, pkg-config, addOpenGLRunpath
, sha256, cudatoolkit
}:
let
pname = "cuda-samples";
version = lib.versions.majorMinor cudatoolkit.version;
in
stdenv.mkDerivation {
inherit pname version;
src = fetchFromGitHub {
owner = "NVIDIA";
repo = pname;
rev = "v${version}";
inherit sha256;
};
nativeBuildInputs = [ pkg-config addOpenGLRunpath ];
buildInputs = [ cudatoolkit ];
enableParallelBuilding = true;
preConfigure = ''
export CUDA_PATH=${cudatoolkit}
'';
installPhase = ''
runHook preInstall
install -Dm755 -t $out/bin bin/${stdenv.hostPlatform.parsed.cpu.name}/${stdenv.hostPlatform.parsed.kernel.name}/release/*
runHook postInstall
'';
postFixup = ''
for exe in $out/bin/*; do
addOpenGLRunpath $exe
done
'';
meta = {
description = "Samples for CUDA Developers which demonstrates features in CUDA Toolkit";
# CUDA itself is proprietary, but these sample apps are not.
license = lib.licenses.bsd3;
maintainers = with lib.maintainers; [ obsidian-systems-maintenance ];
};
}