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