Blender: Difference between revisions
→oneAPI: Tidied use of Issue Template |
|||
| (10 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
[https://www.blender.org/ Blender] is an open-source 3D suite for modelling, animation, VFX, and more. | [https://www.blender.org/ Blender] is an open-source 3D suite for modelling, animation, VFX, and more. | ||
== Installation == | |||
The default <code>blender</code> nix package is compiled without support for any compute APIs (CUDA, OptiX, oneAPI, HIP), and can be installed with the following in your configuration. | The default <code>blender</code> nix package is compiled without support for any compute APIs (CUDA, OptiX, oneAPI, HIP), and can be installed with the following in your configuration. | ||
| Line 20: | Line 20: | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
environment.systemPackages = with pkgs; [ | environment.systemPackages = with pkgs; [ | ||
(blender.withPackages(ps: [ ps.pyserial ps.fs ]) | (blender.withPackages(ps: [ ps.pyserial ps.fs ])) | ||
]; | ]; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 31: | Line 31: | ||
environment.systemPackages = with pkgs; [ | environment.systemPackages = with pkgs; [ | ||
(blender-cuda.withPackages(ps: [ ps.yq ]) | (blender-cuda.withPackages(ps: [ ps.yq ])) | ||
# (pkgsRocm.blender.withPackages(ps: [ ps.pyserial ps.fs ]) | # (pkgsRocm.blender.withPackages(ps: [ ps.pyserial ps.fs ])) | ||
]; | ]; | ||
} | } | ||
| Line 39: | Line 39: | ||
In these functions, <code>ps</code> is an alias for <code>python313Packages</code>. | In these functions, <code>ps</code> is an alias for <code>python313Packages</code>. | ||
Installing with additional packages will result in a binary named <code>blender-wrapped</code> as it adds the python modules by wrapping Blender in a custom Python environment. When using a binary or unofficial Blender nix package, support for this feature will vary depending on if and how the packager implemented it. | Installing with additional packages will result in a binary named <code>blender-wrapped</code>, as it adds the python modules by wrapping Blender in a custom Python environment. | ||
When using a binary or unofficial Blender nix package, support for this feature will vary depending on if and how the packager implemented it. | |||
A workaround if using a package that doesn't support <code>withPackages</code> is to install the python packages globally. | A workaround if using a package that doesn't support <code>withPackages</code> is to install the python packages globally. | ||
| Line 143: | Line 145: | ||
environment.systemPackages = with pkgs; [ | environment.systemPackages = with pkgs; [ | ||
(blender.override {config.cudaSupport=true;}) | (blender.override {config.cudaSupport=true;}) | ||
/* (blender.override { | |||
config.cudaSupport=true; | |||
config.rocmSupport=true;}) # to compile blender with both HIP and CUDA/OptiX support */ | |||
]; | ]; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
If installing Blender with <code>cudaSupport</code>, it is highly recommended you set up a [[CUDA#Setting up CUDA Binary Cache|CUDA binary cache]]. If you do not have one set up, and install Blender with <code>cudaSupport</code>, your machine will be compiling Blender from source. | |||
Compiling Blender is very resource-intensive, so if you are unable to use a binary cache, please see the associated warning and information in [[CUDA#Enabling CUDA In Packages]]. | |||
==== Community Flakes ==== | ==== Community Flakes ==== | ||
| Line 159: | Line 166: | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
environment.systemPackages = with pkgs; [ | environment.systemPackages = with pkgs; [ | ||
pkgsRocm.blender | pkgsRocm.blender | ||
/* (blender.override { | |||
config.rocmSupport=true; | |||
config.cudaSupport=false;}) # (equivalent to `pkgsRocm.blender`) */ | |||
/* (blender.override { | |||
config.cudaSupport=true; | |||
config.rocmSupport=true;}) # to compile blender with both HIP and CUDA/OptiX support */ | |||
]; | ]; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
=== oneAPI === | === oneAPI === | ||
Currently, Nixpkgs has extremely limited oneAPI support (see | Currently, Nixpkgs has extremely limited oneAPI support (see {{issue|367722|<nowiki>the tracking issue</nowiki>}}), which is explicitly blocking {{issue|447245|Blender oneAPI support}}. As such, the current only way to have oneAPI support on NixOS is through one of the [[#Binary Packages|#Binary Packages]]. | ||
=== Last Resorts === | === Last Resorts === | ||
If nothing else works for your situation, you can also download the Blender binary from [https://www.blender.org/download/ blender.org] and run it in NixOS using a program like [[Nix-ld|nix-ld]] or [https://github.com/thiagokokada/nix-alien nix-alien], patch the binary manually (see: [[Packaging/Binaries]]), or try using a container like [[Distrobox]] (see: [https://distrobox.it/useful_tips/#using-the-gpu-inside-the-container Distrobox: Using the GPU Inside the Container]). | If nothing else works for your situation, you can also download the Blender binary from [https://www.blender.org/download/ blender.org] and run it in NixOS using a program like [[Nix-ld|nix-ld]] or [https://github.com/thiagokokada/nix-alien nix-alien], patch the binary manually (see: [[Packaging/Binaries]]), or try using a container like [[Distrobox]] (see: [https://distrobox.it/useful_tips/#using-the-gpu-inside-the-container Distrobox: Using the GPU Inside the Container]). | ||
== | == Known Issues == | ||
=== UI is dim on Vulkan backend and KDE Plasma === | === UI is dim on Vulkan backend and KDE Plasma === | ||
A cross-distro issue on KDE Plasma with NVIDIA. A workaround option that doesn't require downgrading is to force XWayland by running Blender with the following command. See more information at the related {{issue|link=https://projects.blender.org/blender/blender/issues/155467||issue}} on Blender's repo. | |||
<syntaxhighlight lang="sh"> | <syntaxhighlight lang="sh"> | ||
WAYLAND_DISPLAY=0 blender | WAYLAND_DISPLAY=0 blender | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== References == | == References == | ||
<references /> | <references /> | ||