-
Notifications
You must be signed in to change notification settings - Fork 1
/
flake.nix
107 lines (94 loc) · 3.04 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
{
inputs = {
flake-utils.url = "github:numtide/flake-utils";
karamel.url = "github:FStarLang/karamel";
fstar.url = "github:FStarLang/fstar";
nixpkgs.follows = "karamel/nixpkgs";
charon.url = "github:AeneasVerif/charon";
charon.inputs.nixpkgs.follows = "nixpkgs";
};
outputs =
{ self
, flake-utils
, nixpkgs
, ...
} @ inputs:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
karamel = inputs.karamel.packages.${system}.default;
krml = karamel.passthru.lib;
charon-packages = inputs.charon.packages.${system};
charon-ml = charon-packages.charon-ml;
charon = charon-packages.default;
fstar = inputs.fstar.packages.${system}.default;
package =
{ ocamlPackages
, removeReferencesTo
, stdenv
, symlinks
, version
, which
, z3
, gnugrep
, charon-ml
, krml
, symlinkJoin
, clang
,
}:
let
eurydice = ocamlPackages.buildDunePackage {
pname = "eurydice";
inherit version;
src = ./.;
nativeBuildInputs = [ gnugrep ];
propagatedBuildInputs = [ krml charon-ml ocamlPackages.terminal ocamlPackages.yaml ];
passthru = {
tests = stdenv.mkDerivation {
name = "tests";
src = ./.;
KRML_HOME = karamel;
FSTAR_HOME = fstar;
EURYDICE = "${eurydice}/bin/eurydice";
buildInputs = [ charon.buildInputs eurydice ];
nativeBuildInputs = [ charon.nativeBuildInputs fstar clang ];
buildPhase = ''
export CHARON="${charon}/bin/charon"
# setup CHARON_HOME: it is expected to be writtable, hence the `cp --no-preserve`
cp --no-preserve=mode,ownership -rf ${inputs.charon.sourceInfo.outPath} ./charon
export CHARON_HOME=./charon
make -o all test
'';
installPhase = ''touch $out'';
};
};
};
in
eurydice;
in
rec {
packages.default = pkgs.callPackage package {
inherit charon-ml krml;
version = self.rev or "dirty";
};
checks.default = packages.default.tests;
devShells.ci = pkgs.mkShell { packages = [ pkgs.jq ]; };
devShells.default = pkgs.mkShell {
packages = [
pkgs.clang-tools # For clang-format
pkgs.ocamlPackages.ocaml
pkgs.ocamlPackages.ocamlformat
pkgs.ocamlPackages.menhir
# ocaml-lsp's version must match the ocaml version used. Pinning
# this here to save me a headache.
pkgs.ocamlPackages.ocaml-lsp
];
buildInputs = [ charon.buildInputs ];
nativeBuildInputs = [ charon.nativeBuildInputs fstar pkgs.clang ];
inputsFrom = [
self.packages.${system}.default
];
};
});
}