4a7f99d55d
Part of: https://github.com/NixOS/nixpkgs/issues/108938 meta = with stdenv.lib; is a widely used pattern. We want to slowly remove the `stdenv.lib` indirection and encourage people to use `lib` directly. Thus let’s start with the meta field. This used a rewriting script to mostly automatically replace all occurances of this pattern, and add the `lib` argument to the package header if it doesn’t exist yet. The script in its current form is available at https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
67 lines
1.9 KiB
Nix
67 lines
1.9 KiB
Nix
{
|
|
lib, stdenv
|
|
, makeWrapper
|
|
, makeDesktopItem
|
|
, fetchurl
|
|
, jdk8
|
|
}:
|
|
|
|
let
|
|
generic = { version, sha256, ... }@attrs:
|
|
let
|
|
desktopItem = makeDesktopItem {
|
|
categories = "Network;Development;WebDevelopment;Java;";
|
|
desktopName = "Charles";
|
|
exec = "charles %F";
|
|
genericName = "Web Debugging Proxy";
|
|
icon = "charles-proxy";
|
|
mimeType = "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";
|
|
};
|
|
|
|
in stdenv.mkDerivation {
|
|
pname = "charles";
|
|
inherit version;
|
|
|
|
src = fetchurl {
|
|
url = "https://www.charlesproxy.com/assets/release/${version}/charles-proxy-${version}.tar.gz";
|
|
inherit sha256;
|
|
};
|
|
buildInputs = [ makeWrapper ];
|
|
|
|
installPhase = ''
|
|
makeWrapper ${jdk8.jre}/bin/java $out/bin/charles \
|
|
--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
|
|
'';
|
|
|
|
meta = with lib; {
|
|
description = "Web Debugging Proxy";
|
|
homepage = "https://www.charlesproxy.com/";
|
|
maintainers = [ maintainers.kalbasit ];
|
|
license = stdenv.lib.licenses.unfree;
|
|
platforms = stdenv.lib.platforms.linux ++ stdenv.lib.platforms.darwin;
|
|
};
|
|
};
|
|
|
|
in {
|
|
charles4 = (generic {
|
|
version = "4.2.8";
|
|
sha256 = "1jzjdhzxgrq7pdfryfkg0hsjpyni14ma4x8jbdk1rqll78ccr080";
|
|
});
|
|
charles3 = (generic {
|
|
version = "3.12.3";
|
|
sha256 = "13zk82ny1w5zd9qcs9qkq0kdb22ni5byzajyshpxdfm4zv6p32ss";
|
|
});
|
|
}
|
|
|