Files
nixpkgs/pkgs/by-name/za/zap/package.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

79 lines
1.9 KiB
Nix

{
lib,
stdenv,
fetchurl,
jre,
makeDesktopItem,
copyDesktopItems,
runtimeShell,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "zap";
version = "2.16.1";
src = fetchurl {
url = "https://github.com/zaproxy/zaproxy/releases/download/v${finalAttrs.version}/ZAP_${finalAttrs.version}_Linux.tar.gz";
hash = "sha256-Wy64MZsIUSGm6K1Q1p1n2++MhnFm9xqTe/yIjSR6KsE=";
};
desktopItems = [
(makeDesktopItem {
name = "zap";
exec = "zap";
icon = "zap";
desktopName = "Zed Attack Proxy";
categories = [
"Development"
"Security"
"System"
];
})
];
buildInputs = [ jre ];
nativeBuildInputs = [ copyDesktopItems ];
# From https://github.com/zaproxy/zaproxy/blob/master/zap/src/main/java/org/parosproxy/paros/Constant.java
version_tag = "20012000";
# Copying config and adding version tag before first use to avoid permission
# issues if zap tries to copy config on it's own.
installPhase = ''
runHook preInstall
mkdir -p $out/{bin,share}
cp -pR . "$out/share/zap/"
cat >> "$out/bin/zap" << EOF
#!${runtimeShell}
export PATH="${lib.makeBinPath [ jre ]}:\$PATH"
export JAVA_HOME='${jre}'
if ! [ -f "\$HOME/.ZAP/config.xml" ];then
mkdir -p "\$HOME/.ZAP"
head -n 2 $out/share/zap/xml/config.xml > "\$HOME/.ZAP/config.xml"
echo "<version>${finalAttrs.version_tag}</version>" >> "\$HOME/.ZAP/config.xml"
tail -n +3 $out/share/zap/xml/config.xml >> "\$HOME/.ZAP/config.xml"
fi
exec "$out/share/zap/zap.sh" "\$@"
EOF
chmod u+x "$out/bin/zap"
runHook postInstall
'';
meta = {
homepage = "https://www.zaproxy.org/";
description = "Java application for web penetration testing";
maintainers = with lib.maintainers; [
mog
rafael
];
platforms = lib.platforms.linux;
license = lib.licenses.asl20;
mainProgram = "zap";
};
})