Skip to content
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

lammps and python312Packages.lammps related fixes #342532

Merged
merged 4 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,46 +1,49 @@
{ lib
, stdenv
, fetchFromGitHub
, libpng
, gzip
, fftw
, blas
, lapack
, cmake
, autoAddDriverRunpath
, pkg-config
# Available list of packages can be found near here:
#
# - https://github.com/lammps/lammps/blob/develop/cmake/CMakeLists.txt#L222
# - https://docs.lammps.org/Build_extras.html
, packages ? {
ASPHERE = true;
BODY = true;
CLASS2 = true;
COLLOID = true;
COMPRESS = true;
CORESHELL = true;
DIPOLE = true;
GRANULAR = true;
KSPACE = true;
MANYBODY = true;
MC = true;
MISC = true;
MOLECULE = true;
OPT = true;
PERI = true;
QEQ = true;
REPLICA = true;
RIGID = true;
SHOCK = true;
ML-SNAP = true;
SRD = true;
REAXFF = true;
}
# Extra cmakeFlags to add as "-D${attr}=${value}"
, extraCmakeFlags ? {}
# Extra `buildInputs` - meant for packages that require more inputs
, extraBuildInputs ? []
{
lib,
stdenv,
fetchFromGitHub,
libpng,
gzip,
fftw,
blas,
lapack,
python3,
cmake,
autoAddDriverRunpath,
pkg-config,
# Available list of packages can be found near here:
#
# - https://github.com/lammps/lammps/blob/develop/cmake/CMakeLists.txt#L222
# - https://docs.lammps.org/Build_extras.html
packages ? {
ASPHERE = true;
BODY = true;
CLASS2 = true;
COLLOID = true;
COMPRESS = true;
CORESHELL = true;
DIPOLE = true;
GRANULAR = true;
KSPACE = true;
MANYBODY = true;
MC = true;
MISC = true;
MOLECULE = true;
OPT = true;
PERI = true;
QEQ = true;
REPLICA = true;
RIGID = true;
SHOCK = true;
ML-SNAP = true;
SRD = true;
REAXFF = true;
PYTHON = true;
},
# Extra cmakeFlags to add as "-D${attr}=${value}"
extraCmakeFlags ? { },
# Extra `buildInputs` - meant for packages that require more inputs
extraBuildInputs ? [ ],
}:

stdenv.mkDerivation (finalAttrs: {
Expand Down Expand Up @@ -74,21 +77,20 @@ stdenv.mkDerivation (finalAttrs: {
inherit extraCmakeFlags;
inherit extraBuildInputs;
};
cmakeFlags = [
(lib.cmakeBool "BUILD_SHARED_LIBS" true)
]
++ (lib.mapAttrsToList (n: v: lib.cmakeBool "PKG_${n}" v) packages)
++ (lib.mapAttrsToList (n: v: "-D${n}=${v}") extraCmakeFlags)
;
cmakeFlags =
[
(lib.cmakeBool "BUILD_SHARED_LIBS" true)
]
++ (lib.mapAttrsToList (n: v: lib.cmakeBool "PKG_${n}" v) packages)
++ (lib.mapAttrsToList (n: v: "-D${n}=${v}") extraCmakeFlags);

buildInputs = [
fftw
libpng
blas
lapack
gzip
] ++ extraBuildInputs
;
] ++ lib.optionals packages.PYTHON [ python3 ] ++ extraBuildInputs;

postInstall = ''
# For backwards compatibility
Expand All @@ -108,7 +110,7 @@ stdenv.mkDerivation (finalAttrs: {
National Laboratories, a US Department of Energy facility, with
funding from the DOE. It is an open-source code, distributed freely
under the terms of the GNU Public License (GPL).
'';
'';
homepage = "https://www.lammps.org";
license = lib.licenses.gpl2Only;
platforms = lib.platforms.linux;
Expand Down
3 changes: 3 additions & 0 deletions pkgs/development/python-modules/lammps/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ buildPythonPackage {
inherit (lammps) pname version src;

env = {
# Needed for tests
inherit LAMMPS_SHARED_LIB;
};
# Don't perform checks if GPU is enabled - because libcuda.so cannot be opened in the sandbox
doCheck = if lammps.passthru.packages ? GPU then !lammps.passthru.packages.GPU else true;
preConfigure = ''
cd python
# Upstream assumes that the shared library is located in the same directory
Expand Down
4 changes: 0 additions & 4 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36556,10 +36556,6 @@ with pkgs;

dl-poly-classic-mpi = callPackage ../applications/science/molecular-dynamics/dl-poly-classic { };

lammps = callPackage ../applications/science/molecular-dynamics/lammps {
fftw = fftw;
};

lammps-mpi = lowPrio (lammps.override {
extraBuildInputs = [
mpi
Expand Down