summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/consonance/default.nix
blob: 534327b052a633f3a0b06fb0495f9ff91460b3a9 (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
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  fetchpatch,
  setuptools,
  dissononce,
  python-axolotl-curve25519,
  transitions,
  protobuf,
  pytestCheckHook,
}:

buildPythonPackage rec {
  pname = "consonance";
  version = "0.1.5";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "tgalal";
    repo = "consonance";
    tag = version;
    hash = "sha256-BhgxLxjKZ4dSL7DqkaoS+wBPCd1SYZomRKrtDLdGmYQ=";
  };

  patches = [
    # https://github.com/tgalal/consonance/pull/9
    (fetchpatch {
      name = "fix-type-error.patch";
      url = "https://github.com/tgalal/consonance/pull/9/commits/92fb78af98a18f0533ec8a286136968174fb0baf.patch";
      hash = "sha256-wVUGxZ4W2zPyrcQPQTc85LcRUtsLbTBVzS10NEolpQY=";
    })
  ];

  env = {
    # make protobuf compatible with old versions
    # https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates
    PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION = "python";
  };

  build-system = [ setuptools ];

  dependencies = [
    dissononce
    python-axolotl-curve25519
    transitions
    protobuf
  ];

  nativeCheckInputs = [ pytestCheckHook ];

  enabledTestPaths = [ "tests/test_handshakes_offline.py" ];

  pythonImportsCheck = [ "consonance" ];

  meta = {
    description = "WhatsApp's handshake implementation using Noise Protocol";
    homepage = "https://github.com/tgalal/consonance";
    license = lib.licenses.gpl3Plus;
    maintainers = [ ];
  };
}