2021-02-05 17:12:51 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, z3, ocamlPackages, makeWrapper, installShellFiles }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-08-27 14:25:00 +00:00
|
|
|
let
|
|
|
|
# FStar requires sedlex < 2.4
|
|
|
|
# see https://github.com/FStarLang/FStar/issues/2343
|
|
|
|
sedlex-2_3 = ocamlPackages.sedlex_2.overrideAttrs (_: rec {
|
|
|
|
pname = "sedlex";
|
|
|
|
version = "2.3";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "ocaml-community";
|
|
|
|
repo = "sedlex";
|
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "WXUXUuIaBUrFPQOKtZ7dgDZYdpEVnoJck0dkrCi8g0c=";
|
|
|
|
};
|
|
|
|
});
|
|
|
|
in
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "fstar";
|
2021-08-27 14:25:00 +00:00
|
|
|
version = "2021.07.31";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "FStarLang";
|
|
|
|
repo = "FStar";
|
|
|
|
rev = "v${version}";
|
2021-08-27 14:25:00 +00:00
|
|
|
sha256 = "KZTmphpt8nYpOd8EReAZ6iIkS4uY3ZziKQ3A70BL/90=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2020-05-03 17:38:23 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper installShellFiles ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-08-27 14:25:00 +00:00
|
|
|
buildInputs = [
|
|
|
|
z3
|
|
|
|
] ++ (with ocamlPackages; [
|
|
|
|
ocaml
|
|
|
|
findlib
|
|
|
|
ocamlbuild
|
|
|
|
batteries
|
|
|
|
zarith
|
|
|
|
stdint
|
|
|
|
yojson
|
|
|
|
fileutils
|
|
|
|
menhir
|
|
|
|
menhirLib
|
|
|
|
pprint
|
|
|
|
sedlex-2_3
|
|
|
|
ppxlib
|
|
|
|
ppx_deriving
|
|
|
|
ppx_deriving_yojson
|
|
|
|
process
|
|
|
|
]);
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
makeFlags = [ "PREFIX=$(out)" ];
|
|
|
|
|
2021-08-27 14:25:00 +00:00
|
|
|
buildFlags = [ "libs" ];
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
patchShebangs ulib/gen_mllib.sh
|
|
|
|
substituteInPlace src/ocaml-output/Makefile --replace '$(COMMIT)' 'v${version}'
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
preInstall = ''
|
|
|
|
mkdir -p $out/lib/ocaml/${ocamlPackages.ocaml.version}/site-lib/fstarlib
|
|
|
|
'';
|
|
|
|
postInstall = ''
|
|
|
|
wrapProgram $out/bin/fstar.exe --prefix PATH ":" "${z3}/bin"
|
2020-05-03 17:38:23 +00:00
|
|
|
installShellCompletion --bash .completion/bash/fstar.exe.bash
|
|
|
|
installShellCompletion --fish .completion/fish/fstar.exe.fish
|
|
|
|
installShellCompletion --zsh --name _fstar.exe .completion/zsh/__fstar.exe
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "ML-like functional programming language aimed at program verification";
|
|
|
|
homepage = "https://www.fstar-lang.org";
|
|
|
|
license = licenses.asl20;
|
|
|
|
platforms = with platforms; darwin ++ linux;
|
|
|
|
maintainers = with maintainers; [ gebner ];
|
|
|
|
};
|
|
|
|
}
|