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