summary refs log tree commit diff
path: root/pkgs/tools/graphics/agi/default.nix
blob: 950849cafc471feef23a5d16597bca080a34460a (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
61
62
63
64
65
66
67
68
69
{ lib
, stdenv
, fetchzip
, autoPatchelfHook
, makeWrapper
, makeDesktopItem
, copyDesktopItems
, wrapGAppsHook
, gobject-introspection
, gdk-pixbuf
, jre
, androidenv
}:

stdenv.mkDerivation rec {
  pname = "agi";
  version = "2.1.0-dev-20210726";

  src = fetchzip {
    url = "https://github.com/google/agi-dev-releases/releases/download/v${version}/agi-${version}-linux.zip";
    sha256 = "sha256-1joE2+lNFs0VmglqLsbyqhj16tfCZ+saQmy1XP3ATBo=";
  };

  nativeBuildInputs = [
    autoPatchelfHook
    makeWrapper
    wrapGAppsHook
    gdk-pixbuf
    gobject-introspection
    copyDesktopItems
  ];

  buildInputs = [
    stdenv.cc.cc.lib
  ];

  installPhase = ''
    runHook preInstall
    mkdir -p $out/{bin,lib}
    cp ./{agi,gapis,gapir,gapit,device-info} $out/bin
    cp lib/gapic.jar $out/lib
    wrapProgram $out/bin/agi \
      --add-flags "--vm ${jre}/bin/java" \
      --add-flags "--jar $out/lib/gapic.jar" \
      --add-flags "--adb ${androidenv.androidPkgs_9_0.platform-tools}/bin/adb"
    for i in 16 32 48 64 96 128 256 512 1024; do
      install -D ${src}/icon.png $out/share/icons/hicolor/''${i}x$i/apps/agi.png
    done
    runHook postInstall
  '';

  desktopItems = [(makeDesktopItem {
    name = "agi";
    desktopName = "Android GPU Inspector";
    exec = "$out/bin/agi";
    icon = "agi";
    type = "Application";
    categories = "Development;Debugger;Graphics;3DGraphics";
    terminal = "false";
  })];

  meta = with lib; {
    homepage = "https://github.com/google/agi/";
    description = "Android GPU Inspector";
    license = licenses.asl20;
    platforms = [ "x86_64-linux" ];
    maintainers = [ maintainers.ivar ];
  };
}