about summary refs log tree commit diff
path: root/pkgs/by-name/ma/maltego/package.nix
blob: 5c5a011506df2c848a57e2efbbf0d2941e232733 (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
70
71
72
73
74
75
76
77
78
79
80
81
{ lib
, stdenv
, fetchzip
, jre
, giflib
, gawk
, makeBinaryWrapper
, icoutils
, copyDesktopItems
, makeDesktopItem
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "maltego";
  version = "4.6.0";

  src = fetchzip {
    url = "https://downloads.maltego.com/maltego-v4/linux/Maltego.v${finalAttrs.version}.linux.zip";
    hash = "sha256-q+1RYToZtBxAIDSiUWf3i/3GBBDwh6NWteHiK4VM1HY=";
  };

  postPatch = ''
    substituteInPlace bin/maltego \
      --replace-fail /usr/bin/awk ${lib.getExe gawk}
  '';

  desktopItems = [
    (makeDesktopItem {
      name = "maltego";
      desktopName = "Maltego";
      exec = "maltego";
      icon = "maltego";
      comment = "An open source intelligence and forensics application";
      categories = [ "Network" "Security" ];
      startupNotify = false;
    })
  ];

  nativeBuildInputs = [
    icoutils
    makeBinaryWrapper
    copyDesktopItems
  ];

  buildInputs = [ jre giflib ];

  installPhase = ''
    runHook preInstall

    mkdir -p $out/{bin,share}
    chmod +x bin/maltego

    icotool -x bin/maltego.ico

    for size in 16 32 48 256
    do
      mkdir -p $out/share/icons/hicolor/$size\x$size/apps
      cp maltego_*_$size\x$size\x32.png $out/share/icons/hicolor/$size\x$size/apps/maltego.png
    done

    rm -r *.png

    cp -aR . "$out/share/maltego/"

    makeWrapper $out/share/maltego/bin/maltego $out/bin/maltego \
      --set JAVA_HOME ${jre} \
      --prefix PATH : ${lib.makeBinPath [ jre ]}

    runHook postInstall
  '';

  meta = with lib; {
    homepage = "https://www.maltego.com";
    description = "An open source intelligence and forensics application, enabling to easily gather information about DNS, domains, IP addresses, websites, persons, and so on";
    mainProgram = "maltego";
    maintainers = with maintainers; [ emilytrau d3vil0p3r ];
    platforms = platforms.unix;
    sourceProvenance = with sourceTypes; [ binaryBytecode ];
    license = licenses.unfree;
  };
})