1{
2 lib,
3 stdenv,
4 darwin,
5 fetchFromGitHub,
6 ocamlPackages,
7 why3,
8 python3,
9}:
10
11stdenv.mkDerivation rec {
12 pname = "easycrypt";
13 version = "2025.03";
14
15 src = fetchFromGitHub {
16 owner = pname;
17 repo = pname;
18 tag = "r${version}";
19 hash = "sha256-Z6JaqR0BocEhDuof929HOvzWu6C77CAqeuYYY2PXvrs=";
20 };
21
22 nativeBuildInputs =
23 with ocamlPackages;
24 [
25 dune_3
26 findlib
27 menhir
28 ocaml
29 python3.pkgs.wrapPython
30 ]
31 ++ lib.optional stdenv.hostPlatform.isDarwin darwin.sigtool;
32
33 buildInputs = with ocamlPackages; [
34 batteries
35 dune-build-info
36 dune-site
37 inifiles
38 why3
39 yojson
40 zarith
41 ];
42
43 propagatedBuildInputs = [ why3.out ];
44
45 strictDeps = true;
46
47 postPatch = ''
48 substituteInPlace dune-project --replace-fail '(name easycrypt)' '(name easycrypt)(version ${version})'
49 '';
50
51 pythonPath = with python3.pkgs; [ pyyaml ];
52
53 installPhase = ''
54 runHook preInstall
55 dune install --prefix $out ${pname}
56 rm $out/bin/ec-runtest
57 wrapPythonProgramsIn "$out/lib/easycrypt/commands" "$pythonPath"
58 runHook postInstall
59 '';
60
61 meta = {
62 license = lib.licenses.mit;
63 maintainers = [ lib.maintainers.vbgl ];
64 platforms = lib.platforms.all;
65 homepage = "https://easycrypt.info/";
66 description = "Computer-Aided Cryptographic Proofs";
67 mainProgram = "easycrypt";
68 };
69}