about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/misc/blender/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/applications/misc/blender/default.nix')
-rw-r--r--nixpkgs/pkgs/applications/misc/blender/default.nix24
1 files changed, 16 insertions, 8 deletions
diff --git a/nixpkgs/pkgs/applications/misc/blender/default.nix b/nixpkgs/pkgs/applications/misc/blender/default.nix
index 9796aef9b7cb..9921fdc7a797 100644
--- a/nixpkgs/pkgs/applications/misc/blender/default.nix
+++ b/nixpkgs/pkgs/applications/misc/blender/default.nix
@@ -1,4 +1,4 @@
-{ config, stdenv, lib, fetchurl, boost, cmake, ffmpeg, gettext, glew
+{ config, stdenv, lib, fetchurl, fetchzip, boost, cmake, ffmpeg, gettext, glew
 , ilmbase, libXi, libX11, libXext, libXrender
 , libjpeg, libpng, libsamplerate, libsndfile
 , libtiff, libGLU, libGL, openal, opencolorio, openexr, openimagedenoise, openimageio2, openjpeg, python3Packages
@@ -13,9 +13,14 @@
 }:
 
 with lib;
+let
+  python = python3Packages.python;
+  optix = fetchzip {
+    url = "https://developer.download.nvidia.com/redist/optix/v7.0/OptiX-7.0.0-include.zip";
+    sha256 = "1b3ccd3197anya2bj3psxdrvrpfgiwva5zfv2xmyrl73nb2dvfr7";
+  };
 
-let python = python3Packages.python; in
-
+in
 stdenv.mkDerivation rec {
   pname = "blender";
   version = "2.91.0";
@@ -111,7 +116,11 @@ stdenv.mkDerivation rec {
     # Clang doesn't support "-export-dynamic"
     ++ optional stdenv.cc.isClang "-DPYTHON_LINKFLAGS="
     ++ optional jackaudioSupport "-DWITH_JACK=ON"
-    ++ optional cudaSupport "-DWITH_CYCLES_CUDA_BINARIES=ON";
+    ++ optional cudaSupport [
+      "-DWITH_CYCLES_CUDA_BINARIES=ON"
+      "-DWITH_CYCLES_DEVICE_OPTIX=ON"
+      "-DOPTIX_ROOT_DIR=${optix}"
+    ];
 
   NIX_CFLAGS_COMPILE = "-I${ilmbase.dev}/include/OpenEXR -I${python}/include/${python.libPrefix}";
 
@@ -119,8 +128,6 @@ stdenv.mkDerivation rec {
   # libstdc++ in our RPATH. Sigh.
   NIX_LDFLAGS = optionalString cudaSupport "-rpath ${stdenv.cc.cc.lib}/lib";
 
-  enableParallelBuilding = true;
-
   blenderExecutable =
     placeholder "out" + (if stdenv.isDarwin then "/Blender.app/Contents/MacOS/Blender" else "/bin/blender");
   # --python-expr is used to workaround https://developer.blender.org/T74304
@@ -139,12 +146,13 @@ stdenv.mkDerivation rec {
     done
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "3D Creation/Animation/Publishing System";
     homepage = "https://www.blender.org";
     # They comment two licenses: GPLv2 and Blender License, but they
     # say: "We've decided to cancel the BL offering for an indefinite period."
-    license = licenses.gpl2Plus;
+    # OptiX, enabled with cudaSupport, is non-free.
+    license = with licenses; [ gpl2Plus ] ++ optional cudaSupport unfree;
     platforms = [ "x86_64-linux" "x86_64-darwin" ];
     maintainers = with maintainers; [ goibhniu veprbl ];
   };