summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/pynng/default.nix
blob: 40834e556e0f52087d6d329fe76ea8e9a017bbf3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
{
  lib,
  cmake,
  ninja,
  buildPythonPackage,
  fetchFromGitHub,
  setuptools,
  setuptools-scm,
  cffi,
  sniffio,
  pytest,
  trio,
  pytest-trio,
  pytest-asyncio,
}:
let
  nng = fetchFromGitHub {
    owner = "nanomsg";
    repo = "nng";
    tag = "v1.6.0";
    hash = "sha256-Kq8QxPU6SiTk0Ev2IJoktSPjVOlAS4/e1PQvw2+e8UA=";
  };

  mbedtls = fetchFromGitHub {
    owner = "ARMmbed";
    repo = "mbedtls";
    tag = "v3.5.1";
    hash = "sha256-HxsHcGbSExp1aG5yMR/J3kPL4zqnmNoN5T5wfV3APaw=";
  };

in
buildPythonPackage {
  pname = "pynng";
  version = "0.8.1-unstable-2025-05-14";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "codypiersall";
    repo = "pynng";
    rev = "2179328f8a858bbb3e177f66ac132bde4a5aa859";
    hash = "sha256-TxIVcqc+4bro+krc1AWgLdZKGGuQ2D6kybHnv5z1oHg=";
  };

  env.SETUPTOOLS_SCM_PRETEND_VERSION = "0.8.1";

  nativeBuildInputs = [
    cmake
    ninja
  ];

  build-system = [
    setuptools
    setuptools-scm
  ];

  preBuild = ''
    cp -r ${mbedtls} mbedtls
    chmod -R +w mbedtls
    cp -r ${nng} nng
    chmod -R +w nng
  '';

  dontUseCmakeConfigure = true;

  dependencies = [
    cffi
    sniffio
    pytest
    trio
    pytest-trio
    pytest-asyncio
  ];

  pythonImportsCheck = [ "pynng" ];

  meta = {
    description = "Python bindings for Nanomsg Next Generation";
    homepage = "https://github.com/codypiersall/pynng";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ afermg ];
    platforms = lib.platforms.all;
  };
}