nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 lark,
4 asttokens,
5 buildPythonPackage,
6 cbor2,
7 fetchPypi,
8 git,
9 immutables,
10 importlib-metadata,
11 packaging,
12 pycryptodome,
13 recommonmark,
14 setuptools-scm,
15 sphinx,
16 sphinx-rtd-theme,
17 writeText,
18}:
19
20let
21 sample-contract = writeText "example.vy" ''
22 count: int128
23
24 @deploy
25 def __init__(foo: address):
26 self.count = 1
27 '';
28
29in
30buildPythonPackage rec {
31 pname = "vyper";
32 version = "0.4.3";
33 pyproject = true;
34
35 src = fetchPypi {
36 inherit pname version;
37 hash = "sha256-IqdXNldAHYo7xpDWXWt3QWgABxgJeMOgX5iS2zHV3PU=";
38 };
39
40 postPatch = ''
41 # pythonRelaxDeps doesn't work
42 substituteInPlace setup.py \
43 --replace-fail "setuptools_scm>=7.1.0,<8.0.0" "setuptools_scm>=7.1.0"
44 '';
45
46 nativeBuildInputs = [
47 # Git is used in setup.py to compute version information during building
48 # ever since https://github.com/vyperlang/vyper/pull/2816
49 git
50
51 setuptools-scm
52 ];
53
54 pythonRelaxDeps = [
55 "asttokens"
56 "packaging"
57 ];
58
59 propagatedBuildInputs = [
60 lark
61 asttokens
62 cbor2
63 immutables
64 importlib-metadata
65 packaging
66 pycryptodome
67
68 # docs
69 recommonmark
70 sphinx
71 sphinx-rtd-theme
72 ];
73
74 checkPhase = ''
75 $out/bin/vyper "${sample-contract}"
76 '';
77
78 pythonImportsCheck = [
79 "vyper"
80 ];
81
82 meta = {
83 description = "Pythonic Smart Contract Language for the EVM";
84 homepage = "https://github.com/vyperlang/vyper";
85 changelog = "https://github.com/vyperlang/vyper/releases/tag/v${version}";
86 license = lib.licenses.asl20;
87 maintainers = with lib.maintainers; [ siraben ];
88 };
89}