Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 buildPythonPackage, 4 fetchPypi, 5 setuptools, 6 autobahn, 7 twisted, 8 python, 9 pytestCheckHook, 10}: 11 12buildPythonPackage rec { 13 pname = "magic-wormhole-transit-relay"; 14 version = "0.4.0"; 15 pyproject = true; 16 17 src = fetchPypi { 18 inherit pname version; 19 hash = "sha256-kS2DXaIbESZsdxEdybXlgAJj/AuY8KF5liJn30GBnow="; 20 }; 21 22 postPatch = '' 23 # Passing the environment to twistd is necessary to preserve Python's site path. 24 substituteInPlace src/wormhole_transit_relay/test/test_backpressure.py --replace-fail \ 25 'reactor.spawnProcess(proto, exe, args)' \ 26 'reactor.spawnProcess(proto, exe, args, None)' 27 ''; 28 29 build-system = [ setuptools ]; 30 31 dependencies = [ 32 autobahn 33 setuptools # pkg_resources is referenced at runtime 34 twisted 35 ]; 36 37 pythonImportsCheck = [ "wormhole_transit_relay" ]; 38 39 nativeCheckInputs = [ 40 pytestCheckHook 41 twisted 42 ]; 43 44 __darwinAllowLocalNetworking = true; 45 46 postCheck = '' 47 # Avoid collision with twisted's plugin cache (#164775). 48 rm "$out/${python.sitePackages}/twisted/plugins/dropin.cache" 49 ''; 50 51 meta = { 52 description = "Transit Relay server for Magic-Wormhole"; 53 homepage = "https://github.com/magic-wormhole/magic-wormhole-transit-relay"; 54 changelog = "https://github.com/magic-wormhole/magic-wormhole-transit-relay/blob/${version}/NEWS.md"; 55 license = lib.licenses.mit; 56 maintainers = [ lib.maintainers.mjoerg ]; 57 }; 58}