about summary refs log tree commit diff
path: root/pkgs/test/cuda/cuda-samples/generic.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/test/cuda/cuda-samples/generic.nix')
-rw-r--r--pkgs/test/cuda/cuda-samples/generic.nix125
1 files changed, 67 insertions, 58 deletions
diff --git a/pkgs/test/cuda/cuda-samples/generic.nix b/pkgs/test/cuda/cuda-samples/generic.nix
index e690f32959f2a..fb3d7cc99da95 100644
--- a/pkgs/test/cuda/cuda-samples/generic.nix
+++ b/pkgs/test/cuda/cuda-samples/generic.nix
@@ -1,70 +1,79 @@
-{ autoAddOpenGLRunpathHook
-, backendStdenv
-, cmake
-, cudatoolkit
-, cudaVersion
-, fetchFromGitHub
-, fetchpatch
-, freeimage
-, glfw3
-, lib
-, pkg-config
-, sha256
+{
+  autoAddOpenGLRunpathHook,
+  backendStdenv,
+  cmake,
+  cudatoolkit,
+  cudaVersion,
+  fetchFromGitHub,
+  fetchpatch,
+  freeimage,
+  glfw3,
+  hash,
+  lib,
+  pkg-config,
 }:
-backendStdenv.mkDerivation (finalAttrs: {
-  pname = "cuda-samples";
-  version = cudaVersion;
+let
+  inherit (lib) lists strings;
+in
+backendStdenv.mkDerivation (
+  finalAttrs: {
+    strictDeps = true;
 
-  src = fetchFromGitHub {
-    owner = "NVIDIA";
-    repo = finalAttrs.pname;
-    rev = "v${finalAttrs.version}";
-    inherit sha256;
-  };
+    pname = "cuda-samples";
+    version = cudaVersion;
 
-  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
-  ];
+    src = fetchFromGitHub {
+      owner = "NVIDIA";
+      repo = finalAttrs.pname;
+      rev = "v${finalAttrs.version}";
+      inherit hash;
+    };
 
-  # CMake is not the primary build tool -- that's still make.
-  # As such, we disable CMake's build system.
-  dontUseCmakeConfigure = true;
+    nativeBuildInputs =
+      [
+        autoAddOpenGLRunpathHook
+        pkg-config
+      ]
+      # CMake has to run as a native, build-time dependency for libNVVM samples.
+      # However, it's not the primary build tool -- that's still make.
+      # As such, we disable CMake's build system.
+      ++ lists.optionals (strings.versionAtLeast finalAttrs.version "12.2") [cmake];
 
-  buildInputs = [ cudatoolkit ];
+    dontUseCmakeConfigure = true;
 
-  # See https://github.com/NVIDIA/cuda-samples/issues/75.
-  patches = lib.optionals (finalAttrs.version == "11.3") [
-    (fetchpatch {
-      url = "https://github.com/NVIDIA/cuda-samples/commit/5c3ec60faeb7a3c4ad9372c99114d7bb922fda8d.patch";
-      sha256 = "sha256-0XxdmNK9MPpHwv8+qECJTvXGlFxc+fIbta4ynYprfpU=";
-    })
-  ];
+    buildInputs = [
+      cudatoolkit
+      freeimage
+      glfw3
+    ];
 
-  enableParallelBuilding = true;
+    # See https://github.com/NVIDIA/cuda-samples/issues/75.
+    patches = lib.optionals (finalAttrs.version == "11.3") [
+      (fetchpatch {
+        url = "https://github.com/NVIDIA/cuda-samples/commit/5c3ec60faeb7a3c4ad9372c99114d7bb922fda8d.patch";
+        hash = "sha256-0XxdmNK9MPpHwv8+qECJTvXGlFxc+fIbta4ynYprfpU=";
+      })
+    ];
 
-  preConfigure = ''
-    export CUDA_PATH=${cudatoolkit}
-  '';
+    enableParallelBuilding = true;
 
-  installPhase = ''
-    runHook preInstall
+    preConfigure = ''
+      export CUDA_PATH=${cudatoolkit}
+    '';
 
-    install -Dm755 -t $out/bin bin/${backendStdenv.hostPlatform.parsed.cpu.name}/${backendStdenv.hostPlatform.parsed.kernel.name}/release/*
+    installPhase = ''
+      runHook preInstall
 
-    runHook postInstall
-  '';
+      install -Dm755 -t $out/bin bin/${backendStdenv.hostPlatform.parsed.cpu.name}/${backendStdenv.hostPlatform.parsed.kernel.name}/release/*
 
-  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 ] ++ lib.teams.cuda.members;
-  };
-})
+      runHook postInstall
+    '';
+
+    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] ++ lib.teams.cuda.members;
+    };
+  }
+)