2020-05-30 16:37:55 +04:00
|
|
|
{ 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" &&
|
2020-05-31 16:58:59 +04:00
|
|
|
baseNameOf path != ".gitignore" &&
|
|
|
|
baseNameOf path != ".github" &&
|
|
|
|
!(hasSuffix ".nix" path) &&
|
2020-05-30 16:37:55 +04:00
|
|
|
(baseNameOf path == "build" -> type != "directory") &&
|
|
|
|
(baseNameOf path == "nix" -> type != "directory")
|
|
|
|
);
|
2020-07-05 21:55:02 +04:00
|
|
|
|
|
|
|
# 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 {
|
2020-05-30 16:37:55 +04:00
|
|
|
root = filterSource ./.;
|
|
|
|
|
|
|
|
LIBCLANG_PATH = "${llvmPackages.libclang}/lib";
|
2020-07-05 21:55:02 +04:00
|
|
|
buildInputs = [ onnxruntime onnxruntime-headers ];
|
2020-05-31 20:21:30 +04:00
|
|
|
nativeBuildInputs = [ pkg-config clang ];
|
2020-05-30 16:37:55 +04:00
|
|
|
|
2020-07-05 21:55:02 +04:00
|
|
|
# Note: This creates a doc attribute (nested derivation)
|
2020-05-30 16:37:55 +04:00
|
|
|
doDoc = true;
|
2020-07-05 21:55:02 +04:00
|
|
|
|
2020-05-30 16:37:55 +04:00
|
|
|
doCheck = true;
|
|
|
|
}
|