1{ lib
2, stdenv
3, buildPythonPackage
4, fetchFromGitHub
5, pythonOlder
6, cargo
7, rustPlatform
8, rustc
9, setuptools-rust
10, libiconv
11}:
12
13buildPythonPackage rec {
14 pname = "cryptg";
15 version = "0.4";
16 format = "setuptools";
17
18 disabled = pythonOlder "3.7";
19
20 src = fetchFromGitHub {
21 owner = "cher-nov";
22 repo = pname;
23 rev = "v${version}";
24 hash = "sha256-2HP1mKGPr8wOL5B0APJks3EVBicX2iMFI7vLJGTa1PM=";
25 };
26
27 cargoDeps = rustPlatform.fetchCargoTarball {
28 inherit src;
29 hash = "sha256-AqSVFOB9Lfvk9h3GtoYlEOXBEt7YZYLhCDNKM9upQ2U=";
30 };
31
32 nativeBuildInputs = [
33 setuptools-rust
34 rustPlatform.cargoSetupHook
35 rustc
36 cargo
37 ];
38
39 buildInputs = lib.optionals stdenv.isDarwin [
40 libiconv
41 ];
42
43 # has no tests
44 doCheck = false;
45
46 pythonImportsCheck = [ "cryptg" ];
47
48 meta = with lib; {
49 description = "Official Telethon extension to provide much faster cryptography for Telegram API requests";
50 homepage = "https://github.com/cher-nov/cryptg";
51 license = licenses.cc0;
52 maintainers = with maintainers; [ nickcao ];
53 };
54}