Merge pull request #266115 from ConnorBaker/fix/cuda-samples-backendStdenv
cudaPackages.cuda-samples: misc bumps and fixups
This commit is contained in:
commit
69de178b4e
@ -11,13 +11,15 @@ final: prev: let
|
|||||||
"11.4" = "082dkk5y34wyvjgj2p5j1d00rk8xaxb9z0mhvz16bd469r1bw2qk";
|
"11.4" = "082dkk5y34wyvjgj2p5j1d00rk8xaxb9z0mhvz16bd469r1bw2qk";
|
||||||
"11.5" = "sha256-AKRZbke0K59lakhTi8dX2cR2aBuWPZkiQxyKaZTvHrI=";
|
"11.5" = "sha256-AKRZbke0K59lakhTi8dX2cR2aBuWPZkiQxyKaZTvHrI=";
|
||||||
"11.6" = "sha256-AsLNmAplfuQbXg9zt09tXAuFJ524EtTYsQuUlV1tPkE=";
|
"11.6" = "sha256-AsLNmAplfuQbXg9zt09tXAuFJ524EtTYsQuUlV1tPkE=";
|
||||||
"11.7" = throw "The tag 11.7 of cuda-samples does not exist";
|
# The tag 11.7 of cuda-samples does not exist
|
||||||
"11.8" = "sha256-7+1P8+wqTKUGbCUBXGMDO9PkxYr2+PLDx9W2hXtXbuc=";
|
"11.8" = "sha256-7+1P8+wqTKUGbCUBXGMDO9PkxYr2+PLDx9W2hXtXbuc=";
|
||||||
"12.0" = "sha256-Lj2kbdVFrJo5xPYPMiE4BS7Z8gpU5JLKXVJhZABUe/g=";
|
"12.0" = "sha256-Lj2kbdVFrJo5xPYPMiE4BS7Z8gpU5JLKXVJhZABUe/g=";
|
||||||
}.${prev.cudaVersion};
|
"12.1" = "sha256-xE0luOMq46zVsIEWwK4xjLs7NorcTIi9gbfZPVjIlqo=";
|
||||||
|
"12.2" = "sha256-pOy0qfDjA/Nr0T9PNKKefK/63gQnJV2MQsN2g3S2yng=";
|
||||||
|
};
|
||||||
|
|
||||||
in {
|
in prev.lib.attrsets.optionalAttrs (builtins.hasAttr prev.cudaVersion sha256) {
|
||||||
cuda-samples = final.callPackage ./generic.nix {
|
cuda-samples = final.callPackage ./generic.nix {
|
||||||
inherit sha256;
|
sha256 = sha256.${prev.cudaVersion};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,31 +1,46 @@
|
|||||||
{ lib
|
{ autoAddOpenGLRunpathHook
|
||||||
, cudaPackages
|
, backendStdenv
|
||||||
|
, cmake
|
||||||
|
, cudatoolkit
|
||||||
|
, cudaVersion
|
||||||
, fetchFromGitHub
|
, fetchFromGitHub
|
||||||
, fetchpatch
|
, fetchpatch
|
||||||
, addOpenGLRunpath
|
, freeimage
|
||||||
, cudatoolkit
|
, glfw3
|
||||||
|
, lib
|
||||||
, pkg-config
|
, pkg-config
|
||||||
, sha256
|
, sha256
|
||||||
, glfw3
|
|
||||||
, freeimage
|
|
||||||
}:
|
}:
|
||||||
cudaPackages.backendStdenv.mkDerivation rec {
|
backendStdenv.mkDerivation (finalAttrs: {
|
||||||
pname = "cuda-samples";
|
pname = "cuda-samples";
|
||||||
version = lib.versions.majorMinor cudatoolkit.version;
|
version = cudaVersion;
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "NVIDIA";
|
owner = "NVIDIA";
|
||||||
repo = pname;
|
repo = finalAttrs.pname;
|
||||||
rev = "v${version}";
|
rev = "v${finalAttrs.version}";
|
||||||
inherit sha256;
|
inherit sha256;
|
||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = [ pkg-config addOpenGLRunpath glfw3 freeimage ];
|
nativeBuildInputs = [
|
||||||
|
pkg-config
|
||||||
|
autoAddOpenGLRunpathHook
|
||||||
|
glfw3
|
||||||
|
freeimage
|
||||||
|
]
|
||||||
|
# CMake has to run as a native, build-time dependency for libNVVM samples.
|
||||||
|
++ lib.lists.optionals (lib.strings.versionAtLeast finalAttrs.version "12.2") [
|
||||||
|
cmake
|
||||||
|
];
|
||||||
|
|
||||||
|
# CMake is not the primary build tool -- that's still make.
|
||||||
|
# As such, we disable CMake's build system.
|
||||||
|
dontUseCmakeConfigure = true;
|
||||||
|
|
||||||
buildInputs = [ cudatoolkit ];
|
buildInputs = [ cudatoolkit ];
|
||||||
|
|
||||||
# See https://github.com/NVIDIA/cuda-samples/issues/75.
|
# See https://github.com/NVIDIA/cuda-samples/issues/75.
|
||||||
patches = lib.optionals (version == "11.3") [
|
patches = lib.optionals (finalAttrs.version == "11.3") [
|
||||||
(fetchpatch {
|
(fetchpatch {
|
||||||
url = "https://github.com/NVIDIA/cuda-samples/commit/5c3ec60faeb7a3c4ad9372c99114d7bb922fda8d.patch";
|
url = "https://github.com/NVIDIA/cuda-samples/commit/5c3ec60faeb7a3c4ad9372c99114d7bb922fda8d.patch";
|
||||||
sha256 = "sha256-0XxdmNK9MPpHwv8+qECJTvXGlFxc+fIbta4ynYprfpU=";
|
sha256 = "sha256-0XxdmNK9MPpHwv8+qECJTvXGlFxc+fIbta4ynYprfpU=";
|
||||||
@ -41,21 +56,15 @@ cudaPackages.backendStdenv.mkDerivation rec {
|
|||||||
installPhase = ''
|
installPhase = ''
|
||||||
runHook preInstall
|
runHook preInstall
|
||||||
|
|
||||||
install -Dm755 -t $out/bin bin/${cudaPackages.backendStdenv.hostPlatform.parsed.cpu.name}/${cudaPackages.backendStdenv.hostPlatform.parsed.kernel.name}/release/*
|
install -Dm755 -t $out/bin bin/${backendStdenv.hostPlatform.parsed.cpu.name}/${backendStdenv.hostPlatform.parsed.kernel.name}/release/*
|
||||||
|
|
||||||
runHook postInstall
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
|
|
||||||
postFixup = ''
|
|
||||||
for exe in $out/bin/*; do
|
|
||||||
addOpenGLRunpath $exe
|
|
||||||
done
|
|
||||||
'';
|
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
description = "Samples for CUDA Developers which demonstrates features in CUDA Toolkit";
|
description = "Samples for CUDA Developers which demonstrates features in CUDA Toolkit";
|
||||||
# CUDA itself is proprietary, but these sample apps are not.
|
# CUDA itself is proprietary, but these sample apps are not.
|
||||||
license = lib.licenses.bsd3;
|
license = lib.licenses.bsd3;
|
||||||
maintainers = with lib.maintainers; [ obsidian-systems-maintenance ];
|
maintainers = with lib.maintainers; [ obsidian-systems-maintenance ] ++ lib.teams.cuda.members;
|
||||||
};
|
};
|
||||||
}
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user