numsa: init at 0.2.0

This commit is contained in:
Gaetan Lepage
2026-06-22 13:45:59 +00:00
parent 3a0f47ee53
commit 0856fdbe31
2 changed files with 137 additions and 0 deletions
+107
View File
@@ -0,0 +1,107 @@
{
lib,
stdenv,
fetchFromGitHub,
buildType ? "meson",
# nativeBuildInputs
asciidoctor,
gfortran,
pkg-config,
python3,
# meson:
meson,
ninja,
# cmake:
cmake,
# buildInputs
mstore,
test-drive,
blas,
lapack,
# propagatedBuildInputs
mctc-lib,
# passthru
nix-update-script,
}:
assert (
builtins.elem buildType [
"meson"
"cmake"
]
);
stdenv.mkDerivation (finalAttrs: {
pname = "numsa";
version = "0.2.0";
__structuredAttrs = true;
strictDeps = true;
src = fetchFromGitHub {
owner = "grimme-lab";
repo = "numsa";
tag = "v${finalAttrs.version}";
hash = "sha256-PAzxeYyg/9P/3YFxKzM4ZFm2xT0AGap6q8/ei8jD/3M=";
};
outputs = [
"out"
"dev"
];
patches = [
# Use nixpkgs' mstore instead of building it from source
./use-external-mstore.patch
];
postPatch = ''
substituteInPlace config/install-mod.py \
--replace-fail "/usr/bin/env python" "${lib.getExe python3}"
'';
nativeBuildInputs = [
asciidoctor
gfortran
pkg-config
python3
]
++ lib.optionals (buildType == "meson") [
meson
ninja
]
++ lib.optionals (buildType == "cmake") [
cmake
];
buildInputs = [
blas
lapack
mstore # only needed to build the bundled test suite
test-drive
];
propagatedBuildInputs = [
mctc-lib
];
doCheck = true;
preCheck = ''
export OMP_NUM_THREADS=2
'';
passthru.updateScript = nix-update-script { };
meta = {
description = "Solvent accessible surface area calculation";
homepage = "https://github.com/grimme-lab/numsa";
changelog = "https://github.com/grimme-lab/numsa/releases/tag/${finalAttrs.src.tag}";
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [ GaetanLepage ];
platforms = lib.platforms.linux;
};
})
@@ -0,0 +1,30 @@
diff --git a/test/meson.build b/test/meson.build
index c60e4a4..7da0216 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -14,20 +14,21 @@
# You should have received a copy of the GNU Lesser General Public License
# along with numsa. If not, see <https://www.gnu.org/licenses/>.
-# Create mstore as subproject for testing
-mstore_prj = subproject(
+# Find the molecular structure store, preferring an external installation
+# (e.g. via pkg-config) and falling back to building it as a subproject
+mstore_dep = dependency(
'mstore',
version: '>=0.1',
+ fallback: ['mstore', 'mstore_dep'],
required: not meson.is_subproject(),
default_options: [
'default_library=static',
],
)
# If we do not find mstore and are a subproject, we just skip testing
-if not mstore_prj.found()
+if not mstore_dep.found()
subdir_done()
endif
-mstore_dep = mstore_prj.get_variable('mstore_dep')
tests = [
'surface',