{ lib, fetchurl, fetchFromGitHub, buildPythonApplication, sphinx, sphinx_rtd_theme , mfixsolver , numpy, psutil, pyqtgraph, qtpy, pyqt5, vtk, requests, simpleeval, simplejson }: buildPythonApplication rec { pname = "mfixgui"; version = "19.3.0"; srcs = [ ( fetchurl { url = "https://mfix.netl.doe.gov/s3/71e94306/f00d8cf543e7a1f42c41a545baef58c4/source/mfix/mfix-${version}.tar.gz"; sha256 = "1bnwvgmrmz9y32fsnnqb4x2ab4yh9iyg1d7f3wc2w6q9fsfnzpj4"; } ) ( fetchFromGitHub { name = "crow_repo"; owner = "mwm126"; repo = "crow"; rev = "e87cbf55897be4ca134c4e3fd2c58154d4fb3b7b"; sha256 = "0wc4x0dwhqlzw438spvflvmp56xphkwy83mlcrh9byw0yh96wdv9"; } ) ]; sourceRoot = "mfix-${version}"; # # See the various build_* files under conda # # Should include all the mfixsolver patches as well as it packages the code # # Nix boost libraries are not compiled in static mode # VTK 7.x doesn't have AnnotationTextScallingOn/Off # QtCore.Qt colors are lowercase postPatch = '' substituteInPlace model/cppmfix/CMakeLists.txt --replace \ 'set(Boost_USE_STATIC_LIBS ON)' \ '''''' substituteInPlace mfixgui/tools/paths.py --replace \ 'mfix_home = join(conda_prefix(), "share", "mfix")' \ 'mfix_home = join("'"$out"'", "share", "mfix")' substituteInPlace mfixgui/vtk_widgets/base.py --replace \ 'self.scalar_bar.AnnotationTextScalingOff()' \ 'self.scalar_bar.SetAnnotationTextScaling(0)' substituteInPlace mfixgui/vtk_widgets/results_viewer.py --replace \ 'QtCore.Qt.White' \ 'QtCore.Qt.white' ''; postUnpack = '' python "$NIX_BUILD_TOP/crow_repo/amalgamate/merge_all.py" "$NIX_BUILD_TOP/crow_repo/include" mv crow_all.h "$sourceRoot/model/cppmfix/crow.h" ''; postBuild = '' python -c "import mfixgui.namelistparser; mfixgui.namelistparser.build_keywords_rst('doc/user_manual/reference')" ''; postInstall = '' mkdir -p "$out/share/mfix/templates" cp -rL queue_templates tests tutorials "$out/share/mfix/templates/" mkdir -p "$out/share/mfix/src" cp -r CMakeLists.txt cmake model post_mfix tools "$out/share/mfix/src" sphinx-build -M html doc/user_manual "$out/share/mfix/doc" -t release wrapProgram "$out/bin/mfix" --prefix PATH : "${mfixsolver}/bin" ''; nativeBuildInputs = [ sphinx sphinx_rtd_theme ]; buildInputs = [ mfixsolver ]; # Test routine expects gui export from namespace, but there is none doCheck = false; propagatedBuildInputs = [ numpy psutil pyqtgraph qtpy pyqt5 vtk requests simpleeval simplejson ]; meta = with lib; { homepage = https://mfix.netl.doe.gov; description = "An open-source multiphase flow solver python GUI"; platforms = platforms.all; license = licenses.publicDomain; }; }