1{ stdenv
2, lib
3, fetchFromGitLab
4, git
5, coq
6, ocamlPackages
7, cacert
8, ocaml-crunch
9, jq
10, mustache-go
11, yaml2json
12, tezos-rust-libs
13, darwin
14}:
15
16ocamlPackages.buildDunePackage rec {
17 pname = "ligo";
18 version = "0.66.0";
19 src = fetchFromGitLab {
20 owner = "ligolang";
21 repo = "ligo";
22 rev = version;
23 sha256 = "sha256-BFeNnpMT+WKqTvjVg+H2qHl5EUMcbe7xmJohbpD99gY=";
24 fetchSubmodules = true;
25 };
26
27 postPatch = ''
28 substituteInPlace "vendors/tezos-ligo/src/lib_hacl/hacl.ml" \
29 --replace \
30 "Hacl.NaCl.Noalloc.Easy.secretbox ~pt:msg ~n:nonce ~key ~ct:cmsg" \
31 "Hacl.NaCl.Noalloc.Easy.secretbox ~pt:msg ~n:nonce ~key ~ct:cmsg ()" \
32 --replace \
33 "Hacl.NaCl.Noalloc.Easy.box_afternm ~pt:msg ~n:nonce ~ck:k ~ct:cmsg" \
34 "Hacl.NaCl.Noalloc.Easy.box_afternm ~pt:msg ~n:nonce ~ck:k ~ct:cmsg ()"
35
36 substituteInPlace "vendors/tezos-ligo/src/lib_crypto/crypto_box.ml" \
37 --replace \
38 "secretbox_open ~key ~nonce ~cmsg ~msg" \
39 "secretbox_open ~key ~nonce ~cmsg ~msg ()" \
40 --replace \
41 "Box.box_open ~k ~nonce ~cmsg ~msg" \
42 "Box.box_open ~k ~nonce ~cmsg ~msg ()"
43 '';
44
45 # The build picks this up for ligo --version
46 LIGO_VERSION = version;
47
48 # This is a hack to work around the hack used in the dune files
49 OPAM_SWITCH_PREFIX = "${tezos-rust-libs}";
50
51 duneVersion = "3";
52
53 strictDeps = true;
54
55 nativeBuildInputs = [
56 ocaml-crunch
57 git
58 coq
59 ocamlPackages.crunch
60 ocamlPackages.menhir
61 ocamlPackages.ocaml-recovery-parser
62 # deps for changelog
63 jq
64 mustache-go
65 yaml2json
66 ];
67
68 buildInputs = with ocamlPackages; [
69 coq
70 menhir
71 menhirLib
72 qcheck
73 ocamlgraph
74 bisect_ppx
75 decompress
76 ppx_deriving
77 ppx_deriving_yojson
78 ppx_expect
79 ppx_import
80 terminal_size
81 ocaml-recovery-parser
82 yojson
83 getopt
84 core
85 core_unix
86 pprint
87 linenoise
88 crunch
89 semver
90 lambda-term
91 tar-unix
92 parse-argv
93 hacl-star
94 prometheus
95 # lsp
96 linol
97 linol-lwt
98 ocaml-lsp
99 # Test helpers deps
100 qcheck
101 qcheck-alcotest
102 alcotest-lwt
103 # vendored tezos' deps
104 aches
105 aches-lwt
106 tezos-plonk
107 tezos-bls12-381-polynomial
108 ctypes
109 ctypes_stubs_js
110 class_group_vdf
111 dune-configurator
112 hacl-star
113 hacl-star-raw
114 lwt-canceler
115 ipaddr
116 bls12-381
117 bls12-381-signature
118 ptime
119 mtime
120 lwt_log
121 secp256k1-internal
122 resto
123 resto-directory
124 resto-cohttp-self-serving-client
125 irmin-pack
126 ezjsonm
127 data-encoding
128 pure-splitmix
129 zarith_stubs_js
130 simple-diff
131 ] ++ lib.optionals stdenv.isDarwin [
132 darwin.apple_sdk.frameworks.Security
133 ];
134
135 nativeCheckInputs = [
136 cacert
137 ocamlPackages.ca-certs
138 ];
139
140 doCheck = false; # Tests fail, but could not determine the reason
141
142 meta = with lib; {
143 homepage = "https://ligolang.org/";
144 downloadPage = "https://ligolang.org/docs/intro/installation";
145 description = "A friendly Smart Contract Language for Tezos";
146 license = licenses.mit;
147 platforms = ocamlPackages.ocaml.meta.platforms;
148 broken = stdenv.isLinux && stdenv.isAarch64;
149 maintainers = with maintainers; [ ulrikstrid ];
150 };
151}