-
Notifications
You must be signed in to change notification settings - Fork 6
/
parallel-crypto3.nix
58 lines (50 loc) · 1.75 KB
/
parallel-crypto3.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
{ lib,
stdenv,
ninja,
pkg-config,
cmake,
boost,
gdb,
lldb,
cmake_modules,
enableDebugging,
enableDebug ? false,
runTests ? false,
sanitize? false,
benchmarkTests ? false,
}:
let
inherit (lib) optional;
in stdenv.mkDerivation {
name = "Parallel Crypto3";
src = lib.sourceByRegex ./. ["^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];
cmakeFlags =
[
(if runTests then "-DBUILD_PARALLEL_CRYPTO3_TESTS=TRUE" else "")
(if enableDebug then "-DCMAKE_BUILD_TYPE=Debug" else "-DCMAKE_BUILD_TYPE=Release")
(if sanitize then "-DSANITIZE=ON" else "-DSANITIZE=OFF")
(if benchmarkTests then "-DENABLE_BENCHMARKS=ON" else "-DENABLE_BENCHMARKS=OFF")
"-DPARALLEL_CRYPTO3_ENABLE=TRUE"
];
doCheck = runTests; # tests are inside parallel-crypto3-tests derivation
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 parallel-crypto3
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 "Welcome to Parallel Crypto3 development environment!"
'';
}