1{ lib
2, buildPythonPackage
3, fetchPypi
4, pythonAtLeast
5, nettools
6, glibcLocales
7, autobahn
8, cffi
9, click
10, hkdf
11, pynacl
12, spake2
13, tqdm
14, python
15, mock
16, ipaddress
17, humanize
18, pyopenssl
19, service-identity
20, txtorcon
21}:
22
23buildPythonPackage rec {
24 pname = "magic-wormhole";
25 version = "0.10.2";
26 name = "${pname}-${version}";
27
28 src = fetchPypi {
29 inherit pname version;
30 sha256 = "55a423247faee7a0644d25f37760495978cd494ba0274fefd8cd1fad493954ee";
31 };
32
33 checkInputs = [ mock ];
34 buildInputs = [ nettools glibcLocales ];
35 propagatedBuildInputs = [ autobahn cffi click hkdf pynacl spake2 tqdm ipaddress humanize pyopenssl service-identity txtorcon ];
36
37 postPatch = ''
38 sed -i -e "s|'ifconfig'|'${nettools}/bin/ifconfig'|" src/wormhole/ipaddrs.py
39 sed -i -e "s|if (os.path.dirname(os.path.abspath(wormhole))|if not os.path.abspath(wormhole).startswith('/nix/store') and (os.path.dirname(os.path.abspath(wormhole))|" src/wormhole/test/test_cli.py
40 '' + lib.optionalString (pythonAtLeast "3.3") ''
41 sed -i -e 's|"ipaddress",||' setup.py
42 '';
43
44 checkPhase = ''
45 export PATH="$PATH:$out/bin"
46 export LANG="en_US.UTF-8"
47 export LC_ALL="en_US.UTF-8"
48 ${python.interpreter} -m wormhole.test.run_trial wormhole
49 '';
50
51 meta = with lib; {
52 description = "Securely transfer data between computers";
53 homepage = https://github.com/warner/magic-wormhole;
54 license = licenses.mit;
55 maintainers = with maintainers; [ asymmetric ];
56 };
57}