mfix: Initial packaging
This commit is contained in:
@@ -30,6 +30,9 @@ self: super: pkgs: with pkgs; {
|
||||
|
||||
#meraculous = callPackage ./meraculous.nix { let stdenv49 = overrideCC stdenv gcc49; in stdenv = stdenv49; boost = boost159.override { stdenv = stdenv49 }; };
|
||||
|
||||
mfixgui = python36Packages.callPackage ./mfix/mfixgui.nix { };
|
||||
mfixsolver = callPackage ./mfix/mfixsolver.nix { };
|
||||
|
||||
minia = callPackage ./minia.nix { };
|
||||
|
||||
inherit (callPackage ./opengl/default.nix { inherit super; }) libGL mesa_glxgallium;
|
||||
|
||||
88
pkgs/mfix/mfixgui.nix
Normal file
88
pkgs/mfix/mfixgui.nix
Normal file
@@ -0,0 +1,88 @@
|
||||
{ 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;
|
||||
};
|
||||
}
|
||||
76
pkgs/mfix/mfixsolver.nix
Normal file
76
pkgs/mfix/mfixsolver.nix
Normal file
@@ -0,0 +1,76 @@
|
||||
{ stdenv, fetchurl, fetchFromGitHub
|
||||
, cmake, gfortran, python, pkgconfig
|
||||
, openmpi, netcdf, boost }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "mfixsolver-${version}";
|
||||
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
|
||||
#
|
||||
|
||||
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"
|
||||
'';
|
||||
|
||||
# Put the binaries under a bin subdirectory
|
||||
# Nix boost libraries are not compiled in static mode
|
||||
postPatch = ''
|
||||
substituteInPlace CMakeLists.txt --replace \
|
||||
'install(TARGETS mfixsolver DESTINATION ''${CMAKE_INSTALL_PREFIX})' \
|
||||
'install(TARGETS mfixsolver DESTINATION bin)'
|
||||
substituteInPlace post_mfix/CMakeLists.txt --replace \
|
||||
'install(TARGETS postmfix DESTINATION ''${CMAKE_INSTALL_PREFIX})' \
|
||||
'install(TARGETS postmfix DESTINATION bin)'
|
||||
substituteInPlace model/cppmfix/CMakeLists.txt --replace \
|
||||
'set(Boost_USE_STATIC_LIBS ON)' \
|
||||
''''''
|
||||
'';
|
||||
|
||||
cmakeFlags = [
|
||||
"-DVERSION=${version}"
|
||||
"-DENABLE_POSTMFIX=ON"
|
||||
"-DENABLE_MPI=ON"
|
||||
"-DENABLE_CPPMFIX=ON"
|
||||
# "-DENABLE_NETCDF=ON" -- Requires NETCDF built by cmake (input netcdf)
|
||||
# "-DENABLE_OpenMP" -- Probably no need if using MPI
|
||||
];
|
||||
|
||||
nativeBuildInputs = [
|
||||
python
|
||||
pkgconfig
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
cmake
|
||||
gfortran
|
||||
openmpi
|
||||
boost
|
||||
# netcdf
|
||||
];
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
homepage = https://mfix.netl.doe.gov;
|
||||
description = "An open-source multiphase flow solver";
|
||||
platforms = platforms.all;
|
||||
license = licenses.publicDomain;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user