1{ 2 lib, 3 buildPythonPackage, 4 callPackage, 5 fetchFromGitHub, 6 gmp, 7 setuptools, 8}: 9 10let 11 test-vectors = callPackage ./vectors.nix { }; 12in 13buildPythonPackage rec { 14 pname = "pycryptodome"; 15 version = "3.23.0"; 16 pyproject = true; 17 18 src = fetchFromGitHub { 19 owner = "Legrandin"; 20 repo = "pycryptodome"; 21 tag = "v${version}"; 22 hash = "sha256-x8QkRBwM/H/n7yHGjE8UfBhOzkGr0PBixe9g4EuZLUg="; 23 }; 24 25 postPatch = '' 26 substituteInPlace lib/Crypto/Math/_IntegerGMP.py \ 27 --replace-fail 'load_lib("gmp"' 'load_lib("${gmp}/lib/libgmp.so.10"' 28 ''; 29 30 build-system = [ setuptools ]; 31 32 nativeCheckInputs = [ test-vectors ]; 33 34 pythonImportsCheck = [ "Crypto" ]; 35 36 meta = with lib; { 37 description = "Self-contained cryptographic library"; 38 homepage = "https://github.com/Legrandin/pycryptodome"; 39 changelog = "https://github.com/Legrandin/pycryptodome/blob/${src.tag}/Changelog.rst"; 40 license = with licenses; [ 41 bsd2 # and 42 asl20 43 ]; 44 maintainers = with maintainers; [ fab ]; 45 }; 46}