forked from basile-henry/onnxruntime-rs
-
Notifications
You must be signed in to change notification settings - Fork 2
/
default.nix
41 lines (33 loc) · 1.19 KB
/
default.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
{ nixpkgs ? import ./nix/nixpkgs.nix
}:
with nixpkgs;
let filterSource = with lib; builtins.filterSource (path: type:
type != "unknown" &&
baseNameOf path != "target" &&
baseNameOf path != "result" &&
baseNameOf path != ".git" &&
baseNameOf path != ".gitignore" &&
baseNameOf path != ".github" &&
!(hasSuffix ".nix" path) &&
(baseNameOf path == "build" -> type != "directory") &&
(baseNameOf path == "nix" -> type != "directory")
);
# Version of onnxruntime.dev with include directory set up the same way as
# a released version from microsoft/onnxruntime GitHub release.
onnxruntime-headers = stdenv.mkDerivation {
name = "onnxruntime-headers";
src = onnxruntime.dev;
installPhase = ''
mkdir -p $out/include
cp include/onnxruntime/core/session/onnxruntime_c_api.h $out/include/onnxruntime_c_api.h
'';
};
in naersk.buildPackage {
root = filterSource ./.;
LIBCLANG_PATH = "${llvmPackages.libclang}/lib";
buildInputs = [ onnxruntime onnxruntime-headers ];
nativeBuildInputs = [ pkg-config clang ];
# Note: This creates a doc attribute (nested derivation)
doDoc = true;
doCheck = true;
}