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 hash = "sha256-Kq8QxPU6SiTk0Ev2IJoktSPjVOlAS4/e1PQvw2+e8UA=";
22 };
23
24 mbedtls = fetchFromGitHub {
25 owner = "ARMmbed";
26 repo = "mbedtls";
27 tag = "v3.5.1";
28 hash = "sha256-HxsHcGbSExp1aG5yMR/J3kPL4zqnmNoN5T5wfV3APaw=";
29 };
30
31in
32buildPythonPackage {
33 pname = "pynng";
34 version = "0.8.1-unstable-2025-05-14";
35 pyproject = true;
36
37 src = fetchFromGitHub {
38 owner = "codypiersall";
39 repo = "pynng";
40 rev = "2179328f8a858bbb3e177f66ac132bde4a5aa859";
41 hash = "sha256-TxIVcqc+4bro+krc1AWgLdZKGGuQ2D6kybHnv5z1oHg=";
42 };
43
44 env.SETUPTOOLS_SCM_PRETEND_VERSION = "0.8.1";
45
46 nativeBuildInputs = [
47 cmake
48 ninja
49 ];
50
51 build-system = [
52 setuptools
53 setuptools-scm
54 ];
55
56 preBuild = ''
57 cp -r ${mbedtls} mbedtls
58 chmod -R +w mbedtls
59 cp -r ${nng} nng
60 chmod -R +w nng
61 '';
62
63 dontUseCmakeConfigure = true;
64
65 dependencies = [
66 cffi
67 sniffio
68 pytest
69 trio
70 pytest-trio
71 pytest-asyncio
72 ];
73
74 pythonImportsCheck = [ "pynng" ];
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}