Jump to content

Blender: Difference between revisions

From Official NixOS Wiki
Smudgebun (talk | contribs)
m Community Flakes: slightly changed wording
Smudgebun (talk | contribs)
Blendfarm: Converted link to option template
Tags: Mobile edit Mobile web edit Advanced mobile edit
Line 15: Line 15:


=== Blendfarm ===
=== Blendfarm ===
The Blendfarm Network Renderer for Blender is provided by [https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/misc/blenderfarm.nix services.blendfarm]. A very simple example configuration is shown below.
The Blendfarm network renderer for Blender is handled by {{nixos:option|services.blendfarm}}. A very simple example configuration is shown below.


{{file|configuration.nix|nix|
{{file|configuration.nix|nix|

Revision as of 23:19, 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), and can be installed with the following in your configuration.

environment.systemPackages = with pkgs; [
  blender
];

If you want to install Blender with support for compute APIs, see: #Advanced Installation

Tips & Tricks

Blendfarm

The Blendfarm network renderer for Blender is handled by services.blendfarm. A very simple example configuration is shown below.

❄︎ configuration.nix
{
  services.blendfarm = {
    enable = true ;
    openFirewall = true;
    blenderPackage = pkgs.blender;
  };
}

Advanced Installation

Binary Packages

These are alternative distribution methods that package the Blender binaries, meaning they have support for all APIs.

Steam

Installing Blender through Steam will run Linux native Blender in the Steam Runtime environment, and it will receive automatic updates through Steam. Note that if you make Steam 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.

❄︎ flake.nix
{
  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 the most up-to-date 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


References