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.17.0";
14 format = "setuptools";
15
16 src = fetchFromGitHub {
17 owner = "Legrandin";
18 repo = "pycryptodome";
19 rev = "v${version}";
20 hash = "sha256-xsfd+dbaNOPuD0ulvpLPBPtcFgmJqX1VuunwNMcqh+Q=";
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 license = with licenses; [ bsd2 /* and */ asl20 ];
40 maintainers = with maintainers; [ fab ];
41 };
42}