nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 autoreconfHook,
6 makeWrapper,
7 fftw,
8 lapack,
9 openblas,
10 runCommandLocal,
11 raspa,
12 raspa-data,
13}:
14stdenv.mkDerivation rec {
15 pname = "raspa";
16 version = "2.0.47";
17
18 src = fetchFromGitHub {
19 owner = "iRASPA";
20 repo = "RASPA2";
21 rev = "v${version}";
22 hash = "sha256-i8Y+pejiOuyPNJto+/0CmRoAnMljCrnDFx8qDh4I/68=";
23 };
24
25 nativeBuildInputs = [
26 autoreconfHook
27 makeWrapper
28 ];
29
30 buildInputs = [
31 fftw
32 lapack
33 openblas
34 ];
35
36 # Prepare for the Python binding packaging.
37 strictDeps = true;
38
39 enableParallelBuilding = true;
40
41 preAutoreconf = ''
42 mkdir "m4"
43 '';
44
45 postAutoreconf = ''
46 automake --add-missing
47 autoconf
48 '';
49
50 doCheck = true;
51
52 # Wrap with RASPA_DIR
53 # so that users can run $out/bin/simulate directly
54 # without the need of a `run` script.
55 postInstall = ''
56 wrapProgram "$out/bin/simulate" \
57 --set RASPA_DIR "$out"
58 '';
59
60 passthru.tests.run-an-example = runCommandLocal "raspa-test-run-an-example" { } ''
61 set -eu -o pipefail
62 exampleDir="${raspa-data}/share/raspa/examples/Basic/1_MC_Methane_in_Box"
63 exampleDirWritable="$(basename "$exampleDir")"
64 cp -rT "$exampleDir" "./$exampleDirWritable"
65 chmod u+rw -R "$exampleDirWritable"
66 cd "$exampleDirWritable"
67 ${raspa}/bin/simulate
68 touch "$out"
69 '';
70
71 meta = with lib; {
72 description = "General purpose classical molecular simulation package";
73 homepage = "https://iraspa.org/raspa/";
74 license = licenses.mit;
75 platforms = platforms.all;
76 maintainers = with maintainers; [ ShamrockLee ];
77 mainProgram = "simulate";
78 };
79}