Skip to content

Commit

Permalink
openfoam-org: init at 12
Browse files Browse the repository at this point in the history
  • Loading branch information
gusgibbon committed Jul 25, 2024
1 parent 391faf4 commit 9711450
Showing 1 changed file with 102 additions and 0 deletions.
102 changes: 102 additions & 0 deletions pkgs/by-name/op/openfoam-org/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
{
stdenv,
bash,
m4,
flex,
bison,
fftw,
gnumake,
mpi,
scotch,
boost,
cgal,
zlib,
fetchFromGitHub,
lib,
trilinos-mpi,
nix-update-script,
}:
stdenv.mkDerivation {
pname = "openfoam-org";
version = "12";
src = fetchFromGitHub {
owner = "OpenFOAM";
repo = "OpenFOAM-12";
rev = "858aab68ade2864dc8eb29b0a316d4c0fe6df1c9";
hash = "sha256-1vFia30IzuSOLL5d3oNrRWSr8EUzwti9wOarUUa2SHM=";
};
meta = with lib; {
description = "The open source CFD toolkit (openfoam.org)";
homepage = "https://github.com/OpenFOAM/OpenFOAM-12";
license = licenses.gpl3Only;
maintainers = with maintainers; [ gusgibbon ];
platforms = with platforms; [ "x86_64-linux" ];
};
passthru.updateScript = nix-update-script { };
nativeBuildInputs = [
gnumake
bash
m4
flex
bison
];
buildInputs = [
fftw
mpi
mpi.dev
scotch
boost
cgal
zlib
trilinos-mpi
];
sourceRoot = ".";
patchPhase = ''
mkdir -p builduser/OpenFOAM
mkdir -p builduser/.OpenFOAM
export HOME=$(pwd)/builduser
mv source builduser/OpenFOAM/OpenFOAM-12
mkdir -p builduser/OpenFOAM/OpenFOAM-12/paraviewout
set +e
for f in \
$HOME/OpenFOAM/OpenFOAM-12/wmake/scripts/* \
$HOME/OpenFOAM/OpenFOAM-12/wmake/*
do
substituteInPlace $f --replace /bin/bash ${bash}/bin/bash
done
set -e
rm $HOME/OpenFOAM/OpenFOAM-12/etc/config.sh/bash_completion
touch $HOME/OpenFOAM/OpenFOAM-12/etc/config.sh/bash_completion
echo "set +e" | cat $HOME/OpenFOAM/OpenFOAM-12/etc/bashrc > tmp
rm $HOME/OpenFOAM/OpenFOAM-12/etc/bashrc
mv tmp $HOME/OpenFOAM/OpenFOAM-12/etc/bashrc
echo "set +e" | cat $HOME/OpenFOAM/OpenFOAM-12/Allwmake > tmp
rm $HOME/OpenFOAM/OpenFOAM-12/Allwmake
mv tmp $HOME/OpenFOAM/OpenFOAM-12/Allwmake
alias wmRefresh="placeholder"
chmod +x $HOME/OpenFOAM/OpenFOAM-12/Allwmake
chmod +x $HOME/OpenFOAM/OpenFOAM-12/applications/utilities/postProcessing/graphics/PVReaders/Allwmake
touch $HOME/.OpenFOAM/prefs.sh
'';
configurePhase = ''
echo "export ZOLTAN_TYPE=system" >> $HOME/.OpenFOAM/prefs.sh
echo "export SCOTCH_TYPE=system" >> $HOME/.OpenFOAM/prefs.sh
'';
buildPhase = ''
cd $HOME/OpenFOAM/OpenFOAM-12
source ./etc/bashrc
./Allwmake -j $CORES -q
'';
installPhase = ''
mkdir -p $out/opt/OpenFOAM-12
cp -r bin $out/opt/OpenFOAM-12
cp -r platforms $out/opt/OpenFOAM-12
cp -r etc $out/opt/OpenFOAM-12
'';
}

0 comments on commit 9711450

Please sign in to comment.