-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathdefault.nix
More file actions
174 lines (144 loc) · 4.46 KB
/
Copy pathdefault.nix
File metadata and controls
174 lines (144 loc) · 4.46 KB
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
{ pkgs ? import (fetchTarball {
url =
"https://github.com/NixOS/nixpkgs/archive/3f0a8ac25fb674611b98089ca3a5dd6480175751.tar.gz";
sha256 = "sha256:10i7fllqjzq171afzhdf2d9r1pk9irvmq5n55h92rc47vlaabvr4";
}) { config.allowUnfree = true; }, pname ? "harjus", version ? "latest" }:
with pkgs;
let
gccFlags =
"-O3 -march=icelake-server -mtune=icelake-server -pipe -fsemantic-interposition";
enableParallelBuilding = true;
# disable performance affecting hardenings
hardeningDisable =
[ "fortify" "stackprotector" "pic" "pie" "relro" "bindnow" ];
packages = rec {
# build quickfix properly with SSL support
myQuickfix = stdenv.mkDerivation {
pname = "quickfix";
version = "1.16.0";
src = fetchFromGitHub {
owner = "quickfix";
repo = "quickfix";
rev =
"92c85ca63fc260d16e24e0ece419ecdec9ffe868"; # 1.16.0 (no release for this commit)
hash = "sha256-uw47OvhD25rdJaufdgrefotcjyjn/RxT64WNnm2GHmE=";
};
patches = [
# Improved C++17 compatibility
(fetchpatch {
url =
"https://patch-diff.githubusercontent.com/raw/quickfix/quickfix/pull/625.diff";
hash = "sha256-J4Sw7lPS6gv9gkSn3kAM8RTdoBvpgLeOR4qeXtkjVao=";
})
./quickfix/00001-fix-build.patch
];
# enable SSL
cmakeFlags =
[ "-DHAVE_SSL=ON" "-DQUICKFIX_EXAMPLES=OFF" "-DQUICKFIX_TESTS=OFF" ];
nativeBuildInputs = [ cmake ninja ];
buildInputs = [ openssl ];
inherit enableParallelBuilding;
inherit hardeningDisable;
};
myQuickfixOptimized = myQuickfix.overrideAttrs (finalAttrs: {
# override compile flags to optimize for performance
NIX_CFLAGS_COMPILE = gccFlags;
});
# build quickfix properly with SSL support
runClangTidy = stdenv.mkDerivation {
pname = "runClangTidy";
version = "20.1.17";
buildInputs = [ python3 ];
inherit enableParallelBuilding;
src = fetchurl {
url =
"https://raw.githubusercontent.com/llvm/llvm-project/refs/tags/llvmorg-20.1.7/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py";
hash = "sha256-Kyus9SXaulqxg/mP29DyHfi7Qh4V2TiyJFGAlEGG/HM=";
};
dontUnpack = true;
installPhase = "install -D -m 0755 $src $out/bin/run-clang-tidy";
};
# The shell of our experiment runtime environment
devEnv = mkShell rec {
name = "devEnv";
# packages to be installed in env
packages = with pkgs; [
# for working with nix
glibcLocales
nixpkgs-fmt
nixfmt-classic
cowsay
# C++
cmake
ninja
gdb
clang-tools
ccache
gtest
boost
openssl
libcpr
pkg-config
libsodium
gmp
myQuickfix
runClangTidy
# deployment
terraform
ansible
ansible-lint
awscli2
python3
python3Packages.boto3
python3Packages.botocore
];
# disable hardenings (for better debugging experience)
hardeningDisable = [ "all" ];
# this is executed when shell entered
shellHook = ''
export USE_CCACHE=1
export CCACHE_COMPRESS=1
export CCACHE_MAXSIZE=10G
cowsay "Harjus!"
'';
};
# build derivation
# this is the main build derivation that will be used to build harjus
harjusbuild = stdenv.mkDerivation {
pname = "harjusbuild";
version = "rolling";
src = lib.fileset.toSource {
root = ./.;
fileset = lib.fileset.unions [ ./src ./CMakeLists.txt ./include ];
};
buildInputs = [
gtest
boost
openssl
libcpr
pkg-config
libsodium
gmp
myQuickfixOptimized
];
nativeBuildInputs = [ cmake ninja pkg-config ];
cmakeFlags = [ "-DHARJUS_TESTS=OFF" ];
inherit enableParallelBuilding;
inherit hardeningDisable;
NIX_CFLAGS_COMPILE = gccFlags;
};
# harjus wrapper
# this is the main package that will be used by users
# it will depend on harjusbuild and provide the executable
harjus = stdenv.mkDerivation {
inherit version pname;
src = harjusbuild.src;
buildInputs = [ harjusbuild ];
installPhase = ''
mkdir -p $out/bin
ln -s ${harjusbuild}/bin/harjus $out/bin/harjus
echo "Harjus version ${version} installed successfully!" > $out/version.txt
'';
};
};
in packages