-
Notifications
You must be signed in to change notification settings - Fork 6
/
zkevm-framework.nix
61 lines (53 loc) · 1.71 KB
/
zkevm-framework.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
{ lib,
stdenv,
ninja,
pkg-config,
cmake,
boost,
gdb,
lldb,
cmake_modules,
ethash,
intx,
sszpp,
valijson,
gtest,
enableDebugging,
enableDebug ? false,
runTests ? false,
}:
let
inherit (lib) optional;
in stdenv.mkDerivation rec {
name = "zkevm-framework";
src = lib.sourceByRegex ./. ["^zkevm-framework(/.*)?$" "^evm-assigner(/.*)?$" "^proof-producer(/.*)?$" "^crypto3(/.*)?$" "^parallel-crypto3(/.*)?$" "CMakeLists.txt"];
hardeningDisable = [ "fortify" ];
nativeBuildInputs =[ cmake ninja pkg-config ] ++
(lib.optional (!stdenv.isDarwin) gdb) ++
(lib.optional (stdenv.isDarwin) lldb);
# enableDebugging will keep debug symbols in boost
propagatedBuildInputs = [ (if enableDebug then (enableDebugging boost) else boost) ];
buildInputs = [cmake_modules intx ethash sszpp valijson gtest];
cmakeFlags =
[
(if runTests then "-DENABLE_TESTS=TRUE" else "")
(if enableDebug then "-DCMAKE_BUILD_TYPE=Debug" else "-DCMAKE_BUILD_TYPE=Release")
"-DZKEVM_FRAMEWORK_ENABLE=TRUE"
"-G Ninja"
];
doBuild = true;
doCheck = runTests;
checkPhase = ''
# JUNIT file without explicit file name is generated after the name of the master test suite inside `CMAKE_CURRENT_SOURCE_DIR`
export BOOST_TEST_LOGGER=JUNIT:HRF
cd zkevm-framework
ctest --verbose --output-on-failure -R
cd ..
mkdir -p ${placeholder "out"}/test-logs
find .. -type f -name '*_test.xml' -exec cp {} ${placeholder "out"}/test-logs \;
'';
shellHook = ''
PS1="\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ "
echo "zkEVM-framework ${if enableDebug then "debug" else "release"} dev environment activated"
'';
}