2020-09-25 04:45:31 +00:00
|
|
|
{ stdenv, fetchurl, jre8, makeWrapper, bash, coreutils, gnugrep, gnused, ps,
|
2020-04-24 23:36:52 +00:00
|
|
|
majorVersion ? "1.0" }:
|
|
|
|
|
|
|
|
let
|
|
|
|
versionMap = {
|
|
|
|
"2.4" = {
|
2020-09-25 04:45:31 +00:00
|
|
|
kafkaVersion = "2.4.1";
|
2020-04-24 23:36:52 +00:00
|
|
|
scalaVersion = "2.12";
|
2020-09-25 04:45:31 +00:00
|
|
|
sha256 = "0ahsprmpjz026mhbr79187wfdrxcg352iipyfqfrx68q878wnxr1";
|
|
|
|
};
|
|
|
|
"2.5" = {
|
|
|
|
kafkaVersion = "2.5.0";
|
|
|
|
scalaVersion = "2.13";
|
|
|
|
sha256 = "0w3g7ii8x63m2blv2a8c491d0diczpliaqm9f7w5yn98hikh0aqi";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
};
|
2020-09-25 04:45:31 +00:00
|
|
|
|
|
|
|
jre = jre8; # TODO: remove override https://github.com/NixOS/nixpkgs/pull/89731
|
2020-04-24 23:36:52 +00:00
|
|
|
in
|
|
|
|
|
|
|
|
with versionMap.${majorVersion};
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
version = "${scalaVersion}-${kafkaVersion}";
|
|
|
|
pname = "apache-kafka";
|
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "mirror://apache/kafka/${kafkaVersion}/kafka_${version}.tgz";
|
|
|
|
inherit sha256;
|
|
|
|
};
|
|
|
|
|
|
|
|
buildInputs = [ jre makeWrapper bash gnugrep gnused coreutils ps ];
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out
|
|
|
|
cp -R config libs $out
|
|
|
|
|
|
|
|
mkdir -p $out/bin
|
|
|
|
cp bin/kafka* $out/bin
|
|
|
|
cp bin/connect* $out/bin
|
|
|
|
|
|
|
|
# allow us the specify logging directory using env
|
|
|
|
substituteInPlace $out/bin/kafka-run-class.sh \
|
|
|
|
--replace 'LOG_DIR="$base_dir/logs"' 'LOG_DIR="$KAFKA_LOG_DIR"'
|
|
|
|
|
|
|
|
substituteInPlace $out/bin/kafka-server-stop.sh \
|
|
|
|
--replace 'ps' '${ps}/bin/ps'
|
|
|
|
|
|
|
|
for p in $out/bin\/*.sh; do
|
|
|
|
wrapProgram $p \
|
|
|
|
--set JAVA_HOME "${jre}" \
|
|
|
|
--set KAFKA_LOG_DIR "/tmp/apache-kafka-logs" \
|
|
|
|
--prefix PATH : "${bash}/bin:${coreutils}/bin:${gnugrep}/bin:${gnused}/bin"
|
|
|
|
done
|
|
|
|
chmod +x $out/bin\/*
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
homepage = "http://kafka.apache.org";
|
|
|
|
description = "A high-throughput distributed messaging system";
|
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = [ maintainers.ragge ];
|
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|