about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/science/robotics/edgetpu-compiler/default.nix
blob: 07d978641663d3af2b0d8ade046b4ad9c6b72f1a (plain) (blame)
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
{ autoPatchelfHook
, dpkg
, fetchurl
, lib
, libcxx
, stdenv
}:
stdenv.mkDerivation rec {
  pname = "edgetpu-compiler";
  version = "15.0";

  src = fetchurl rec {
    url = "https://packages.cloud.google.com/apt/pool/${pname}_${version}_amd64_${sha256}.deb";
    sha256 = "ce03822053c2bddbb8640eaa988396ae66f9bc6b9d6d671914acd1727c2b445a";
  };

  nativeBuildInputs = [
    autoPatchelfHook
    dpkg
  ];

  buildInputs = [
    libcxx
  ];

  unpackPhase = ''
    mkdir bin pkg

    dpkg -x $src pkg

    rm -r pkg/usr/share/lintian

    cp pkg/usr/bin/edgetpu_compiler_bin/edgetpu_compiler ./bin
    cp -r pkg/usr/share .

    rm -r pkg
  '';

  dontConfigure = true;
  dontBuild = true;

  installPhase = ''
    runHook preInstall

    mkdir -p $out
    cp -r ./{bin,share} $out

    runHook postInstall
  '';

  meta = with lib; {
    description = "A command line tool that compiles a TensorFlow Lite model into an Edge TPU compatible file.";
    mainProgram = "edgetpu_compiler";
    homepage = "https://coral.ai/docs/edgetpu/compiler";
    sourceProvenance = with sourceTypes; [ binaryNativeCode ];
    license = licenses.asl20;
    maintainers = with maintainers; [ cpcloud ];
    platforms = [ "x86_64-linux" ];
  };
}