1{ lib 2, buildPythonPackage 3, callPackage 4, fetchFromGitHub 5, cffi 6, gmp 7}: 8 9let 10 test-vectors = callPackage ./vectors.nix { }; 11in 12buildPythonPackage rec { 13 pname = "pycryptodome"; 14 version = "3.15.0"; 15 format = "setuptools"; 16 17 src = fetchFromGitHub { 18 owner = "Legrandin"; 19 repo = "pycryptodome"; 20 rev = "v${version}"; 21 hash = "sha256-SPRoAfwP1MFlVzZsVWmXDWUY5Yje7eg7d+9zJhZNXrw="; 22 }; 23 24 postPatch = '' 25 substituteInPlace lib/Crypto/Math/_IntegerGMP.py \ 26 --replace 'load_lib("gmp"' 'load_lib("${gmp}/lib/libgmp.so.10"' 27 ''; 28 29 checkInputs = [ 30 test-vectors 31 ]; 32 33 pythonImportsCheck = [ 34 "Crypto" 35 ]; 36 37 meta = with lib; { 38 description = "Self-contained cryptographic library"; 39 homepage = "https://github.com/Legrandin/pycryptodome"; 40 license = with licenses; [ bsd2 /* and */ asl20 ]; 41 maintainers = with maintainers; [ fab ]; 42 }; 43}