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