Skip to content

Commit

Permalink
Add Nix configuration files
Browse files Browse the repository at this point in the history
  • Loading branch information
vbgl committed Feb 5, 2024
1 parent 796a8d6 commit 7d864b3
Show file tree
Hide file tree
Showing 2 changed files with 119 additions and 0 deletions.
78 changes: 78 additions & 0 deletions config/alt-ergo.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
{ stdenv, autoreconfHook, fetchFromGitHub, fetchpatch, lib, which, ocamlPackages }:

let ocplib-simplex =

let
inherit (ocamlPackages) ocaml findlib;
pname = "ocplib-simplex";
version = "0.4";
in

stdenv.mkDerivation {
name = "ocaml${ocaml.version}-${pname}-${version}";

src = fetchFromGitHub {
owner = "OCamlPro-Iguernlala";
repo = pname;
rev = "v${version}";
sha256 = "09niyidrjzrj8g1qwx4wgsdf5m6cwrnzg7zsgala36jliic4di60";
};

nativeBuildInputs = [ autoreconfHook ocaml findlib ];

strictDeps = true;

installFlags = [ "LIBDIR=$(OCAMLFIND_DESTDIR)" ];

createFindlibDestdir = true;

};
in

let
pname = "alt-ergo";
version = "2.4.3";

configureScript = "ocaml unix.cma configure.ml";

src = fetchFromGitHub {
owner = "OCamlPro";
repo = pname;
rev = "refs/tags/${version}";
hash = "sha256-2XARGr8rLiPMOM0rBBoRv5tZvKYtkLkJctGqLYkMe7Q=";
};
in

let alt-ergo-lib = ocamlPackages.buildDunePackage rec {
pname = "alt-ergo-lib";
inherit version src configureScript;
configureFlags = [ pname ];
nativeBuildInputs = [ which ];
buildInputs = with ocamlPackages; [ dune-configurator ];
propagatedBuildInputs = with ocamlPackages; [ dune-build-info num ocplib-simplex seq stdlib-shims zarith ];
}; in

let alt-ergo-parsers = ocamlPackages.buildDunePackage rec {
pname = "alt-ergo-parsers";
inherit version src configureScript;
configureFlags = [ pname ];
nativeBuildInputs = [ which ocamlPackages.menhir ];
propagatedBuildInputs = [ alt-ergo-lib ] ++ (with ocamlPackages; [ camlzip psmt2-frontend ]);
}; in

ocamlPackages.buildDunePackage {

inherit pname version src configureScript;

configureFlags = [ pname ];

nativeBuildInputs = [ which ocamlPackages.menhir ];
buildInputs = [ alt-ergo-parsers ocamlPackages.cmdliner ];

meta = {
description = "High-performance theorem prover and SMT solver";
homepage = "https://alt-ergo.ocamlpro.com/";
license = lib.licenses.ocamlpro_nc;
maintainers = [ lib.maintainers.thoughtpolice ];
};
}
41 changes: 41 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
with import (fetchTarball {
url = https://github.com/NixOS/nixpkgs/archive/53fbe41cf76b6a685004194e38e889bc8857e8c2.tar.gz;
sha256 = "sha256:1fyc4kbhv7rrfzya74yprvd70prlcsv56b7n0fv47kn7rznvvr2b";
}) {};

let
oc = ocaml-ng.ocamlPackages_4_14;
why = why3.override {
ocamlPackages = oc;
ideSupport = false;
coqPackages = { coq = null; flocq = null; };
};
ecVersion = "f7992e1fe5a443a9dcbce2941f708ea7bc78f6e0";
ec = (easycrypt.overrideAttrs (_: {
src = fetchFromGitHub {
owner = "EasyCrypt";
repo = "easycrypt";
rev = ecVersion;
hash = "sha256-CdgF2bFzUPNMQoGCOsJaqKp4pDBMqtFZXB0y1Miwm2c=";
};
postPatch = ''
substituteInPlace dune-project --replace '(name easycrypt)' '(name easycrypt)(version ${ecVersion})'
'';
})).override {
ocamlPackages = oc;
why3 = why;
};
altergo = callPackage ./config/alt-ergo.nix { ocamlPackages = oc; } ;
in

mkShell {
packages = [
ec
altergo
cvc4
z3
];

JASMINC = "${jasmin-compiler.bin}/bin/jasminc";
EC_RDIRS = "Jasmin:${jasmin-compiler.lib}/lib/jasmin/easycrypt";
}

0 comments on commit 7d864b3

Please sign in to comment.