11 stdenv.mkDerivation rec {
15 url = "https://github.com/zaproxy/zaproxy/releases/download/v${version}/ZAP_${version}_Linux.tar.gz";
16 sha256 = "sha256-ZBDhlrqrRYqSBOKar7V0X8oAOipsA4byxuXAS2diH6c=";
24 desktopName = "Zed Attack Proxy";
33 buildInputs = [ jre ];
35 nativeBuildInputs = [ copyDesktopItems ];
37 # From https://github.com/zaproxy/zaproxy/blob/master/zap/src/main/java/org/parosproxy/paros/Constant.java
38 version_tag = "20012000";
40 # Copying config and adding version tag before first use to avoid permission
41 # issues if zap tries to copy config on it's own.
45 mkdir -p $out/{bin,share}
47 cp -pR . "$out/share/${pname}/"
49 cat >> "$out/bin/${pname}" << EOF
51 export PATH="${lib.makeBinPath [ jre ]}:\$PATH"
52 export JAVA_HOME='${jre}'
53 if ! [ -f "\$HOME/.ZAP/config.xml" ];then
54 mkdir -p "\$HOME/.ZAP"
55 head -n 2 $out/share/${pname}/xml/config.xml > "\$HOME/.ZAP/config.xml"
56 echo "<version>${version_tag}</version>" >> "\$HOME/.ZAP/config.xml"
57 tail -n +3 $out/share/${pname}/xml/config.xml >> "\$HOME/.ZAP/config.xml"
59 exec "$out/share/${pname}/zap.sh" "\$@"
62 chmod u+x "$out/bin/${pname}"
68 homepage = "https://www.zaproxy.org/";
69 description = "Java application for web penetration testing";
70 maintainers = with maintainers; [
74 platforms = platforms.linux;
75 license = licenses.asl20;