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.2.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-CglVEvmZ8xYtjFPNhCyzToYrOvGe/Sw3zHAIy1HidzM="; 24 }; 25 26 cargoDeps = rustPlatform.importCargoLock { lockFile = ./Cargo.lock; }; 27 28 postPatch = '' 29 cp ${./Cargo.lock} Cargo.lock 30 ''; 31 32 nativeBuildInputs = with rustPlatform; [ 33 cargoSetupHook 34 maturinBuildHook 35 ]; 36 37 buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ libiconv ]; 38 39 nativeCheckInputs = [ pytestCheckHook ]; 40 41 pytestFlagsArray = [ "tests.py" ]; 42 43 pythonImportsCheck = [ "bip39" ]; 44 45 meta = with lib; { 46 description = "Python bindings for the tiny-bip39 library"; 47 homepage = "https://github.com/polkascan/py-bip39-bindings"; 48 license = licenses.asl20; 49 maintainers = with maintainers; [ stargate01 ]; 50 }; 51}