1{
2 buildPythonPackage,
3 cmake,
4 cryptography,
5 fetchFromGitHub,
6 lib,
7 pytest-asyncio,
8 pytest-mock,
9 pytestCheckHook,
10 rustPlatform,
11 stdenv,
12}:
13
14buildPythonPackage rec {
15 pname = "qh3";
16 version = "1.5.4";
17 pyproject = true;
18
19 src = fetchFromGitHub {
20 owner = "jawah";
21 repo = "qh3";
22 tag = "v${version}";
23 hash = "sha256-VlqkZk+7803dzwMBFpsSSQUSVu5/1jKouwuK7jNuMGU=";
24 };
25
26 cargoDeps = rustPlatform.fetchCargoVendor {
27 inherit pname version src;
28 hash = "sha256-Dgx7CSH+XyVZSVHAcr65QULsY//rxgeQe5jYQQkSjHc=";
29 };
30
31 nativeBuildInputs = [
32 cmake
33 rustPlatform.bindgenHook
34 rustPlatform.cargoSetupHook
35 rustPlatform.maturinBuildHook
36 ];
37
38 dontUseCmakeConfigure = true;
39
40 env.NIX_CFLAGS_COMPILE = toString (
41 lib.optionals stdenv.cc.isGNU [
42 "-Wno-error=stringop-overflow"
43 ]
44 );
45
46 pythonImportsCheck = [ "qh3" ];
47
48 nativeCheckInputs = [
49 cryptography
50 pytest-asyncio
51 pytest-mock
52 pytestCheckHook
53 ];
54
55 __darwinAllowLocalNetworking = true;
56
57 preCheck = ''
58 # import from $out
59 rm -r qh3
60 '';
61
62 disabledTests = lib.optionals stdenv.buildPlatform.isDarwin [
63 # ConnectionError
64 "test_connect_and_serve_ipv4"
65 ];
66
67 meta = {
68 changelog = "https://github.com/jawah/qh3/blob/${src.tag}/CHANGELOG.rst";
69 description = "Lightweight QUIC and HTTP/3 implementation in Python";
70 homepage = "https://github.com/jawah/qh3";
71 license = lib.licenses.bsd3;
72 maintainers = with lib.maintainers; [ dotlambda ];
73 };
74}