-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathflake.nix
More file actions
124 lines (116 loc) · 2.78 KB
/
Copy pathflake.nix
File metadata and controls
124 lines (116 loc) · 2.78 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
{
inputs.self.submodules = true;
outputs = inputs@{
self, nixpkgs, flake-parts,
}: let
ecc-tools-bin = {
lib,
python3Packages,
rustPlatform,
stdenv,
zlib,
tcl,
boost,
eigen,
yaml-cpp,
libunwind,
glog,
gtest,
gflags,
metis,
gmp,
curl,
tbb_2022,
qhull,
cmake,
ninja,
flex,
bison,
patchelf,
pkg-config,
cargo,
}: python3Packages.buildPythonPackage rec {
name = "ecc-tools-bin";
format = "pyproject";
src = with lib.fileset; toSource {
root = ./.;
fileset = unions [
./src
./cmake
./CMakeLists.txt
./pyproject.toml
./uv.lock
];
};
postPatch = lib.pipe {
sdf_parser = "src/database/manager/parser/sdf/sdf_parse";
vcd_parser = "src/database/manager/parser/vcd/vcd_parser";
verilog-parser = "src/database/manager/parser/verilog/verilog-rust/verilog-parser";
} [
(lib.mapAttrsToList (name: path: ''
mkdir -p ${path}/.cargo
cat <<EOF > ${path}/.cargo/config.toml
[source."crates-io"]
"replace-with" = "vendored-sources"
[source."vendored-sources"]
"directory" = "${rustPlatform.importCargoLock {
lockFile = "${src}/${path}/Cargo.lock";
}}"
EOF
''))
(lib.concatStringsSep "\n")
];
build-system = [
python3Packages.scikit-build-core
];
dependencies = with python3Packages; [
torch
];
buildInputs = [
stdenv.cc.cc.lib
zlib
tcl
boost
eigen
yaml-cpp
libunwind
glog
gtest
gflags
metis
gmp
curl
tbb_2022
qhull
];
nativeBuildInputs = [
cmake
ninja
flex
bison
patchelf
pkg-config
cargo
tcl
];
dontUseCmakeConfigure = true;
pythonImportsCheck = [ "ecc_tools_bin.ecc_py" ];
passthru.rawBuildInputs = buildInputs;
passthru.rawNativeBuildInputs = nativeBuildInputs;
};
in flake-parts.lib.mkFlake { inherit inputs; } {
systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
perSystem = { self', pkgs, system, ... }: {
packages.default = pkgs.callPackage ecc-tools-bin {};
devShells.default = pkgs.mkShell.override {
stdenv = pkgs.ccacheStdenv;
} {
buildInputs = self'.packages.default.rawBuildInputs;
nativeBuildInputs = self'.packages.default.rawNativeBuildInputs ++ (with pkgs; [ uv ]);
shellHook = ''
export CCACHE_DIR="$PWD/.ccache"
'';
};
};
};
}