lammps: nixfmt-rfc-style

This commit is contained in:
Doron Behar 2024-09-17 16:18:13 +03:00
parent b9d665c1fc
commit 6ccf3b79a3

View File

@ -1,48 +1,49 @@
{ 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 ? []
{
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: {
@ -76,12 +77,12 @@ 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
@ -89,8 +90,7 @@ stdenv.mkDerivation (finalAttrs: {
blas
lapack
gzip
] ++ lib.optionals packages.PYTHON [ python3 ] ++ extraBuildInputs
;
] ++ lib.optionals packages.PYTHON [ python3 ] ++ extraBuildInputs;
postInstall = ''
# For backwards compatibility
@ -110,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;