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 pname version src; 33 hash = "sha256-V1z16GKaSQVjp+stWir7kAO2wsnOYPdhKi4KzIKmKx8="; 34 }; 35 36 build-system = with rustPlatform; [ 37 bindgenHook 38 cargoSetupHook 39 maturinBuildHook 40 ]; 41 42 nativeBuildInputs = [ 43 pkg-config 44 ] 45 ++ (with rustPlatform; [ 46 bindgenHook 47 cargoSetupHook 48 maturinBuildHook 49 ]); 50 51 buildInputs = [ 52 nettle 53 ] 54 ++ lib.optionals stdenv.hostPlatform.isLinux [ pcsclite ] 55 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 56 libiconv 57 ]; 58 59 dependencies = [ httpx ]; 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 description = "Python module for OpenPGP written in Rust"; 75 homepage = "https://github.com/kushaldas/johnnycanencrypt"; 76 changelog = "https://github.com/kushaldas/johnnycanencrypt/blob/v${version}/changelog.md"; 77 license = licenses.lgpl3Plus; 78 maintainers = with maintainers; [ _0x4A6F ]; 79 }; 80}