1{ lib
2, fetchFromGitHub
3, buildPythonPackage
4, pythonOlder
5 # Mitmproxy requirements
6, asgiref
7, blinker
8, brotli
9, certifi
10, cryptography
11, flask
12, h11
13, h2
14, hyperframe
15, kaitaistruct
16, ldap3
17, mitmproxy-wireguard
18, msgpack
19, passlib
20, protobuf
21, publicsuffix2
22, pyopenssl
23, pyparsing
24, pyperclip
25, ruamel-yaml
26, setuptools
27, sortedcontainers
28, tornado
29, urwid
30, wsproto
31, zstandard
32 # Additional check requirements
33, hypothesis
34, parver
35, pytest-asyncio
36, pytest-timeout
37, pytest-xdist
38, pytestCheckHook
39, requests
40}:
41
42buildPythonPackage rec {
43 pname = "mitmproxy";
44 version = "9.0.1";
45 disabled = pythonOlder "3.9";
46
47 src = fetchFromGitHub {
48 owner = "mitmproxy";
49 repo = "mitmproxy";
50 rev = "refs/tags/${version}";
51 hash = "sha256-CINKvRnBspciS+wefJB8gzBE13L8CjbYCkmLmTTeYlA=";
52 };
53
54 propagatedBuildInputs = [
55 setuptools
56 # setup.py
57 asgiref
58 blinker
59 brotli
60 certifi
61 cryptography
62 flask
63 h11
64 h2
65 hyperframe
66 kaitaistruct
67 ldap3
68 mitmproxy-wireguard
69 msgpack
70 passlib
71 protobuf
72 pyopenssl
73 publicsuffix2
74 pyparsing
75 pyperclip
76 ruamel-yaml
77 sortedcontainers
78 tornado
79 urwid
80 wsproto
81 zstandard
82 ];
83
84 nativeCheckInputs = [
85 hypothesis
86 parver
87 pytest-asyncio
88 pytest-timeout
89 pytest-xdist
90 pytestCheckHook
91 requests
92 ];
93
94 postPatch = ''
95 # remove dependency constraints
96 sed 's/>=\([0-9]\.\?\)\+\( \?, \?<\([0-9]\.\?\)\+\)\?\( \?, \?!=\([0-9]\.\?\)\+\)\?//' -i setup.py
97 '';
98
99 preCheck = ''
100 export HOME=$(mktemp -d)
101 '';
102
103 disabledTests = [
104 # Tests require a git repository
105 "test_get_version"
106 # https://github.com/mitmproxy/mitmproxy/commit/36ebf11916704b3cdaf4be840eaafa66a115ac03
107 # Tests require terminal
108 "test_integration"
109 "test_contentview_flowview"
110 "test_flowview"
111 # ValueError: Exceeds the limit (4300) for integer string conversion
112 "test_roundtrip_big_integer"
113
114 "test_wireguard"
115 "test_commands_exist"
116 "test_statusbar"
117 ];
118
119 disabledTestPaths = [
120 # teardown of half the tests broken
121 "test/mitmproxy/addons/test_onboarding.py"
122 ];
123
124 dontUsePytestXdist = true;
125
126 pythonImportsCheck = [ "mitmproxy" ];
127
128 meta = with lib; {
129 description = "Man-in-the-middle proxy";
130 homepage = "https://mitmproxy.org/";
131 license = licenses.mit;
132 maintainers = with maintainers; [ kamilchm SuperSandro2000 ];
133 };
134}