modules = [
# Add the overlay of blender-bin
({config, pkgs, ...}: { nixpkgs.overlays = [ blender-bin.overlays.default ]; })
# In configuration.nix, you can now refer to blender_4_0 in environment.systemPackages
./configuration.nix
]
Full version:
{
description = "The configuration of my system";
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
blender-bin.url = "github:edolstra/nix-warez?dir=blender";
};
outputs = { self, nixpkgs, blender-bin, ... }@inputs: {
nixosConfigurations.foo = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
({config, pkgs, ...}: {
nixpkgs.overlays = [ blender-bin.overlays.default ];
# This line can either be here or in configuration.nix
environment.systemPackages = with pkgs; [ blender_4_0 ];
})
./configuration.nix
];
};
};
}
Thank you for this! I think I will try blender-bin way for now then as I am facing a strange issue the other way around. Though maybe I can ask you here about it?
If I could trouble you a little bit more, I am facing an issue where after inserting nixpkgs.config.cudaSupport = true and updating the flake, the rebuild cranks the cpu to full utilization and the temperatures go all the way up to 89-90C while rebuilding. This isnât an issue as I think the system is just updating but then the system hangs in between the rebuild. Is there a way for me to slow down the rebuild and tell the system to do it slowly so as to prevent the system hang?
I guess what you observe is because blender with cuda support might not be in the Hydra cache, so you are compiling them yourself. To avoid system hangs, I personally tweak the CPU performance policy (I hink under the hood this is made thanks to services.power-profiles-daemon.enable enabled by default in Plasma and Gnome I think). In Plasma, I can just go to the systray in the battery icon, and I have a line âEnergy gestion profileâ that I can put to the minimal position when the temperature goes too high.
If the hang is due to memory being full, I can maybe recommend a swap file, but this will be quite slow. You can use htop/dmesg/journalctl to see the memory consumption in real time/the reason of a crash.
Strangely, after making the changes accordingly, updating flake, and rebuilding it, blender still canât detect the GPU. I am running blender through terminal with the command nvidia-offload blender. Should I run the blender in some other way? What can be the issue here?..
This is the output of nvidia-smi and it shows the blender app in processes.
Wed Jan 10 05:32:53 2024
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 545.29.06 Driver Version: 545.29.06 CUDA Version: 12.3 |
|-----------------------------------------+----------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+======================+======================|
| 0 NVIDIA GeForce RTX 3050 ... Off | 00000000:01:00.0 Off | N/A |
| N/A 53C P8 3W / 35W | 357MiB / 4096MiB | 0% Default |
| | | N/A |
+-----------------------------------------+----------------------+----------------------+
+---------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=======================================================================================|
| 0 N/A N/A 2398 G ...mn-gnome-shell-45.2/bin/gnome-shell 1MiB |
| 0 N/A N/A 3908 C+G /run/current-system/sw/bin/blender 349MiB |
+---------------------------------------------------------------------------------------+
My apologies ^^ I had forgotten to remove the blender package from the configuration.nix. so my system had blender packages called in both the flakes.nix and configuration.nix.
Removing the blender from configuration.nix and rebuilding solved the issue. Thank you for your help @tobiasBora !
is it possible to pass the systemâs Cuda install to the nixpkgs install instead of using the blender-bin repo?
Iâve tried with no avail to have Blender detect the gpu under NixPkgs, my current flake for this is: