about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/networking/zap/default.nix
blob: 183f226f84b1042376360bc5121c1ca913cbffb0 (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
{ lib, stdenv, fetchFromGitHub, jdk8, ant, runtimeShell }:

let jdk = jdk8; in
stdenv.mkDerivation rec {
  pname = "zap";
  version = "2.7.0";
  src = fetchFromGitHub {
    owner = "zaproxy";
    repo = "zaproxy";
    rev =version;
    sha256 = "1bz4pgq66v6kxmgj99llacm1d85vj8z78jlgc2z9hv0ha5i57y32";
  };

  buildInputs = [ jdk ant ];

  buildPhase = ''
    cd build
    echo -n "${version}" > version.txt
    ant -f build.xml setup init  compile dist copy-source-to-build package-linux
  '';

  installPhase = ''
    mkdir -p "$out/share"
    tar xvf  "ZAP_${version}_Linux.tar.gz" -C "$out/share/"
    mkdir -p "$out/bin"
    echo "#!${runtimeShell}" > "$out/bin/zap"
    echo \"$out/share/ZAP_${version}/zap.sh\" >> "$out/bin/zap"
    chmod +x "$out/bin/zap"
  '';

  meta = with lib; {
    homepage = "https://www.owasp.org/index.php/ZAP";
    description = "Java application for web penetration testing";
    maintainers = with maintainers; [ mog ];
    platforms = platforms.linux;
    license = licenses.asl20;
  };
}