nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib
2, stdenv
3, buildPythonPackage
4, fetchPypi
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, mock
19, magic-wormhole-transit-relay
20, magic-wormhole-mailbox-server
21}:
22
23buildPythonPackage rec {
24 pname = "magic-wormhole";
25 version = "0.12.0";
26
27 src = fetchPypi {
28 inherit pname version;
29 sha256 = "0q41j99718y7m95zg1vaybnsp31lp6lhyqkbv4yqz5ys6jixh3qv";
30 };
31
32 propagatedBuildInputs = [
33 spake2
34 pynacl
35 six
36 attrs
37 twisted
38 autobahn
39 automat
40 hkdf
41 tqdm
42 click
43 humanize
44 txtorcon
45 ] ++ autobahn.optional-dependencies.twisted
46 ++ twisted.optional-dependencies.tls;
47
48 checkInputs = [
49 mock
50 magic-wormhole-transit-relay
51 magic-wormhole-mailbox-server
52 twisted
53 ];
54
55 postPatch = lib.optionalString stdenv.isLinux ''
56 sed -i -e "s|'ifconfig'|'${nettools}/bin/ifconfig'|" src/wormhole/ipaddrs.py
57 '';
58
59 postInstall = ''
60 install -Dm644 docs/wormhole.1 $out/share/man/man1/wormhole.1
61 '';
62
63 checkPhase = ''
64 export PATH=$out/bin:$PATH
65 export LANG="en_US.UTF-8"
66 export LC_ALL="en_US.UTF-8"
67 substituteInPlace src/wormhole/test/test_cli.py \
68 --replace 'getProcessOutputAndValue("locale", ["-a"])' 'getProcessOutputAndValue("locale", ["-a"], env=os.environ)' \
69 --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))' \
70 --replace 'locale_env = dict(LC_ALL=locale, LANG=locale)' 'locale_env = dict(LC_ALL=locale, LANG=locale, LOCALE_ARCHIVE=os.getenv("LOCALE_ARCHIVE"))'
71
72 trial -j$NIX_BUILD_CORES wormhole
73 '';
74
75 meta = with lib; {
76 description = "Securely transfer data between computers";
77 homepage = "https://github.com/magic-wormhole/magic-wormhole";
78 license = licenses.mit;
79 maintainers = with maintainers; [ asymmetric SuperSandro2000 ];
80 mainProgram = "wormhole";
81 };
82}