2021-07-14 22:03:04 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2020-04-24 23:36:52 +00:00
|
|
|
, makeWrapper
|
|
|
|
, makeDesktopItem
|
|
|
|
, fetchurl
|
2021-04-05 15:23:46 +00:00
|
|
|
, jdk11
|
2020-09-25 04:45:31 +00:00
|
|
|
, jdk8
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2021-04-05 15:23:46 +00:00
|
|
|
generic = { version, sha256, platform ? "", jdk, ... }@attrs:
|
2020-04-24 23:36:52 +00:00
|
|
|
let
|
|
|
|
desktopItem = makeDesktopItem {
|
2022-03-05 16:20:37 +00:00
|
|
|
categories = [ "Network" "Development" "WebDevelopment" "Java" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
desktopName = "Charles";
|
|
|
|
exec = "charles %F";
|
|
|
|
genericName = "Web Debugging Proxy";
|
|
|
|
icon = "charles-proxy";
|
2022-03-05 16:20:37 +00:00
|
|
|
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"
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
name = "Charles";
|
2022-03-05 16:20:37 +00:00
|
|
|
startupNotify = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
in stdenv.mkDerivation {
|
|
|
|
pname = "charles";
|
|
|
|
inherit version;
|
|
|
|
|
|
|
|
src = fetchurl {
|
2021-04-05 15:23:46 +00:00
|
|
|
url = "https://www.charlesproxy.com/assets/release/${version}/charles-proxy-${version}${platform}.tar.gz";
|
2022-12-02 08:20:57 +00:00
|
|
|
curlOptsList = [ "--user-agent" "Mozilla/5.0" ]; # HTTP 104 otherwise
|
2020-04-24 23:36:52 +00:00
|
|
|
inherit sha256;
|
|
|
|
};
|
2021-03-09 03:18:52 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
2021-04-05 15:23:46 +00:00
|
|
|
makeWrapper ${jdk}/bin/java $out/bin/charles \
|
2020-04-24 23:36:52 +00:00
|
|
|
--add-flags "-Xmx1024M -Dcharles.config='~/.charles.config' -jar $out/share/java/charles.jar"
|
|
|
|
|
|
|
|
for fn in lib/*.jar; do
|
|
|
|
install -D -m644 $fn $out/share/java/$(basename $fn)
|
|
|
|
done
|
|
|
|
|
|
|
|
mkdir -p $out/share/applications
|
|
|
|
ln -s ${desktopItem}/share/applications/* $out/share/applications/
|
|
|
|
|
|
|
|
mkdir -p $out/share/icons
|
|
|
|
cp -r icon $out/share/icons/hicolor
|
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Web Debugging Proxy";
|
|
|
|
homepage = "https://www.charlesproxy.com/";
|
2023-10-09 19:29:22 +00:00
|
|
|
maintainers = with maintainers; [ kalbasit kashw2 ];
|
2022-06-16 17:23:12 +00:00
|
|
|
sourceProvenance = with sourceTypes; [ binaryBytecode ];
|
2021-07-14 22:03:04 +00:00
|
|
|
license = licenses.unfree;
|
|
|
|
platforms = platforms.unix;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
in {
|
|
|
|
charles4 = (generic {
|
2023-10-09 19:29:22 +00:00
|
|
|
version = "4.6.4";
|
|
|
|
sha256 = "KEQYb90kt41dS3TJLZqdaV9P3mQA9UPsEyiFb/knm3w=";
|
2021-04-05 15:23:46 +00:00
|
|
|
platform = "_amd64";
|
|
|
|
jdk = jdk11;
|
2020-04-24 23:36:52 +00:00
|
|
|
});
|
|
|
|
charles3 = (generic {
|
|
|
|
version = "3.12.3";
|
|
|
|
sha256 = "13zk82ny1w5zd9qcs9qkq0kdb22ni5byzajyshpxdfm4zv6p32ss";
|
2021-04-05 15:23:46 +00:00
|
|
|
jdk = jdk8.jre;
|
2020-04-24 23:36:52 +00:00
|
|
|
});
|
|
|
|
}
|