1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-20 12:42:24 +00:00
nixpkgs/pkgs/development/python-modules/magic-wormhole/default.nix

60 lines
1.6 KiB
Nix

{ lib
, buildPythonPackage
, fetchPypi
, pythonAtLeast
, nettools
, glibcLocales
, autobahn
, cffi
, click
, hkdf
, pynacl
, spake2
, tqdm
, python
, mock
, ipaddress
, humanize
, pyopenssl
, service-identity
}:
buildPythonPackage rec {
pname = "magic-wormhole";
version = "0.9.2";
name = "${pname}-${version}";
src = fetchPypi {
inherit pname version;
sha256 = "14aed4b453278651d92c3fd8955a105e2d33dcde279fa25d1d759e0e769f16b3";
};
checkInputs = [ mock ];
buildInputs = [ nettools glibcLocales ];
propagatedBuildInputs = [ autobahn cffi click hkdf pynacl spake2 tqdm ipaddress humanize pyopenssl service-identity ];
postPatch = ''
sed -i -e "s|'ifconfig'|'${nettools}/bin/ifconfig'|" src/wormhole/ipaddrs.py
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_scripts.py
# XXX: disable one test due to warning:
# setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
sed -i -e "s|def test_text_subprocess|def skip_test_text_subprocess|" src/wormhole/test/test_scripts.py
'' + lib.optionalString (pythonAtLeast "3.3") ''
sed -i -e 's|"ipaddress",||' setup.py
'';
checkPhase = ''
export PATH="$PATH:$out/bin"
export LANG="en_US.UTF-8"
export LC_ALL="en_US.UTF-8"
${python.interpreter} -m wormhole.test.run_trial wormhole
'';
meta = with lib; {
description = "Securely transfer data between computers";
homepage = "https://github.com/warner/magic-wormhole";
license = licenses.mit;
maintainers = with maintainers; [ asymmetric ];
};
}