initial commit

master
Ben Gamari 2 years ago
commit 0f75f58d4b

@ -0,0 +1,13 @@
diff --git a/Allwmake b/Allwmake
index d34b3665ec..1c2f9c6787 100755
--- a/Allwmake
+++ b/Allwmake
@@ -1,7 +1,7 @@
#!/bin/sh
# Run from OPENFOAM top-level directory only
cd "${0%/*}" || exit
-wmake -check-dir "$WM_PROJECT_DIR" 2>/dev/null || {
+wmake -check-dir "$WM_PROJECT_DIR" || {
echo "Error (${0##*/}) : not located in \$WM_PROJECT_DIR"
echo " Check your OpenFOAM environment and installation"
exit 1

@ -0,0 +1,60 @@
{
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1667395993,
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1672505534,
"narHash": "sha256-ntaHfT53P4DtP3nW2mTmq5MQP3gqeut+ByPLHRkipcc=",
"owner": "bgamari",
"repo": "nixpkgs",
"rev": "48dcea17d21e1b7ebcda2baa9fa2ea1beef00a3d",
"type": "github"
},
"original": {
"owner": "bgamari",
"ref": "wip/vtk-egg-info",
"repo": "nixpkgs",
"type": "github"
}
},
"openfoam": {
"flake": false,
"locked": {
"lastModified": 1672220166,
"narHash": "sha256-taqKAEPIG4jmiteMFF0wMYDYppsBf/a1k1kMEAahGl0=",
"ref": "refs/heads/master",
"rev": "0031cb1efac0d550334108346f26dde5e707b6fd",
"revCount": 26097,
"type": "git",
"url": "https://develop.openfoam.com/Development/openfoam"
},
"original": {
"type": "git",
"url": "https://develop.openfoam.com/Development/openfoam"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs",
"openfoam": "openfoam"
}
}
},
"root": "root",
"version": 7
}

@ -0,0 +1,27 @@
{
description = "Flake utils demo";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.nixpkgs.url = "github:bgamari/nixpkgs/wip/vtk-egg-info";
inputs.openfoam = {
url = "git+https://develop.openfoam.com/Development/openfoam";
flake = false;
};
outputs = inputs@{ self, nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let pkgs = nixpkgs.legacyPackages.${system}; in
{
packages = rec {
openfoam = pkgs.callPackage ./openfoam.nix {
src = inputs.openfoam;
mpi = pkgs.openmpi;
};
default = openfoam;
};
}
);
}

@ -0,0 +1,85 @@
{
stdenv, src,
bash, m4, flex, bison,
fftw, mpi, scotch, boost, cgal, zlib
}:
stdenv.mkDerivation {
name = "openfoam";
inherit src;
nativeBuildInputs = [ bash m4 flex bison ];
buildInputs = [ fftw mpi scotch boost cgal zlib ];
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
'';
configurePhase = ''
set -x
build="$(pwd)"
export FOAM_APP=$build/applications
export FOAM_SOLVERS=$build/applications/solvers
export FOAM_APPBIN=$build/platforms/linux64Gcc/bin
export FOAM_LIBBIN=$build/platforms/linux64Gcc/lib
export FOAM_EXT_LIBBIN=$build/platforms/linux64Gcc/lib
export FOAM_MPI=openmpi-system
export FOAM_RUN=$build/run
export FOAM_SRC=$build/src
export FOAM_ETC=$build/etc
export FOAM_USER_APPBIN=$build/platforms/linux64Gcc/bin
export FOAM_USER_LIBBIN=$build/platforms/linux64Gcc/lib
export FOAM_EXTRA_CXXFLAGS="-DFOAM_CONFIGURED_PROJECT_DIR=\\\"${placeholder "out"}\\\""
export MPI_ARCH_PATH=/usr/include/openmpi
export WM_ARCH=linux64
export WM_LABEL_SIZE=32
export WM_LABEL_OPTION=Int32
export WM_COMPILER=Gcc
export WM_COMPILER_LIB_ARCH=64
export WM_COMPILE_OPTION=Opt
export WM_DIR=$build/wmake
export WM_OPTIONS=linux64Gcc
export WM_PRECISION_OPTION=DP
export WM_PROJECT=OpenFOAM
export WM_PROJECT_DIR=$build
export WM_PROJECT_USER_DIR=$build/debian/tmp
export WM_PROJECT_VERSION="$(bin/foamEtcFile -show-api)"
export WM_NCOMPPROCS=$CORES
export gperftools_install=$build/platforms/linux64Gcc
export WM_MPLIB=SYSTEMOPENMPI
unset FOAMY_HEX_MESH
bin/tools/foamConfigurePaths \
-boost boost-system \
-cgal cgal-system \
-fftw fftw-system \
-kahip kahip-none \
-scotch scotch-system
'';
buildPhase = ''
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$build/platforms/linux64Gcc/lib/openmpi-system:$build/platforms/linux64Gcc/lib:$build/platforms/linux64Gcc/lib/dummy" \
PATH="$PATH:$build/wmake" \
./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
'';
}
Loading…
Cancel
Save