about summary refs log tree commit diff
path: root/nixpkgs/pkgs/test
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/test')
-rw-r--r--nixpkgs/pkgs/test/cuda/cuda-library-samples/extension.nix17
-rw-r--r--nixpkgs/pkgs/test/cuda/cuda-library-samples/generic.nix74
-rw-r--r--nixpkgs/pkgs/test/cuda/cuda-samples/extension.nix49
-rw-r--r--nixpkgs/pkgs/test/cuda/cuda-samples/generic.nix125
-rw-r--r--nixpkgs/pkgs/test/cuda/default.nix12
-rw-r--r--nixpkgs/pkgs/test/default.nix4
6 files changed, 165 insertions, 116 deletions
diff --git a/nixpkgs/pkgs/test/cuda/cuda-library-samples/extension.nix b/nixpkgs/pkgs/test/cuda/cuda-library-samples/extension.nix
index 4c721a9e9e1b..62de715fd0b4 100644
--- a/nixpkgs/pkgs/test/cuda/cuda-library-samples/extension.nix
+++ b/nixpkgs/pkgs/test/cuda/cuda-library-samples/extension.nix
@@ -1,3 +1,14 @@
-final: prev: {
-  cuda-library-samples = final.callPackage ./generic.nix { };
-}
+{hostPlatform, lib}:
+let
+  # Samples are built around the CUDA Toolkit, which is not available for
+  # aarch64. Check for both CUDA version and platform.
+  platformIsSupported = hostPlatform.isx86_64;
+
+  # Build our extension
+  extension =
+    final: _:
+    lib.attrsets.optionalAttrs platformIsSupported {
+      cuda-library-samples = final.callPackage ./generic.nix {};
+    };
+in
+extension
diff --git a/nixpkgs/pkgs/test/cuda/cuda-library-samples/generic.nix b/nixpkgs/pkgs/test/cuda/cuda-library-samples/generic.nix
index e9a481c94a7a..d4182536654e 100644
--- a/nixpkgs/pkgs/test/cuda/cuda-library-samples/generic.nix
+++ b/nixpkgs/pkgs/test/cuda/cuda-library-samples/generic.nix
@@ -1,7 +1,11 @@
-{ lib, backendStdenv, fetchFromGitHub
-, cmake, addOpenGLRunpath
-, cudatoolkit
-, cutensor
+{
+  lib,
+  backendStdenv,
+  fetchFromGitHub,
+  cmake,
+  addOpenGLRunpath,
+  cudatoolkit,
+  cutensor,
 }:
 
 let
@@ -14,8 +18,11 @@ let
   };
   commonAttrs = {
     version = lib.strings.substring 0 7 rev + "-" + lib.versions.majorMinor cudatoolkit.version;
-    nativeBuildInputs = [ cmake addOpenGLRunpath ];
-    buildInputs = [ cudatoolkit ];
+    nativeBuildInputs = [
+      cmake
+      addOpenGLRunpath
+    ];
+    buildInputs = [cudatoolkit];
     postFixup = ''
       for exe in $out/bin/*; do
         addOpenGLRunpath $exe
@@ -29,43 +36,50 @@ let
         cuSPARSE, cuSOLVER, cuFFT, cuRAND, NPP and nvJPEG.
       '';
       license = lib.licenses.bsd3;
-      maintainers = with lib.maintainers; [ obsidian-systems-maintenance ];
+      maintainers = with lib.maintainers; [obsidian-systems-maintenance] ++ lib.teams.cuda.members;
     };
   };
 in
 
 {
-  cublas = backendStdenv.mkDerivation (commonAttrs // {
-    pname = "cuda-library-samples-cublas";
+  cublas = backendStdenv.mkDerivation (
+    commonAttrs
+    // {
+      pname = "cuda-library-samples-cublas";
 
-    src = "${src}/cuBLASLt";
-  });
+      src = "${src}/cuBLASLt";
+    }
+  );
 
-  cusolver = backendStdenv.mkDerivation (commonAttrs // {
-    pname = "cuda-library-samples-cusolver";
+  cusolver = backendStdenv.mkDerivation (
+    commonAttrs
+    // {
+      pname = "cuda-library-samples-cusolver";
 
-    src = "${src}/cuSOLVER";
+      src = "${src}/cuSOLVER";
 
-    sourceRoot = "cuSOLVER/gesv";
-  });
+      sourceRoot = "cuSOLVER/gesv";
+    }
+  );
 
-  cutensor = backendStdenv.mkDerivation (commonAttrs // {
-    pname = "cuda-library-samples-cutensor";
+  cutensor = backendStdenv.mkDerivation (
+    commonAttrs
+    // {
+      pname = "cuda-library-samples-cutensor";
 
-    src = "${src}/cuTENSOR";
+      src = "${src}/cuTENSOR";
 
-    buildInputs = [ cutensor ];
+      buildInputs = [cutensor];
 
-    cmakeFlags = [
-      "-DCUTENSOR_EXAMPLE_BINARY_INSTALL_DIR=${builtins.placeholder "out"}/bin"
-    ];
+      cmakeFlags = ["-DCUTENSOR_EXAMPLE_BINARY_INSTALL_DIR=${builtins.placeholder "out"}/bin"];
 
-    # CUTENSOR_ROOT is double escaped
-    postPatch = ''
-      substituteInPlace CMakeLists.txt \
-        --replace "\''${CUTENSOR_ROOT}/include" "${cutensor.dev}/include"
-    '';
+      # CUTENSOR_ROOT is double escaped
+      postPatch = ''
+        substituteInPlace CMakeLists.txt \
+          --replace "\''${CUTENSOR_ROOT}/include" "${cutensor.dev}/include"
+      '';
 
-    CUTENSOR_ROOT = cutensor;
-  });
+      CUTENSOR_ROOT = cutensor;
+    }
+  );
 }
diff --git a/nixpkgs/pkgs/test/cuda/cuda-samples/extension.nix b/nixpkgs/pkgs/test/cuda/cuda-samples/extension.nix
index 664349416b71..d41da90cd5d0 100644
--- a/nixpkgs/pkgs/test/cuda/cuda-samples/extension.nix
+++ b/nixpkgs/pkgs/test/cuda/cuda-samples/extension.nix
@@ -1,14 +1,18 @@
-final: prev: let
-
-  sha256 = {
-    "10.0" = "1zvh4xsdyc59m87brpcmssxsjlp9dkynh4asnkcmc3g94f53l0jw";
-    "10.1" = "1s8ka0hznrni36ajhzf2gqpdrl8kd8fi047qijxks5l2abc093qd";
-    "10.2" = "01p1innzgh9siacpld6nsqimj8jkg93rk4gj8q4crn62pa5vhd94";
-    "11.0" = "1n3vjc8c7zdig2xgl5fppavrphqzhdiv9m9nk6smh4f99fwi0705";
-    "11.1" = "1kjixk50i8y1bkiwbdn5lkv342crvkmbvy1xl5j3lsa1ica21kwh";
-    "11.2" = "1p1qjvfbm28l933mmnln02rqrf0cy9kbpsyb488d1haiqzvrazl1";
-    "11.3" = "0kbibb6pgz8j5iq6284axcnmycaha9bw8qlmdp6yfwmnahq1v0yz";
-    "11.4" = "082dkk5y34wyvjgj2p5j1d00rk8xaxb9z0mhvz16bd469r1bw2qk";
+{
+  cudaVersion,
+  hostPlatform,
+  lib,
+}:
+let
+  cudaVersionToHash = {
+    "10.0" = "sha256-XAI6iiPpDVbZtFoRaP1s6VKpu9aV3bwOqqkw33QncP8=";
+    "10.1" = "sha256-DY8E2FKCFj27jPgQEB1qE9HcLn7CfSiVGdFm+yFQE+k=";
+    "10.2" = "sha256-JDW4i7rC2MwIRvKRmUd6UyJZI9bWNHqZijrB962N4QY=";
+    "11.0" = "sha256-BRwQuUvJEVi1mTbVtGODH8Obt7rXFfq6eLH9wxCTe9g=";
+    "11.1" = "sha256-kM8gFItBaTpkoT34vercmQky9qTFtsXjXMGjCMrsUc4=";
+    "11.2" = "sha256-gX6V98dRwdAQIsvru2byDLiMswCW2lrHSBSJutyWONw=";
+    "11.3" = "sha256-34MdMFS2cufNbZVixFdSUDFfLeuKIGFwLBL9d81acU0=";
+    "11.4" = "sha256-Ewu+Qk6GtGXC37CCn1ZXHc0MQAuyXCGf3J6T4cucTSA=";
     "11.5" = "sha256-AKRZbke0K59lakhTi8dX2cR2aBuWPZkiQxyKaZTvHrI=";
     "11.6" = "sha256-AsLNmAplfuQbXg9zt09tXAuFJ524EtTYsQuUlV1tPkE=";
     # The tag 11.7 of cuda-samples does not exist
@@ -16,10 +20,23 @@ final: prev: let
     "12.0" = "sha256-Lj2kbdVFrJo5xPYPMiE4BS7Z8gpU5JLKXVJhZABUe/g=";
     "12.1" = "sha256-xE0luOMq46zVsIEWwK4xjLs7NorcTIi9gbfZPVjIlqo=";
     "12.2" = "sha256-pOy0qfDjA/Nr0T9PNKKefK/63gQnJV2MQsN2g3S2yng=";
+    "12.3" = "sha256-fjVp0G6uRCWxsfe+gOwWTN+esZfk0O5uxS623u0REAk=";
   };
 
-in prev.lib.attrsets.optionalAttrs (builtins.hasAttr prev.cudaVersion sha256) {
-  cuda-samples = final.callPackage ./generic.nix {
-    sha256 = sha256.${prev.cudaVersion};
-  };
-}
+  # Samples are built around the CUDA Toolkit, which is not available for
+  # aarch64. Check for both CUDA version and platform.
+  cudaVersionIsSupported = cudaVersionToHash ? ${cudaVersion};
+  platformIsSupported = hostPlatform.isx86_64;
+  isSupported = cudaVersionIsSupported && platformIsSupported;
+
+  # Build our extension
+  extension =
+    final: _:
+    lib.attrsets.optionalAttrs isSupported {
+      cuda-samples = final.callPackage ./generic.nix {
+        inherit cudaVersion;
+        hash = cudaVersionToHash.${cudaVersion};
+      };
+    };
+in
+extension
diff --git a/nixpkgs/pkgs/test/cuda/cuda-samples/generic.nix b/nixpkgs/pkgs/test/cuda/cuda-samples/generic.nix
index e690f32959f2..fb3d7cc99da9 100644
--- a/nixpkgs/pkgs/test/cuda/cuda-samples/generic.nix
+++ b/nixpkgs/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;
+    };
+  }
+)
diff --git a/nixpkgs/pkgs/test/cuda/default.nix b/nixpkgs/pkgs/test/cuda/default.nix
index c7b790e35e25..be88bd3820a9 100644
--- a/nixpkgs/pkgs/test/cuda/default.nix
+++ b/nixpkgs/pkgs/test/cuda/default.nix
@@ -1,7 +1,7 @@
-{ callPackage }:
+{callPackage}:
 
 rec {
-  cuda-samplesPackages = callPackage ./cuda-samples/generic.nix { };
+  cuda-samplesPackages = callPackage ./cuda-samples/generic.nix {};
   inherit (cuda-samplesPackages)
     cuda-samples_cudatoolkit_10
     cuda-samples_cudatoolkit_10_0
@@ -12,9 +12,10 @@ rec {
     cuda-samples_cudatoolkit_11_1
     cuda-samples_cudatoolkit_11_2
     cuda-samples_cudatoolkit_11_3
-    cuda-samples_cudatoolkit_11_4;
+    cuda-samples_cudatoolkit_11_4
+    ;
 
-  cuda-library-samplesPackages = callPackage ./cuda-library-samples/generic.nix { };
+  cuda-library-samplesPackages = callPackage ./cuda-library-samples/generic.nix {};
   inherit (cuda-library-samplesPackages)
     cuda-library-samples_cudatoolkit_10
     cuda-library-samples_cudatoolkit_10_1
@@ -24,5 +25,6 @@ rec {
     cuda-library-samples_cudatoolkit_11_1
     cuda-library-samples_cudatoolkit_11_2
     cuda-library-samples_cudatoolkit_11_3
-    cuda-library-samples_cudatoolkit_11_4;
+    cuda-library-samples_cudatoolkit_11_4
+    ;
 }
diff --git a/nixpkgs/pkgs/test/default.nix b/nixpkgs/pkgs/test/default.nix
index 9543e165a805..29dc4b5192ec 100644
--- a/nixpkgs/pkgs/test/default.nix
+++ b/nixpkgs/pkgs/test/default.nix
@@ -63,12 +63,8 @@ with pkgs;
 
             # libcxxStdenv broken
             # fix in https://github.com/NixOS/nixpkgs/pull/216273
-          ] ++ lib.optionals (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) [
-            # libcxx does not build for some reason on aarch64-linux
-            (filterAttrs (n: _: n != "llvmPackages_7"))
           ] ++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [
             (filterAttrs (n: _: n != "llvmPackages_6"))
-            (filterAttrs (n: _: n != "llvmPackages_7"))
             (filterAttrs (n: _: n != "llvmPackages_8"))
             (filterAttrs (n: _: n != "llvmPackages_9"))
             (filterAttrs (n: _: n != "llvmPackages_10"))