Package OpenFOAM for nixpkgs

I’ve been trying to package OpenFOAM for NixOS for some time now, and haven’t had the success I’ve hoped for. The biggest issue is that OpenFOAM is conventionally built with a custom wrapper for make that was created just for OpenFOAM. Reversing this back to just simple make commands was not simple, but it’s where I started my efforts to package OpenFOAM. This really did not work well at all. Searching online, I found this issue on the nixpkgs repo. Two previous attempts at packaging this did better than I could at reversing things back to just plain old make, however my efforts to update one of those attempts in particular also didn’t go so well. I was able to get something to build, but the binaries are very limited and missing most of the CFD solvers. I changed almost nothing from that compute canada repo, aside from renaming package.nix to default.nix and making a few other light changes to make it work with nix-build just to see if I was on to something.

I’m very new to NixOS and trying to set up software I need in order to make it a good fit for a main OS. I would appreciate any help people are willing to offer.

1 Like

Hey, not an OpenFOAM expert here but I’ve spent lots of time cursing at its build system to make it work inside a derivation at work. It was tricky and lots of substituteInPlace was involved on those bash scripts under etc/.
We’ve recently put it into production and has been working well (including custom .so extensions). I’m going to open a PR on nixpkgs at some point in July.

3 Likes

@razielgn Any update on this? Really looking forward to using this package.

Hello, I’ve opened a PR openfoam-com: init at 2406 (plus 2312) by razielgn · Pull Request #329213 · NixOS/nixpkgs · GitHub

2 Likes