nixpkgs/pkgs/applications/networking/charles/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

81 lines
2.2 KiB
Nix
Raw Permalink Normal View History

{ lib
, stdenv
, makeWrapper
, makeDesktopItem
, fetchurl
2021-03-29 13:40:51 +00:00
, jdk11
2020-09-19 19:56:23 +00:00
, jdk8
}:
2018-07-13 23:11:43 +00:00
let
2021-03-29 13:40:51 +00:00
generic = { version, sha256, platform ? "", jdk, ... }@attrs:
let
desktopItem = makeDesktopItem {
categories = [ "Network" "Development" "WebDevelopment" "Java" ];
desktopName = "Charles";
exec = "charles %F";
genericName = "Web Debugging Proxy";
icon = "charles-proxy";
mimeTypes = [
"application/x-charles-savedsession"
"application/x-charles-savedsession+xml"
"application/x-charles-savedsession+json"
"application/har+json"
"application/vnd.tcpdump.pcap"
"application/x-charles-trace"
];
name = "Charles";
startupNotify = true;
};
2019-08-13 21:52:01 +00:00
in stdenv.mkDerivation {
pname = "charles";
inherit version;
src = fetchurl {
2021-03-29 13:40:51 +00:00
url = "https://www.charlesproxy.com/assets/release/${version}/charles-proxy-${version}${platform}.tar.gz";
curlOptsList = [ "--user-agent" "Mozilla/5.0" ]; # HTTP 104 otherwise
inherit sha256;
};
nativeBuildInputs = [ makeWrapper ];
2018-07-13 23:11:43 +00:00
installPhase = ''
2021-03-29 13:40:51 +00:00
makeWrapper ${jdk}/bin/java $out/bin/charles \
--add-flags "-Xmx1024M -Dcharles.config='~/.charles.config' -jar $out/share/java/charles.jar"
2018-07-13 23:11:43 +00:00
for fn in lib/*.jar; do
install -D -m644 $fn $out/share/java/$(basename $fn)
done
2018-07-13 23:11:43 +00:00
mkdir -p $out/share/applications
ln -s ${desktopItem}/share/applications/* $out/share/applications/
2018-07-14 05:28:27 +00:00
mkdir -p $out/share/icons
cp -r icon $out/share/icons/hicolor
'';
2018-07-13 23:11:43 +00:00
meta = with lib; {
description = "Web Debugging Proxy";
homepage = "https://www.charlesproxy.com/";
2023-09-04 04:42:34 +00:00
maintainers = with maintainers; [ kalbasit kashw2 ];
sourceProvenance = with sourceTypes; [ binaryBytecode ];
license = licenses.unfree;
platforms = platforms.unix;
};
};
2018-07-13 23:11:43 +00:00
2019-08-13 21:52:01 +00:00
in {
charles4 = (generic {
2023-09-04 04:42:34 +00:00
version = "4.6.4";
sha256 = "KEQYb90kt41dS3TJLZqdaV9P3mQA9UPsEyiFb/knm3w=";
2021-03-29 13:40:51 +00:00
platform = "_amd64";
jdk = jdk11;
});
charles3 = (generic {
version = "3.12.3";
sha256 = "13zk82ny1w5zd9qcs9qkq0kdb22ni5byzajyshpxdfm4zv6p32ss";
2021-03-29 13:40:51 +00:00
jdk = jdk8.jre;
2023-11-27 01:17:53 +00:00
mainProgram = "charles";
});
2018-07-13 23:11:43 +00:00
}