forked from heal-research/operon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
91 lines (82 loc) · 2.53 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
{
description = "Operon development environment";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.foolnotion.url = "github:foolnotion/nur-pkg";
inputs.nixpkgs.url = "github:nixos/nixpkgs/master";
inputs.pratt-parser.url = "github:foolnotion/pratt-parser-calculator";
inputs.vstat.url = "github:heal-research/vstat/main";
outputs = { self, flake-utils, nixpkgs, foolnotion, pratt-parser, vstat }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ foolnotion.overlay ];
};
operon = pkgs.stdenv.mkDerivation {
name = "operon";
src = self;
cmakeFlags = [
"-DBUILD_CLI_PROGRAMS=ON"
"-DBUILD_SHARED_LIBS=${if pkgs.hostPlatform.isStatic then "OFF" else "ON"}"
"-DBUILD_TESTING=OFF"
"-DCMAKE_BUILD_TYPE=Release"
"-DUSE_OPENLIBM=ON"
"-DUSE_SINGLE_PRECISION=ON"
"-DCMAKE_CXX_FLAGS=${if pkgs.hostPlatform.isx86_64 then "-march=x86-64-v3" else ""}"
];
nativeBuildInputs = with pkgs; [ cmake ];
buildInputs = (with pkgs; [
aria-csv
cpp-sort
cxxopts
doctest
eigen
fast_float
fmt_8
git
mold
openlibm
pkg-config
pratt-parser.packages.${system}.default
scnlib
span-lite
taskflow
unordered_dense
vectorclass
vstat.packages.${system}.default
xxhash_cpp
]);
};
in rec {
packages.${system}.default = operon;
defaultPackage = operon;
devShell = pkgs.stdenv.mkDerivation {
name = "operon-env";
hardeningDisable = [ "all" ];
impureUseNativeOptimizations = true;
nativeBuildInputs = operon.nativeBuildInputs ++ (with pkgs; [
bear
clang_14
clang-tools
cppcheck
include-what-you-use
]);
buildInputs = operon.buildInputs ++ (with pkgs; [
gdb
hotspot
valgrind
jemalloc
linuxPackages.perf
graphviz
seer
hyperfine
]);
shellHook = ''
LD_LIBRARY_PATH=${
pkgs.lib.makeLibraryPath [ pkgs.stdenv.cc.cc.lib ]
};
alias bb="cmake --build build -j"
'';
};
});
}