1{ lib
2, stdenv
3, buildPythonPackage
4, fetchPypi
5
6# build-system
7, setuptools
8
9# dependencies
10, spake2
11, pynacl
12, six
13, attrs
14, twisted
15, autobahn
16, automat
17, tqdm
18, click
19, humanize
20, txtorcon
21
22# optional-dependencies
23, noiseprotocol
24
25# tests
26, nettools
27, unixtools
28, mock
29, magic-wormhole-transit-relay
30, magic-wormhole-mailbox-server
31, pytestCheckHook
32}:
33
34buildPythonPackage rec {
35 pname = "magic-wormhole";
36 version = "0.13.0";
37 format = "pyproject";
38
39 src = fetchPypi {
40 inherit pname version;
41 hash = "sha256-rDvWgoYnDn8UnAYUmo5Anl+jTX/rDoiESibSnu0tFRY=";
42 };
43
44 nativeBuildInputs = [
45 setuptools
46 ];
47
48 propagatedBuildInputs = [
49 spake2
50 pynacl
51 six
52 attrs
53 twisted
54 autobahn
55 automat
56 tqdm
57 click
58 humanize
59 txtorcon
60 ]
61 ++ autobahn.optional-dependencies.twisted
62 ++ twisted.optional-dependencies.tls;
63
64 passthru.optional-dependencies = {
65 dilation = [
66 noiseprotocol
67 ];
68 };
69
70 nativeCheckInputs = [
71 mock
72 magic-wormhole-transit-relay
73 magic-wormhole-mailbox-server
74 pytestCheckHook
75 ]
76 ++ passthru.optional-dependencies.dilation
77 ++ lib.optionals stdenv.isDarwin [ unixtools.locale ];
78
79 disabledTests = lib.optionals stdenv.isDarwin [
80 # These tests doesn't work within Darwin's sandbox
81 "test_version"
82 "test_text"
83 "test_receiver"
84 "test_sender"
85 "test_sender_allocation"
86 "test_text_wrong_password"
87 "test_override"
88 "test_allocate_port"
89 "test_allocate_port_no_reuseaddr"
90 "test_ignore_localhost_hint"
91 "test_ignore_localhost_hint_orig"
92 "test_keep_only_localhost_hint"
93 "test_get_direct_hints"
94 "test_listener"
95 "test_success_direct"
96 "test_direct"
97 "test_relay"
98 ];
99
100 disabledTestPaths = lib.optionals stdenv.isDarwin [
101 # These tests doesn't work within Darwin's sandbox
102 "src/wormhole/test/test_xfer_util.py"
103 "src/wormhole/test/test_wormhole.py"
104 ];
105
106 postPatch = lib.optionalString stdenv.isLinux ''
107 sed -i -e "s|'ifconfig'|'${nettools}/bin/ifconfig'|" src/wormhole/ipaddrs.py
108 '';
109
110 postInstall = ''
111 install -Dm644 docs/wormhole.1 $out/share/man/man1/wormhole.1
112 '';
113
114 meta = with lib; {
115 changelog = "https://github.com/magic-wormhole/magic-wormhole/blob/${version}/NEWS.md";
116 description = "Securely transfer data between computers";
117 homepage = "https://github.com/magic-wormhole/magic-wormhole";
118 license = licenses.mit;
119 maintainers = with maintainers; [ asymmetric ];
120 mainProgram = "wormhole";
121 };
122}