about summary refs log tree commit diff
path: root/pkgs/development/cuda-modules
diff options
context:
space:
mode:
authorSomeone Serge2024-07-20 13:05:15 +0000
committerSomeone Serge2024-07-20 13:10:10 +0000
commite863b5843a3223998adf3f634aa1e6e7af0db6d4 (patch)
tree38d40baeb9a46e4cebbe319147193c83fd360ea8 /pkgs/development/cuda-modules
parent2d5e573acf2af54df6a8d6bcc4dc5dce639b2d72 (diff)
cudaPackages.writeGpuTestPython: accept makeWrapperArgs
Diffstat (limited to 'pkgs/development/cuda-modules')
-rw-r--r--pkgs/development/cuda-modules/write-gpu-test-python.nix33
1 files changed, 23 insertions, 10 deletions
diff --git a/pkgs/development/cuda-modules/write-gpu-test-python.nix b/pkgs/development/cuda-modules/write-gpu-test-python.nix
index 10b10fa3f923..23282e916929 100644
--- a/pkgs/development/cuda-modules/write-gpu-test-python.nix
+++ b/pkgs/development/cuda-modules/write-gpu-test-python.nix
@@ -1,14 +1,15 @@
 {
   lib,
-  writers,
   runCommand,
   python3Packages,
+  makeWrapper,
 }:
 {
   feature ? "cuda",
-  name ? feature,
+  name ? if feature == null then "cpu" else feature,
   libraries ? [ ], # [PythonPackage] | (PackageSet -> [PythonPackage])
-}:
+  ...
+}@args:
 
 let
   inherit (builtins) isFunction all;
@@ -25,23 +26,35 @@ let
   interpreter = python3Packages.python.withPackages librariesFun;
   tester =
     runCommand "tester-${name}"
-      {
-        inherit content;
-        passAsFile = [ "content" ];
-      }
+      (
+        lib.removeAttrs args [
+          "libraries"
+          "name"
+        ]
+        // {
+          inherit content;
+          nativeBuildInputs = args.nativeBuildInputs or [ ] ++ [ makeWrapper ];
+          passAsFile = args.passAsFile or [ ] ++ [ "content" ];
+        }
+      )
       ''
         mkdir -p "$out"/bin
-        cat << EOF >"$out"/bin/"tester-${name}"
+        cat << EOF >"$out/bin/$name"
         #!${lib.getExe interpreter}
         EOF
-        cat "$contentPath" >>"$out"/bin/"tester-${name}"
+        cat "$contentPath" >>"$out/bin/$name"
+        chmod +x "$out/bin/$name"
+
+        if [[ -n "''${makeWrapperArgs+''${makeWrapperArgs[@]}}" ]] ; then
+          wrapProgram "$out/bin/$name" ''${makeWrapperArgs[@]}
+        fi
       '';
   tester' = tester.overrideAttrs (oldAttrs: {
     passthru.gpuCheck =
       runCommand "test-${name}"
         {
           nativeBuildInputs = [ tester' ];
-          requiredSystemFeatures = [ feature ];
+          requiredSystemFeatures = lib.optionals (feature != null) [ feature ];
         }
         ''
           set -e