diff options
author | Doron Behar <doron.behar@gmail.com> | 2023-06-20 12:59:55 +0300 |
---|---|---|
committer | Doron Behar <doron.behar@gmail.com> | 2023-06-21 23:03:57 +0300 |
commit | 4a64b8d9f3050e0880a2e0c16d67a6461f55a67d (patch) | |
tree | 17e6e614447978a18c00e158b9b456b60fcb4a22 /pkgs/applications/science/molecular-dynamics | |
parent | 6764cc2a0909396c435ee4c915c72c7db1be6bae (diff) |
lammps-mpi: Use a generic extraBuildInputs instead of withMpi
Add support for `extraCmakeFlags` as well and add `pkg-config` to
`nativeBuildInputs`.
Diffstat (limited to 'pkgs/applications/science/molecular-dynamics')
-rw-r--r-- | pkgs/applications/science/molecular-dynamics/lammps/default.nix | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/pkgs/applications/science/molecular-dynamics/lammps/default.nix b/pkgs/applications/science/molecular-dynamics/lammps/default.nix index e8ad77f7d4dc..a1c0f60ffa01 100644 --- a/pkgs/applications/science/molecular-dynamics/lammps/default.nix +++ b/pkgs/applications/science/molecular-dynamics/lammps/default.nix @@ -6,11 +6,12 @@ , fftw , blas , lapack -, withMPI ? false -, mpi , cmake +, pkg-config # Available list of packages can be found near here: -# https://github.com/lammps/lammps/blob/develop/cmake/CMakeLists.txt#L222 +# +# - https://github.com/lammps/lammps/blob/develop/cmake/CMakeLists.txt#L222 +# - https://docs.lammps.org/Build_extras.html , packages ? { ASPHERE = true; BODY = true; @@ -35,6 +36,10 @@ SRD = true; REAXFF = true; } +# Extra cmakeFlags to add as "-D${attr}=${value}" +, extraCmakeFlags ? {} +# Extra `buildInputs` - meant for packages that require more inputs +, extraBuildInputs ? [] }: stdenv.mkDerivation rec { @@ -53,14 +58,22 @@ stdenv.mkDerivation rec { ''; nativeBuildInputs = [ cmake + pkg-config ]; passthru = { - inherit mpi; + # Remove these at some point - perhaps after release 23.11. See discussion at: + # https://github.com/NixOS/nixpkgs/pull/238771#discussion_r1235459961 + mpi = throw "`lammps-mpi.passthru.mpi` was removed in favor of `extraBuildInputs`"; inherit packages; + inherit extraCmakeFlags; + inherit extraBuildInputs; }; cmakeFlags = [ - ] ++ (builtins.map (p: "-DPKG_${p}=ON") (builtins.attrNames (lib.filterAttrs (n: v: v) packages))); + ] + ++ (builtins.map (p: "-DPKG_${p}=ON") (builtins.attrNames (lib.filterAttrs (n: v: v) packages))) + ++ (lib.mapAttrsToList (n: v: "-D${n}=${v}") extraCmakeFlags) + ; buildInputs = [ fftw @@ -68,9 +81,8 @@ stdenv.mkDerivation rec { blas lapack gzip - ] ++ lib.optionals withMPI [ - mpi - ]; + ] ++ extraBuildInputs + ; # For backwards compatibility postInstall = '' |