1{ lib 2, buildPythonPackage 3, callPackage 4, fetchFromGitHub 5, gmp 6}: 7 8let 9 test-vectors = callPackage ./vectors.nix { }; 10in 11buildPythonPackage rec { 12 pname = "pycryptodome"; 13 version = "3.18.0"; 14 format = "setuptools"; 15 16 src = fetchFromGitHub { 17 owner = "Legrandin"; 18 repo = "pycryptodome"; 19 rev = "refs/tags/v${version}"; 20 hash = "sha256-6oXXy18KlSjfyZhfMnIgnu34u/9sG0TPYvPJ8ovTqMA="; 21 }; 22 23 postPatch = '' 24 substituteInPlace lib/Crypto/Math/_IntegerGMP.py \ 25 --replace 'load_lib("gmp"' 'load_lib("${gmp}/lib/libgmp.so.10"' 26 ''; 27 28 nativeCheckInputs = [ 29 test-vectors 30 ]; 31 32 pythonImportsCheck = [ 33 "Crypto" 34 ]; 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/v${version}/Changelog.rst"; 40 license = with licenses; [ bsd2 /* and */ asl20 ]; 41 maintainers = with maintainers; [ fab ]; 42 }; 43}