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