2020-09-22 06:28:28 +00:00
|
|
|
{ lib, stdenv, fetchurl, jdk8_headless, jdk11_headless, makeWrapper, bash, coreutils, gnugrep, gnused, ps,
|
2017-11-02 17:48:22 +00:00
|
|
|
majorVersion ? "1.0" }:
|
2015-01-28 22:06:28 +00:00
|
|
|
|
|
|
|
let
|
2020-09-22 06:28:28 +00:00
|
|
|
jre8 = jdk8_headless;
|
|
|
|
jre11 = jdk11_headless;
|
2016-05-28 17:46:46 +00:00
|
|
|
versionMap = {
|
2020-01-11 02:01:24 +00:00
|
|
|
"2.4" = {
|
2020-06-20 13:31:47 +00:00
|
|
|
kafkaVersion = "2.4.1";
|
2020-01-11 02:01:24 +00:00
|
|
|
scalaVersion = "2.12";
|
2020-06-20 13:31:47 +00:00
|
|
|
sha256 = "0ahsprmpjz026mhbr79187wfdrxcg352iipyfqfrx68q878wnxr1";
|
2020-09-22 06:28:28 +00:00
|
|
|
jre = jre8;
|
2020-06-20 13:31:47 +00:00
|
|
|
};
|
|
|
|
"2.5" = {
|
2020-09-22 06:43:34 +00:00
|
|
|
kafkaVersion = "2.5.1";
|
|
|
|
scalaVersion = "2.12";
|
|
|
|
sha256 = "1wn4iszrm2rvsfyyr515zx79k5m86davjkcwcwpxcgc4k3q0z7lv";
|
2020-09-22 06:28:28 +00:00
|
|
|
jre = jre8;
|
2020-01-11 02:01:24 +00:00
|
|
|
};
|
2020-09-22 06:45:06 +00:00
|
|
|
"2.6" = {
|
|
|
|
kafkaVersion = "2.6.1";
|
|
|
|
scalaVersion = "2.13";
|
|
|
|
sha256 = "1a2kd4r6f8z7qf886nnq9f350sblzzdi230j2hll7x156888573y";
|
|
|
|
jre = jre11;
|
|
|
|
};
|
2016-05-28 17:46:46 +00:00
|
|
|
};
|
2015-01-28 22:06:28 +00:00
|
|
|
in
|
|
|
|
|
2016-05-28 17:46:46 +00:00
|
|
|
with versionMap.${majorVersion};
|
|
|
|
|
2015-01-28 22:06:28 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
version = "${scalaVersion}-${kafkaVersion}";
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "apache-kafka";
|
2015-01-28 22:06:28 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "mirror://apache/kafka/${kafkaVersion}/kafka_${version}.tgz";
|
2016-05-28 17:46:46 +00:00
|
|
|
inherit sha256;
|
2015-01-28 22:06:28 +00:00
|
|
|
};
|
|
|
|
|
2021-02-07 09:17:39 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
buildInputs = [ jre bash gnugrep gnused coreutils ps ];
|
2015-01-28 22:06:28 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out
|
|
|
|
cp -R config libs $out
|
|
|
|
|
|
|
|
mkdir -p $out/bin
|
|
|
|
cp bin/kafka* $out/bin
|
2018-05-31 20:03:48 +00:00
|
|
|
cp bin/connect* $out/bin
|
2015-01-28 22:06:28 +00:00
|
|
|
|
|
|
|
# allow us the specify logging directory using env
|
|
|
|
substituteInPlace $out/bin/kafka-run-class.sh \
|
2015-04-27 02:58:12 +00:00
|
|
|
--replace 'LOG_DIR="$base_dir/logs"' 'LOG_DIR="$KAFKA_LOG_DIR"'
|
2015-01-28 22:06:28 +00:00
|
|
|
|
2019-10-03 09:48:29 +00:00
|
|
|
substituteInPlace $out/bin/kafka-server-stop.sh \
|
|
|
|
--replace 'ps' '${ps}/bin/ps'
|
|
|
|
|
2015-01-28 22:06:28 +00:00
|
|
|
for p in $out/bin\/*.sh; do
|
|
|
|
wrapProgram $p \
|
|
|
|
--set JAVA_HOME "${jre}" \
|
|
|
|
--set KAFKA_LOG_DIR "/tmp/apache-kafka-logs" \
|
2018-07-06 12:18:42 +00:00
|
|
|
--prefix PATH : "${bash}/bin:${coreutils}/bin:${gnugrep}/bin:${gnused}/bin"
|
2015-01-28 22:06:28 +00:00
|
|
|
done
|
|
|
|
chmod +x $out/bin\/*
|
|
|
|
'';
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "http://kafka.apache.org";
|
2015-01-28 22:06:28 +00:00
|
|
|
description = "A high-throughput distributed messaging system";
|
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = [ maintainers.ragge ];
|
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
2020-09-22 06:28:28 +00:00
|
|
|
passthru = { inherit jre; };
|
2015-01-28 22:06:28 +00:00
|
|
|
}
|