-
Notifications
You must be signed in to change notification settings - Fork 14
/
flake.nix
153 lines (137 loc) · 3.95 KB
/
flake.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
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
{
description = "Object level memory profiler for C++";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
treefmt-nix.url = "github:numtide/treefmt-nix";
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
};
outputs =
{
self,
nixpkgs,
flake-utils,
treefmt-nix,
...
}@inputs:
flake-utils.lib.eachSystem [ flake-utils.lib.system.x86_64-linux ] (
system:
let
defaultLlvmVersion = 16;
pkgs = import nixpkgs { inherit system; };
drgnSrc = pkgs.fetchFromGitHub {
owner = "JakeHillion";
repo = "drgn";
rev = "b1f8c3e8526611b6720800250ba858a713dd9e4f";
hash = "sha256-5WhMHgx/RKtqjxGx4AyiqVKMot5xulr+6c8i2E9IxiA=";
fetchSubmodules = true;
};
mkOidPackage =
llvmVersion:
let
llvmPackages = pkgs."llvmPackages_${toString llvmVersion}";
in
llvmPackages.stdenv.mkDerivation rec {
name = "oid";
src = self;
nativeBuildInputs = with pkgs; [
autoconf
automake
bison
cmake
flex
gettext
git
hexdump
libtool
ninja
pkgconf
python312
python312Packages.setuptools
python312Packages.toml
glibcLocales
];
buildInputs =
(with llvmPackages; [
llvmPackages.libclang
llvmPackages.llvm
llvmPackages.openmp
])
++ (with pkgs; [
boost
bzip2
curl
double-conversion
elfutils
flex
folly
folly.fmt
gflags
glog
gtest
icu
jemalloc
libarchive
libmicrohttpd
liburing
libxml2
lzma
msgpack
range-v3
rocksdb_8_11
sqlite
tomlplusplus
zstd
]);
cmakeFlags = [
"-Ddrgn_SOURCE_DIR=${drgnSrc}"
"-DFORCE_BOOST_STATIC=Off"
];
outputs = [ "out" ];
};
mkOidDevShell =
llvmVersion:
let
llvmPackages = pkgs."llvmPackages_${toString llvmVersion}";
in
pkgs.mkShell.override { stdenv = llvmPackages.stdenv; } {
inputsFrom = [ self.packages.${system}."oid-llvm${toString llvmVersion}" ];
buildInputs = [ ];
};
in
{
packages = rec {
default = self.packages.${system}."oid-llvm${toString defaultLlvmVersion}";
oid-llvm15 = mkOidPackage 15;
oid-llvm16 = mkOidPackage 16;
};
devShells = rec {
default = self.devShells.${system}."oid-llvm${toString defaultLlvmVersion}";
oid-llvm15 = mkOidDevShell 15;
oid-llvm16 = mkOidDevShell 16;
};
apps.default = {
type = "app";
program = "${self.packages.${system}.default}/bin/oid";
};
}
)
// flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
treefmtEval = treefmt-nix.lib.evalModule pkgs (pkgs: {
projectRootFile = "flake.nix";
settings.global.excludes = [ "./extern/**" ];
programs.nixfmt.enable = true;
programs.clang-format.enable = true;
programs.black.enable = true;
programs.isort.enable = true;
});
in
{
formatter = treefmtEval.config.build.wrapper;
checks.formatting = treefmtEval.config.build.check self;
}
);
}