2017-05-03 08:52:53 +01:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchPypi
|
2017-06-01 20:30:50 +01:00
|
|
|
, pythonAtLeast
|
2018-02-19 16:11:50 +00:00
|
|
|
, python
|
|
|
|
, spake2
|
|
|
|
, pynacl
|
|
|
|
, six
|
|
|
|
, attrs
|
|
|
|
, twisted
|
2017-05-03 08:52:53 +01:00
|
|
|
, autobahn
|
2018-02-19 16:11:50 +00:00
|
|
|
, automat
|
2017-05-03 08:52:53 +01:00
|
|
|
, hkdf
|
|
|
|
, tqdm
|
2018-02-19 16:11:50 +00:00
|
|
|
, click
|
2017-06-01 20:30:50 +01:00
|
|
|
, humanize
|
2018-02-19 16:11:50 +00:00
|
|
|
, ipaddress
|
2017-09-05 10:16:41 +01:00
|
|
|
, txtorcon
|
2018-02-19 16:11:50 +00:00
|
|
|
, nettools
|
2018-02-23 09:27:23 +00:00
|
|
|
, glibc
|
2018-02-19 16:11:50 +00:00
|
|
|
, glibcLocales
|
|
|
|
, mock
|
|
|
|
, magic-wormhole-transit-relay
|
2017-05-03 08:52:53 +01:00
|
|
|
}:
|
2016-11-25 08:12:23 +00:00
|
|
|
|
2017-05-03 08:52:53 +01:00
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "magic-wormhole";
|
2018-02-17 13:20:58 +00:00
|
|
|
version = "0.10.5";
|
2016-11-25 08:12:23 +00:00
|
|
|
|
2017-05-03 08:52:53 +01:00
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2018-02-17 13:20:58 +00:00
|
|
|
sha256 = "9558ea1f3551e535deec3462cd5c8391cb32ebb12ecd8b40b36861dbee4917ee";
|
2016-11-25 08:12:23 +00:00
|
|
|
};
|
2016-11-25 23:34:41 +00:00
|
|
|
|
2018-02-19 16:11:50 +00:00
|
|
|
checkInputs = [ mock magic-wormhole-transit-relay ];
|
2016-11-25 23:34:41 +00:00
|
|
|
buildInputs = [ nettools glibcLocales ];
|
2018-02-19 16:11:50 +00:00
|
|
|
propagatedBuildInputs = [ spake2 pynacl six attrs twisted autobahn automat hkdf tqdm click humanize ipaddress txtorcon ];
|
2016-11-25 23:34:41 +00:00
|
|
|
|
2017-05-03 08:52:53 +01:00
|
|
|
postPatch = ''
|
2016-11-25 23:34:41 +00:00
|
|
|
sed -i -e "s|'ifconfig'|'${nettools}/bin/ifconfig'|" src/wormhole/ipaddrs.py
|
2017-09-05 10:16:41 +01:00
|
|
|
sed -i -e "s|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))|" src/wormhole/test/test_cli.py
|
2018-02-23 09:27:23 +00:00
|
|
|
|
|
|
|
# magic-wormhole will attempt to find all available locales by running
|
|
|
|
# 'locale -a'. If we're building on Linux, then this may result in us
|
|
|
|
# running the system's locale binary instead of the one from Nix, so let's
|
|
|
|
# ensure we patch this.
|
|
|
|
sed -i -e 's|getProcessOutputAndValue("locale"|getProcessOutputAndValue("${glibc}/bin/locale"|' src/wormhole/test/test_cli.py
|
2017-06-01 20:30:50 +01:00
|
|
|
'' + lib.optionalString (pythonAtLeast "3.3") ''
|
|
|
|
sed -i -e 's|"ipaddress",||' setup.py
|
2016-11-25 08:12:23 +00:00
|
|
|
'';
|
|
|
|
|
2016-11-25 23:34:41 +00:00
|
|
|
checkPhase = ''
|
|
|
|
export PATH="$PATH:$out/bin"
|
|
|
|
export LANG="en_US.UTF-8"
|
|
|
|
export LC_ALL="en_US.UTF-8"
|
2017-05-03 08:52:53 +01:00
|
|
|
${python.interpreter} -m wormhole.test.run_trial wormhole
|
2016-11-25 23:34:41 +00:00
|
|
|
'';
|
2016-11-25 08:12:23 +00:00
|
|
|
|
2017-05-03 08:52:53 +01:00
|
|
|
meta = with lib; {
|
2016-11-25 08:12:23 +00:00
|
|
|
description = "Securely transfer data between computers";
|
2017-08-01 21:03:30 +01:00
|
|
|
homepage = https://github.com/warner/magic-wormhole;
|
2016-11-25 23:34:41 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ asymmetric ];
|
2016-11-25 08:12:23 +00:00
|
|
|
};
|
|
|
|
}
|