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