Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib
2, aiohttp
3, buildPythonPackage
4, cachetools
5, ecdsa
6, eth-hash
7, fastecdsa
8, fetchzip
9, frozendict
10, gmp
11, lark
12, marshmallow
13, marshmallow-dataclass
14, marshmallow-enum
15, marshmallow-oneofschema
16, mpmath
17, numpy
18, pipdeptree
19, prometheus-client
20, pytest
21, pytest-asyncio
22, pytestCheckHook
23, pythonOlder
24, pythonRelaxDepsHook
25, pyyaml
26, setuptools
27, sympy
28, typeguard
29, web3
30}:
31
32buildPythonPackage rec {
33 pname = "cairo-lang";
34 version = "0.10.0";
35 format = "setuptools";
36
37 disabled = pythonOlder "3.7";
38
39 src = fetchzip {
40 url = "https://github.com/starkware-libs/cairo-lang/releases/download/v${version}/cairo-lang-${version}.zip";
41 sha256 = "sha256-+PE7RSKEGADbue63FoT6UBOwURJs7lBNkL7aNlpSxP8=";
42 };
43
44 # TODO: remove a substantial part when https://github.com/starkware-libs/cairo-lang/pull/88/files is merged.
45 postPatch = ''
46 substituteInPlace requirements.txt \
47 --replace "lark-parser" "lark"
48
49 substituteInPlace starkware/cairo/lang/compiler/parser_transformer.py \
50 --replace 'value, meta' 'meta, value' \
51 --replace 'value: Tuple[CommaSeparatedWithNotes], meta' 'meta, value: Tuple[CommaSeparatedWithNotes]'
52 substituteInPlace starkware/cairo/lang/compiler/parser.py \
53 --replace 'standard' 'basic'
54 '';
55
56 nativeBuildInputs = [
57 pythonRelaxDepsHook
58 ];
59
60 buildInputs = [
61 gmp
62 ];
63
64 propagatedBuildInputs = [
65 aiohttp
66 cachetools
67 setuptools
68 ecdsa
69 fastecdsa
70 sympy
71 mpmath
72 numpy
73 typeguard
74 frozendict
75 prometheus-client
76 marshmallow
77 marshmallow-enum
78 marshmallow-dataclass
79 marshmallow-oneofschema
80 pipdeptree
81 lark
82 web3
83 eth-hash
84 pyyaml
85 ] ++ eth-hash.optional-dependencies.pycryptodome;
86
87 checkInputs = [
88 pytest-asyncio
89 pytestCheckHook
90 ];
91
92 pythonRelaxDeps = [
93 "frozendict"
94 ];
95
96 pythonRemoveDeps = [
97 # TODO: pytest and pytest-asyncio must be removed as they are check inputs
98 "pytest"
99 "pytest-asyncio"
100 ];
101
102 # There seems to be no test included in the ZIP release…
103 # Cloning from GitHub is harder because they use a custom CMake setup
104 # TODO(raitobezarius): upstream was pinged out of band about it.
105 doCheck = false;
106
107 meta = with lib; {
108 description = "Tooling for Cairo language";
109 homepage = "https://github.com/starkware/cairo-lang";
110 license = licenses.mit;
111 maintainers = with maintainers; [ raitobezarius ];
112 };
113}