2022-08-05 01:19:03 +00:00
|
|
|
{ lib, stdenv, fetchurl, jdk17_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
|
2016-05-28 17:46:46 +00:00
|
|
|
versionMap = {
|
2023-06-30 13:08:03 +00:00
|
|
|
"3.5" = {
|
|
|
|
kafkaVersion = "3.5.0";
|
|
|
|
scalaVersion = "2.13";
|
|
|
|
sha256 = "sha256-KjpGjgab5XDxbWEqgZbC96kge36shlvpNNIM4SUusvg=";
|
|
|
|
jre = jdk17_headless;
|
|
|
|
};
|
|
|
|
"3.4" = {
|
|
|
|
kafkaVersion = "3.4.1";
|
|
|
|
scalaVersion = "2.13";
|
|
|
|
sha256 = "sha256-p28XpSuPLNMd4RVx/zZqcUggtuTgKJOwFZ0J2w7a+Zg=";
|
|
|
|
jre = jdk17_headless;
|
|
|
|
};
|
2022-10-14 19:52:05 +00:00
|
|
|
"3.3" = {
|
2023-06-30 13:08:03 +00:00
|
|
|
kafkaVersion = "3.3.2";
|
2022-10-14 19:52:05 +00:00
|
|
|
scalaVersion = "2.13";
|
2023-06-30 13:08:03 +00:00
|
|
|
sha256 = "sha256-Gv5XrpXnEajH8fSbcfIfURz+QPcqTrJ1oe3SGXYLNRc=";
|
2022-10-14 19:52:05 +00:00
|
|
|
jre = jdk17_headless;
|
|
|
|
};
|
2022-08-05 01:19:03 +00:00
|
|
|
"3.2" = {
|
2022-10-14 19:52:05 +00:00
|
|
|
kafkaVersion = "3.2.3";
|
2021-08-05 11:01:59 +00:00
|
|
|
scalaVersion = "2.13";
|
2022-10-14 20:10:22 +00:00
|
|
|
sha256 = "sha256-tvkbwBP83M1zl31J4g6uu4/LEhqJoIA9Eam48fyT24A=";
|
2022-10-14 19:52:05 +00:00
|
|
|
jre = jdk17_headless;
|
2022-08-05 01:19:03 +00:00
|
|
|
};
|
|
|
|
"3.1" = {
|
2022-10-14 19:52:05 +00:00
|
|
|
kafkaVersion = "3.1.2";
|
2022-08-05 01:19:03 +00:00
|
|
|
scalaVersion = "2.13";
|
2022-10-14 20:10:22 +00:00
|
|
|
sha256 = "sha256-SO1bTQkG3YQSv657QjwBeBCWbDlDqS3E5eUp7ciojnI=";
|
2022-10-14 19:52:05 +00:00
|
|
|
jre = jdk17_headless;
|
2022-08-05 01:19:03 +00:00
|
|
|
};
|
|
|
|
"3.0" = {
|
2022-10-14 19:52:05 +00:00
|
|
|
kafkaVersion = "3.0.2";
|
2022-08-05 01:19:03 +00:00
|
|
|
scalaVersion = "2.13";
|
2022-10-14 20:10:22 +00:00
|
|
|
sha256 = "sha256-G8b6STGlwow+iDqMCeZkF3HTKd94TKccmyfZ7AT/7yE=";
|
2022-10-14 19:52:05 +00:00
|
|
|
jre = jdk17_headless;
|
2020-01-11 02:01:24 +00:00
|
|
|
};
|
2021-08-05 11:01:59 +00:00
|
|
|
"2.8" = {
|
2022-09-28 21:59:43 +00:00
|
|
|
kafkaVersion = "2.8.2";
|
2020-09-22 06:45:06 +00:00
|
|
|
scalaVersion = "2.13";
|
2022-09-28 21:59:43 +00:00
|
|
|
sha256 = "sha256-inZXZJSs8ivtEqF6E/ApoyUHn8vg38wUG3KhowP8mfQ=";
|
2022-10-14 19:52:05 +00:00
|
|
|
jre = jdk11_headless;
|
2020-09-22 06:45:06 +00:00
|
|
|
};
|
2022-08-05 01:19:03 +00:00
|
|
|
|
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\/*
|
|
|
|
'';
|
|
|
|
|
2022-10-26 08:07:17 +00:00
|
|
|
passthru = {
|
|
|
|
inherit jre; # Used by the NixOS module to select the supported jre
|
|
|
|
};
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2021-12-28 17:59:12 +00:00
|
|
|
homepage = "https://kafka.apache.org";
|
2015-01-28 22:06:28 +00:00
|
|
|
description = "A high-throughput distributed messaging system";
|
|
|
|
license = licenses.asl20;
|
2022-08-05 23:17:51 +00:00
|
|
|
sourceProvenance = with sourceTypes; [ binaryBytecode ];
|
2015-01-28 22:06:28 +00:00
|
|
|
maintainers = [ maintainers.ragge ];
|
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
|
|
|
}
|