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