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:
@@ -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";
|
||||
}
|
||||
Reference in New Issue
Block a user