1{
2 lib,
3 fetchFromGitHub,
4 buildPythonPackage,
5 pythonOlder,
6 pytestCheckHook,
7 rustPlatform,
8 stdenv,
9 libiconv,
10}:
11
12buildPythonPackage rec {
13 pname = "py-bip39-bindings";
14 version = "0.3.0";
15 format = "pyproject";
16
17 disabled = pythonOlder "3.7";
18
19 src = fetchFromGitHub {
20 owner = "polkascan";
21 repo = "py-bip39-bindings";
22 tag = "v${version}";
23 hash = "sha256-jpBlupIjlH2LJkSm3tzxrH5wT2+eziugNMR4B01gSdE=";
24 };
25
26 cargoDeps = rustPlatform.fetchCargoVendor {
27 inherit pname version src;
28 hash = "sha256-qX4ydIT2+8dJQIVSYzO8Rg8PP61cu7ZjanPkmI34IUY=";
29 };
30
31 nativeBuildInputs = with rustPlatform; [
32 cargoSetupHook
33 maturinBuildHook
34 ];
35
36 buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ libiconv ];
37
38 nativeCheckInputs = [ pytestCheckHook ];
39
40 enabledTestPaths = [ "tests.py" ];
41
42 pythonImportsCheck = [ "bip39" ];
43
44 meta = with lib; {
45 description = "Python bindings for the tiny-bip39 library";
46 homepage = "https://github.com/polkascan/py-bip39-bindings";
47 license = licenses.asl20;
48 maintainers = with maintainers; [ stargate01 ];
49 };
50}