1{ lib
2, stdenv
3, fetchFromGitHub
4, buildPythonPackage
5, rustPlatform
6, pkg-config
7, pcsclite
8, nettle
9, httpx
10, pytestCheckHook
11, pythonOlder
12, vcrpy
13, PCSC
14, libiconv
15}:
16
17buildPythonPackage rec {
18 pname = "johnnycanencrypt";
19 version = "0.14.1";
20 disabled = pythonOlder "3.8";
21
22 src = fetchFromGitHub {
23 owner = "kushaldas";
24 repo = "johnnycanencrypt";
25 rev = "v${version}";
26 hash = "sha256-13zIC+zH/BebMplUfdtiwEEVODS+jTURC1vudbmQPlA=";
27 };
28
29 cargoDeps = rustPlatform.fetchCargoTarball {
30 inherit src;
31 name = "${pname}-${version}";
32 hash = "sha256-u3qKli76XGS0Ijg15BQzbFlfLPpBPFKh++EZLfnO9ps=";
33 };
34
35 format = "pyproject";
36
37 propagatedBuildInputs = [
38 httpx
39 ];
40
41 nativeBuildInputs = [
42 pkg-config
43 ] ++ (with rustPlatform; [
44 bindgenHook
45 cargoSetupHook
46 maturinBuildHook
47 ]);
48
49 buildInputs = [
50 nettle
51 ] ++ lib.optionals stdenv.isLinux [
52 pcsclite
53 ] ++ lib.optionals stdenv.isDarwin [
54 PCSC
55 libiconv
56 ];
57
58 nativeCheckInputs = [
59 pytestCheckHook
60 vcrpy
61 ];
62
63 preCheck = ''
64 # import from $out
65 rm -r johnnycanencrypt
66 '';
67
68 pythonImportsCheck = [ "johnnycanencrypt" ];
69
70 meta = with lib; {
71 homepage = "https://github.com/kushaldas/johnnycanencrypt";
72 changelog = "https://github.com/kushaldas/johnnycanencrypt/blob/v${version}/changelog.md";
73 description = "Python module for OpenPGP written in Rust";
74 license = licenses.lgpl3Plus;
75 maintainers = with maintainers; [ _0x4A6F ];
76 };
77}