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 lib,
, fetchFromGitHub stdenv,
, libpng fetchFromGitHub,
, gzip libpng,
, fftw gzip,
, blas fftw,
, lapack blas,
, python3 lapack,
, cmake python3,
, autoAddDriverRunpath cmake,
, pkg-config autoAddDriverRunpath,
# Available list of packages can be found near here: 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 # - https://github.com/lammps/lammps/blob/develop/cmake/CMakeLists.txt#L222
, packages ? { # - https://docs.lammps.org/Build_extras.html
ASPHERE = true; packages ? {
BODY = true; ASPHERE = true;
CLASS2 = true; BODY = true;
COLLOID = true; CLASS2 = true;
COMPRESS = true; COLLOID = true;
CORESHELL = true; COMPRESS = true;
DIPOLE = true; CORESHELL = true;
GRANULAR = true; DIPOLE = true;
KSPACE = true; GRANULAR = true;
MANYBODY = true; KSPACE = true;
MC = true; MANYBODY = true;
MISC = true; MC = true;
MOLECULE = true; MISC = true;
OPT = true; MOLECULE = true;
PERI = true; OPT = true;
QEQ = true; PERI = true;
REPLICA = true; QEQ = true;
RIGID = true; REPLICA = true;
SHOCK = true; RIGID = true;
ML-SNAP = true; SHOCK = true;
SRD = true; ML-SNAP = true;
REAXFF = true; SRD = true;
PYTHON = true; REAXFF = true;
} PYTHON = true;
# Extra cmakeFlags to add as "-D${attr}=${value}" },
, extraCmakeFlags ? {} # Extra cmakeFlags to add as "-D${attr}=${value}"
# Extra `buildInputs` - meant for packages that require more inputs extraCmakeFlags ? { },
, extraBuildInputs ? [] # Extra `buildInputs` - meant for packages that require more inputs
extraBuildInputs ? [ ],
}: }:
stdenv.mkDerivation (finalAttrs: { stdenv.mkDerivation (finalAttrs: {
@ -76,12 +77,12 @@ stdenv.mkDerivation (finalAttrs: {
inherit extraCmakeFlags; inherit extraCmakeFlags;
inherit extraBuildInputs; inherit extraBuildInputs;
}; };
cmakeFlags = [ cmakeFlags =
(lib.cmakeBool "BUILD_SHARED_LIBS" true) [
] (lib.cmakeBool "BUILD_SHARED_LIBS" true)
++ (lib.mapAttrsToList (n: v: lib.cmakeBool "PKG_${n}" v) packages) ]
++ (lib.mapAttrsToList (n: v: "-D${n}=${v}") extraCmakeFlags) ++ (lib.mapAttrsToList (n: v: lib.cmakeBool "PKG_${n}" v) packages)
; ++ (lib.mapAttrsToList (n: v: "-D${n}=${v}") extraCmakeFlags);
buildInputs = [ buildInputs = [
fftw fftw
@ -89,8 +90,7 @@ stdenv.mkDerivation (finalAttrs: {
blas blas
lapack lapack
gzip gzip
] ++ lib.optionals packages.PYTHON [ python3 ] ++ extraBuildInputs ] ++ lib.optionals packages.PYTHON [ python3 ] ++ extraBuildInputs;
;
postInstall = '' postInstall = ''
# For backwards compatibility # For backwards compatibility
@ -110,7 +110,7 @@ stdenv.mkDerivation (finalAttrs: {
National Laboratories, a US Department of Energy facility, with National Laboratories, a US Department of Energy facility, with
funding from the DOE. It is an open-source code, distributed freely funding from the DOE. It is an open-source code, distributed freely
under the terms of the GNU Public License (GPL). under the terms of the GNU Public License (GPL).
''; '';
homepage = "https://www.lammps.org"; homepage = "https://www.lammps.org";
license = lib.licenses.gpl2Only; license = lib.licenses.gpl2Only;
platforms = lib.platforms.linux; platforms = lib.platforms.linux;