···
···
url = "${patchSource}/include_stdlib.patch";
hash = "sha256-W+NgGBuy/UmzVbPTSqR8FRUlyN/9dl9l9e9rxKklmIc=";
# when generating python stub file utilizing system python pybind11_stubgen module
# cmake need to inherit pythonpath
+
sed -i '/-DBDIR=''\'''${CMAKE_CURRENT_BINARY_DIR}/a\
+
-DNETGEN_VERSION_GIT=''\'''${NETGEN_VERSION_GIT}
+
substituteInPlace python/CMakeLists.txt \
+
--replace-fail ''\'''${CMAKE_INSTALL_PREFIX}/''${NG_INSTALL_DIR_PYTHON}' \
+
''\'''${CMAKE_INSTALL_PREFIX}/''${NG_INSTALL_DIR_PYTHON}:$ENV{PYTHONPATH}'
+
substituteInPlace ng/ng.tcl ng/onetcl.cpp \
+
--replace-fail "libnggui" "$out/lib/libnggui"
+
substituteInPlace ng/Togl2.1/CMakeLists.txt \
+
--replace-fail "/usr/bin/gcc" "$CC"
+
+ lib.optionalString (!stdenv.hostPlatform.isx86_64) ''
+
# mesh generation differs on x86_64 and aarch64 platform
+
# test_tutorials will fail on aarch64 platform
+
rm tests/pytest/test_tutorials.py
python3Packages.pybind11-stubgen
+
] ++ lib.optional stdenv.hostPlatform.isLinux copyDesktopItems;
···
(lib.cmakeFeature "NETGEN_VERSION_GIT" "v${finalAttrs.version}-0")
+
(lib.cmakeFeature "NG_INSTALL_DIR_BIN" "bin")
+
(lib.cmakeFeature "NG_INSTALL_DIR_LIB" "lib")
+
(lib.cmakeFeature "NG_INSTALL_DIR_CMAKE" "lib/cmake/${finalAttrs.pname}")
+
(lib.cmakeFeature "NG_INSTALL_DIR_PYTHON" python3Packages.python.sitePackages)
+
(lib.cmakeFeature "NG_INSTALL_DIR_RES" "share")
+
(lib.cmakeFeature "NG_INSTALL_DIR_INCLUDE" "include")
(lib.cmakeFeature "CMAKE_CXX_FLAGS" archFlags)
(lib.cmakeBool "USE_MPI" true)
(lib.cmakeBool "USE_MPI4PY" true)
···
(lib.cmakeBool "ENABLE_UNIT_TESTS" finalAttrs.finalPackage.doInstallCheck)
+
__darwinAllowLocalNetworking = true;
+
comment = finalAttrs.meta.description;
+
desktopName = "Netgen Mesh Generator";
+
genericName = "3D Mesh Generator";
+
categories = [ "Science" ];
+
lib.optionalString stdenv.hostPlatform.isDarwin ''
+
rm $out/bin/{Netgen1,startup.sh}
+
mkdir -p $out/Applications/${finalAttrs.pname}.app/Contents/{MacOS,Resouces}
+
substituteInPlace $out/Info.plist --replace-fail "Netgen1" "netgen"
+
mv $out/Info.plist $out/Applications/${finalAttrs.pname}.app/Contents
+
mv $out/Netgen.icns $out/Applications/${finalAttrs.pname}.app/Contents/Resouces
+
ln -s $out/bin/netgen $out/Applications/${finalAttrs.pname}.app/Contents/MacOS/netgen
+
+ lib.optionalString stdenv.hostPlatform.isLinux ''
+
# Extract pngs from the Apple icon image and create
+
# the missing ones from the 512x512 image.
+
icns2png --extract ../netgen.icns
+
for size in 16 24 32 48 64 128 256 512; do
+
mkdir -pv $out/share/icons/hicolor/"$size"x"$size"/apps
+
if [ -e netgen_"$size"x"$size"x32.png ]
+
mv netgen_"$size"x"$size"x32.png $out/share/icons/hicolor/"$size"x"$size"/apps/netgen.png
+
convert -resize "$size"x"$size" netgen_512x512x32.png $out/share/icons/hicolor/"$size"x"$size"/apps/netgen.png
export PYTHONPATH=$out/${python3Packages.python.sitePackages}:$PYTHONPATH
···
python3Packages.pytest-check
python3Packages.pytest-mpi
+
python3Packages.pythonImportsCheckHook
+
pythonImportsCheck = [ "netgen" ];
inherit avxSupport avx2Support avx512Support;
···
homepage = "https://ngsolve.org";
+
downloadPage = "https://github.com/NGSolve/netgen";
description = "Atomatic 3d tetrahedral mesh generator";
license = with lib.licenses; [
···
+
platforms = lib.platforms.unix;
maintainers = with lib.maintainers; [ qbisi ];