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