summary refs log tree commit diff
path: root/pkgs/test
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2021-03-09 13:04:03 -0500
committerJohn Ericson <John.Ericson@Obsidian.Systems>2021-03-17 19:10:33 +0000
commit23f815f12c6cd3850f0df3723372e7fe9aea804b (patch)
tree3f8873d842d89aff230e711a2264bc9080dbfdcc /pkgs/test
parentd10acb2d69360cf502743301a2770c9012f72ff1 (diff)
downloadnixpkgs-23f815f12c6cd3850f0df3723372e7fe9aea804b.tar
nixpkgs-23f815f12c6cd3850f0df3723372e7fe9aea804b.tar.gz
nixpkgs-23f815f12c6cd3850f0df3723372e7fe9aea804b.tar.bz2
nixpkgs-23f815f12c6cd3850f0df3723372e7fe9aea804b.tar.lz
nixpkgs-23f815f12c6cd3850f0df3723372e7fe9aea804b.tar.xz
nixpkgs-23f815f12c6cd3850f0df3723372e7fe9aea804b.tar.zst
nixpkgs-23f815f12c6cd3850f0df3723372e7fe9aea804b.zip
tests.cuda.cuda-sample_*: Init at supported CUDA toolkit versions
Since CUDA is unfree, we won't actually use this when testing Nixpkgs
officially. But I want to include this as they are useful for users of
Nixpkgs trying to set up / debug a CUDA environment.
Diffstat (limited to 'pkgs/test')
-rw-r--r--pkgs/test/cuda/cuda-samples/default.nix52
-rw-r--r--pkgs/test/cuda/cuda-samples/generic.nix51
-rw-r--r--pkgs/test/cuda/default.nix16
-rw-r--r--pkgs/test/default.nix2
4 files changed, 121 insertions, 0 deletions
diff --git a/pkgs/test/cuda/cuda-samples/default.nix b/pkgs/test/cuda/cuda-samples/default.nix
new file mode 100644
index 00000000000..46d4d531690
--- /dev/null
+++ b/pkgs/test/cuda/cuda-samples/default.nix
@@ -0,0 +1,52 @@
+{ callPackage
+, cudatoolkit_9_2
+, cudatoolkit_10_0, cudatoolkit_10_1, cudatoolkit_10_2
+, cudatoolkit_11_0, cudatoolkit_11_1, cudatoolkit_11_2
+}:
+
+rec {
+  cuda-samples_cudatoolkit_9_2 = callPackage ./generic.nix {
+    cudatoolkit = cudatoolkit_9_2;
+    sha256 = "1ydankhyigcg99h0rqnmz1z4vc0sl6p9s1s0hbdxh5l1sx9141j6";
+  };
+
+  cuda-samples_cudatoolkit_9 = cuda-samples_cudatoolkit_9_2;
+
+  ##
+
+  cuda-samples_cudatoolkit_10_0 = callPackage ./generic.nix {
+    cudatoolkit = cudatoolkit_10_0;
+    sha256 = "1zvh4xsdyc59m87brpcmssxsjlp9dkynh4asnkcmc3g94f53l0jw";
+  };
+
+  cuda-samples_cudatoolkit_10_1 = callPackage ./generic.nix {
+    cudatoolkit = cudatoolkit_10_1;
+    sha256 = "1s8ka0hznrni36ajhzf2gqpdrl8kd8fi047qijxks5l2abc093qd";
+  };
+
+  cuda-samples_cudatoolkit_10_2 = callPackage ./generic.nix {
+    cudatoolkit = cudatoolkit_10_2;
+    sha256 = "01p1innzgh9siacpld6nsqimj8jkg93rk4gj8q4crn62pa5vhd94";
+  };
+
+  cuda-samples_cudatoolkit_10 = cuda-samples_cudatoolkit_10_2;
+
+  ##
+
+  cuda-samples_cudatoolkit_11_0 = callPackage ./generic.nix {
+    cudatoolkit = cudatoolkit_11_0;
+    sha256 = "1n3vjc8c7zdig2xgl5fppavrphqzhdiv9m9nk6smh4f99fwi0705";
+  };
+
+  cuda-samples_cudatoolkit_11_1 = callPackage ./generic.nix {
+    cudatoolkit = cudatoolkit_11_1;
+    sha256 = "1kjixk50i8y1bkiwbdn5lkv342crvkmbvy1xl5j3lsa1ica21kwh";
+  };
+
+  cuda-samples_cudatoolkit_11_2 = callPackage ./generic.nix {
+    cudatoolkit = cudatoolkit_11_2;
+    sha256 = "1p1qjvfbm28l933mmnln02rqrf0cy9kbpsyb488d1haiqzvrazl1";
+  };
+
+  cuda-samples_cudatoolkit_11 = cuda-samples_cudatoolkit_11_2;
+}
diff --git a/pkgs/test/cuda/cuda-samples/generic.nix b/pkgs/test/cuda/cuda-samples/generic.nix
new file mode 100644
index 00000000000..a104f88ad4b
--- /dev/null
+++ b/pkgs/test/cuda/cuda-samples/generic.nix
@@ -0,0 +1,51 @@
+{ 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-maintainence ];
+  };
+}
diff --git a/pkgs/test/cuda/default.nix b/pkgs/test/cuda/default.nix
new file mode 100644
index 00000000000..a3b0f8a66d1
--- /dev/null
+++ b/pkgs/test/cuda/default.nix
@@ -0,0 +1,16 @@
+{ callPackage }:
+
+rec {
+  cuda-samplesPackages = callPackage ./cuda-samples { };
+  inherit (cuda-samplesPackages)
+    cuda-samples_cudatoolkit_9
+    cuda-samples_cudatoolkit_9_2
+    cuda-samples_cudatoolkit_10
+    cuda-samples_cudatoolkit_10_0
+    cuda-samples_cudatoolkit_10_1
+    cuda-samples_cudatoolkit_10_2
+    cuda-samples_cudatoolkit_11
+    cuda-samples_cudatoolkit_11_0
+    cuda-samples_cudatoolkit_11_1
+    cuda-samples_cudatoolkit_11_2;
+}
diff --git a/pkgs/test/default.nix b/pkgs/test/default.nix
index f45e981cff0..fa93ceb0721 100644
--- a/pkgs/test/default.nix
+++ b/pkgs/test/default.nix
@@ -47,5 +47,7 @@ with pkgs;
 
   texlive = callPackage ./texlive {};
 
+  cuda = callPackage ./cuda { };
+
   writers = callPackage ../build-support/writers/test.nix {};
 }