Loading pkgs/by-name/ex/exhibit/package.nix +1 −1 Original line number Diff line number Diff line Loading @@ -36,7 +36,7 @@ python3Packages.buildPythonApplication rec { dependencies = with python3Packages; [ pygobject3 f3d_egl f3d ]; dontWrapGApps = true; Loading pkgs/by-name/f3/f3d/package.nix +2 −5 Original line number Diff line number Diff line Loading @@ -9,10 +9,7 @@ libXt, openusd, tbb, # There is a f3d overridden with EGL enabled vtk in top-level/all-packages.nix # compiling with EGL enabled vtk will result in f3d running in headless mode # See https://github.com/NixOS/nixpkgs/pull/324022. This may change later. vtk_9, vtk, autoPatchelfHook, python3Packages, opencascade-occt, Loading Loading @@ -50,7 +47,7 @@ stdenv.mkDerivation rec { ]; buildInputs = [ vtk_9 vtk opencascade-occt assimp fontconfig Loading pkgs/development/libraries/vtk/9.x.nixdeleted 100644 → 0 +0 −5 Original line number Diff line number Diff line import ./generic.nix { majorVersion = "9.2"; minorVersion = "6"; sourceSha256 = "sha256-BvyNScTlb0mMQPyzilY+2NTsMTWNAQHomI8LtNU53RI="; } pkgs/development/libraries/vtk/default.nix 0 → 100644 +30 −0 Original line number Diff line number Diff line { callPackage, fetchpatch2, }: let mkVtk = initArgs: callPackage (import ./generic.nix initArgs) { }; in { vtk_9_5 = mkVtk { version = "9.5.0"; sourceSha256 = "sha256-BK6GJGuVV8a2GvvFNKbfCZJE+8jzk3+C5rwFcJU6+H0="; patches = [ # https://gitlab.kitware.com/vtk/vtk/-/issues/19699 (fetchpatch2 { url = "https://gitlab.kitware.com/vtk/vtk/-/commit/6b4f7b853675c63e4831c366ca8f78e320c1bfb5.diff"; hash = "sha256-hWJc5RxW6iK+W/rTxp2GUWKcm/2+oxbP5nVZ0EUSKHE="; }) # https://gitlab.kitware.com/vtk/vtk/-/issues/19705 (fetchpatch2 { url = "https://gitlab.kitware.com/vtk/vtk/-/commit/ce10dfe82ffa19c8108885625a6f8b3f980bed3b.diff"; hash = "sha256-kyPM0whL4WeaV27sNM1fbbs5kwMYn+9E561HtvnwHRc="; }) # https://gitlab.kitware.com/vtk/vtk/-/merge_requests/12262 (fetchpatch2 { url = "https://gitlab.kitware.com/vtk/vtk/-/commit/c0e0f793e6adf740f5b1c91ac330afdbc2a03b72.diff"; hash = "sha256-BinSv8sPqpAEcgkn8trnCPv2snR9MGcA8rkVflAhc5w="; }) ]; }; } pkgs/development/libraries/vtk/generic.nix +310 −108 Original line number Diff line number Diff line { majorVersion, minorVersion, version, sourceSha256, patchesToFetch ? [ ], patches ? [ ], }: { stdenv, lib, newScope, stdenv, fetchurl, cmake, libGLU, libGL, libX11, xorgproto, libXt, pkg-config, # common dependencies tk, mpi, python3Packages, catalyst, cli11, boost, eigen, verdict, double-conversion, # common data libraries lz4, xz, zlib, pugixml, expat, jsoncpp, libxml2, exprtk, utf8cpp, libarchive, nlohmann_json, # filters openturns, openslide, # io modules cgns, adios2, libLAS, libgeotiff, laszip_2, gdal, pdal, alembic, imath, openvdb, c-blosc, unixODBC, postgresql, libmysqlclient, ffmpeg, libjpeg, libpng, libtiff, fetchpatch, enableQt ? false, qtx11extras, qttools, qtdeclarative, qtEnv, enablePython ? false, python ? throw "vtk: Python support requested, but no python interpreter was given.", enableEgl ? false, }: proj, sqlite, libogg, libharu, libtheora, hdf5, netcdf, opencascade-occt, let inherit (lib) optionalString optionals; # threading tbb, llvmPackages, # rendering viskores, freetype, fontconfig, libX11, libXfixes, libXrender, libXcursor, gl2ps, libGL, qt5, qt6, # custom options qtVersion ? null, # To avoid conflicts between the propagated vtkPackages.hdf5 # and the input hdf5 used by most downstream packages, # we set mpiSupport to false by default. mpiSupport ? false, pythonSupport ? false, version = "${majorVersion}.${minorVersion}"; pythonMajor = lib.substring 0 1 python.pythonVersion; # passthru.tests testers, }: let qtPackages = if (isNull qtVersion) then null else if (qtVersion == "6") then qt6 else if (qtVersion == "5") then qt5 else throw ''qtVersion must be "5", "6" or null''; vtkPackages = lib.makeScope newScope (self: { inherit tbb mpi mpiSupport python3Packages pythonSupport ; hdf5 = hdf5.override { inherit mpi mpiSupport; cppSupport = !mpiSupport; }; openvdb = self.callPackage openvdb.override { }; netcdf = self.callPackage netcdf.override { }; catalyst = self.callPackage catalyst.override { }; adios2 = self.callPackage adios2.override { }; cgns = self.callPackage cgns.override { }; viskores = self.callPackage viskores.override { }; }); vtkBool = feature: bool: lib.cmakeFeature feature "${if bool then "YES" else "NO"}"; in stdenv.mkDerivation { pname = "vtk" + optionalString enableEgl "-egl" + optionalString enableQt "-qvtk"; inherit version; stdenv.mkDerivation (finalAttrs: { pname = "vtk"; inherit version patches; src = fetchurl { url = "https://www.vtk.org/files/release/${majorVersion}/VTK-${version}.tar.gz"; sha256 = sourceSha256; url = "https://www.vtk.org/files/release/${lib.versions.majorMinor finalAttrs.version}/VTK-${finalAttrs.version}.tar.gz"; hash = sourceSha256; }; nativeBuildInputs = [ cmake ]; nativeBuildInputs = [ cmake pkg-config # required for finding MySQl ] ++ lib.optional pythonSupport python3Packages.python ++ lib.optional ( pythonSupport && stdenv.buildPlatform == stdenv.hostPlatform ) python3Packages.pythonImportsCheckHook; buildInputs = [ libLAS libgeotiff laszip_2 gdal pdal alembic imath c-blosc unixODBC postgresql libmysqlclient ffmpeg opencascade-occt fontconfig openturns libarchive libGL vtkPackages.openvdb ] ++ lib.optionals stdenv.hostPlatform.isLinux [ libXfixes libXrender libXcursor ] ++ lib.optional (!(isNull qtPackages)) qtPackages.qttools ++ lib.optional mpiSupport mpi ++ lib.optional pythonSupport tk; # propagated by vtk-config.cmake propagatedBuildInputs = [ eigen boost verdict double-conversion freetype lz4 xz zlib expat exprtk pugixml jsoncpp libxml2 utf8cpp nlohmann_json libjpeg libpng libtiff proj sqlite libogg libharu libtheora cli11 openslide vtkPackages.hdf5 vtkPackages.cgns vtkPackages.adios2 vtkPackages.netcdf vtkPackages.catalyst vtkPackages.viskores vtkPackages.tbb ] ++ lib.optionals stdenv.cc.isClang [ llvmPackages.openmp ] ++ optionals enableQt [ (qtEnv "qvtk-qt-env" [ qtx11extras qttools qtdeclarative ]) ++ lib.optionals stdenv.hostPlatform.isLinux [ libX11 gl2ps ] ++ optionals stdenv.hostPlatform.isLinux [ libGLU xorgproto libXt # create meta package providing dist-info for python3Pacakges.vtk that common cmake build does not do ++ lib.optionals pythonSupport [ (python3Packages.mkPythonMetaPackage { inherit (finalAttrs) pname version meta; dependencies = with python3Packages; [ numpy wslink matplotlib ] ++ optionals enablePython [ python ++ lib.optional mpiSupport (mpi4py.override { inherit mpi; }); }) ]; propagatedBuildInputs = optionals stdenv.hostPlatform.isLinux [ libX11 libGL # wrapper script calls qmlplugindump, crashes due to lack of minimal platform plugin # Could not find the Qt platform plugin "minimal" in "" preConfigure = lib.optionalString (qtVersion == "5") '' export QT_PLUGIN_PATH=${lib.getBin qt5.qtbase}/${qt5.qtbase.qtPluginPrefix} ''; env = { CMAKE_PREFIX_PATH = "${lib.getDev openvdb}/lib/cmake/OpenVDB"; NIX_LDFLAGS = "-L${lib.getLib libmysqlclient}/lib/mariadb"; }; cmakeFlags = [ (lib.cmakeFeature "CMAKE_INSTALL_BINDIR" "bin") (lib.cmakeFeature "CMAKE_INSTALL_LIBDIR" "lib") (lib.cmakeFeature "CMAKE_INSTALL_INCLUDEDIR" "include") # vtk common configure options (lib.cmakeBool "VTK_DISPATCH_SOA_ARRAYS" true) (lib.cmakeBool "VTK_ENABLE_CATALYST" true) (lib.cmakeBool "VTK_WRAP_SERIALIZATION" true) (lib.cmakeBool "VTK_BUILD_ALL_MODULES" true) (lib.cmakeBool "VTK_VERSIONED_INSTALL" false) (lib.cmakeBool "VTK_SMP_ENABLE_OPENMP" true) (lib.cmakeFeature "VTK_SMP_IMPLEMENTATION_TYPE" "TBB") # use system packages if possible (lib.cmakeBool "VTK_USE_EXTERNAL" true) (lib.cmakeBool "VTK_MODULE_USE_EXTERNAL_VTK_fast_float" false) # required version incompatible (lib.cmakeBool "VTK_MODULE_USE_EXTERNAL_VTK_pegtl" false) # required version incompatible (lib.cmakeBool "VTK_MODULE_USE_EXTERNAL_VTK_ioss" false) # missing in nixpkgs (lib.cmakeBool "VTK_MODULE_USE_EXTERNAL_VTK_token" false) # missing in nixpkgs (lib.cmakeBool "VTK_MODULE_USE_EXTERNAL_VTK_fmt" false) # prefer vendored fmt (lib.cmakeBool "VTK_MODULE_USE_EXTERNAL_VTK_scn" false) # missing in nixpkgs (lib.cmakeBool "VTK_MODULE_USE_EXTERNAL_VTK_gl2ps" stdenv.hostPlatform.isLinux) # external gl2ps causes failure linking to macOS OpenGL.framework # Rendering (vtkBool "VTK_MODULE_ENABLE_VTK_RenderingRayTracing" false) # ospray (vtkBool "VTK_MODULE_ENABLE_VTK_RenderingOpenXR" false) # openxr (vtkBool "VTK_MODULE_ENABLE_VTK_RenderingOpenVR" false) # openvr (vtkBool "VTK_MODULE_ENABLE_VTK_RenderingAnari" false) # anari # qtSupport (vtkBool "VTK_GROUP_ENABLE_Qt" (!(isNull qtPackages))) (lib.cmakeFeature "VTK_QT_VERSION" "Auto") # will search for Qt6 first # pythonSupport (lib.cmakeBool "VTK_USE_TK" pythonSupport) (vtkBool "VTK_GROUP_ENABLE_Tk" pythonSupport) (lib.cmakeBool "VTK_WRAP_PYTHON" pythonSupport) (lib.cmakeBool "VTK_BUILD_PYI_FILES" pythonSupport) (lib.cmakeFeature "VTK_PYTHON_VERSION" "3") # mpiSupport (lib.cmakeBool "VTK_USE_MPI" mpiSupport) (vtkBool "VTK_GROUP_ENABLE_MPI" mpiSupport) ]; # see https://github.com/NixOS/nixpkgs/pull/178367#issuecomment-1238827254 patches = map fetchpatch patchesToFetch; # byte-compile python modules since the CMake build does not do it postInstall = lib.optionalString pythonSupport '' python -m compileall -s $out $out/${python3Packages.python.sitePackages} ''; pythonImportsCheck = [ "vtk" ]; dontWrapQtApps = true; # GCC 13: error: 'int64_t' in namespace 'std' does not name a type postPatch = '' sed '1i#include <cstdint>' \ -i ThirdParty/libproj/vtklibproj/src/proj_json_streaming_writer.hpp \ -i IO/Image/vtkSEPReader.h postFixup = # Remove thirdparty find module that have been provided in nixpkgs. '' + optionalString stdenv.hostPlatform.isDarwin '' sed -i 's|COMMAND vtkHashSource|COMMAND "DYLD_LIBRARY_PATH=''${VTK_BINARY_DIR}/lib" ''${VTK_BINARY_DIR}/bin/vtkHashSource-${majorVersion}|' ./Parallel/Core/CMakeLists.txt sed -i 's/fprintf(output, shift)/fprintf(output, "%s", shift)/' ./ThirdParty/libxml2/vtklibxml2/xmlschemas.c sed -i 's/fprintf(output, shift)/fprintf(output, "%s", shift)/g' ./ThirdParty/libxml2/vtklibxml2/xpath.c rm -rf $out/lib/cmake/vtk/patches rm $out/lib/cmake/vtk/Find{EXPAT,Freetype,utf8cpp,LibXml2,FontConfig}.cmake '' # libvtkglad.so will find and load libGL.so at runtime. + lib.optionalString stdenv.hostPlatform.isLinux '' patchelf --add-rpath ${lib.getLib libGL}/lib $out/lib/libvtkglad.so ''; dontWrapQtApps = true; passthru = { inherit pythonSupport mpiSupport ; # Shared libraries don't work, because of rpath troubles with the current # nixpkgs cmake approach. It wants to call a binary at build time, just # built and requiring one of the shared objects. # At least, we use -fPIC for other packages to be able to use this in shared # objects. cmakeFlags = [ "-DCMAKE_C_FLAGS=-fPIC" "-DCMAKE_CXX_FLAGS=-fPIC" "-DVTK_MODULE_USE_EXTERNAL_vtkpng=ON" "-DVTK_MODULE_USE_EXTERNAL_vtktiff=1" "-DVTK_MODULE_ENABLE_VTK_RenderingExternal=YES" ] ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ "-DOPENGL_INCLUDE_DIR=${lib.getInclude libGL}/include" (lib.cmakeBool "VTK_OPENGL_HAS_EGL" enableEgl) ] ++ [ "-DCMAKE_INSTALL_LIBDIR=lib" "-DCMAKE_INSTALL_INCLUDEDIR=include" "-DCMAKE_INSTALL_BINDIR=bin" "-DVTK_VERSIONED_INSTALL=OFF" ] ++ optionals enableQt [ "-DVTK_GROUP_ENABLE_Qt:STRING=YES" ] ++ optionals enablePython [ "-DVTK_WRAP_PYTHON:BOOL=ON" "-DVTK_PYTHON_VERSION:STRING=${pythonMajor}" ]; vtkPackages = vtkPackages.overrideScope ( final: prev: { vtk = finalAttrs.finalPackage; } ); env = { # Lots of warnings in vendored code… NIX_CFLAGS_COMPILE = if stdenv.cc.isClang then "-Wno-error=incompatible-function-pointer-types" else "-Wno-error=incompatible-pointer-types"; tests = { cmake-config = testers.hasCmakeConfigModules { moduleNames = [ "VTK" ]; package = finalAttrs.finalPackage; nativeBuildInputs = lib.optionals (!(isNull qtPackages)) [ qtPackages.qttools qtPackages.wrapQtAppsHook ]; }; }; }; postInstall = optionalString enablePython '' substitute \ ${./vtk.egg-info} \ $out/${python.sitePackages}/vtk-${version}.egg-info \ --subst-var-by VTK_VER "${version}" ''; requiredSystemFeatures = [ "big-parallel" ]; meta = with lib; { meta = { description = "Open source libraries for 3D computer graphics, image processing and visualization"; homepage = "https://www.vtk.org/"; license = licenses.bsd3; maintainers = with maintainers; [ tfmoraes ]; platforms = platforms.unix; badPlatforms = optionals enableEgl platforms.darwin; changelog = "https://docs.vtk.org/en/latest/release_details/${lib.versions.majorMinor finalAttrs.version}.html"; license = lib.licenses.bsd3; maintainers = with lib.maintainers; [ qbisi ]; platforms = lib.platforms.unix; }; } }) Loading
pkgs/by-name/ex/exhibit/package.nix +1 −1 Original line number Diff line number Diff line Loading @@ -36,7 +36,7 @@ python3Packages.buildPythonApplication rec { dependencies = with python3Packages; [ pygobject3 f3d_egl f3d ]; dontWrapGApps = true; Loading
pkgs/by-name/f3/f3d/package.nix +2 −5 Original line number Diff line number Diff line Loading @@ -9,10 +9,7 @@ libXt, openusd, tbb, # There is a f3d overridden with EGL enabled vtk in top-level/all-packages.nix # compiling with EGL enabled vtk will result in f3d running in headless mode # See https://github.com/NixOS/nixpkgs/pull/324022. This may change later. vtk_9, vtk, autoPatchelfHook, python3Packages, opencascade-occt, Loading Loading @@ -50,7 +47,7 @@ stdenv.mkDerivation rec { ]; buildInputs = [ vtk_9 vtk opencascade-occt assimp fontconfig Loading
pkgs/development/libraries/vtk/9.x.nixdeleted 100644 → 0 +0 −5 Original line number Diff line number Diff line import ./generic.nix { majorVersion = "9.2"; minorVersion = "6"; sourceSha256 = "sha256-BvyNScTlb0mMQPyzilY+2NTsMTWNAQHomI8LtNU53RI="; }
pkgs/development/libraries/vtk/default.nix 0 → 100644 +30 −0 Original line number Diff line number Diff line { callPackage, fetchpatch2, }: let mkVtk = initArgs: callPackage (import ./generic.nix initArgs) { }; in { vtk_9_5 = mkVtk { version = "9.5.0"; sourceSha256 = "sha256-BK6GJGuVV8a2GvvFNKbfCZJE+8jzk3+C5rwFcJU6+H0="; patches = [ # https://gitlab.kitware.com/vtk/vtk/-/issues/19699 (fetchpatch2 { url = "https://gitlab.kitware.com/vtk/vtk/-/commit/6b4f7b853675c63e4831c366ca8f78e320c1bfb5.diff"; hash = "sha256-hWJc5RxW6iK+W/rTxp2GUWKcm/2+oxbP5nVZ0EUSKHE="; }) # https://gitlab.kitware.com/vtk/vtk/-/issues/19705 (fetchpatch2 { url = "https://gitlab.kitware.com/vtk/vtk/-/commit/ce10dfe82ffa19c8108885625a6f8b3f980bed3b.diff"; hash = "sha256-kyPM0whL4WeaV27sNM1fbbs5kwMYn+9E561HtvnwHRc="; }) # https://gitlab.kitware.com/vtk/vtk/-/merge_requests/12262 (fetchpatch2 { url = "https://gitlab.kitware.com/vtk/vtk/-/commit/c0e0f793e6adf740f5b1c91ac330afdbc2a03b72.diff"; hash = "sha256-BinSv8sPqpAEcgkn8trnCPv2snR9MGcA8rkVflAhc5w="; }) ]; }; }
pkgs/development/libraries/vtk/generic.nix +310 −108 Original line number Diff line number Diff line { majorVersion, minorVersion, version, sourceSha256, patchesToFetch ? [ ], patches ? [ ], }: { stdenv, lib, newScope, stdenv, fetchurl, cmake, libGLU, libGL, libX11, xorgproto, libXt, pkg-config, # common dependencies tk, mpi, python3Packages, catalyst, cli11, boost, eigen, verdict, double-conversion, # common data libraries lz4, xz, zlib, pugixml, expat, jsoncpp, libxml2, exprtk, utf8cpp, libarchive, nlohmann_json, # filters openturns, openslide, # io modules cgns, adios2, libLAS, libgeotiff, laszip_2, gdal, pdal, alembic, imath, openvdb, c-blosc, unixODBC, postgresql, libmysqlclient, ffmpeg, libjpeg, libpng, libtiff, fetchpatch, enableQt ? false, qtx11extras, qttools, qtdeclarative, qtEnv, enablePython ? false, python ? throw "vtk: Python support requested, but no python interpreter was given.", enableEgl ? false, }: proj, sqlite, libogg, libharu, libtheora, hdf5, netcdf, opencascade-occt, let inherit (lib) optionalString optionals; # threading tbb, llvmPackages, # rendering viskores, freetype, fontconfig, libX11, libXfixes, libXrender, libXcursor, gl2ps, libGL, qt5, qt6, # custom options qtVersion ? null, # To avoid conflicts between the propagated vtkPackages.hdf5 # and the input hdf5 used by most downstream packages, # we set mpiSupport to false by default. mpiSupport ? false, pythonSupport ? false, version = "${majorVersion}.${minorVersion}"; pythonMajor = lib.substring 0 1 python.pythonVersion; # passthru.tests testers, }: let qtPackages = if (isNull qtVersion) then null else if (qtVersion == "6") then qt6 else if (qtVersion == "5") then qt5 else throw ''qtVersion must be "5", "6" or null''; vtkPackages = lib.makeScope newScope (self: { inherit tbb mpi mpiSupport python3Packages pythonSupport ; hdf5 = hdf5.override { inherit mpi mpiSupport; cppSupport = !mpiSupport; }; openvdb = self.callPackage openvdb.override { }; netcdf = self.callPackage netcdf.override { }; catalyst = self.callPackage catalyst.override { }; adios2 = self.callPackage adios2.override { }; cgns = self.callPackage cgns.override { }; viskores = self.callPackage viskores.override { }; }); vtkBool = feature: bool: lib.cmakeFeature feature "${if bool then "YES" else "NO"}"; in stdenv.mkDerivation { pname = "vtk" + optionalString enableEgl "-egl" + optionalString enableQt "-qvtk"; inherit version; stdenv.mkDerivation (finalAttrs: { pname = "vtk"; inherit version patches; src = fetchurl { url = "https://www.vtk.org/files/release/${majorVersion}/VTK-${version}.tar.gz"; sha256 = sourceSha256; url = "https://www.vtk.org/files/release/${lib.versions.majorMinor finalAttrs.version}/VTK-${finalAttrs.version}.tar.gz"; hash = sourceSha256; }; nativeBuildInputs = [ cmake ]; nativeBuildInputs = [ cmake pkg-config # required for finding MySQl ] ++ lib.optional pythonSupport python3Packages.python ++ lib.optional ( pythonSupport && stdenv.buildPlatform == stdenv.hostPlatform ) python3Packages.pythonImportsCheckHook; buildInputs = [ libLAS libgeotiff laszip_2 gdal pdal alembic imath c-blosc unixODBC postgresql libmysqlclient ffmpeg opencascade-occt fontconfig openturns libarchive libGL vtkPackages.openvdb ] ++ lib.optionals stdenv.hostPlatform.isLinux [ libXfixes libXrender libXcursor ] ++ lib.optional (!(isNull qtPackages)) qtPackages.qttools ++ lib.optional mpiSupport mpi ++ lib.optional pythonSupport tk; # propagated by vtk-config.cmake propagatedBuildInputs = [ eigen boost verdict double-conversion freetype lz4 xz zlib expat exprtk pugixml jsoncpp libxml2 utf8cpp nlohmann_json libjpeg libpng libtiff proj sqlite libogg libharu libtheora cli11 openslide vtkPackages.hdf5 vtkPackages.cgns vtkPackages.adios2 vtkPackages.netcdf vtkPackages.catalyst vtkPackages.viskores vtkPackages.tbb ] ++ lib.optionals stdenv.cc.isClang [ llvmPackages.openmp ] ++ optionals enableQt [ (qtEnv "qvtk-qt-env" [ qtx11extras qttools qtdeclarative ]) ++ lib.optionals stdenv.hostPlatform.isLinux [ libX11 gl2ps ] ++ optionals stdenv.hostPlatform.isLinux [ libGLU xorgproto libXt # create meta package providing dist-info for python3Pacakges.vtk that common cmake build does not do ++ lib.optionals pythonSupport [ (python3Packages.mkPythonMetaPackage { inherit (finalAttrs) pname version meta; dependencies = with python3Packages; [ numpy wslink matplotlib ] ++ optionals enablePython [ python ++ lib.optional mpiSupport (mpi4py.override { inherit mpi; }); }) ]; propagatedBuildInputs = optionals stdenv.hostPlatform.isLinux [ libX11 libGL # wrapper script calls qmlplugindump, crashes due to lack of minimal platform plugin # Could not find the Qt platform plugin "minimal" in "" preConfigure = lib.optionalString (qtVersion == "5") '' export QT_PLUGIN_PATH=${lib.getBin qt5.qtbase}/${qt5.qtbase.qtPluginPrefix} ''; env = { CMAKE_PREFIX_PATH = "${lib.getDev openvdb}/lib/cmake/OpenVDB"; NIX_LDFLAGS = "-L${lib.getLib libmysqlclient}/lib/mariadb"; }; cmakeFlags = [ (lib.cmakeFeature "CMAKE_INSTALL_BINDIR" "bin") (lib.cmakeFeature "CMAKE_INSTALL_LIBDIR" "lib") (lib.cmakeFeature "CMAKE_INSTALL_INCLUDEDIR" "include") # vtk common configure options (lib.cmakeBool "VTK_DISPATCH_SOA_ARRAYS" true) (lib.cmakeBool "VTK_ENABLE_CATALYST" true) (lib.cmakeBool "VTK_WRAP_SERIALIZATION" true) (lib.cmakeBool "VTK_BUILD_ALL_MODULES" true) (lib.cmakeBool "VTK_VERSIONED_INSTALL" false) (lib.cmakeBool "VTK_SMP_ENABLE_OPENMP" true) (lib.cmakeFeature "VTK_SMP_IMPLEMENTATION_TYPE" "TBB") # use system packages if possible (lib.cmakeBool "VTK_USE_EXTERNAL" true) (lib.cmakeBool "VTK_MODULE_USE_EXTERNAL_VTK_fast_float" false) # required version incompatible (lib.cmakeBool "VTK_MODULE_USE_EXTERNAL_VTK_pegtl" false) # required version incompatible (lib.cmakeBool "VTK_MODULE_USE_EXTERNAL_VTK_ioss" false) # missing in nixpkgs (lib.cmakeBool "VTK_MODULE_USE_EXTERNAL_VTK_token" false) # missing in nixpkgs (lib.cmakeBool "VTK_MODULE_USE_EXTERNAL_VTK_fmt" false) # prefer vendored fmt (lib.cmakeBool "VTK_MODULE_USE_EXTERNAL_VTK_scn" false) # missing in nixpkgs (lib.cmakeBool "VTK_MODULE_USE_EXTERNAL_VTK_gl2ps" stdenv.hostPlatform.isLinux) # external gl2ps causes failure linking to macOS OpenGL.framework # Rendering (vtkBool "VTK_MODULE_ENABLE_VTK_RenderingRayTracing" false) # ospray (vtkBool "VTK_MODULE_ENABLE_VTK_RenderingOpenXR" false) # openxr (vtkBool "VTK_MODULE_ENABLE_VTK_RenderingOpenVR" false) # openvr (vtkBool "VTK_MODULE_ENABLE_VTK_RenderingAnari" false) # anari # qtSupport (vtkBool "VTK_GROUP_ENABLE_Qt" (!(isNull qtPackages))) (lib.cmakeFeature "VTK_QT_VERSION" "Auto") # will search for Qt6 first # pythonSupport (lib.cmakeBool "VTK_USE_TK" pythonSupport) (vtkBool "VTK_GROUP_ENABLE_Tk" pythonSupport) (lib.cmakeBool "VTK_WRAP_PYTHON" pythonSupport) (lib.cmakeBool "VTK_BUILD_PYI_FILES" pythonSupport) (lib.cmakeFeature "VTK_PYTHON_VERSION" "3") # mpiSupport (lib.cmakeBool "VTK_USE_MPI" mpiSupport) (vtkBool "VTK_GROUP_ENABLE_MPI" mpiSupport) ]; # see https://github.com/NixOS/nixpkgs/pull/178367#issuecomment-1238827254 patches = map fetchpatch patchesToFetch; # byte-compile python modules since the CMake build does not do it postInstall = lib.optionalString pythonSupport '' python -m compileall -s $out $out/${python3Packages.python.sitePackages} ''; pythonImportsCheck = [ "vtk" ]; dontWrapQtApps = true; # GCC 13: error: 'int64_t' in namespace 'std' does not name a type postPatch = '' sed '1i#include <cstdint>' \ -i ThirdParty/libproj/vtklibproj/src/proj_json_streaming_writer.hpp \ -i IO/Image/vtkSEPReader.h postFixup = # Remove thirdparty find module that have been provided in nixpkgs. '' + optionalString stdenv.hostPlatform.isDarwin '' sed -i 's|COMMAND vtkHashSource|COMMAND "DYLD_LIBRARY_PATH=''${VTK_BINARY_DIR}/lib" ''${VTK_BINARY_DIR}/bin/vtkHashSource-${majorVersion}|' ./Parallel/Core/CMakeLists.txt sed -i 's/fprintf(output, shift)/fprintf(output, "%s", shift)/' ./ThirdParty/libxml2/vtklibxml2/xmlschemas.c sed -i 's/fprintf(output, shift)/fprintf(output, "%s", shift)/g' ./ThirdParty/libxml2/vtklibxml2/xpath.c rm -rf $out/lib/cmake/vtk/patches rm $out/lib/cmake/vtk/Find{EXPAT,Freetype,utf8cpp,LibXml2,FontConfig}.cmake '' # libvtkglad.so will find and load libGL.so at runtime. + lib.optionalString stdenv.hostPlatform.isLinux '' patchelf --add-rpath ${lib.getLib libGL}/lib $out/lib/libvtkglad.so ''; dontWrapQtApps = true; passthru = { inherit pythonSupport mpiSupport ; # Shared libraries don't work, because of rpath troubles with the current # nixpkgs cmake approach. It wants to call a binary at build time, just # built and requiring one of the shared objects. # At least, we use -fPIC for other packages to be able to use this in shared # objects. cmakeFlags = [ "-DCMAKE_C_FLAGS=-fPIC" "-DCMAKE_CXX_FLAGS=-fPIC" "-DVTK_MODULE_USE_EXTERNAL_vtkpng=ON" "-DVTK_MODULE_USE_EXTERNAL_vtktiff=1" "-DVTK_MODULE_ENABLE_VTK_RenderingExternal=YES" ] ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ "-DOPENGL_INCLUDE_DIR=${lib.getInclude libGL}/include" (lib.cmakeBool "VTK_OPENGL_HAS_EGL" enableEgl) ] ++ [ "-DCMAKE_INSTALL_LIBDIR=lib" "-DCMAKE_INSTALL_INCLUDEDIR=include" "-DCMAKE_INSTALL_BINDIR=bin" "-DVTK_VERSIONED_INSTALL=OFF" ] ++ optionals enableQt [ "-DVTK_GROUP_ENABLE_Qt:STRING=YES" ] ++ optionals enablePython [ "-DVTK_WRAP_PYTHON:BOOL=ON" "-DVTK_PYTHON_VERSION:STRING=${pythonMajor}" ]; vtkPackages = vtkPackages.overrideScope ( final: prev: { vtk = finalAttrs.finalPackage; } ); env = { # Lots of warnings in vendored code… NIX_CFLAGS_COMPILE = if stdenv.cc.isClang then "-Wno-error=incompatible-function-pointer-types" else "-Wno-error=incompatible-pointer-types"; tests = { cmake-config = testers.hasCmakeConfigModules { moduleNames = [ "VTK" ]; package = finalAttrs.finalPackage; nativeBuildInputs = lib.optionals (!(isNull qtPackages)) [ qtPackages.qttools qtPackages.wrapQtAppsHook ]; }; }; }; postInstall = optionalString enablePython '' substitute \ ${./vtk.egg-info} \ $out/${python.sitePackages}/vtk-${version}.egg-info \ --subst-var-by VTK_VER "${version}" ''; requiredSystemFeatures = [ "big-parallel" ]; meta = with lib; { meta = { description = "Open source libraries for 3D computer graphics, image processing and visualization"; homepage = "https://www.vtk.org/"; license = licenses.bsd3; maintainers = with maintainers; [ tfmoraes ]; platforms = platforms.unix; badPlatforms = optionals enableEgl platforms.darwin; changelog = "https://docs.vtk.org/en/latest/release_details/${lib.versions.majorMinor finalAttrs.version}.html"; license = lib.licenses.bsd3; maintainers = with lib.maintainers; [ qbisi ]; platforms = lib.platforms.unix; }; } })