From 6af9c5c3c02457f248d60f97e2c161e219575568 Mon Sep 17 00:00:00 2001 From: frenetic00 <50942055+frenetic00@users.noreply.github.com> Date: Sun, 22 Sep 2024 15:42:10 +0100 Subject: [PATCH 1/2] maintainers: add frenetic00 --- maintainers/maintainer-list.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index 15fa72f89843d..44c0751d4506d 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -7188,6 +7188,11 @@ githubId = 13279982; name = "freezeboy"; }; + frenetic00 = { + github = "frenetic00"; + githubId = 50942055; + name = "frenetic00"; + }; Fresheyeball = { email = "fresheyeball@gmail.com"; github = "Fresheyeball"; From 197de6a90d7889dfa53925dbead6b8f52fa162c5 Mon Sep 17 00:00:00 2001 From: frenetic00 <50942055+frenetic00@users.noreply.github.com> Date: Sun, 22 Sep 2024 17:12:26 +0100 Subject: [PATCH 2/2] libedgetpu: init at 0-unstable-2024-03-14 --- pkgs/by-name/li/libedgetpu/package.nix | 87 ++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 pkgs/by-name/li/libedgetpu/package.nix diff --git a/pkgs/by-name/li/libedgetpu/package.nix b/pkgs/by-name/li/libedgetpu/package.nix new file mode 100644 index 0000000000000..9ead9c5f60b33 --- /dev/null +++ b/pkgs/by-name/li/libedgetpu/package.nix @@ -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; + }; +}