1{ 2 lib, 3 aioquic, 4 argon2-cffi, 5 asgiref, 6 brotli, 7 buildPythonPackage, 8 certifi, 9 cryptography, 10 fetchFromGitHub, 11 flask, 12 h11, 13 h2, 14 hyperframe, 15 hypothesis, 16 kaitaistruct, 17 ldap3, 18 mitmproxy-linux, 19 mitmproxy-rs, 20 msgpack, 21 passlib, 22 publicsuffix2, 23 pyopenssl, 24 pyparsing, 25 pyperclip, 26 pytest-asyncio, 27 pytest-timeout, 28 pytest-xdist, 29 pytestCheckHook, 30 requests, 31 ruamel-yaml, 32 setuptools, 33 sortedcontainers, 34 stdenv, 35 tornado, 36 urwid, 37 wsproto, 38 zstandard, 39}: 40 41buildPythonPackage rec { 42 pname = "mitmproxy"; 43 version = "12.0.1"; 44 pyproject = true; 45 46 src = fetchFromGitHub { 47 owner = "mitmproxy"; 48 repo = "mitmproxy"; 49 tag = "v${version}"; 50 hash = "sha256-BKT/qBWlfShAveL1KY5XXgQjhxR3Vr4zoJwiRxtBJkE="; 51 }; 52 53 pythonRelaxDeps = [ 54 "h11" # https://github.com/NixOS/nixpkgs/pull/399393 55 "h2" 56 "passlib" 57 "typing-extensions" # https://github.com/NixOS/nixpkgs/pull/397082 58 ]; 59 60 build-system = [ setuptools ]; 61 62 dependencies = [ 63 aioquic 64 argon2-cffi 65 asgiref 66 brotli 67 certifi 68 cryptography 69 flask 70 h11 71 h2 72 hyperframe 73 kaitaistruct 74 ldap3 75 mitmproxy-rs 76 msgpack 77 passlib 78 publicsuffix2 79 pyopenssl 80 pyparsing 81 pyperclip 82 ruamel-yaml 83 sortedcontainers 84 tornado 85 urwid 86 wsproto 87 zstandard 88 ]; 89 90 nativeCheckInputs = [ 91 hypothesis 92 pytest-asyncio 93 pytest-timeout 94 pytest-xdist 95 pytestCheckHook 96 requests 97 ]; 98 99 __darwinAllowLocalNetworking = true; 100 101 preCheck = '' 102 export HOME=$(mktemp -d) 103 ''; 104 105 disabledTests = [ 106 # Tests require a git repository 107 "test_get_version" 108 # https://github.com/mitmproxy/mitmproxy/commit/36ebf11916704b3cdaf4be840eaafa66a115ac03 109 # Tests require terminal 110 "test_commands_exist" 111 "test_contentview_flowview" 112 "test_flowview" 113 "test_get_hex_editor" 114 "test_integration" 115 "test_spawn_editor" 116 "test_statusbar" 117 # FileNotFoundError: [Errno 2] No such file or directory 118 # likely wireguard is also not working in the sandbox 119 "test_tun_mode" 120 "test_wireguard" 121 # test require a DNS server 122 # RuntimeError: failed to get dns servers: io error: entity not found 123 "test_errorcheck" 124 "test_errorcheck" 125 "test_dns" 126 "test_order" 127 ]; 128 129 disabledTestPaths = [ 130 # test require a DNS server 131 # RuntimeError: failed to get dns servers: io error: entity not found 132 "test/mitmproxy/addons/test_dns_resolver.py" 133 "test/mitmproxy/tools/test_dump.py" 134 "test/mitmproxy/tools/test_main.py" 135 "test/mitmproxy/tools/web/test_app.py" 136 "test/mitmproxy/tools/web/test_app.py" # 2 out of 31 tests work 137 "test/mitmproxy/tools/web/test_master.py" 138 ]; 139 140 dontUsePytestXdist = true; 141 142 pythonImportsCheck = [ "mitmproxy" ]; 143 144 meta = with lib; { 145 description = "Man-in-the-middle proxy"; 146 homepage = "https://mitmproxy.org/"; 147 changelog = "https://github.com/mitmproxy/mitmproxy/blob/${src.tag}/CHANGELOG.md"; 148 license = licenses.mit; 149 maintainers = with maintainers; [ SuperSandro2000 ]; 150 }; 151}