nixpkgs/pkgs/applications/networking/jmeter/default.nix
Profpatsch 4a7f99d55d treewide: with stdenv.lib; in meta -> with lib;
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
2021-01-11 10:38:22 +01:00

61 lines
1.9 KiB
Nix

{ fetchurl, lib, stdenv, jre, makeWrapper, coreutils }:
stdenv.mkDerivation rec {
pname = "jmeter";
version = "5.1.1";
src = fetchurl {
url = "https://archive.apache.org/dist/jmeter/binaries/apache-${pname}-${version}.tgz";
sha256 = "1bmlxnlcias781mwf3wzpd4935awswbq3w8ijck65bsaw07m2kc4";
};
nativeBuildInputs = [ makeWrapper ];
installPhase = ''
mkdir $out
rm bin/*.bat bin/*.cmd
cp -R * $out/
substituteInPlace $out/bin/create-rmi-keystore.sh --replace \
"keytool -genkey" \
"${jre}/lib/openjdk/jre/bin/keytool -genkey"
# Prefix some scripts with jmeter to avoid clobbering the namespace
for i in heapdump.sh mirror-server mirror-server.sh shutdown.sh stoptest.sh create-rmi-keystore.sh; do
mv $out/bin/$i $out/bin/jmeter-$i
wrapProgram $out/bin/jmeter-$i \
--prefix PATH : "${jre}/bin"
done
wrapProgram $out/bin/jmeter --set JAVA_HOME "${jre}"
wrapProgram $out/bin/jmeter.sh --set JAVA_HOME "${jre}"
'';
doInstallCheck = true;
checkInputs = [ coreutils ];
installCheckPhase = ''
$out/bin/jmeter --version 2>&1 | grep -q "${version}"
$out/bin/jmeter-heapdump.sh > /dev/null
$out/bin/jmeter-shutdown.sh > /dev/null
$out/bin/jmeter-stoptest.sh > /dev/null
timeout --kill=1s 1s $out/bin/jmeter-mirror-server.sh || test "$?" = "124"
'';
meta = with lib; {
description = "A 100% pure Java desktop application designed to load test functional behavior and measure performance";
longDescription = ''
The Apache JMeter desktop application is open source software, a 100%
pure Java application designed to load test functional behavior and
measure performance. It was originally designed for testing Web
Applications but has since expanded to other test functions.
'';
license = licenses.asl20;
maintainers = [ ];
priority = 1;
platforms = platforms.unix;
};
}