mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 16:33:15 +00:00
blender: add CUDA discovery test
This commit is contained in:
parent
340b41815d
commit
b9299696ab
@ -372,6 +372,16 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
--render-frame 1
|
||||
done
|
||||
'';
|
||||
|
||||
cudaAvailable = runCommand
|
||||
"blender-cuda-available"
|
||||
{
|
||||
nativeBuildInputs = [ finalAttrs.finalPackage ];
|
||||
requiredSystemFeatures = [ "cuda" ];
|
||||
}
|
||||
''
|
||||
blender --background -noaudio --python-exit-code 1 --python ${./test-cuda.py} && touch $out
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
|
8
pkgs/applications/misc/blender/test-cuda.py
Normal file
8
pkgs/applications/misc/blender/test-cuda.py
Normal file
@ -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")
|
Loading…
Reference in New Issue
Block a user