1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 scikit-build-core,
8 cython,
9 oldest-supported-numpy,
10
11 # nativeBuildInputs
12 cmake,
13 ninja,
14
15 # buildInputs
16 tbb_2022,
17 nanobind,
18
19 # dependencies
20 numpy,
21 rowan,
22 scipy,
23 parsnip,
24
25 # tests
26 pytestCheckHook,
27 python,
28 gsd,
29 matplotlib,
30 sympy,
31}:
32
33buildPythonPackage rec {
34 pname = "freud";
35 version = "3.4.0";
36 pyproject = true;
37
38 src = fetchFromGitHub {
39 owner = "glotzerlab";
40 repo = "freud";
41 tag = "v${version}";
42 hash = "sha256-JX3pbzNTj85UTAtWYnDRvtJSjS27qgY/vitaAjmXbjA=";
43 fetchSubmodules = true;
44 };
45
46 # Because we prefer to not `leaveDotGit`, we need to fool upstream into
47 # thinking we left the .git files in the submodules, so cmake won't think we
48 # didn't initialize them. Upstream doesn't support using the system wide
49 # installed version of these libraries, and it's probably aint's worth the
50 # hassle, because upstream also doesn't distribute all of these dependencies'
51 # libraries, and probably it uses only what it needs.
52 preConfigure = ''
53 touch extern/{voro++,fsph,Eigen}/.git
54 '';
55
56 build-system = [
57 scikit-build-core
58 cython
59 oldest-supported-numpy
60 ];
61
62 nativeBuildInputs = [
63 cmake
64 ninja
65 ];
66 dontUseCmakeConfigure = true;
67 buildInputs = [
68 tbb_2022
69 nanobind
70 ];
71
72 dependencies = [
73 numpy
74 rowan
75 scipy
76 parsnip
77 ];
78
79 nativeCheckInputs = [
80 pytestCheckHook
81 gsd
82 matplotlib
83 sympy
84 ];
85 # On top of cd $out due to https://github.com/NixOS/nixpkgs/issues/255262 ,
86 # we need to also copy the tests because otherwise pytest won't find them.
87 preCheck = ''
88 cp -R tests $out/${python.sitePackages}/freud/tests
89 cd $out
90 '';
91
92 pythonImportsCheck = [ "freud" ];
93
94 meta = {
95 description = "Powerful, efficient particle trajectory analysis in scientific Python";
96 homepage = "https://github.com/glotzerlab/freud";
97 changelog = "https://github.com/glotzerlab/freud/blob/${src.tag}/ChangeLog.md";
98 license = lib.licenses.bsd3;
99 maintainers = with lib.maintainers; [ doronbehar ];
100 };
101}