1{ lib, stdenv
2, buildPythonPackage
3, fetchPypi
4, isPy27
5, spake2
6, pynacl
7, six
8, attrs
9, twisted
10, autobahn
11, automat
12, hkdf
13, tqdm
14, click
15, humanize
16, txtorcon
17, nettools
18, glibcLocales
19, mock
20, magic-wormhole-transit-relay
21, magic-wormhole-mailbox-server
22}:
23
24buildPythonPackage rec {
25 pname = "magic-wormhole";
26 version = "0.12.0";
27
28 src = fetchPypi {
29 inherit pname version;
30 sha256 = "0q41j99718y7m95zg1vaybnsp31lp6lhyqkbv4yqz5ys6jixh3qv";
31 };
32
33 buildInputs = [ glibcLocales ];
34 propagatedBuildInputs = [ spake2 pynacl six attrs twisted autobahn automat hkdf tqdm click humanize txtorcon ];
35 checkInputs = [ mock magic-wormhole-transit-relay magic-wormhole-mailbox-server ];
36
37 postPatch = lib.optionalString stdenv.isLinux ''
38 sed -i -e "s|'ifconfig'|'${nettools}/bin/ifconfig'|" src/wormhole/ipaddrs.py
39 '';
40
41 postInstall = ''
42 install -Dm644 docs/wormhole.1 $out/share/man/man1/wormhole.1
43 '';
44
45 # zope.interface issue
46 doCheck = !isPy27;
47 preCheck = ''
48 export PATH=$out/bin:$PATH
49 export LANG="en_US.UTF-8"
50 export LC_ALL="en_US.UTF-8"
51 substituteInPlace src/wormhole/test/test_cli.py \
52 --replace 'getProcessOutputAndValue("locale", ["-a"])' 'getProcessOutputAndValue("locale", ["-a"], env=os.environ)' \
53 --replace '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))' \
54 --replace 'locale_env = dict(LC_ALL=locale, LANG=locale)' 'locale_env = dict(LC_ALL=locale, LANG=locale, LOCALE_ARCHIVE=os.getenv("LOCALE_ARCHIVE"))'
55 '';
56
57 meta = with lib; {
58 description = "Securely transfer data between computers";
59 homepage = "https://github.com/warner/magic-wormhole";
60 license = licenses.mit;
61 # Currently broken on Python 2.7. See
62 # https://github.com/NixOS/nixpkgs/issues/71826
63 broken = isPy27;
64 maintainers = with maintainers; [ asymmetric ];
65 mainProgram = "wormhole";
66 };
67}