forked from hacspec/hax
-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.nix
50 lines (50 loc) · 1.37 KB
/
default.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
{
craneLib,
stdenv,
lib,
hax,
fstar,
hacl-star,
hax-env,
jq,
}: let
matches = re: path: !builtins.isNull (builtins.match re path);
commonArgs = {
version = "0.0.1";
src = lib.cleanSourceWith {
src = craneLib.path ./..;
filter = path: type:
# We include only certain files. FStar files under the example
# directory are listed out.
( matches ".*(Makefile|.*[.](rs|toml|lock|diff|fsti?))$" path
&& !matches ".*examples/.*[.]fsti?$" path
) || ("directory" == type);
};
doCheck = false;
cargoVendorDir = craneLib.vendorMultipleCargoDeps {
cargoLockList = [
./Cargo.lock
../Cargo.lock
];
};
};
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
in
craneLib.mkCargoDerivation (commonArgs
// {
inherit cargoArtifacts;
pname = "hax-examples";
doCheck = false;
buildPhaseCargoCommand = ''
cd examples
eval $(hax-env)
export CACHE_DIR=$(mktemp -d)
export HINT_DIR=$(mktemp -d)
export SHELL=${stdenv.shell}
make clean # Should be a no-op (see `filter` above)
# Need to inject `HAX_VANILLA_RUSTC=never` because of #472
sed -i "s/make -C limited-order-book/HAX_VANILLA_RUSTC=never make -C limited-order-book/g" Makefile
make
'';
buildInputs = [hax hax-env fstar jq];
})