https://github.com/EasyCrypt/easycrypt
Raw File
Tip revision: 99b4ea26aedb7454f15013520e0077538de5bbf9 authored by François Dupressoir on 22 July 2022, 14:34:38 UTC
workflow to compile with nix
Tip revision: 99b4ea2
default.nix
{ provers ? []
, devDeps ? []
, testDeps ? false
}:

let
  version = "git";
  src = ./.;
in

with import <nixpkgs> {};

let inherit (lib) optionals; in

let runtest = optionals testDeps (python3Packages.buildPythonApplication rec {
  pname = "easycrypt-runtest";
  inherit src version;

  dontConfigure = true;
  dontBuild = true;
  doCheck = false;

  pythonPath = with python3Packages; [ pyyaml ];

  installPhase = ''
    runHook preInstall
    mkdir -p $out/bin
    cp scripts/testing/runtest $out/bin/ec-runtest
    runHook postInstall
  '';
}); in

stdenv.mkDerivation {
  pname = "easycrypt";
  inherit version src;

  buildInputs = [ git ] ++ (with ocamlPackages; [
      ocaml
      findlib
      batteries
      camlp-streams
      dune_2
      dune-build-info
      dune-site
      inifiles
      menhir
      menhirLib
      merlin
      yojson
      zarith
  ]);
  propagatedBuildInputs = [ why3 runtest ]
    ++ devDeps
    ++ provers;

  installPhase = ''
    runHook preInstall
    dune install --prefix $out -p $pname
    rm $out/bin/ec-runtest
    runHook postInstall
  '';

  passthru = {
    inherit runtest;
  };
}
back to top