diff options
Diffstat (limited to 'pkgs/applications/misc/blender')
-rw-r--r-- | pkgs/applications/misc/blender/default.nix | 18 | ||||
-rw-r--r-- | pkgs/applications/misc/blender/test-cuda.py | 8 |
2 files changed, 25 insertions, 1 deletions
diff --git a/pkgs/applications/misc/blender/default.nix b/pkgs/applications/misc/blender/default.nix index e54cae9e56a24..3d044abaad6d9 100644 --- a/pkgs/applications/misc/blender/default.nix +++ b/pkgs/applications/misc/blender/default.nix @@ -7,6 +7,7 @@ SDL, addOpenGLRunpath, alembic, + blender, boost, brotli, callPackage, @@ -372,6 +373,20 @@ stdenv.mkDerivation (finalAttrs: { --render-frame 1 done ''; + tester-cudaAvailable = cudaPackages.writeGpuTestPython { } '' + import subprocess + subprocess.run([${ + lib.concatMapStringsSep ", " (x: ''"${x}"'') [ + (lib.getExe (blender.override { cudaSupport = true; })) + "--background" + "-noaudio" + "--python-exit-code" + "1" + "--python" + "${./test-cuda.py}" + ] + }], check=True) # noqa: E501 + ''; }; }; @@ -381,7 +396,8 @@ stdenv.mkDerivation (finalAttrs: { # They comment two licenses: GPLv2 and Blender License, but they # say: "We've decided to cancel the BL offering for an indefinite period." # OptiX, enabled with cudaSupport, is non-free. - license = with lib.licenses; [ gpl2Plus ] ++ lib.optional cudaSupport unfree; + license = with lib.licenses; [ gpl2Plus ] ++ lib.optional cudaSupport (unfree // { shortName = "NVidia OptiX EULA"; }); + platforms = [ "aarch64-linux" "x86_64-darwin" diff --git a/pkgs/applications/misc/blender/test-cuda.py b/pkgs/applications/misc/blender/test-cuda.py new file mode 100644 index 0000000000000..8a3ec57347592 --- /dev/null +++ b/pkgs/applications/misc/blender/test-cuda.py @@ -0,0 +1,8 @@ +import bpy + +preferences = bpy.context.preferences.addons["cycles"].preferences +devices = preferences.get_devices_for_type("CUDA") +ids = [d.id for d in devices] + +assert any("CUDA" in i for i in ids), f"CUDA not present in {ids}" +print("CUDA is available") |