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