diff --git a/pkgs/development/python-modules/ecpy/default.nix b/pkgs/development/python-modules/ecpy/default.nix new file mode 100644 index 000000000000..57549792d218 --- /dev/null +++ b/pkgs/development/python-modules/ecpy/default.nix @@ -0,0 +1,22 @@ +{ stdenv, fetchPypi, buildPythonPackage, hidapi +, pycrypto, pillow, protobuf, future, ecpy +}: + +buildPythonPackage rec { + name = "${pname}-${version}"; + pname = "ECPy"; + version = "0.8.1"; + + src = fetchPypi { + inherit pname version; + sha256 = "0ab60sx4bbsmccwmdvz1023r0cbzi4phar4ipzn5npdj5gw1ny4l"; + }; + + buildInputs = [ hidapi pycrypto pillow protobuf future ]; + + meta = with stdenv.lib; { + description = "Pure Pyhton Elliptic Curve Library"; + homepage = "https://github.com/ubinity/ECPy"; + license = licenses.asl20; + }; +} diff --git a/pkgs/development/python-modules/ed25519/default.nix b/pkgs/development/python-modules/ed25519/default.nix new file mode 100644 index 000000000000..1cdf85385e8b --- /dev/null +++ b/pkgs/development/python-modules/ed25519/default.nix @@ -0,0 +1,19 @@ +{ stdenv, fetchPypi, buildPythonPackage }: + +buildPythonPackage rec { + name = "${pname}-${version}"; + pname = "ed25519"; + version = "1.4"; + + src = fetchPypi { + inherit pname version; + sha256 = "0ahx1nkxa0xis3cw0h5c4fpgv8mq4znkq7kajly33lc3317bk499"; + }; + + meta = with stdenv.lib; { + description = "Ed25519 public-key signatures"; + homepage = "https://github.com/warner/python-ed25519"; + license = licenses.mit; + maintainers = with maintainers; [ np ]; + }; +} diff --git a/pkgs/development/python-modules/hidapi/default.nix b/pkgs/development/python-modules/hidapi/default.nix new file mode 100644 index 000000000000..697bc1cd0e3d --- /dev/null +++ b/pkgs/development/python-modules/hidapi/default.nix @@ -0,0 +1,30 @@ +{ stdenv, libusb1, udev, fetchPypi, buildPythonPackage, cython }: + +buildPythonPackage rec { + name = "${pname}-${version}"; + pname = "hidapi"; + version = "0.7.99.post20"; + + src = fetchPypi { + inherit pname version; + sha256 = "1k7z5m7xsqy8j4qkjy4pfxdx4hm36ha68vi65z6smvnyg4zgv22z"; + }; + + propagatedBuildInputs = [ libusb1 udev cython ]; + + # Fix the USB backend library lookup + postPatch = '' + libusb=${libusb1.dev}/include/libusb-1.0 + test -d $libusb || { echo "ERROR: $libusb doesn't exist, please update/fix this build expression."; exit 1; } + sed -i -e "s|/usr/include/libusb-1.0|$libusb|" setup.py + ''; + + meta = with stdenv.lib; { + description = "A Cython interface to the hidapi from https://github.com/signal11/hidapi"; + homepage = https://github.com/trezor/cython-hidapi; + # license can actually be either bsd3 or gpl3 + # see https://github.com/trezor/cython-hidapi/blob/master/LICENSE-orig.txt + license = licenses.bsd3; + maintainers = with maintainers; [ np ]; + }; +} diff --git a/pkgs/development/python-modules/keepkey/default.nix b/pkgs/development/python-modules/keepkey/default.nix new file mode 100644 index 000000000000..0d7f7661e7dd --- /dev/null +++ b/pkgs/development/python-modules/keepkey/default.nix @@ -0,0 +1,30 @@ +{ stdenv, fetchPypi, buildPythonPackage, ecdsa +, mnemonic, protobuf3_0, hidapi }: + +buildPythonPackage rec { + name = "${pname}-${version}"; + pname = "keepkey"; + version = "0.7.3"; + + src = fetchPypi { + inherit pname version; + sha256 = "14d2r8dlx997ypgma2k8by90acw7i3l7hfq4gar9lcka0lqfj714"; + }; + + propagatedBuildInputs = [ protobuf3_0 hidapi ]; + + buildInputs = [ ecdsa mnemonic ]; + + # There are no actual tests: "ImportError: No module named tests" + doCheck = false; + + # Remove impossible dependency constraint + postPatch = "sed -i -e 's|hidapi==|hidapi>=|' setup.py"; + + meta = with stdenv.lib; { + description = "KeepKey Python client"; + homepage = https://github.com/keepkey/python-keepkey; + license = licenses.gpl3; + maintainers = with maintainers; [ np ]; + }; +} diff --git a/pkgs/development/python-modules/ledgerblue/default.nix b/pkgs/development/python-modules/ledgerblue/default.nix new file mode 100644 index 000000000000..9ed18190a8e3 --- /dev/null +++ b/pkgs/development/python-modules/ledgerblue/default.nix @@ -0,0 +1,23 @@ +{ stdenv, fetchPypi, buildPythonPackage, hidapi +, pycrypto, pillow, protobuf, future, ecpy +}: + +buildPythonPackage rec { + name = "${pname}-${version}"; + pname = "ledgerblue"; + version = "0.1.13"; + + src = fetchPypi { + inherit pname version; + sha256 = "09bsiylvgax6m47w8r0myaf61xj9j0h1spvadx6fx31qy0iqicw0"; + }; + + buildInputs = [ hidapi pycrypto pillow protobuf future ecpy ]; + + meta = with stdenv.lib; { + description = "Python library to communicate with Ledger Blue/Nano S"; + homepage = "https://github.com/LedgerHQ/blue-loader-python"; + license = licenses.asl20; + maintainers = with maintainers; [ np ]; + }; +} diff --git a/pkgs/development/python-modules/libagent/default.nix b/pkgs/development/python-modules/libagent/default.nix new file mode 100644 index 000000000000..5192abf8200f --- /dev/null +++ b/pkgs/development/python-modules/libagent/default.nix @@ -0,0 +1,26 @@ +{ stdenv, fetchPypi, buildPythonPackage, ed25519, ecdsa +, semver, keepkey, trezor, mnemonic, ledgerblue +}: + +buildPythonPackage rec { + name = "${pname}-${version}"; + pname = "libagent"; + version = "0.9.1"; + + src = fetchPypi{ + inherit pname version; + sha256 = "1g19lsid7lqw567w31fif89w088lzbgh27xpb1pshjk1gvags3bc"; + }; + + buildInputs = [ + ed25519 ecdsa semver keepkey + trezor mnemonic ledgerblue + ]; + + meta = with stdenv.lib; { + description = "Using hardware wallets as SSH/GPG agent"; + homepage = "https://github.com/romanz/trezor-agent"; + license = licenses.gpl3; + maintainers = with maintainers; [ np ]; + }; +} diff --git a/pkgs/development/python-modules/mnemonic/default.nix b/pkgs/development/python-modules/mnemonic/default.nix new file mode 100644 index 000000000000..9f71fdb8e741 --- /dev/null +++ b/pkgs/development/python-modules/mnemonic/default.nix @@ -0,0 +1,21 @@ +{ lib, fetchurl, buildPythonPackage, pbkdf2 }: + +buildPythonPackage rec { + pname = "mnemonic"; + version = "0.17"; + name = "${pname}-${version}"; + + src = fetchurl { + url = "mirror://pypi/m/${pname}/${name}.tar.gz"; + sha256 = "1hq6xb47jagfqf65iwcrh0065mj3521d2mxmahg7vfraihqyqdjn"; + }; + + propagatedBuildInputs = [ pbkdf2 ]; + + meta = { + description = "Implementation of Bitcoin BIP-0039"; + homepage = https://github.com/trezor/python-mnemonic; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ np ]; + }; +} diff --git a/pkgs/development/python-modules/semver/default.nix b/pkgs/development/python-modules/semver/default.nix new file mode 100644 index 000000000000..285da5460717 --- /dev/null +++ b/pkgs/development/python-modules/semver/default.nix @@ -0,0 +1,19 @@ +{ stdenv, fetchPypi, buildPythonPackage }: + +buildPythonPackage rec { + name = "${pname}-${version}"; + pname = "semver"; + version = "2.2.1"; + + src = fetchPypi { + inherit pname version; + sha256 = "161gvsfpw0l8lnf1v19rvqc8b9f8n70cc8ppya4l0n6rwc1c1n4m"; + }; + + meta = with stdenv.lib; { + description = "Python package to work with Semantic Versioning (http://semver.org/)"; + homepage = "https://github.com/k-bx/python-semver"; + license = licenses.bsd3; + maintainers = with maintainers; [ np ]; + }; +} diff --git a/pkgs/development/python-modules/trezor.nix b/pkgs/development/python-modules/trezor/default.nix similarity index 80% rename from pkgs/development/python-modules/trezor.nix rename to pkgs/development/python-modules/trezor/default.nix index 70160dcb0f94..6fc6622cf3f2 100644 --- a/pkgs/development/python-modules/trezor.nix +++ b/pkgs/development/python-modules/trezor/default.nix @@ -1,12 +1,12 @@ -{ lib, fetchurl, buildPythonPackage, protobuf3_0, hidapi, ecdsa, mnemonic }: +{ lib, fetchPypi, buildPythonPackage, protobuf3_0, hidapi, ecdsa, mnemonic }: buildPythonPackage rec { + name = "${pname}-${version}"; pname = "trezor"; version = "0.7.13"; - name = "${pname}-${version}"; - src = fetchurl { - url = "mirror://pypi/t/${pname}/${name}.tar.gz"; + src = fetchPypi { + inherit pname version; sha256 = "d05f388bb56b6f61cc727999cc725078575238a0b6172450322bc55c437fefe5"; }; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 696f8ad7c862..c694534d3a98 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -29626,106 +29626,40 @@ EOF }; }; - hidapi = buildPythonPackage rec{ - version = "0.7.99.post15"; - name = "hidapi-${version}"; - - src = pkgs.fetchurl { - url = "mirror://pypi/h/hidapi/${name}.tar.gz"; - sha256 = "09wlr1d7mx80974bsq62j4pk80234jgl7ip4br0y43q6999dpcr0"; - }; - - propagatedBuildInputs = with self; [ pkgs.libusb1 pkgs.udev cython ]; - - # Fix the USB backend library lookup - postPatch = '' - libusb=${pkgs.libusb1.dev}/include/libusb-1.0 - test -d $libusb || { echo "ERROR: $libusb doesn't exist, please update/fix this build expression."; exit 1; } - sed -i -e "s|/usr/include/libusb-1.0|$libusb|" setup.py - ''; - - meta = { - description = "A Cython interface to the hidapi from https://github.com/signal11/hidapi"; - homepage = https://github.com/trezor/cython-hidapi; - # license can actually be either bsd3 or gpl3 - # see https://github.com/trezor/cython-hidapi/blob/master/LICENSE-orig.txt - license = licenses.bsd3; - maintainers = with maintainers; [ np ]; - }; + hidapi = callPackage ../development/python-modules/hidapi { + inherit (pkgs) udev libusb1; }; - mnemonic = callPackage ../development/python-modules/mnemonic.nix { }; + mnemonic = callPackage ../development/python-modules/mnemonic { }; - trezor = callPackage ../development/python-modules/trezor.nix { }; + keepkey = callPackage ../development/python-modules/keepkey { }; - keepkey = buildPythonPackage rec{ - version = "0.7.3"; - name = "keepkey-${version}"; + libagent = callPackage ../development/python-modules/libagent { }; - src = pkgs.fetchurl { - url = "mirror://pypi/k/keepkey/${name}.tar.gz"; - sha256 = "14d2r8dlx997ypgma2k8by90acw7i3l7hfq4gar9lcka0lqfj714"; - }; + ledgerblue = callPackage ../development/python-modules/ledgerblue { }; - propagatedBuildInputs = with self; [ protobuf3_0 hidapi ]; + ecpy = callPackage ../development/python-modules/ecpy { }; - buildInputs = with self; [ ecdsa mnemonic ]; + semver = callPackage ../development/python-modules/semver { }; - # There are no actual tests: "ImportError: No module named tests" - doCheck = false; + ed25519 = callPackage ../development/python-modules/ed25519 { }; - meta = { - description = "KeepKey Python client"; - homepage = https://github.com/keepkey/python-keepkey; - license = licenses.gpl3; - maintainers = with maintainers; [ np ]; - }; - }; - - semver = buildPythonPackage rec { - name = "semver-${version}"; - version = "2.2.1"; - - src = pkgs.fetchurl { - url = "mirror://pypi/s/semver/${name}.tar.gz"; - sha256 = "161gvsfpw0l8lnf1v19rvqc8b9f8n70cc8ppya4l0n6rwc1c1n4m"; - }; - - meta = { - description = "Python package to work with Semantic Versioning (http://semver.org/)"; - homepage = "https://github.com/k-bx/python-semver"; - license = licenses.bsd3; - maintainers = with maintainers; [ np ]; - }; - }; - - ed25519 = buildPythonPackage rec { - name = "ed25519-${version}"; - version = "1.4"; - - src = pkgs.fetchurl { - url = "mirror://pypi/e/ed25519/${name}.tar.gz"; - sha256 = "0ahx1nkxa0xis3cw0h5c4fpgv8mq4znkq7kajly33lc3317bk499"; - }; - - meta = { - description = "Ed25519 public-key signatures"; - homepage = "https://github.com/warner/python-ed25519"; - license = licenses.mit; - maintainers = with maintainers; [ np ]; - }; - }; + trezor = callPackage ../development/python-modules/trezor { }; trezor_agent = buildPythonPackage rec{ - version = "0.7.0"; - name = "trezor_agent-${version}"; + name = "${pname}-${version}"; + pname = "trezor_agent"; + version = "0.9.0"; - src = pkgs.fetchurl { - url = "mirror://pypi/t/trezor_agent/${name}.tar.gz"; - sha256 = "1x1gwih6w8kxhpgmcp0v1k7mpmfsqiikkjca291sd0v2if24x7q1"; + src = fetchPypi { + inherit pname version; + sha256 = "1i5cdamlf3c0ym600pjklij74p8ifj9cv7xrpnrfl1b8nkadswbz"; }; - propagatedBuildInputs = with self; [ trezor ecdsa ed25519 mnemonic keepkey semver ]; + propagatedBuildInputs = with self; [ + trezor libagent ecdsa ed25519 + mnemonic keepkey semver + ]; meta = { description = "Using Trezor as hardware SSH agent";