From e6b738aa1060bc660032d9ac45a7e74bc3a3dbcd Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Tue, 14 Jul 2026 11:50:44 -0400 Subject: [PATCH 1/4] openshadinglanguage: enable LLVM_STATIC to avoid conflicts When OSL is included in a downstream consumer that has other dependencies with different libllvm versions, crashes often ensue. Avoid this by linking statically to it. This then requires libxml on Linux. Notably, this fixes blender when built with rocmSupport, as ROCm deps depend on a conflicting libllvm. --- pkgs/by-name/op/openshadinglanguage/package.nix | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pkgs/by-name/op/openshadinglanguage/package.nix b/pkgs/by-name/op/openshadinglanguage/package.nix index 9d0dc4df17a1..d0f4997ccacd 100644 --- a/pkgs/by-name/op/openshadinglanguage/package.nix +++ b/pkgs/by-name/op/openshadinglanguage/package.nix @@ -32,6 +32,7 @@ stdenv.mkDerivation (finalAttrs: { }; cmakeFlags = [ + (lib.cmakeBool "LLVM_STATIC" true) (lib.cmakeBool "USE_QT" false) # Build system implies llvm-config and llvm-as are in the same directory. @@ -60,6 +61,7 @@ stdenv.mkDerivation (finalAttrs: { buildInputs = [ hexdump libclang + libxml2 llvm openexr openimageio @@ -68,9 +70,6 @@ stdenv.mkDerivation (finalAttrs: { python3Packages.pybind11 robin-map zlib - ] - ++ lib.optionals stdenv.hostPlatform.isDarwin [ - libxml2 ]; propagatedBuildInputs = [ From f49885ecdb026627fe270193f5a645024e2a8e8b Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Tue, 14 Jul 2026 06:30:11 -0400 Subject: [PATCH 2/4] blender: fix missing cattrs Python dep MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is in bpy’s install_requires list. --- pkgs/by-name/bl/blender/package.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/by-name/bl/blender/package.nix b/pkgs/by-name/bl/blender/package.nix index c4d80135ebf5..ade4a3545f62 100644 --- a/pkgs/by-name/bl/blender/package.nix +++ b/pkgs/by-name/bl/blender/package.nix @@ -337,6 +337,7 @@ stdenv'.mkDerivation (finalAttrs: { ps = python3Packages; in [ + ps.cattrs ps.materialx ps.numpy ps.openshadinglanguage From 03d3fa0074c3f810d5ab3d2b3b498b8c6713fd81 Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Tue, 14 Jul 2026 10:53:37 -0400 Subject: [PATCH 3/4] blender: remove HIP RT support as it is broken MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Unfortunately it does not currently work (it builds, but cannot be enabled at runtime). Further, Blender upstream expects HIP 2.x, which is no longer in Nixpkgs and does not trivially build in Nixpkgs’ rocmPackages anymore. The current hiprt-3-compat.patch will soon not apply in Blender 5.2, and a newer patch (in https://projects.blender.org/blender/blender/pulls/157753) applies but does not build. As such, remove the support for now, rather than pretending that it is functional. --- pkgs/by-name/bl/blender/hiprt-3-compat.patch | 42 -------------------- pkgs/by-name/bl/blender/package.nix | 8 +--- 2 files changed, 1 insertion(+), 49 deletions(-) delete mode 100644 pkgs/by-name/bl/blender/hiprt-3-compat.patch diff --git a/pkgs/by-name/bl/blender/hiprt-3-compat.patch b/pkgs/by-name/bl/blender/hiprt-3-compat.patch deleted file mode 100644 index ab42ff8ae27b..000000000000 --- a/pkgs/by-name/bl/blender/hiprt-3-compat.patch +++ /dev/null @@ -1,42 +0,0 @@ -diff --git a/extern/hipew/src/hipew.c b/extern/hipew/src/hipew.c -index e72ccde6..138e1efc 100644 ---- a/extern/hipew/src/hipew.c -+++ b/extern/hipew/src/hipew.c -@@ -241,13 +241,13 @@ static int hipewHipInit(void) { - /* ROCm 6 changes paths from /opt/rocm/hip/lib to /opt/rocm/lib, so - * search for libraries there. */ - -- const char* hip_paths[] = { "libamdhip64.so", -+ const char* hip_paths[] = { "libamdhip64.so.7", -+ "/opt/rocm/lib/libamdhip64.so.7", -+ "/opt/rocm/hip/lib/libamdhip64.so.7", - "libamdhip64.so.6", - "/opt/rocm/lib/libamdhip64.so.6", - "/opt/rocm/hip/lib/libamdhip64.so.6", -- "libamdhip64.so.7", -- "/opt/rocm/lib/libamdhip64.so.7", -- "/opt/rocm/hip/lib/libamdhip64.so.7", -+ "libamdhip64.so", - NULL }; - #endif - static int initialized = 0; -diff --git a/intern/cycles/kernel/device/hiprt/CMakeLists.txt b/intern/cycles/kernel/device/hiprt/CMakeLists.txt -index 9f48fb9be3..01e05159c9 100644 ---- a/intern/cycles/kernel/device/hiprt/CMakeLists.txt -+++ b/intern/cycles/kernel/device/hiprt/CMakeLists.txt -@@ -30,13 +30,13 @@ - set(SRC_KERNEL_DEVICE_HIPRT_SDK - hiprt/impl/Aabb.h - hiprt/impl/BvhNode.h -- hiprt/impl/Geometry.h -+ hiprt/impl/Header.h - hiprt/impl/hiprt_device_impl.h - hiprt/impl/hiprt_kernels_bitcode.h - hiprt/impl/Instance.h -+ hiprt/impl/Obb.h - hiprt/impl/QrDecomposition.h - hiprt/impl/Quaternion.h -- hiprt/impl/Scene.h - hiprt/impl/Transform.h - hiprt/impl/Triangle.h - ) diff --git a/pkgs/by-name/bl/blender/package.nix b/pkgs/by-name/bl/blender/package.nix index ade4a3545f62..1a86b82199f0 100644 --- a/pkgs/by-name/bl/blender/package.nix +++ b/pkgs/by-name/bl/blender/package.nix @@ -133,10 +133,6 @@ stdenv'.mkDerivation (finalAttrs: { # https://projects.blender.org/blender/blender/commit/470127ede2448de50a6936b8484b3c382c76d596 ./fix-quite-clog-warning.patch ] - # Minimal backport of hiprt 3.x support from https://projects.blender.org/blender/blender/pulls/144889 - ++ lib.optionals rocmSupport [ - ./hiprt-3-compat.patch - ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ ./darwin.patch ]; @@ -157,7 +153,6 @@ stdenv'.mkDerivation (finalAttrs: { + (lib.optionalString rocmSupport '' substituteInPlace extern/hipew/src/hipew.c --replace-fail '"/opt/rocm/hip/lib/libamdhip64.so.${lib.versions.major rocmPackages.clr.version}"' '"${rocmPackages.clr}/lib/libamdhip64.so"' substituteInPlace extern/hipew/src/hipew.c --replace-fail '"opt/rocm/hip/bin"' '"${rocmPackages.clr}/bin"' - substituteInPlace extern/hipew/src/hiprtew.cc --replace-fail '"/opt/rocm/lib/libhiprt64.so"' '"${rocmPackages.hiprt}/lib/libhiprt64.so"' ''); env.NIX_CFLAGS_COMPILE = "-I${python3}/include/${python3.libPrefix}"; @@ -205,8 +200,7 @@ stdenv'.mkDerivation (finalAttrs: { (lib.cmakeBool "WITH_CYCLES_CUDA_BINARIES" true) ] ++ lib.optionals rocmSupport [ - (lib.cmakeFeature "HIPRT_INCLUDE_DIR" "${rocmPackages.hiprt}/include") - (lib.cmakeBool "WITH_CYCLES_DEVICE_HIPRT" true) + (lib.cmakeBool "WITH_CYCLES_DEVICE_HIPRT" false) (lib.cmakeBool "WITH_CYCLES_HIP_BINARIES" true) ] ++ lib.optionals waylandSupport [ From fab8604004f3fad618e0ac36e236b0d845d8edba Mon Sep 17 00:00:00 2001 From: Andrew Marshall Date: Tue, 14 Jul 2026 10:13:10 +0000 Subject: [PATCH 4/4] blender: 5.1.2 -> 5.2.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changelog: https://developer.blender.org/docs/release_notes/5.2/ - Add some now-required libs for build time - Remove now-unneeded patches - `bpy.utils.resource_path('SYSTEM_LIBS')` was returning e.g. `/nix/store/*//nix/store/*/…`. This is because CMake’s GNUInstallDirs’ `CMAKE_INSTALL_LIBDIR` should not be an absolute path, but Nixpkgs’s CMake setup hook sets it to be (so that multiple outputs work). Blender follows this assumption and prepends the prefix, thus concatenating absolute paths. Since we know BLENDER_INSTALL_LIBDIR (which is just CMAKE_INSTALL_LIBDIR) will be an absolute path, substitute to omit the prefix. This fixes e.g. the import of Draco-compressed gITF files, since the lib is loaded at runtime from a path derived from the above. --- .../bl/blender/fix-quite-clog-warning.patch | 13 ----- pkgs/by-name/bl/blender/package.nix | 50 +++++++++++-------- 2 files changed, 28 insertions(+), 35 deletions(-) delete mode 100644 pkgs/by-name/bl/blender/fix-quite-clog-warning.patch diff --git a/pkgs/by-name/bl/blender/fix-quite-clog-warning.patch b/pkgs/by-name/bl/blender/fix-quite-clog-warning.patch deleted file mode 100644 index ff75af489244..000000000000 --- a/pkgs/by-name/bl/blender/fix-quite-clog-warning.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/source/blender/gpu/vulkan/vk_texture_pool.cc b/source/blender/gpu/vulkan/vk_texture_pool.cc -index 850e7808ae7..3478d4907f2 100644 ---- a/source/blender/gpu/vulkan/vk_texture_pool.cc -+++ b/source/blender/gpu/vulkan/vk_texture_pool.cc -@@ -554,7 +554,7 @@ void VKTexturePool::log_usage_data() - log_message += std::format(" ({} cached VkImages)", current_usage_data_.image_cache_size); - } - -- CLOG_TRACE(&LOG, log_message.c_str()); -+ CLOG_TRACE(&LOG, "%s", log_message.c_str()); - } - - } // namespace gpu diff --git a/pkgs/by-name/bl/blender/package.nix b/pkgs/by-name/bl/blender/package.nix index 1a86b82199f0..9eaa6e1cdbf5 100644 --- a/pkgs/by-name/bl/blender/package.nix +++ b/pkgs/by-name/bl/blender/package.nix @@ -12,6 +12,7 @@ cudaPackages, cudaSupport ? config.cudaSupport, dbus, + draco, embree, fetchFromGitHub, fetchzip, @@ -49,6 +50,7 @@ makeWrapper, manifold, mesa, + meshoptimizer, nix-update-script, onetbb, openal, @@ -116,12 +118,12 @@ in stdenv'.mkDerivation (finalAttrs: { pname = "blender"; - version = "5.1.2"; + version = "5.2.0"; src = fetchzip { name = "source"; url = "https://download.blender.org/source/blender-${finalAttrs.version}.tar.xz"; - hash = "sha256-FnReSNsP8U1/4jSgZN3cMQV2qkP7OZPh0f/9JA1lAxs="; + hash = "sha256-V2+Oc7GT31JvWccffzUaingEs8CtSFaazgQ+YdZUB7M="; }; patches = [ @@ -129,31 +131,33 @@ stdenv'.mkDerivation (finalAttrs: { # ceres-solver dependency propagates eigen 3 and appears to be incompatible # with more recent versions. ./eigen-3-compat.patch - # Required due to `-Werror=format-security` in nixpkgs - # https://projects.blender.org/blender/blender/commit/470127ede2448de50a6936b8484b3c382c76d596 - ./fix-quite-clog-warning.patch ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ ./darwin.patch ]; - postPatch = - (lib.optionalString stdenv.hostPlatform.isDarwin '' - : > build_files/cmake/platform/platform_apple_xcode.cmake - substituteInPlace source/creator/CMakeLists.txt \ - --replace-fail '${"$"}{LIBDIR}/python' \ - '${python3}' \ - --replace-fail '${"$"}{LIBDIR}/materialx/' '${python3Packages.materialx}/' - substituteInPlace build_files/cmake/platform/platform_apple.cmake \ - --replace-fail '${"$"}{LIBDIR}/brotli/lib/libbrotlicommon-static.a' \ - '${lib.getLib brotli}/lib/libbrotlicommon.dylib' \ - --replace-fail '${"$"}{LIBDIR}/brotli/lib/libbrotlidec-static.a' \ - '${lib.getLib brotli}/lib/libbrotlidec.dylib' - '') - + (lib.optionalString rocmSupport '' - substituteInPlace extern/hipew/src/hipew.c --replace-fail '"/opt/rocm/hip/lib/libamdhip64.so.${lib.versions.major rocmPackages.clr.version}"' '"${rocmPackages.clr}/lib/libamdhip64.so"' - substituteInPlace extern/hipew/src/hipew.c --replace-fail '"opt/rocm/hip/bin"' '"${rocmPackages.clr}/bin"' - ''); + postPatch = '' + substituteInPlace intern/ghost/intern/GHOST_SystemPathsUnix.cc \ + --replace-fail \ + 'static const char *static_libs_path = PREFIX "/" BLENDER_INSTALL_LIBDIR;' \ + 'static const char *static_libs_path = BLENDER_INSTALL_LIBDIR;' + '' + + (lib.optionalString stdenv.hostPlatform.isDarwin '' + : > build_files/cmake/platform/platform_apple_xcode.cmake + substituteInPlace source/creator/CMakeLists.txt \ + --replace-fail '${"$"}{LIBDIR}/python' \ + '${python3}' \ + --replace-fail '${"$"}{LIBDIR}/materialx/' '${python3Packages.materialx}/' + substituteInPlace build_files/cmake/platform/platform_apple.cmake \ + --replace-fail '${"$"}{LIBDIR}/brotli/lib/libbrotlicommon-static.a' \ + '${lib.getLib brotli}/lib/libbrotlicommon.dylib' \ + --replace-fail '${"$"}{LIBDIR}/brotli/lib/libbrotlidec-static.a' \ + '${lib.getLib brotli}/lib/libbrotlidec.dylib' + '') + + (lib.optionalString rocmSupport '' + substituteInPlace extern/hipew/src/hipew.c --replace-fail '"/opt/rocm/hip/lib/libamdhip64.so.${lib.versions.major rocmPackages.clr.version}"' '"${rocmPackages.clr}/lib/libamdhip64.so"' + substituteInPlace extern/hipew/src/hipew.c --replace-fail '"opt/rocm/hip/bin"' '"${rocmPackages.clr}/bin"' + ''); env.NIX_CFLAGS_COMPILE = "-I${python3}/include/${python3.libPrefix}"; @@ -247,6 +251,7 @@ stdenv'.mkDerivation (finalAttrs: { alembic boost ceres-solver + draco ffmpeg_7 fftw fftwFloat @@ -264,6 +269,7 @@ stdenv'.mkDerivation (finalAttrs: { libtiff libwebp manifold + meshoptimizer opencolorio openexr openimageio