Unverified Commit 3a2110a4 authored by Pol Dellaiera's avatar Pol Dellaiera Committed by GitHub
Browse files

zap: add .desktop (#355282)

parents af4c8496 63c3362d
Loading
Loading
Loading
Loading
+35 −3
Original line number Diff line number Diff line
{ lib, stdenv, fetchurl, jre, runtimeShell }:
{
  lib,
  stdenv,
  fetchurl,
  jre,
  makeDesktopItem,
  copyDesktopItems,
  runtimeShell,
}:

stdenv.mkDerivation rec {
  pname = "zap";
@@ -8,15 +16,34 @@ stdenv.mkDerivation rec {
    sha256 = "sha256-ZBDhlrqrRYqSBOKar7V0X8oAOipsA4byxuXAS2diH6c=";
  };

  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 = ''
    mkdir -p "$out/bin" "$out/share"
    runHook preInstall

    mkdir -p $out/{bin,share}

    cp -pR . "$out/share/${pname}/"

    cat >> "$out/bin/${pname}" << EOF
@@ -33,12 +60,17 @@ stdenv.mkDerivation rec {
    EOF

    chmod u+x  "$out/bin/${pname}"

    runHook postInstall
  '';

  meta = with lib; {
    homepage = "https://www.zaproxy.org/";
    description = "Java application for web penetration testing";
    maintainers = with maintainers; [ mog rafael ];
    maintainers = with maintainers; [
      mog
      rafael
    ];
    platforms = platforms.linux;
    license = licenses.asl20;
    mainProgram = "zap";