blender.gpuChecks: add unwrapped

An unwrapped check for `nix run`-ing on the host platform,
instead of `nix build`-ing in the sandbox

E.g.:

```
❯ nix run -f ./. --arg config '{ cudaSupport = true; cudaCapabilities = [ "8.6" ]; cudaEnableForwardCompat = false; allowUnfree = true; }' -L blender.gpuChecks.cudaAvailable.unwrapped
Blender 4.0.1
Read prefs: "/home/user/.config/blender/4.0/config/userpref.blend"
CUDA is available
Blender quit
❯ nix build -f ./. --arg config '{ cudaSupport = true; cudaCapabilities = [ "8.6" ]; cudaEnableForwardCompat = false; allowUnfree = true; }' -L blender.gpuChecks
blender> Blender 4.0.1
blender> could not get a list of mounted file-systems
blender> CUDA is available
blender> Blender quit
```
This commit is contained in:
Someone Serge
2024-06-26 00:35:45 +00:00
parent 39f33456e4
commit da430f4872
2 changed files with 30 additions and 9 deletions
+1 -9
View File
@@ -374,15 +374,7 @@ stdenv.mkDerivation (finalAttrs: {
'';
};
gpuChecks.cudaAvailable = { blenderWithCuda, runCommand }: runCommand
"blender-cuda-available"
{
nativeBuildInputs = [ blenderWithCuda ];
requiredSystemFeatures = [ "cuda" ];
}
''
blender --background -noaudio --python-exit-code 1 --python ${./test-cuda.py} && touch $out
'' { };
gpuChecks = callPackage ./gpu-checks.nix { };
};
meta = {
@@ -0,0 +1,29 @@
{
bash,
blender,
callPackage,
lib,
runCommand,
writeScriptBin,
}:
let
blenderWithCuda = blender.override {cudaSupport = true;};
name = "${blenderWithCuda.name}-check-cuda";
unwrapped = writeScriptBin "${name}-unwrapped" ''
#!${lib.getExe bash}
${lib.getExe blenderWithCuda} --background -noaudio --python-exit-code 1 --python ${./test-cuda.py}
'';
in
{
cudaAvailable =
runCommand name
{
nativeBuildInputs = [unwrapped];
requiredSystemFeatures = ["cuda"];
passthru = {
inherit unwrapped;
};
}
"${name}-unwrapped && touch $out";
}