1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, stdenv
5, darwin
6, pytestCheckHook
7, pythonOlder
8, rustPlatform
9, setuptools-rust
10}:
11
12buildPythonPackage rec {
13 pname = "mitmproxy-wireguard";
14 version = "0.1.23";
15 format = "pyproject";
16
17 disabled = pythonOlder "3.7";
18
19 src = fetchFromGitHub {
20 owner = "decathorpe";
21 repo = "mitmproxy_wireguard";
22 rev = "refs/tags/${version}";
23 hash = "sha256-z9ucTBLLRXc1lcHA0r1wUleoP8X7yIlHrtdZdLD9qJk=";
24 };
25
26 buildInputs = lib.optionals stdenv.isDarwin [
27 darwin.libiconv
28 darwin.apple_sdk.frameworks.Security
29 ];
30
31 nativeBuildInputs = [
32 setuptools-rust
33 ] ++ (with rustPlatform; [
34 cargoSetupHook
35 maturinBuildHook
36 ]);
37
38 cargoDeps = rustPlatform.fetchCargoTarball {
39 inherit src;
40 name = "${pname}-${version}";
41 hash = "sha256-qgyAaUpyuWVYMxUA4Gg8inlUMlSLo++16+nVvmDMhTQ=";
42 };
43
44 # Module has no tests, only a test client
45 doCheck = false;
46
47 pythonImportsCheck = [
48 "mitmproxy_wireguard"
49 ];
50
51 meta = with lib; {
52 description = "WireGuard frontend for mitmproxy";
53 homepage = "https://github.com/decathorpe/mitmproxy_wireguard";
54 changelog = "https://github.com/decathorpe/mitmproxy_wireguard/releases/tag/${version}";
55 license = licenses.mit;
56 maintainers = with maintainers; [ fab ];
57 };
58}