anchor.diff:  { 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, python39Packages
  +, libtiff, libGLU, libGL, openal, opencolorio, openexr, openimagedenoise, openimageio2, openjpeg, python310Packages
   , openvdb, libXxf86vm, tbb, alembic
  -, zlib, fftw, opensubdiv, freetype, jemalloc, ocl-icd, addOpenGLRunpath
  +, zlib, zstd, fftw, opensubdiv, freetype, jemalloc, ocl-icd, addOpenGLRunpath
   , jackaudioSupport ? false, libjack2
  -, cudaSupport ? config.cudaSupport or false, cudatoolkit
  +, cudaSupport ? config.cudaSupport or false, cudatoolkit_11
   , colladaSupport ? true, opencollada
   , spaceNavSupport ? stdenv.isLinux, libspnav
   , makeWrapper
  
positive.code:       llvmPackages.openmp SDL Cocoa CoreGraphics ForceFeedback OpenAL OpenGL
      ])
      ++ optional jackaudioSupport libjack2
      ++ optional cudaSupport cudatoolkit
      ++ optional colladaSupport opencollada
      ++ optional spaceNavSupport libspnav;
    pythonPath = with python39Packages; [ numpy requests ];
  
    postPatch = ''
      # allow usage of dynamically linked embree
  
negative.code: 
  with lib;
  let
    python = python310Packages.python;
    optix = fetchzip {
      # url taken from the archlinux blender PKGBUILD
      url = "https://developer.download.nvidia.com/redist/optix/v7.3/OptiX-7.3.0-Include.zip";
      sha256 = "0max1j4822mchj0xpz9lqzh91zkmvsn4py0r174cvqfz8z8ykjk8";
    };
  
  in
  stdenv.mkDerivation rec {
    pname = "blender";
    version = "3.1.0";
  
    src = fetchurl {
      url = "https://download.blender.org/source/${pname}-${version}.tar.xz";
      sha256 = "1d0476bzcz86lwdnyjn7hyzkmhfiqh47ls5h09jlbm7v7k9x69hw";
    };
  
    patches = lib.optional stdenv.isDarwin ./darwin.patch;
  
    nativeBuildInputs = [ cmake makeWrapper python310Packages.wrapPython llvmPackages.llvm.dev ]
      ++ optionals cudaSupport [ addOpenGLRunpath ];
    buildInputs =
      [ boost ffmpeg gettext glew ilmbase
        freetype libjpeg libpng libsamplerate libsndfile libtiff
        opencolorio openexr openimagedenoise openimageio2 openjpeg python zlib zstd fftw jemalloc
        alembic
        (opensubdiv.override { inherit cudaSupport; })
        tbb
  