1{ buildPythonPackage, lib, fetchFromGitHub, isPy27, nixosTests, fetchpatch, fetchPypi
2, alembic
3, aniso8601
4, Babel
5, blinker
6, click
7, dnspython
8, email_validator
9, flask
10, flask-babel
11, flask-cors
12, flask_mail
13, flask_migrate
14, flask-restful
15, flask_script
16, flask_sqlalchemy
17, flask_wtf
18, debts
19, idna
20, itsdangerous
21, jinja2
22, Mako
23, markupsafe
24, python-dateutil
25, pytz
26, six
27, sqlalchemy
28, sqlalchemy-continuum
29, werkzeug
30, wtforms
31, psycopg2 # optional, for postgresql support
32, flask_testing
33, pytestCheckHook
34}:
35
36# ihatemoney is not really a library. It will only ever be imported
37# by the interpreter of uwsgi. So overrides for its depencies are fine.
38let
39 # https://github.com/spiral-project/ihatemoney/issues/567
40 pinned_wtforms = wtforms.overridePythonAttrs (old: rec {
41 pname = "WTForms";
42 version = "2.2.1";
43 src = fetchPypi {
44 inherit pname version;
45 sha256 = "0q9vkcq6jnnn618h27lx9sas6s9qlg2mv8ja6dn0hy38gwzarnqc";
46 };
47 });
48 pinned_flask_wtf = flask_wtf.override { wtforms = pinned_wtforms; };
49in
50
51buildPythonPackage rec {
52 pname = "ihatemoney";
53 version = "4.2";
54
55 src = fetchFromGitHub {
56 owner = "spiral-project";
57 repo = pname;
58 rev = version;
59 sha256 = "0d4vc6m0jkwlz9ly0hcjghccydvqbldh2jb8yzf94jrgkd5fd7k1";
60 };
61
62 disabled = isPy27;
63
64 patches = [
65 # fix migration on postgresql
66 # remove on next release
67 (fetchpatch {
68 url = "https://github.com/spiral-project/ihatemoney/commit/6129191b26784b895e203fa3eafb89cee7d88b71.patch";
69 sha256 = "0yc24gsih9x3pnh2mhj4v5i71x02dq93a9jd2r8b1limhcl4p1sw";
70 })
71 (fetchpatch {
72 name = "CVE-2020-15120.patch";
73 url = "https://github.com/spiral-project/ihatemoney/commit/8d77cf5d5646e1d2d8ded13f0660638f57e98471.patch";
74 sha256 = "0y855sk3qsbpq7slj876k2ifa1lccc2dccag98pkyaadpz5gbabv";
75 })
76 ];
77
78 postPatch = ''
79 # remove draconian pinning
80 sed -i 's/==.*$//' setup.cfg
81 '';
82
83 propagatedBuildInputs = [
84 alembic
85 aniso8601
86 Babel
87 blinker
88 click
89 dnspython
90 email_validator
91 flask
92 flask-babel
93 flask-cors
94 flask_mail
95 flask_migrate
96 flask-restful
97 flask_script
98 flask_sqlalchemy
99 pinned_flask_wtf
100 idna
101 itsdangerous
102 jinja2
103 Mako
104 markupsafe
105 python-dateutil
106 pytz
107 six
108 sqlalchemy
109 sqlalchemy-continuum
110 werkzeug
111 pinned_wtforms
112 psycopg2
113 debts
114 ];
115
116 checkInputs = [
117 flask_testing pytestCheckHook
118 ];
119
120 pytestFlagsArray = [ "--pyargs ihatemoney.tests.tests" ];
121 disabledTests = [
122 "test_notifications" # requires running service.
123 "test_invite" # requires running service.
124 ];
125
126 passthru.tests = {
127 inherit (nixosTests.ihatemoney) ihatemoney-postgresql ihatemoney-sqlite;
128 };
129
130 meta = with lib; {
131 homepage = "https://ihatemoney.org";
132 description = "A simple shared budget manager web application";
133 license = licenses.beerware;
134 maintainers = [ maintainers.symphorien ];
135 };
136}
137
138