diff options
-rw-r--r-- | pkgs/applications/science/molecular-dynamics/lammps/default.nix | 28 | ||||
-rw-r--r-- | pkgs/top-level/all-packages.nix | 6 |
2 files changed, 25 insertions, 9 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 = '' diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 98e03c64d920..f8dbd2c8b23f 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -38314,7 +38314,11 @@ with pkgs; fftw = fftw; }; - lammps-mpi = lowPrio (lammps.override { withMPI = true; }); + lammps-mpi = lowPrio (lammps.override { + extraBuildInputs = [ + mpi + ]; + }); gromacs = callPackage ../applications/science/molecular-dynamics/gromacs { singlePrec = true; |