Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libedgetpu: init at 0-unstable-2024-03-14 #343786

Merged
merged 2 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions maintainers/maintainer-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7188,6 +7188,11 @@
githubId = 13279982;
name = "freezeboy";
};
frenetic00 = {
github = "frenetic00";
githubId = 50942055;
name = "frenetic00";
};
Fresheyeball = {
email = "[email protected]";
github = "Fresheyeball";
Expand Down
87 changes: 87 additions & 0 deletions pkgs/by-name/li/libedgetpu/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
{
lib,
stdenv,
fetchFromGitHub,
libusb1,
abseil-cpp,
flatbuffers,
fetchpatch,
xxd,
}:
let
# Tensorflow 2.16.1 requires Flatbuffers 23.5.26
# Compile as a shared library
flatbuffers_23_5_26 = flatbuffers.overrideAttrs (oldAttrs: rec {
version = "23.5.26";
cmakeFlags = (oldAttrs.cmakeFlags or [ ]) ++ [ "-DFLATBUFFERS_BUILD_SHAREDLIB=ON" ];
NIX_CXXSTDLIB_COMPILE = "-std=c++17";
configureFlags = (oldAttrs.configureFlags or [ ]) ++ [ "--enable-shared" ];
src = fetchFromGitHub {
owner = "google";
repo = "flatbuffers";
rev = "v${version}";
hash = "sha256-e+dNPNbCHYDXUS/W+hMqf/37fhVgEGzId6rhP3cToTE=";
};
});
in
stdenv.mkDerivation {
pname = "libedgetpu";
version = "0-unstable-2024-03-14";

src = fetchFromGitHub {
owner = "google-coral";
repo = "libedgetpu";
rev = "e35aed18fea2e2d25d98352e5a5bd357c170bd4d";
hash = "sha256-SabiFG/EgspiCFpg8XQs6RjFhrPPUfhILPmYQQA1E2w=";
};

patches = [
(fetchpatch {
name = "fix-makefile-to-compile-with-latest-tensorflow.patch";
url = "https://patch-diff.githubusercontent.com/raw/google-coral/libedgetpu/pull/66.patch";
hash = "sha256-mMODpQmikfXtsQvtgh26cy97EiykYNLngSjidOBt/3I=";
})
];

makeFlags = [
"-f"
"makefile_build/Makefile"
"libedgetpu"
];

buildInputs = [
abseil-cpp
libusb1
flatbuffers_23_5_26
];

nativeBuildInputs = [ xxd ];

NIX_CXXSTDLIB_COMPILE = "-std=c++17";

TFROOT = fetchFromGitHub {
owner = "tensorflow";
repo = "tensorflow";
rev = "v2.16.1";
hash = "sha256-UPvK5Kc/FNVJq3FchN5IIBBObvcHtAPVv0ARzWzA35M=";
};

enableParallelBuilding = true;

installPhase = ''
runHook preInstall
install -Dm555 out/direct/k8/libedgetpu.so.1.0 -t $out/lib
ln -s $out/lib/libedgetpu.so.1.0 $out/lib/libedgetpu.so.1
install -Dm444 debian/edgetpu-accelerator.rules $out/lib/udev/rules.d/99-edgetpu-accelerator.rules
install -Dm444 tflite/public/*.h -t $out/include
runHook postInstall
'';

meta = {
homepage = "https://github.com/google-coral/libedgetpu";
description = "Userspace level runtime driver for Coral devices";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ frenetic00 ];
platforms = lib.platforms.linux;
};
}