Greetings!
I’m trying to compile OpenFOAM on NixOS using a flake.nix file + it’s corresponding shell.
{
description = "OpenFOAM Compilation env";
inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0"; # stable Nixpkgs
outputs =
{ self, ... }@inputs:
let
supportedSystems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
forEachSupportedSystem =
f:
inputs.nixpkgs.lib.genAttrs supportedSystems (
system:
f {
pkgs = import inputs.nixpkgs { inherit system; };
}
);
in
{
devShells = forEachSupportedSystem (
{ pkgs }:
{
default =
pkgs.mkShell.override
{
# Override stdenv in order to change compiler:
# stdenv = pkgs.clangStdenv;
}
{
packages =
with pkgs;
[
flex
gnum4
gcc
clang-tools
clang
cmake
codespell
conan
cppcheck
doxygen
gtest
lcov
vcpkg
vcpkg-tool
openmpi
file
]
++ (if system == "aarch64-darwin" then [ ] else [ gdb ]);
shellHook = ''
source ./etc/bashrc
# Ensure OpenFOAM finds m4
PATH=${pkgs.gnum4}/bin:$PATH
# Ensure m4 include paths exist
M4PATH=$WM_PROJECT_DIR:$WM_PROJECT_DIR/src:$WM_PROJECT_DIR/src/OpenFOAM
'';
};
}
);
};
}
To compile I’m using:
./Allmake -s -l
It works out until it errors out with:
make -f /home/bm69/git/third_party/openFoam/OpenFOAM-v2412/wmake/makefiles/general 'MAKE_DIR=Make' 'OBJECTS_DIR=/home/bm69/git/third_party/openFoam/OpenFOAM-v2412/build/linux64GccDPInt32Opt/src/OpenFOAM' libso
lyy-m4too: fieldExprLemonParser.lyy-m4
lemon-m4: fieldExprLemonParser.lyy-m4
m4:expressions/fields/fieldExprLemonParser.lyy-m4:96: cannot open `fieldExprLemonParserMacros.m4': No such file or directory
m4:expressions/fields/fieldExprLemonParser.lyy-m4:425: cannot open `[m4/lemon/parser-methods.m4]': No such file or directory
m4 stage failed on expressions/fields/fieldExprLemonParser.lyy-m4
This seems to be a simple path error, but I’m not smart enough to figure out how to set m4 search path in this context (setting the variable M4PATH as noticed in the m4 documentation doesn’t seem to work.
Has anybody encountered this?
Thanks in advance!