2016-05-28 19:46:46 +02:00
|
|
|
{ stdenv, fetchurl, jre, makeWrapper, bash,
|
|
|
|
majorVersion ? "0.9" }:
|
2015-01-28 23:06:28 +01:00
|
|
|
|
|
|
|
let
|
2016-05-28 19:46:46 +02:00
|
|
|
versionMap = {
|
|
|
|
"0.8" = { kafkaVersion = "0.8.2.1";
|
|
|
|
scalaVersion = "2.10";
|
|
|
|
sha256 = "1klri23fjxbzv7rmi05vcqqfpy7dzi1spn2084y1dxsi1ypfkvc9";
|
|
|
|
};
|
|
|
|
"0.9" = { kafkaVersion = "0.9.0.1";
|
|
|
|
scalaVersion = "2.11";
|
|
|
|
sha256 = "0ykcjv5dz9i5bws9my2d60pww1g9v2p2nqr67h0i2xrjm7az8a6v";
|
|
|
|
};
|
|
|
|
};
|
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}";
|
|
|
|
name = "apache-kafka-${version}";
|
|
|
|
|
|
|
|
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
|
|
|
};
|
|
|
|
|
|
|
|
buildInputs = [ jre makeWrapper bash ];
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out
|
|
|
|
cp -R config libs $out
|
|
|
|
|
|
|
|
mkdir -p $out/bin
|
|
|
|
cp bin/kafka* $out/bin
|
|
|
|
|
|
|
|
# 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
|
|
|
|
|
|
|
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"
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|