14 # Available list of packages can be found near here:
16 # - https://github.com/lammps/lammps/blob/develop/cmake/CMakeLists.txt#L222
17 # - https://docs.lammps.org/Build_extras.html
43 # Extra cmakeFlags to add as "-D${attr}=${value}"
44 extraCmakeFlags ? { },
45 # Extra `buildInputs` - meant for packages that require more inputs
46 extraBuildInputs ? [ ],
49 stdenv.mkDerivation (finalAttrs: {
50 # LAMMPS has weird versioning convention. Updates should go smoothly with:
51 # nix-update --commit lammps --version-regex 'stable_(.*)'
52 version = "29Aug2024_update1";
55 src = fetchFromGitHub {
58 rev = "stable_${finalAttrs.version}";
59 hash = "sha256-B2oMs9bVYO+G3yL1DGJVK/INIfANMDREV7AtC4kH3H8=";
67 # Although not always needed, it is needed if cmakeFlags include
68 # GPU_API=cuda, and it doesn't users that don't enable the GPU package.
74 inherit extraCmakeFlags;
75 inherit extraBuildInputs;
79 (lib.cmakeBool "BUILD_SHARED_LIBS" true)
81 ++ (lib.mapAttrsToList (n: v: lib.cmakeBool "PKG_${n}" v) packages)
82 ++ (lib.mapAttrsToList (n: v: "-D${n}=${v}") extraCmakeFlags);
92 ++ lib.optionals packages.PYTHON [ python3 ]
96 # For backwards compatibility
97 ln -s $out/bin/lmp $out/bin/lmp_serial
98 # Install vim and neovim plugin
99 install -Dm644 ../../tools/vim/lammps.vim $out/share/vim-plugins/lammps/syntax/lammps.vim
100 install -Dm644 ../../tools/vim/filetype.vim $out/share/vim-plugins/lammps/ftdetect/lammps.vim
101 mkdir -p $out/share/nvim
102 ln -s $out/share/vim-plugins/lammps $out/share/nvim/site
106 description = "Classical Molecular Dynamics simulation code";
108 LAMMPS is a classical molecular dynamics simulation code designed to
109 run efficiently on parallel computers. It was developed at Sandia
110 National Laboratories, a US Department of Energy facility, with
111 funding from the DOE. It is an open-source code, distributed freely
112 under the terms of the GNU Public License (GPL).
114 homepage = "https://www.lammps.org";
115 license = lib.licenses.gpl2Only;
116 platforms = lib.platforms.linux;
117 # compiling lammps with 64 bit support blas and lapack might cause runtime
118 # segfaults. In anycase both blas and lapack should have the same #bits
120 broken = (blas.isILP64 && lapack.isILP64);
121 maintainers = with lib.maintainers; [