1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 setuptools,
6 wheel,
7 qt5,
8 python,
9 dill,
10 matplotlib,
11 numpy,
12 pandas,
13 pillow,
14 pyqt5,
15 scipy,
16 tqdm,
17}:
18buildPythonPackage rec {
19 pname = "uxsim";
20 version = "1.7.2";
21 pyproject = true;
22
23 src = fetchFromGitHub {
24 owner = "toruseo";
25 repo = "UXsim";
26 tag = "v${version}";
27 hash = "sha256-5up44edivGWj0nQOOL3+lqjdOBBfxk01nFokG5ht+5Y=";
28 };
29
30 patches = [ ./add-qt-plugin-path-to-env.patch ];
31
32 nativeBuildInputs = [
33 setuptools
34 wheel
35 ];
36
37 propagatedBuildInputs = [
38 dill
39 matplotlib
40 numpy
41 pandas
42 pillow
43 pyqt5
44 scipy
45 tqdm
46 ];
47
48 pythonImportsCheck = [ "uxsim" ];
49
50 # QT_PLUGIN_PATH is required to be set for the program to produce its images
51 # our patch sets it to $NIX_QT_PLUGIN_PATH if QT_PLUGIN_PATH is not set
52 # and here we replace this string with the actual path to qt plugins
53 postInstall = ''
54 substituteInPlace $out/${python.sitePackages}/uxsim/__init__.py \
55 --replace-fail '$NIX_QT_PLUGIN_PATH' '${qt5.qtbase.bin}/${qt5.qtbase.qtPluginPrefix}'
56 '';
57
58 meta = with lib; {
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}