1{
2 lib,
3 cmake,
4 ninja,
5 buildPythonPackage,
6 fetchFromGitHub,
7 setuptools,
8 setuptools-scm,
9 cffi,
10 sniffio,
11 pytest,
12 trio,
13 pytest-trio,
14 pytest-asyncio,
15}:
16let
17 nng = fetchFromGitHub {
18 owner = "nanomsg";
19 repo = "nng";
20 tag = "v1.6.0";
21 sha256 = "sha256-Kq8QxPU6SiTk0Ev2IJoktSPjVOlAS4/e1PQvw2+e8UA=";
22 };
23
24 mbedtls = fetchFromGitHub {
25 owner = "ARMmbed";
26 repo = "mbedtls";
27 tag = "v3.5.1";
28 sha256 = "sha256-HxsHcGbSExp1aG5yMR/J3kPL4zqnmNoN5T5wfV3APaw=";
29 };
30
31in
32buildPythonPackage {
33 pname = "pynng";
34 version = "0.8.1-unstable-2025-05-14";
35 format = "pyproject";
36
37 src = fetchFromGitHub {
38 owner = "codypiersall";
39 repo = "pynng";
40 rev = "2179328f8a858bbb3e177f66ac132bde4a5aa859";
41 sha256 = "sha256-TxIVcqc+4bro+krc1AWgLdZKGGuQ2D6kybHnv5z1oHg=";
42 };
43
44 nativeBuildInputs = [
45 cmake
46 ninja
47 ];
48
49 build-system = [
50 setuptools
51 setuptools-scm
52 ];
53
54 preBuild = ''
55 cp -r ${mbedtls} mbedtls
56 chmod -R +w mbedtls
57 cp -r ${nng} nng
58 chmod -R +w nng
59 '';
60
61 dontUseCmakeConfigure = true;
62
63 dependencies = [
64 cffi
65 sniffio
66 pytest
67 trio
68 pytest-trio
69 pytest-asyncio
70 ];
71
72 pythonImportsCheck = [
73 "pynng"
74 ];
75
76 meta = {
77 description = "Python bindings for Nanomsg Next Generation";
78 homepage = "https://github.com/codypiersall/pynng";
79 license = lib.licenses.mit;
80 maintainers = with lib.maintainers; [ afermg ];
81 platforms = lib.platforms.all;
82 };
83}