2021-01-22 11:25:31 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, z3, ocamlPackages, makeWrapper, installShellFiles }:
|
2016-01-19 00:44:21 +00:00
|
|
|
|
2021-08-25 22:42:21 +01: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
|
|
|
|
|
2016-01-19 00:44:21 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "fstar";
|
2021-10-20 16:46:41 +01:00
|
|
|
version = "2021.10.16";
|
2016-01-19 00:44:21 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "FStarLang";
|
|
|
|
repo = "FStar";
|
2016-03-13 08:32:28 +00:00
|
|
|
rev = "v${version}";
|
2021-10-20 16:46:41 +01:00
|
|
|
sha256 = "03b693s7s7dzflv5qkf61gd8ji9bn6fq4pxd8pd3a6ppkwj6b5vc";
|
2016-01-19 00:44:21 +00:00
|
|
|
};
|
|
|
|
|
2020-04-29 10:20:00 +01:00
|
|
|
nativeBuildInputs = [ makeWrapper installShellFiles ];
|
2016-03-13 08:32:28 +00:00
|
|
|
|
2021-08-25 22:42:21 +01:00
|
|
|
buildInputs = [
|
|
|
|
z3
|
2021-10-04 16:34:32 +01:00
|
|
|
sedlex-2_3
|
2021-08-25 22:42:21 +01:00
|
|
|
] ++ (with ocamlPackages; [
|
|
|
|
ocaml
|
|
|
|
findlib
|
|
|
|
ocamlbuild
|
|
|
|
batteries
|
|
|
|
zarith
|
|
|
|
stdint
|
|
|
|
yojson
|
|
|
|
fileutils
|
|
|
|
menhir
|
|
|
|
menhirLib
|
|
|
|
pprint
|
|
|
|
ppxlib
|
|
|
|
ppx_deriving
|
|
|
|
ppx_deriving_yojson
|
|
|
|
process
|
|
|
|
]);
|
2016-01-19 00:44:21 +00:00
|
|
|
|
2017-10-02 11:19:41 +01:00
|
|
|
makeFlags = [ "PREFIX=$(out)" ];
|
2016-01-19 00:44:21 +00:00
|
|
|
|
2021-08-25 22:42:21 +01:00
|
|
|
buildFlags = [ "libs" ];
|
|
|
|
|
2021-10-04 16:34:32 +01:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2021-08-25 22:42:21 +01:00
|
|
|
postPatch = ''
|
|
|
|
patchShebangs ulib/gen_mllib.sh
|
|
|
|
substituteInPlace src/ocaml-output/Makefile --replace '$(COMMIT)' 'v${version}'
|
2016-01-19 00:44:21 +00:00
|
|
|
'';
|
|
|
|
|
2018-05-25 09:27:02 +01:00
|
|
|
preInstall = ''
|
|
|
|
mkdir -p $out/lib/ocaml/${ocamlPackages.ocaml.version}/site-lib/fstarlib
|
|
|
|
'';
|
2016-01-19 00:44:21 +00:00
|
|
|
postInstall = ''
|
|
|
|
wrapProgram $out/bin/fstar.exe --prefix PATH ":" "${z3}/bin"
|
2020-04-29 10:20:00 +01:00
|
|
|
installShellCompletion --bash .completion/bash/fstar.exe.bash
|
|
|
|
installShellCompletion --fish .completion/fish/fstar.exe.fish
|
|
|
|
installShellCompletion --zsh --name _fstar.exe .completion/zsh/__fstar.exe
|
2016-01-19 00:44:21 +00:00
|
|
|
'';
|
|
|
|
|
2021-01-22 11:25:31 +00:00
|
|
|
meta = with lib; {
|
2016-01-19 00:44:21 +00:00
|
|
|
description = "ML-like functional programming language aimed at program verification";
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://www.fstar-lang.org";
|
2016-01-19 00:44:21 +00:00
|
|
|
license = licenses.asl20;
|
2021-09-01 13:31:20 +01:00
|
|
|
changelog = "https://github.com/FStarLang/FStar/raw/v${version}/CHANGES.md";
|
2016-06-30 16:57:32 +01:00
|
|
|
platforms = with platforms; darwin ++ linux;
|
2021-10-04 16:34:32 +01:00
|
|
|
maintainers = with maintainers; [ gebner pnmadelaine ];
|
2016-01-19 00:44:21 +00:00
|
|
|
};
|
|
|
|
}
|