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