1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-23 14:11:36 +00:00
nixpkgs/pkgs/servers/apache-kafka/default.nix

67 lines
1.7 KiB
Nix
Raw Normal View History

2020-09-19 14:38:51 +01:00
{ stdenv, fetchurl, jre8, makeWrapper, bash, coreutils, gnugrep, gnused, ps,
2017-11-02 17:48:22 +00:00
majorVersion ? "1.0" }:
let
versionMap = {
2020-01-11 02:01:24 +00:00
"2.4" = {
2020-06-20 14:31:47 +01:00
kafkaVersion = "2.4.1";
2020-01-11 02:01:24 +00:00
scalaVersion = "2.12";
2020-06-20 14:31:47 +01:00
sha256 = "0ahsprmpjz026mhbr79187wfdrxcg352iipyfqfrx68q878wnxr1";
};
"2.5" = {
kafkaVersion = "2.5.0";
scalaVersion = "2.13";
sha256 = "0w3g7ii8x63m2blv2a8c491d0diczpliaqm9f7w5yn98hikh0aqi";
2020-01-11 02:01:24 +00:00
};
};
2020-09-19 14:38:51 +01:00
jre = jre8; # TODO: remove override https://github.com/NixOS/nixpkgs/pull/89731
in
with versionMap.${majorVersion};
stdenv.mkDerivation rec {
version = "${scalaVersion}-${kafkaVersion}";
pname = "apache-kafka";
src = fetchurl {
url = "mirror://apache/kafka/${kafkaVersion}/kafka_${version}.tgz";
inherit sha256;
};
buildInputs = [ jre makeWrapper bash gnugrep gnused coreutils ps ];
installPhase = ''
mkdir -p $out
cp -R config libs $out
mkdir -p $out/bin
cp bin/kafka* $out/bin
cp bin/connect* $out/bin
# allow us the specify logging directory using env
substituteInPlace $out/bin/kafka-run-class.sh \
--replace 'LOG_DIR="$base_dir/logs"' 'LOG_DIR="$KAFKA_LOG_DIR"'
substituteInPlace $out/bin/kafka-server-stop.sh \
--replace 'ps' '${ps}/bin/ps'
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:${coreutils}/bin:${gnugrep}/bin:${gnused}/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;
};
}