2024-01-02 11:29:13 +00:00
|
|
|
{ callPackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
, installShellFiles
|
|
|
|
, lib
|
|
|
|
, makeWrapper
|
|
|
|
, ocamlPackages
|
|
|
|
, removeReferencesTo
|
|
|
|
, stdenv
|
|
|
|
, writeScript
|
|
|
|
, z3
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-02-07 01:22:34 +00:00
|
|
|
version = "2024.01.13";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "FStarLang";
|
|
|
|
repo = "FStar";
|
|
|
|
rev = "v${version}";
|
2024-02-07 01:22:34 +00:00
|
|
|
hash = "sha256-xjSWDP8mSjLcn+0hsRpEdzsBgBR+mKCZB8yLmHl+WqE=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
fstar-dune = ocamlPackages.callPackage ./dune.nix { inherit version src; };
|
|
|
|
|
|
|
|
fstar-ulib = callPackage ./ulib.nix { inherit version src fstar-dune z3; };
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
pname = "fstar";
|
|
|
|
inherit version src;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-03-05 16:20:37 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
installShellFiles
|
2024-01-02 11:29:13 +00:00
|
|
|
makeWrapper
|
2023-02-02 18:25:31 +00:00
|
|
|
removeReferencesTo
|
2023-03-04 12:14:45 +00:00
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
inherit (fstar-dune) propagatedBuildInputs;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
dontBuild = true;
|
2021-10-06 13:57:05 +00:00
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
installPhase = ''
|
|
|
|
mkdir $out
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
CP="cp -r --no-preserve=mode"
|
|
|
|
$CP ${fstar-dune}/* $out
|
|
|
|
$CP ${fstar-ulib}/* $out
|
|
|
|
|
|
|
|
PREFIX=$out make -C src/ocaml-output install-sides
|
|
|
|
|
|
|
|
chmod +x $out/bin/fstar.exe
|
|
|
|
wrapProgram $out/bin/fstar.exe --prefix PATH ":" ${z3}/bin
|
2023-02-02 18:25:31 +00:00
|
|
|
remove-references-to -t '${ocamlPackages.ocaml}' $out/bin/fstar.exe
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
substituteInPlace $out/lib/ocaml/${ocamlPackages.ocaml.version}/site-lib/fstar/dune-package \
|
|
|
|
--replace ${fstar-dune} $out
|
|
|
|
|
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
|
|
|
'';
|
|
|
|
|
2022-12-28 21:21:41 +00:00
|
|
|
passthru.updateScript = writeScript "update-fstar" ''
|
2024-01-02 11:29:13 +00:00
|
|
|
#!/usr/bin/env nix-shell
|
|
|
|
#!nix-shell -i bash -p git gnugrep common-updater-scripts
|
|
|
|
set -eu -o pipefail
|
2022-12-28 21:21:41 +00:00
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
version="$(git ls-remote --tags git@github.com:FStarLang/FStar.git | grep -Po 'v\K\d{4}\.\d{2}\.\d{2}' | sort | tail -n1)"
|
|
|
|
update-source-version fstar "$version"
|
2022-12-28 21:21:41 +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";
|
2021-09-18 10:52:07 +00:00
|
|
|
changelog = "https://github.com/FStarLang/FStar/raw/v${version}/CHANGES.md";
|
2022-05-18 14:49:53 +00:00
|
|
|
license = licenses.asl20;
|
2021-10-06 13:57:05 +00:00
|
|
|
maintainers = with maintainers; [ gebner pnmadelaine ];
|
2022-05-18 14:49:53 +00:00
|
|
|
mainProgram = "fstar.exe";
|
|
|
|
platforms = with platforms; darwin ++ linux;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|