1 { lib, stdenv, fetchurl, jre, runtimeShell }:
3 stdenv.mkDerivation rec {
7 url = "https://github.com/zaproxy/zaproxy/releases/download/v${version}/ZAP_${version}_Linux.tar.gz";
8 sha256 = "sha256-ZBDhlrqrRYqSBOKar7V0X8oAOipsA4byxuXAS2diH6c=";
11 buildInputs = [ jre ];
13 # From https://github.com/zaproxy/zaproxy/blob/master/zap/src/main/java/org/parosproxy/paros/Constant.java
14 version_tag = "20012000";
16 # Copying config and adding version tag before first use to avoid permission
17 # issues if zap tries to copy config on it's own.
19 mkdir -p "$out/bin" "$out/share"
20 cp -pR . "$out/share/${pname}/"
22 cat >> "$out/bin/${pname}" << EOF
24 export PATH="${lib.makeBinPath [ jre ]}:\$PATH"
25 export JAVA_HOME='${jre}'
26 if ! [ -f "\$HOME/.ZAP/config.xml" ];then
27 mkdir -p "\$HOME/.ZAP"
28 head -n 2 $out/share/${pname}/xml/config.xml > "\$HOME/.ZAP/config.xml"
29 echo "<version>${version_tag}</version>" >> "\$HOME/.ZAP/config.xml"
30 tail -n +3 $out/share/${pname}/xml/config.xml >> "\$HOME/.ZAP/config.xml"
32 exec "$out/share/${pname}/zap.sh" "\$@"
35 chmod u+x "$out/bin/${pname}"
39 homepage = "https://www.zaproxy.org/";
40 description = "Java application for web penetration testing";
41 maintainers = with maintainers; [ mog rafael ];
42 platforms = platforms.linux;
43 license = licenses.asl20;