Skip to content

Commit

Permalink
CI: clean easycrypt nix derivation
Browse files Browse the repository at this point in the history
eclib: use easycrypt runtest instead of ec-runtest
  • Loading branch information
vbgl committed Jan 18, 2024
1 parent b40e717 commit 6b756ca
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 34 deletions.
2 changes: 1 addition & 1 deletion default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ stdenv.mkDerivation {
batteries
menhir (oP.menhirLib or null) zarith camlidl apron yojson ]))
++ optionals devTools (with oP; [ merlin ocaml-lsp ])
++ optionals ecDeps [ easycrypt easycrypt.runtest alt-ergo z3.out ]
++ optionals ecDeps [ easycrypt alt-ergo z3.out ]
++ optionals opamDeps [ rsync git pkg-config perl ppl mpfr opam ]
;
}
6 changes: 3 additions & 3 deletions eclib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ CHECKS ?= jasmin

ifeq ($(ECCHECK),)
ifeq ($(ECROOT),)
ECCHECK := ec-runtest
ECCHECK := easycrypt runtest
else
PATH := ${ECROOT}:${PATH}
ECCHECK := $(ECROOT)/scripts/testing/runtest
Expand All @@ -34,10 +34,10 @@ usage:
@echo "Usage: make <target> where <target> in [check|check-xunit]" >&2

check:
$(ECCHECK) --bin-args="$(ECARGS)" $(ECCONF) $(CHECKS)
$(ECCHECK) $(ECARGS) $(ECCONF) $(CHECKS)

check-xunit:
$(ECCHECK) --bin-args="$(ECARGS)" --report=$(XUNITOUT) $(ECCONF) $(CHECKS)
$(ECCHECK) $(ECARGS) --report=$(XUNITOUT) $(ECCONF) $(CHECKS)

install:
$(INSTALL) -m 0755 -d $(DESTDIR)$(LIBDIR)/jasmin/easycrypt
Expand Down
1 change: 0 additions & 1 deletion eclib/tests.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[default]
bin = easycrypt
args = -I .

[test-jasmin]
Expand Down
51 changes: 22 additions & 29 deletions scripts/easycrypt.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
, stdenv
, fetchFromGitHub
, ocamlPackages
, python3Packages
, python3
, why3
}:

Expand All @@ -29,50 +29,43 @@ with {

}."${ecRef}";

let runtest = python3Packages.buildPythonApplication rec {
pname = "easycrypt-runtest";
format = "other";
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 rec {
pname = "easycrypt";
inherit version src;

nativeBuildInputs = with ocamlPackages; [
dune_3
findlib
menhir
ocaml
python3.pkgs.wrapPython
];

buildInputs = with ocamlPackages; [
ocaml findlib dune_3
batteries camlp-streams dune-build-info inifiles menhir menhirLib yojson zarith
batteries
dune-build-info
inifiles
yojson
zarith
];

propagatedBuildInputs = [ why3 ];

preConfigure = ''
strictDeps = true;

postPatch = ''
substituteInPlace dune-project --replace '(name easycrypt)' '(name easycrypt)(version ${rev})'
'';

pythonPath = with python3.pkgs; [ pyyaml ];

installPhase = ''
runHook preInstall
dune install --prefix $out -p $pname
dune install --prefix $out ${pname}
rm -rf $out/lib/easycrypt/ecLib
rm $out/bin/ec-runtest
wrapPythonProgramsIn "$out/lib/easycrypt/commands" "$pythonPath"
runHook postInstall
'';

passthru = {
inherit runtest;
};

}

0 comments on commit 6b756ca

Please sign in to comment.