Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 fetchFromGitHub, 6 installShellFiles, 7 8 # build-system 9 setuptools, 10 versioneer, 11 12 # dependencies 13 attrs, 14 autobahn, 15 automat, 16 click, 17 cryptography, 18 humanize, 19 iterable-io, 20 pynacl, 21 qrcode, 22 spake2, 23 tqdm, 24 twisted, 25 txtorcon, 26 zipstream-ng, 27 28 # optional-dependencies 29 noiseprotocol, 30 31 # tests 32 net-tools, 33 unixtools, 34 magic-wormhole-transit-relay, 35 magic-wormhole-mailbox-server, 36 pytestCheckHook, 37 pytest-twisted, 38 39 gitUpdater, 40}: 41 42buildPythonPackage rec { 43 pname = "magic-wormhole"; 44 version = "0.19.2"; 45 pyproject = true; 46 47 src = fetchFromGitHub { 48 owner = "magic-wormhole"; 49 repo = "magic-wormhole"; 50 tag = version; 51 hash = "sha256-5Tipcood5RktXY05p20hQpWhSMMnZm67I4iybjV8TcA="; 52 }; 53 54 postPatch = 55 # enable tests by fixing the location of the wormhole binary 56 '' 57 substituteInPlace src/wormhole/test/test_cli.py --replace-fail \ 58 'locations = procutils.which("wormhole")' \ 59 'return "${placeholder "out"}/bin/wormhole"' 60 '' 61 # fix the location of the ifconfig binary 62 + lib.optionalString stdenv.hostPlatform.isLinux '' 63 sed -i -e "s|'ifconfig'|'${net-tools}/bin/ifconfig'|" src/wormhole/ipaddrs.py 64 ''; 65 66 build-system = [ 67 setuptools 68 versioneer 69 ]; 70 71 dependencies = [ 72 attrs 73 autobahn 74 automat 75 click 76 cryptography 77 humanize 78 iterable-io 79 pynacl 80 qrcode 81 spake2 82 tqdm 83 twisted 84 txtorcon 85 zipstream-ng 86 ] 87 ++ autobahn.optional-dependencies.twisted 88 ++ twisted.optional-dependencies.tls; 89 90 optional-dependencies = { 91 dilation = [ noiseprotocol ]; 92 }; 93 94 nativeBuildInputs = [ 95 installShellFiles 96 ]; 97 98 nativeCheckInputs = [ 99 magic-wormhole-mailbox-server 100 magic-wormhole-transit-relay 101 pytestCheckHook 102 pytest-twisted 103 ] 104 ++ optional-dependencies.dilation 105 ++ lib.optionals stdenv.hostPlatform.isDarwin [ unixtools.locale ]; 106 107 enabledTestPaths = [ "src/wormhole/test" ]; 108 109 __darwinAllowLocalNetworking = true; 110 111 postInstall = '' 112 install -Dm644 docs/wormhole.1 $out/share/man/man1/wormhole.1 113 installShellCompletion --cmd ${meta.mainProgram} \ 114 --bash wormhole_complete.bash \ 115 --fish wormhole_complete.fish \ 116 --zsh wormhole_complete.zsh 117 ''; 118 119 passthru.updateScript = gitUpdater { }; 120 121 meta = { 122 changelog = "https://github.com/magic-wormhole/magic-wormhole/blob/${version}/NEWS.md"; 123 description = "Securely transfer data between computers"; 124 homepage = "https://magic-wormhole.readthedocs.io/"; 125 license = lib.licenses.mit; 126 maintainers = [ lib.maintainers.mjoerg ]; 127 mainProgram = "wormhole"; 128 }; 129}