1 { lib, stdenv, fetchurl, jdk17_headless, jdk11_headless, makeWrapper, bash, coreutils, gnugrep, gnused, ps }:
6 kafkaVersion = "3.7.1";
8 sha256 = "sha256-YqyuShQ92YPcfrSATVdEugxQsZm1CPWZ7wAQIOJVj8k=";
12 kafkaVersion = "3.6.2";
13 scalaVersion = "2.13";
14 sha256 = "sha256-wxfkf3cUHTFG6VY9nLodZIbIHmcLIR7OasRqn3Lkqqw=";
19 build = versionInfo: with versionInfo; stdenv.mkDerivation rec {
20 version = "${scalaVersion}-${kafkaVersion}";
21 pname = "apache-kafka";
24 url = "mirror://apache/kafka/${kafkaVersion}/kafka_${version}.tgz";
28 nativeBuildInputs = [ makeWrapper ];
29 buildInputs = [ jre bash gnugrep gnused coreutils ps ];
33 cp -R config libs $out
36 cp bin/kafka* $out/bin
37 cp bin/connect* $out/bin
39 # allow us the specify logging directory using env
40 substituteInPlace $out/bin/kafka-run-class.sh \
41 --replace 'LOG_DIR="$base_dir/logs"' 'LOG_DIR="$KAFKA_LOG_DIR"'
43 substituteInPlace $out/bin/kafka-server-stop.sh \
44 --replace 'ps' '${ps}/bin/ps'
46 for p in $out/bin\/*.sh; do
48 --set JAVA_HOME "${jre}" \
49 --set KAFKA_LOG_DIR "/tmp/apache-kafka-logs" \
50 --prefix PATH : "${bash}/bin:${coreutils}/bin:${gnugrep}/bin:${gnused}/bin"
56 inherit jre; # Used by the NixOS module to select the supported jre
60 homepage = "https://kafka.apache.org";
61 description = "High-throughput distributed messaging system";
62 license = licenses.asl20;
63 sourceProvenance = with sourceTypes; [ binaryBytecode ];
64 maintainers = [ maintainers.ragge ];
65 platforms = platforms.unix;
68 in with lib; mapAttrs'
69 (majorVersion: versionInfo: nameValuePair "apacheKafka_${majorVersion}" (build versionInfo))