1{ lib 2, stdenv 3, fetchFromGitHub 4, buildPythonPackage 5, rustPlatform 6, llvmPackages 7, pkg-config 8, pcsclite 9, nettle 10, httpx 11, numpy 12, pytestCheckHook 13, pythonOlder 14, PCSC 15, libiconv 16}: 17 18buildPythonPackage rec { 19 pname = "johnnycanencrypt"; 20 version = "0.11.0"; 21 disabled = pythonOlder "3.7"; 22 23 src = fetchFromGitHub { 24 owner = "kushaldas"; 25 repo = "johnnycanencrypt"; 26 rev = "v${version}"; 27 hash = "sha256-YhuYejxuKZEv1xQ1fQcXSkt9I80iJOJ6MecG622JJJo="; 28 }; 29 30 cargoDeps = rustPlatform.fetchCargoTarball { 31 inherit patches src; 32 name = "${pname}-${version}"; 33 hash = "sha256-r2NU1e3yeZDLOBy9pndGYM3JoH6BBKQkXMLsJR6PTRs="; 34 }; 35 36 format = "pyproject"; 37 38 # https://github.com/kushaldas/johnnycanencrypt/issues/125 39 patches = [ ./Cargo.lock.patch ]; 40 41 LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib"; 42 43 propagatedBuildInputs = [ 44 httpx 45 ]; 46 47 nativeBuildInputs = [ 48 llvmPackages.clang 49 pkg-config 50 ] ++ (with rustPlatform; [ 51 cargoSetupHook 52 maturinBuildHook 53 ]); 54 55 buildInputs = [ 56 nettle 57 ] ++ lib.optionals stdenv.isLinux [ 58 pcsclite 59 ] ++ lib.optionals stdenv.isDarwin [ 60 PCSC 61 libiconv 62 ]; 63 64 # Needed b/c need to check AFTER python wheel is installed (using Rust Build, not buildPythonPackage) 65 doCheck = false; 66 doInstallCheck = true; 67 68 installCheckInputs = [ 69 pytestCheckHook 70 numpy 71 ]; 72 73 preCheck = '' 74 export TESTDIR=$(mktemp -d) 75 cp -r tests/ $TESTDIR 76 pushd $TESTDIR 77 ''; 78 79 postCheck = '' 80 popd 81 ''; 82 83 pythonImportsCheck = [ "johnnycanencrypt" ]; 84 85 meta = with lib; { 86 homepage = "https://github.com/kushaldas/johnnycanencrypt"; 87 description = "Python module for OpenPGP written in Rust"; 88 license = licenses.gpl3Plus; 89 maintainers = with maintainers; [ _0x4A6F ]; 90 }; 91}