1{ lib
2, stdenv
3, buildPythonPackage
4, fetchFromGitHub
5, rustPlatform
6, darwin
7, libiconv
8, mitmproxy-macos
9}:
10
11buildPythonPackage rec {
12 pname = "mitmproxy-rs";
13 version = "0.4.1";
14 pyproject = true;
15
16 src = fetchFromGitHub {
17 owner = "mitmproxy";
18 repo = "mitmproxy_rs";
19 rev = version;
20 hash = "sha256-Vc7ez/W40CefO2ZLAHot14p478pDPtQor865675vCtI=";
21 };
22
23 cargoDeps = rustPlatform.importCargoLock {
24 lockFile = ./Cargo.lock;
25 outputHashes = {
26 "internet-packet-0.1.0" = "sha256-VtEuCE1sulBIFVymh7YW7VHCuIBjtb6tHoPz2tjxX+Q=";
27 };
28 };
29
30 buildAndTestSubdir = "mitmproxy-rs";
31
32 nativeBuildInputs = [
33 rustPlatform.cargoSetupHook
34 rustPlatform.maturinBuildHook
35 ];
36
37 buildInputs = lib.optionals stdenv.isDarwin [
38 darwin.apple_sdk.frameworks.Security
39 libiconv
40 mitmproxy-macos
41 ];
42
43 pythonImportsCheck = [ "mitmproxy_rs" ];
44
45 meta = with lib; {
46 description = "The Rust bits in mitmproxy";
47 homepage = "https://github.com/mitmproxy/mitmproxy_rs";
48 changelog = "https://github.com/mitmproxy/mitmproxy_rs/blob/${src.rev}/CHANGELOG.md";
49 license = licenses.mit;
50 maintainers = with maintainers; [ fab ];
51 platforms = platforms.all;
52 };
53}