nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 buildPythonPackage,
3 python,
4 simple-dftd3,
5 cffi,
6 numpy,
7 toml,
8 qcengine,
9 pyscf,
10 ase,
11 pytestCheckHook,
12}:
13
14buildPythonPackage {
15 format = "setuptools";
16 inherit (simple-dftd3)
17 pname
18 version
19 src
20 meta
21 ;
22
23 # pytest is also required for installation, not only testing
24 nativeBuildInputs = [ pytestCheckHook ];
25
26 buildInputs = [ simple-dftd3 ];
27
28 propagatedBuildInputs = [
29 cffi
30 numpy
31 toml
32 ];
33
34 checkInputs = [
35 ase
36 qcengine
37 pyscf
38 ];
39
40 preConfigure = ''
41 cd python
42 '';
43
44 # The compiled CFFI is not placed correctly before pytest invocation
45 preCheck = ''
46 find . -name "_libdftd3*" -exec cp {} ./dftd3/. \;
47 '';
48
49 pythonImportsCheck = [ "dftd3" ];
50 doCheck = true;
51
52 # Parameters need to be present in the python site packages directory, but they
53 # are originally only present in the fortran package. This is a consequence of
54 # building the python bindings separately from the fortran library.
55 postInstall = ''
56 ln -s ${simple-dftd3}/share/s-dftd3/parameters.toml $out/${python.sitePackages}/dftd3/.
57 '';
58}