1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 rustPlatform,
7 darwin,
8 libiconv,
9 mitmproxy,
10 mitmproxy-macos,
11}:
12
13buildPythonPackage rec {
14 pname = "mitmproxy-rs";
15 version = "0.10.7";
16 pyproject = true;
17
18 src = fetchFromGitHub {
19 owner = "mitmproxy";
20 repo = "mitmproxy_rs";
21 rev = "v${version}";
22 hash = "sha256-YRiaslXdpRGJfuZAHQ4zX+6DgH+IPkeyD8RA7TYgmBY=";
23 };
24
25 cargoDeps = rustPlatform.importCargoLock {
26 lockFile = ./Cargo.lock;
27 outputHashes = {
28 "boringtun-0.6.0" = "sha256-fx2lY6q1ZdO5STvf7xnbVG64tn0BC4yWPFy4ICPJgEg=";
29 "smoltcp-0.11.0" = "sha256-KC9nTKd2gfZ1ICjrkLK//M2bbqYlfcCK18gBdN0RqWQ=";
30 };
31 };
32
33 buildAndTestSubdir = "mitmproxy-rs";
34
35 nativeBuildInputs = [
36 rustPlatform.cargoSetupHook
37 rustPlatform.maturinBuildHook
38 ];
39
40 buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [
41 darwin.apple_sdk.frameworks.Security
42 darwin.apple_sdk.frameworks.AppKit
43 libiconv
44 mitmproxy-macos
45 ];
46
47 pythonImportsCheck = [ "mitmproxy_rs" ];
48
49 meta = with lib; {
50 description = "Rust bits in mitmproxy";
51 homepage = "https://github.com/mitmproxy/mitmproxy_rs";
52 changelog = "https://github.com/mitmproxy/mitmproxy_rs/blob/${src.rev}/CHANGELOG.md#${
53 lib.replaceStrings [ "." ] [ "" ] version
54 }";
55 license = licenses.mit;
56 inherit (mitmproxy.meta) maintainers;
57 };
58}