From 8b41a83a355ddf0f0cc2d289f1ab05e07c343b98 Mon Sep 17 00:00:00 2001 From: NomisIV Date: Mon, 14 Dec 2020 09:41:47 +0100 Subject: [PATCH 1/4] blender: add option for OptiX --- pkgs/applications/misc/blender/default.nix | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/pkgs/applications/misc/blender/default.nix b/pkgs/applications/misc/blender/default.nix index 9796aef9b7cb..a7cef2c49b8c 100644 --- a/pkgs/applications/misc/blender/default.nix +++ b/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 @@ -6,6 +6,7 @@ , zlib, fftw, opensubdiv, freetype, jemalloc, ocl-icd, addOpenGLRunpath , jackaudioSupport ? false, libjack2 , cudaSupport ? config.cudaSupport or false, cudatoolkit +, optixSupport ? config.optixSupport or false , colladaSupport ? true, opencollada , makeWrapper , pugixml, llvmPackages, SDL, Cocoa, CoreGraphics, ForceFeedback, OpenAL, OpenGL @@ -13,10 +14,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 - -stdenv.mkDerivation rec { +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" + ++ optional optixSupport [ + "-DWITH_CYCLES_DEVICE_OPTIX=ON" + "-DOPTIX_ROOT_DIR=${optix}" + ]; NIX_CFLAGS_COMPILE = "-I${ilmbase.dev}/include/OpenEXR -I${python}/include/${python.libPrefix}"; From 49ce410158710117591d50e8f05dfaa75a45ad25 Mon Sep 17 00:00:00 2001 From: NomisIV Date: Tue, 15 Dec 2020 19:10:38 +0100 Subject: [PATCH 2/4] blender: merged option optixSupport with cudaSupport --- pkgs/applications/misc/blender/default.nix | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pkgs/applications/misc/blender/default.nix b/pkgs/applications/misc/blender/default.nix index a7cef2c49b8c..f001e20a380e 100644 --- a/pkgs/applications/misc/blender/default.nix +++ b/pkgs/applications/misc/blender/default.nix @@ -6,7 +6,6 @@ , zlib, fftw, opensubdiv, freetype, jemalloc, ocl-icd, addOpenGLRunpath , jackaudioSupport ? false, libjack2 , cudaSupport ? config.cudaSupport or false, cudatoolkit -, optixSupport ? config.optixSupport or false , colladaSupport ? true, opencollada , makeWrapper , pugixml, llvmPackages, SDL, Cocoa, CoreGraphics, ForceFeedback, OpenAL, OpenGL @@ -116,8 +115,8 @@ in 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 optixSupport [ + ++ optional cudaSupport [ + "-DWITH_CYCLES_CUDA_BINARIES=ON" "-DWITH_CYCLES_DEVICE_OPTIX=ON" "-DOPTIX_ROOT_DIR=${optix}" ]; From 7eff6be40c09f173c547ab4088ccf78b3cb78817 Mon Sep 17 00:00:00 2001 From: NomisIV Date: Tue, 15 Dec 2020 19:25:32 +0100 Subject: [PATCH 3/4] blender: updated license, because of OptiX --- pkgs/applications/misc/blender/default.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/applications/misc/blender/default.nix b/pkgs/applications/misc/blender/default.nix index f001e20a380e..001c730ba6c2 100644 --- a/pkgs/applications/misc/blender/default.nix +++ b/pkgs/applications/misc/blender/default.nix @@ -152,7 +152,8 @@ in stdenv.mkDerivation rec { 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 ]; }; From 952df7049b496e6c3f098b87dcdfbfb49b50d1ed Mon Sep 17 00:00:00 2001 From: NomisIV <47303199+NomisIV@users.noreply.github.com> Date: Wed, 30 Dec 2020 18:01:16 +0100 Subject: [PATCH 4/4] Update pkgs/applications/misc/blender/default.nix Co-authored-by: Pavol Rusnak --- pkgs/applications/misc/blender/default.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/applications/misc/blender/default.nix b/pkgs/applications/misc/blender/default.nix index 001c730ba6c2..e5eaabdc399b 100644 --- a/pkgs/applications/misc/blender/default.nix +++ b/pkgs/applications/misc/blender/default.nix @@ -20,7 +20,8 @@ let sha256 = "1b3ccd3197anya2bj3psxdrvrpfgiwva5zfv2xmyrl73nb2dvfr7"; }; -in stdenv.mkDerivation rec { +in +stdenv.mkDerivation rec { pname = "blender"; version = "2.91.0";