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