Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
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 postPatch = 48 # enable tests by fixing the location of the wormhole binary 49 '' 50 substituteInPlace src/wormhole/test/test_cli.py --replace-fail \ 51 'locations = procutils.which("wormhole")' \ 52 'return "${placeholder "out"}/bin/wormhole"' 53 '' 54 # fix the location of the ifconfig binary 55 + lib.optionalString stdenv.isLinux '' 56 sed -i -e "s|'ifconfig'|'${nettools}/bin/ifconfig'|" src/wormhole/ipaddrs.py 57 ''; 58 59 build-system = [ setuptools ]; 60 61 dependencies = [ 62 attrs 63 autobahn 64 automat 65 click 66 humanize 67 iterable-io 68 pynacl 69 six 70 spake2 71 tqdm 72 twisted 73 txtorcon 74 zipstream-ng 75 ] ++ autobahn.optional-dependencies.twisted ++ twisted.optional-dependencies.tls; 76 77 passthru.optional-dependencies = { 78 dilation = [ noiseprotocol ]; 79 }; 80 81 nativeCheckInputs = 82 # For Python 3.12, remove magic-wormhole-mailbox-server and magic-wormhole-transit-relay from test dependencies, 83 # which are not yet supported with this version. 84 lib.optionals (!magic-wormhole-mailbox-server.meta.broken) [ magic-wormhole-mailbox-server ] 85 ++ lib.optionals (!magic-wormhole-transit-relay.meta.broken) [ magic-wormhole-transit-relay ] 86 ++ [ 87 mock 88 pytestCheckHook 89 ] 90 ++ passthru.optional-dependencies.dilation 91 ++ lib.optionals stdenv.isDarwin [ unixtools.locale ]; 92 93 __darwinAllowLocalNetworking = true; 94 95 disabledTestPaths = 96 # For Python 3.12, remove the tests depending on magic-wormhole-mailbox-server and magic-wormhole-transit-relay, 97 # which are not yet supported with this version. 98 lib.optionals 99 (magic-wormhole-mailbox-server.meta.broken || magic-wormhole-transit-relay.meta.broken) 100 [ 101 "src/wormhole/test/dilate/test_full.py" 102 "src/wormhole/test/test_args.py" 103 "src/wormhole/test/test_cli.py" 104 "src/wormhole/test/test_wormhole.py" 105 "src/wormhole/test/test_xfer_util.py" 106 ] 107 ++ lib.optionals magic-wormhole-transit-relay.meta.broken [ "src/wormhole/test/test_transit.py" ]; 108 109 postInstall = '' 110 install -Dm644 docs/wormhole.1 $out/share/man/man1/wormhole.1 111 ''; 112 113 meta = { 114 changelog = "https://github.com/magic-wormhole/magic-wormhole/blob/${version}/NEWS.md"; 115 description = "Securely transfer data between computers"; 116 homepage = "https://github.com/magic-wormhole/magic-wormhole"; 117 license = lib.licenses.mit; 118 maintainers = [ lib.maintainers.mjoerg ]; 119 mainProgram = "wormhole"; 120 }; 121}