-
Notifications
You must be signed in to change notification settings - Fork 13
/
crypto3.nix
45 lines (38 loc) · 1.17 KB
/
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
{ lib,
stdenv,
src_repo,
ninja,
pkg-config,
cmake,
boost183,
# We'll use boost183 by default, but you can override it
boost_lib ? boost183,
gdb,
cmake_modules,
enableDebugging,
enableDebug ? false,
runTests ? false,
}:
let
inherit (lib) optional;
in stdenv.mkDerivation {
name = "Crypto3";
src = src_repo;
nativeBuildInputs = [ cmake ninja pkg-config ] ++ (lib.optional (!stdenv.isDarwin) gdb);
# enableDebugging will keep debug symbols in boost
propagatedBuildInputs = [ (if enableDebug then (enableDebugging boost_lib) else boost_lib) ];
buildInputs = [cmake_modules];
cmakeFlags =
[
(if runTests then "-DBUILD_TESTS=TRUE" else "")
(if runTests then "-DCMAKE_ENABLE_TESTS=TRUE" else "")
(if enableDebug then "-DCMAKE_BUILD_TYPE=Debug" else "-DCMAKE_BUILD_TYPE=Release")
(if enableDebug then "-DCMAKE_CXX_FLAGS=-ggdb" else "")
(if enableDebug then "-DCMAKE_CXX_FLAGS=-O0" else "")
];
doCheck = runTests; # tests are inside crypto3-tests derivation
shellHook = ''
PS1="\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ "
echo "Welcome to Crypto3 development environment!"
'';
}