-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Package openfoam-org and add openfoam NixOS module #329527
base: master
Are you sure you want to change the base?
Conversation
6d5e730
to
effd0a0
Compare
ae2f88a
to
a2547e1
Compare
]; | ||
buildInputs = [ | ||
fftw | ||
mpi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mpi |
Builds without. I think this is covered by mpi.dev
below, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe you are correct, I probably just left that in there when packaging this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mpi
in builtInputs
is automatically taken with getDev
already so you don't need to specify .dev
, and it's better not to specify so that we don't enforce that the output should necessarily be split out
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/package-openfoam-for-nixpkgs/47096/5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both of these PRs are for different forks of OpenFOAM, each with some fairly significant differences between them. I'm not sure which one is more popular.
@razielgn, we should probably find a consistent way to make the binaries accessible across forks before these PRs are merged. I'm using a shell alias to load the OpenFOAM environment similar to how arch does it, as the OpenFOAM bashrc is quite large, but I would be open to other methods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, unfortunately there are two forks of OpenFOAM.
@gusgibbon You talked about having the two collections of binaries available. Do you mean in the same $PATH? I wouldn't expect it to be a common use case. I mean, you either use one or the other, right?
In my derivation, to get around the fact that OpenFOAM's binaries require that obscure env setup via etc/bashrc
(if I recall the name correctly), I'm wrapping each one in order for that initialisation to take place transparently. It might not be the best solution, for sure there's a tiny amount of time wasted on every invocation, but in my opinion it provides a "least surprise" effect.
That said, @SomeoneSerge, I just yesterday found out that a dependency's derivation (scotch) has recently been split out into $out and $dev, my derivation still compiles but fails to see it and use it, resulting in a crash at runtime on a subset of binaries. This is due to the rigidness and frankly awkward build system that OpenFOAM implements. I still need to figure out how to fix this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I apologize, I worded that unclearly.
What I was getting at is specifically that bashrc environment setup you mentioned, which I believe is the same for both forks. The NixOS module in this PR creates a "ofoam" shell alias to load that bashrc, as opposed to your wrapping technique which places binaries directly in $PATH and loads the bashrc upon execution. I suggest that we decide on one of these two methods for both packages, as currently there would be a NixOS module that only works with the org fork, which I imagine would be confusing to users.
My argument for the shell alias is that it provides much more flexibility if multiple versions are installed, which I imagine is a somewhat common use case given the prevalence of custom solvers/boundary conditions/etc. Additionally it allows for two forks to be used simultaneously. Personally, I use the com fork occasionally for meshing, however as you said this is probably not a typical use case. The shell alias is less intuitive than your approach, however I think the pros outweigh the cons, and considering the OpenFOAM install instructions for other distros guide you through using the bashrc environment setup, I don't think many users would get lost with the shell alias. Regardless, I'm not very opinionated on this, and would be willing to help adjust the packages in either circumstance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My opinion is still uninformed, but generally speaking the wrapper approach sounds more flexible in terms of multi-tenancy and less invasive?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An assumption of mine: if people would decide to use OpenFOAM through nixpkgs instead of going for the official debs, it means they are supposed to be at least somewhat familiar with the nixpkgs way of things.
Now a few thoughts:
- Supporting simultaneous multiple versions probably could solved at a higher level, meaning through nix you can mix and match by setting up
$PATH
s to accomodate one own's personal needs. - It is true that the "official" way of using OpenFOAM is to first go through
source etc/bashrc
, then invoke bash functions/binaries. This contrasts with my initial assumption above, meaning that through documentation we can show how to use it, so that it better integrates in the nixpkgs ecosystem. This covers the development of OpenFOAM extensions as well, as I documented in my PR. - Elaborating on the wrapper approach, as @SomeoneSerge wrote, it's more flexible because each invocation of a binary is self-contained and not invasive. It means that the case of using one binary from version X and one binary from version Y is totally fine and wouldn't create issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that you mention it, I think you are right in that using multiple versions should just be done through nix. I'll rewrite to use the wrapping method when I have time.
Description of changes
Added a new package: openfoam-org
openfoam.org fork of OpenFOAM
Added a new NixOS module: programs.openfoam
Creates a
ofoam
shell alias for loading the OpenFOAM environmentCloses #131486.
Closes #346976.
Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.