Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib
2, buildPythonPackage
3, callPackage
4, fetchFromGitHub
5, fetchpatch
6, gmp
7}:
8
9let
10 test-vectors = callPackage ./vectors.nix { };
11in
12buildPythonPackage rec {
13 pname = "pycryptodome";
14 version = "3.16.0";
15 format = "setuptools";
16
17 src = fetchFromGitHub {
18 owner = "Legrandin";
19 repo = "pycryptodome";
20 rev = "v${version}";
21 hash = "sha256-8EAgeAU3HQiPrMKOtoVQQLbgq47cbveU2eQYp15XS/U=";
22 };
23
24 patches = [
25 (fetchpatch {
26 url = "https://github.com/Legrandin/pycryptodome/commit/1c043abb089ddbc2fc43d1c169672688ccc64c64.patch";
27 sha256 = "sha256-QklwOlFpQNAH0CpR06fWSZqx8C97RV8BRsKbp2j8js8=";
28 })
29 ];
30
31 postPatch = ''
32 substituteInPlace lib/Crypto/Math/_IntegerGMP.py \
33 --replace 'load_lib("gmp"' 'load_lib("${gmp}/lib/libgmp.so.10"'
34 '';
35
36 checkInputs = [
37 test-vectors
38 ];
39
40 pythonImportsCheck = [
41 "Crypto"
42 ];
43
44 meta = with lib; {
45 description = "Self-contained cryptographic library";
46 homepage = "https://github.com/Legrandin/pycryptodome";
47 license = with licenses; [ bsd2 /* and */ asl20 ];
48 maintainers = with maintainers; [ fab ];
49 };
50}