From b7047c728616881f6e8052c743146ac59cf208e4 Mon Sep 17 00:00:00 2001 From: Jonas Nick Date: Sun, 26 Apr 2020 18:51:28 +0000 Subject: [PATCH] HWI: allow building with unstable nixpkgs --- .travis.yml | 1 + pkgs/hwi/default.nix | 15 ++++++++++----- pkgs/hwi/ecdsa/default.nix | 28 ++++++++++++++++++++++++++++ pkgs/hwi/mnemonic/default.nix | 20 ++++++++++++++++++++ 4 files changed, 59 insertions(+), 5 deletions(-) create mode 100644 pkgs/hwi/ecdsa/default.nix create mode 100644 pkgs/hwi/mnemonic/default.nix diff --git a/.travis.yml b/.travis.yml index 13ca60c..a74d999 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,6 +21,7 @@ env: jobs: - TestModules=1 STABLE=1 - PKG=hwi STABLE=1 + - PKG=hwi STABLE=0 - PKG=lightning-charge STABLE=1 - PKG=lightning-charge STABLE=0 - PKG=nanopos STABLE=1 diff --git a/pkgs/hwi/default.nix b/pkgs/hwi/default.nix index 9377158..41ec2d5 100644 --- a/pkgs/hwi/default.nix +++ b/pkgs/hwi/default.nix @@ -1,12 +1,18 @@ { stdenv, fetchurl, fetchFromGitHub, python3 }: with stdenv.lib; -with python3.pkgs; let - buildInputs = [ mnemonic ecdsa typing-extensions hidapi libusb1 pyaes ]; + python = python3.override { + packageOverrides = self: super: { + # HWI requires mnemonic <0.19 but nixpkgs has a newer version + mnemonic = self.callPackage ./mnemonic {}; + # HWI requires ecdsa <0.14 but nixpkgs has a newer version + ecdsa = self.callPackage ./ecdsa {}; + }; + }; in -buildPythonPackage rec { +python.pkgs.buildPythonPackage rec { pname = "hwi"; version = "1.0.3"; @@ -20,8 +26,7 @@ buildPythonPackage rec { # TODO: enable tests doCheck = false; - inherit buildInputs; - propagatedBuildInputs = buildInputs; + propagatedBuildInputs = with python.pkgs; [ mnemonic ecdsa typing-extensions hidapi libusb1 pyaes ]; meta = with lib; { homepage = https://github.com/bitcoin-core/hwi; diff --git a/pkgs/hwi/ecdsa/default.nix b/pkgs/hwi/ecdsa/default.nix new file mode 100644 index 0000000..d9c43f5 --- /dev/null +++ b/pkgs/hwi/ecdsa/default.nix @@ -0,0 +1,28 @@ +{ stdenv +, buildPythonPackage +, fetchPypi +, pkgs +, six +}: + +buildPythonPackage rec { + pname = "ecdsa"; + version = "0.13.3"; + + src = fetchPypi { + inherit pname version; + sha256 = "163c80b064a763ea733870feb96f9dd9b92216cfcacd374837af18e4e8ec3d4d"; + }; + + propagatedBuildInputs = [ six ]; + # Only needed for tests + checkInputs = [ pkgs.openssl ]; + + meta = with stdenv.lib; { + description = "ECDSA cryptographic signature library"; + homepage = "https://github.com/warner/python-ecdsa"; + license = licenses.mit; + maintainers = with maintainers; [ aszlig ]; + }; + +} diff --git a/pkgs/hwi/mnemonic/default.nix b/pkgs/hwi/mnemonic/default.nix new file mode 100644 index 0000000..4cb416a --- /dev/null +++ b/pkgs/hwi/mnemonic/default.nix @@ -0,0 +1,20 @@ +{ lib, fetchPypi, buildPythonPackage, pbkdf2 }: + +buildPythonPackage rec { + pname = "mnemonic"; + version = "0.18"; + + src = fetchPypi { + inherit pname version; + sha256 = "02a7306a792370f4a0c106c2cf1ce5a0c84b9dbd7e71c6792fdb9ad88a727f1d"; + }; + + 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 ]; + }; +}