1{
2 lib,
3 python3,
4 fetchFromGitHub,
5 gdk-pixbuf,
6 adwaita-icon-theme,
7 gpsbabel,
8 glib-networking,
9 glibcLocales,
10 gobject-introspection,
11 gtk3,
12 perl,
13 sqlite,
14 tzdata,
15 webkitgtk_4_0,
16 wrapGAppsHook3,
17 xvfb-run,
18}:
19
20let
21 python = python3.override {
22 self = python;
23 packageOverrides = (
24 self: super: {
25 matplotlib = super.matplotlib.override {
26 enableGtk3 = true;
27 };
28 }
29 );
30 };
31in
32python.pkgs.buildPythonApplication rec {
33 pname = "pytrainer";
34 version = "2.2.1";
35 pyproject = true;
36
37 src = fetchFromGitHub {
38 owner = "pytrainer";
39 repo = "pytrainer";
40 rev = "v${version}";
41 hash = "sha256-t61vHVTKN5KsjrgbhzljB7UZdRask7qfYISd+++QbV0=";
42 };
43
44 build-system = with python3.pkgs; [ setuptools ];
45
46 dependencies = with python.pkgs; [
47 sqlalchemy
48 python-dateutil
49 matplotlib
50 lxml
51 requests
52 gdal
53 ];
54
55 nativeBuildInputs = [
56 gobject-introspection
57 wrapGAppsHook3
58 ];
59
60 buildInputs = [
61 sqlite
62 gtk3
63 webkitgtk_4_0
64 glib-networking
65 adwaita-icon-theme
66 gdk-pixbuf
67 ];
68
69 makeWrapperArgs = [
70 "--prefix"
71 "PATH"
72 ":"
73 (lib.makeBinPath [
74 perl
75 gpsbabel
76 ])
77 ];
78
79 nativeCheckInputs = [
80 glibcLocales
81 perl
82 xvfb-run
83 ]
84 ++ (with python.pkgs; [
85 mysqlclient
86 psycopg2
87 ]);
88
89 postPatch = ''
90 substituteInPlace pytrainer/platform.py \
91 --replace-fail 'sys.prefix' "\"$out\""
92 '';
93
94 checkPhase = ''
95 env \
96 HOME=$TEMPDIR \
97 TZDIR=${tzdata}/share/zoneinfo \
98 TZ=Europe/Kaliningrad \
99 LC_TIME=C \
100 xvfb-run -s '-screen 0 800x600x24' \
101 ${python.interpreter} -m unittest
102 '';
103
104 meta = with lib; {
105 homepage = "https://github.com/pytrainer/pytrainer";
106 description = "Application for logging and graphing sporting excursions";
107 mainProgram = "pytrainer";
108 maintainers = with maintainers; [
109 rycee
110 dotlambda
111 ];
112 license = licenses.gpl2Plus;
113 platforms = platforms.linux;
114 };
115}