{ stdenv, src, bash, m4, flex, bison, fftw, mpi, scotch, boost, cgal, zlib, pkg-config, gmp, cmake, python3 }: stdenv.mkDerivation { name = "openfoam"; inherit src; nativeBuildInputs = [ bash m4 flex bison pkg-config cmake ]; buildInputs = [ fftw mpi scotch boost cgal zlib gmp ]; patches = [ ./fix-bash.patch ]; postPatch = '' for f in \ bin/foamGetDict \ etc/openfoam \ wmake/scripts/* \ wmake/wmake \ wmake/wmakeCollect \ wmake/wmakeLnIncludeAll do substituteInPlace $f --replace /bin/bash ${bash}/bin/bash done cp ../bashrc etc/bashrc ''; buildPhase = '' source etc/bashrc ./Allwmake -j$CORES -q ''; installPhase = '' find mkdir -p $out cp -Ra ./platforms/linux64Gcc/lib $out cp -Ra ./platforms/linux64Gcc/lib/dummy/* $out/lib cp -Ra ./platforms/linux64Gcc/lib/openmpi-system/* $out/lib cp -Ra ./platforms/linux64Gcc/bin $out cp -Ra ./etc $out ''; }