1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 setuptools,
6 wheel,
7 qt5,
8 python,
9 dill,
10 matplotlib,
11 networkx,
12 numpy,
13 pandas,
14 pillow,
15 pyqt5,
16 scipy,
17 tqdm,
18}:
19buildPythonPackage rec {
20 pname = "uxsim";
21 version = "1.10.0";
22 pyproject = true;
23
24 src = fetchFromGitHub {
25 owner = "toruseo";
26 repo = "UXsim";
27 tag = "v${version}";
28 hash = "sha256-4ZN52atcAbT6z9GzV4tOA3IiDYu+v4i3NHfauMPwMJ0=";
29 };
30
31 patches = [ ./add-qt-plugin-path-to-env.patch ];
32
33 build-system = [ setuptools ];
34
35 dependencies = [
36 dill
37 matplotlib
38 networkx
39 numpy
40 pandas
41 pillow
42 pyqt5
43 scipy
44 tqdm
45 ];
46
47 pythonImportsCheck = [ "uxsim" ];
48
49 # QT_PLUGIN_PATH is required to be set for the program to produce its images
50 # our patch sets it to $NIX_QT_PLUGIN_PATH if QT_PLUGIN_PATH is not set
51 # and here we replace this string with the actual path to qt plugins
52 postInstall = ''
53 substituteInPlace $out/${python.sitePackages}/uxsim/__init__.py \
54 --replace-fail '$NIX_QT_PLUGIN_PATH' '${qt5.qtbase.bin}/${qt5.qtbase.qtPluginPrefix}'
55 '';
56
57 meta = with lib; {
58 changelog = "https://github.com/toruseo/UXsim/releases/tag/${src.tag}";
59 description = "Vehicular traffic flow simulator in road network, written in pure Python";
60 homepage = "https://github.com/toruseo/UXsim";
61 license = licenses.mit;
62 maintainers = with maintainers; [ vinnymeller ];
63 };
64}