fork
Configure Feed
Select the types of activity you want to include in your feed.
nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
fork
Configure Feed
Select the types of activity you want to include in your feed.
1{
2 callPackage,
3 fetchFromGitHub,
4 installShellFiles,
5 lib,
6 makeWrapper,
7 nix-update-script,
8 ocaml-ng,
9 removeReferencesTo,
10 util-linux,
11 which,
12}:
13
14let
15 # The version of ocaml fstar uses.
16 ocamlPackages = ocaml-ng.ocamlPackages_5_3;
17
18 fstarZ3 = callPackage ./z3 { };
19in
20ocamlPackages.buildDunePackage (finalAttrs: {
21 pname = "fstar";
22 version = "2025.12.15";
23
24 src = fetchFromGitHub {
25 owner = "FStarLang";
26 repo = "FStar";
27 rev = "v${finalAttrs.version}";
28 hash = "sha256-UuwDX6178YMhEQqpEOATswzoUNpEECq7Nyh2yk5gKRg=";
29 };
30
31 nativeBuildInputs = [
32 ocamlPackages.menhir
33 which
34 util-linux
35 installShellFiles
36 makeWrapper
37 removeReferencesTo
38 ];
39
40 prePatch = ''
41 patchShebangs .scripts/*.sh
42 patchShebangs ulib/ml/app/ints/mk_int_file.sh
43 '';
44
45 buildInputs = with ocamlPackages; [
46 memtrace
47 ];
48
49 propagatedBuildInputs = with ocamlPackages; [
50 batteries
51 menhirLib
52 pprint
53 ppx_deriving
54 ppx_deriving_yojson
55 ppxlib
56 process
57 sedlex
58 stdint
59 yojson
60 zarith
61 mtime
62 ];
63
64 preConfigure = ''
65 mkdir -p cache
66 export DUNE_CACHE_ROOT="$(pwd)/cache"
67 export PATH="${lib.makeBinPath [ fstarZ3 ]}''${PATH:+:}$PATH"
68 export PREFIX="$out"
69 '';
70
71 buildPhase = ''
72 runHook preBuild
73 make -j$NIX_BUILD_CORES
74 runHook postBuild
75 '';
76
77 installPhase = ''
78 runHook preInstall
79
80 make install
81
82 # Ensure ocamlfind can locate fstar OCaml libraries
83 mkdir -p $OCAMLFIND_DESTDIR
84 ln -s -t $OCAMLFIND_DESTDIR/ $out/lib/fstar
85
86 remove-references-to -t '${ocamlPackages.ocaml}' $out/bin/fstar.exe
87
88 for binary in $out/bin/*; do
89 wrapProgram "$binary" --prefix PATH : "${lib.makeBinPath [ fstarZ3 ]}"
90 done
91
92 src="$(pwd)"
93 cd $out
94 installShellCompletion --bash $src/.completion/bash/fstar.exe.bash
95 installShellCompletion --fish $src/.completion/fish/fstar.exe.fish
96 installShellCompletion --zsh --name _fstar.exe $src/.completion/zsh/__fstar.exe
97 cd $src
98
99 runHook postInstall
100 '';
101
102 enableParallelBuilding = true;
103
104 passthru = {
105 updateScript = nix-update-script {
106 extraArgs = [
107 "--version-regex"
108 "v(\\d{4}\\.\\d{2}\\.\\d{2})$"
109 ];
110 };
111 z3 = fstarZ3;
112 };
113
114 meta = {
115 description = "ML-like functional programming language aimed at program verification";
116 homepage = "https://www.fstar-lang.org";
117 changelog = "https://github.com/FStarLang/FStar/raw/v${finalAttrs.version}/CHANGES.md";
118 license = lib.licenses.asl20;
119 maintainers = with lib.maintainers; [
120 numinit
121 ];
122 mainProgram = "fstar.exe";
123 platforms = with lib.platforms; darwin ++ linux;
124 };
125})