nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 fetchpatch,
6 setuptools,
7 dissononce,
8 python-axolotl-curve25519,
9 transitions,
10 protobuf,
11 pytestCheckHook,
12}:
13
14buildPythonPackage rec {
15 pname = "consonance";
16 version = "0.1.5";
17 pyproject = true;
18
19 src = fetchFromGitHub {
20 owner = "tgalal";
21 repo = "consonance";
22 tag = version;
23 hash = "sha256-BhgxLxjKZ4dSL7DqkaoS+wBPCd1SYZomRKrtDLdGmYQ=";
24 };
25
26 patches = [
27 # https://github.com/tgalal/consonance/pull/9
28 (fetchpatch {
29 name = "fix-type-error.patch";
30 url = "https://github.com/tgalal/consonance/pull/9/commits/92fb78af98a18f0533ec8a286136968174fb0baf.patch";
31 hash = "sha256-wVUGxZ4W2zPyrcQPQTc85LcRUtsLbTBVzS10NEolpQY=";
32 })
33 ];
34
35 env = {
36 # make protobuf compatible with old versions
37 # https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates
38 PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION = "python";
39 };
40
41 build-system = [ setuptools ];
42
43 dependencies = [
44 dissononce
45 python-axolotl-curve25519
46 transitions
47 protobuf
48 ];
49
50 nativeCheckInputs = [ pytestCheckHook ];
51
52 enabledTestPaths = [ "tests/test_handshakes_offline.py" ];
53
54 pythonImportsCheck = [ "consonance" ];
55
56 meta = {
57 description = "WhatsApp's handshake implementation using Noise Protocol";
58 homepage = "https://github.com/tgalal/consonance";
59 license = lib.licenses.gpl3Plus;
60 maintainers = [ ];
61 };
62}