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