Blender: Difference between revisions
m →HIP: fixed package name |
Added more configuration examples |
||
| Line 75: | Line 75: | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
environment.systemPackages = [ | environment.systemPackages = with pkgs; [ | ||
(blender.override {config.cudaSupport=true;}) | (blender.override {config.cudaSupport=true;}) | ||
# (pkgsRocm.blender.override {config.cudaSupport=true;}) # to compile blender with both HIP and CUDA/OptiX support | |||
]; | ]; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 88: | Line 89: | ||
With the deprecation of the <code>blender-hip</code> package,<ref name="deprecate-hip"> {{pull|463064}}</ref> the easiest way to add Blender with HIP support is now with the <code>pkgsRocm.blender</code> package. Other methods are to use the <code>rocmSupport</code> flag the same way as [[#The cudaSupport Flag|#The cudaSupport Flag]], or to use a [[#Binary Packages|#Binary Package]]. | With the deprecation of the <code>blender-hip</code> package,<ref name="deprecate-hip"> {{pull|463064}}</ref> the easiest way to add Blender with HIP support is now with the <code>pkgsRocm.blender</code> package. Other methods are to use the <code>rocmSupport</code> flag the same way as [[#The cudaSupport Flag|#The cudaSupport Flag]], or to use a [[#Binary Packages|#Binary Package]]. | ||
Unlike <code>cudaSupport</code>, most if not all packages with <code>rocmSuppport</code> are built by Hydra and cached into cache.nixos.org. That said, it is still recommended to enable <code>rocmSupport</code> only as much as you will need it, to avoid | Unlike <code>cudaSupport</code>, most if not all packages with <code>rocmSuppport</code> are built by Hydra and cached into cache.nixos.org. That said, it is still recommended to enable <code>rocmSupport</code> only as much as you will need it, to avoid the chance of pointless recompilation on your machine. | ||
To activate the flag globally, run the following. | |||
<syntaxhighlight lang="nix"> nixpkgs.config.rocmSupport = true; </syntaxhighlight> | |||
Or, override specifically Blender with HIP support. | |||
<syntaxhighlight lang="nix"> | |||
environment.systemPackages = with pkgs; [ | |||
pkgsRocm.blender | |||
# (blender.override {config.rocmSupport=true;}) # (equivalent to `pkgsRocm.blender`) | |||
# (pkgsRocm.blender.override {config.cudaSupport=true;}) # to compile blender with both HIP and CUDA/OptiX support | |||
]; | |||
</syntaxhighlight> | |||
=== oneAPI === | === oneAPI === | ||
Revision as of 22:35, 10 April 2026
Installation
Blender is an open-source 3D suite for modelling, animation, VFX, and more.
The default blender nix package is compiled without support for any compute APIs (CUDA, OptiX, oneAPI, HIP). If you want to install Blender with support for compute APIs, see: #Advanced Installation
Tips & Tricks
Blendfarm
The Blendfarm Network Renderer for Blender is provided by services.blendfarm. A very simple example configuration is shown below.
{
services.blendfarm = {
enable = true ;
openFirewall = true;
blenderPackage = pkgs.blender;
};
}
Advanced Installation
- #Binary Packages for Blender binary packages with support for all APIs
- #CUDA & OptiX for support for NVIDIA's CUDA & OptiX
- #HIP for support for AMD's HIP
- #oneAPI for support for Intel's oneAPI
- #Last Resorts if all other methods don't work for your situation
Binary Packages
These are alternative distribution methods that package the Blender binaries, meaning they have support for all APIs.
Steam
Launching Blender through Steam will run Linux native Blender in the Steam Runtime environment, and will receive automatic updates. If you force Steam to run the Windows version (through Proton) by selecting "Force the use of a specific Steam Play compatibility tool" under Properties > Compatibility, the APIs will fail as they will not have the relevant Windows drivers.
The blender-bin Flake
The unofficial blender-bin flake, provided by edolstra, packages the binary release of Blender for NixOS, and hosts it on FlakeHub here. The following demonstrates how to add the flake to a flake-based configuration.
{
description = "blender-bin example";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
# the '*' specifies the newest release
blender-bin.url = "https://flakehub.com/f/edolstra/blender-bin/*";
};
outputs = { self, nixpkgs, blender-bin }: {
nixosConfigurations.hostname = nixpkgs.lib.nixosSystem rec {
system = "x86_64-linux"; # the flake does not currently build for aarch64-linux
specialArgs = { inherit self system; };
modules = [
({self, system, ...}: {
environment.systemPackages = with self.inputs.blender-bin.packages.${system}; [
# 'default' is the latest blender version, though you can also pull a specific version e.g. 'blender_4_3'
default
];
})
];
};
};
}
CUDA & OptiX
By default Nixpkgs builds software with CUDA (and therefore OptiX) support disabled, because of the unfree license. For Blender there are multiple ways around this, detailed below.
The cudaSupport Flag
Whether a compatible package is built with CUDA support is managed by the cudaSupport flag enabled. This can either be done with a global flag
nixpkgs.config.cudaSupport = true;
Or by overriding specifically the Blender package.
environment.systemPackages = with pkgs; [
(blender.override {config.cudaSupport=true;})
# (pkgsRocm.blender.override {config.cudaSupport=true;}) # to compile blender with both HIP and CUDA/OptiX support
];
It's important to note that any package installed with the cudaSupport flag enabled that is CUDA-compatible will be compiled from source, as Hydra does not build (and therefore cache.nixos.org does not cache) with CUDA support enabled. With larger programs like Blender this can be very resource-intensive, so it is recommended to limit the number of cores or jobs that the process will take with the --max-jobs / -j and --cores flags when calling for example nix-shell or nixos-rebuild. This is also why it is recommended to only enable cudaSupport for the programs you need it for.
Community Flakes
In addition to the #blender-bin flake, there is also blender-cuda-nixos, which compiles Blender with cudaSupport enabled and caches it on cachix so you don't need to build it yourself. For instructions on adding it to your configuration, see its README.
HIP
With the deprecation of the blender-hip package,[1] the easiest way to add Blender with HIP support is now with the pkgsRocm.blender package. Other methods are to use the rocmSupport flag the same way as #The cudaSupport Flag, or to use a #Binary Package.
Unlike cudaSupport, most if not all packages with rocmSuppport are built by Hydra and cached into cache.nixos.org. That said, it is still recommended to enable rocmSupport only as much as you will need it, to avoid the chance of pointless recompilation on your machine.
To activate the flag globally, run the following.
nixpkgs.config.rocmSupport = true;
Or, override specifically Blender with HIP support.
environment.systemPackages = with pkgs; [
pkgsRocm.blender
# (blender.override {config.rocmSupport=true;}) # (equivalent to `pkgsRocm.blender`)
# (pkgsRocm.blender.override {config.cudaSupport=true;}) # to compile blender with both HIP and CUDA/OptiX support
];
oneAPI
Currently, Nixpkgs has extremely limited oneAPI support, (see: 🚩︎oneAPI Tracking), which is explicitly blocking oneAPI integration into the Blender package (see: 🚩︎Blender oneAPI Support). As such, the current only way to have oneAPI support on NixOS is through one of the #Binary Packages
Last Resorts
If nothing else works for your situation, you can also download the Blender binary from blender.org and run it in NixOS using a program like nix-ld or nix-alien, patch the binary manually (see: Packaging/Binaries), or try using a container like Distrobox (see: Distrobox: Using the GPU Inside the Container).
Troubleshooting
UI is dim on Vulkan backend and KDE Plasma
This is a cross-distro issue on current KDE Plasma (Wayland Session, KDE Version 6.6.3) and NVIDIA drivers (Versions 595.XX). 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 on Blender's repo.
WAYLAND_DISPLAY=0 blender