mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-23 22:23:15 +00:00
4a7f99d55d
Part of: https://github.com/NixOS/nixpkgs/issues/108938 meta = with stdenv.lib; is a widely used pattern. We want to slowly remove the `stdenv.lib` indirection and encourage people to use `lib` directly. Thus let’s start with the meta field. This used a rewriting script to mostly automatically replace all occurances of this pattern, and add the `lib` argument to the package header if it doesn’t exist yet. The script in its current form is available at https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
67 lines
1.7 KiB
Nix
67 lines
1.7 KiB
Nix
{ lib, stdenv, fetchurl, jre8, makeWrapper, bash, coreutils, gnugrep, gnused, ps,
|
|
majorVersion ? "1.0" }:
|
|
|
|
let
|
|
versionMap = {
|
|
"2.4" = {
|
|
kafkaVersion = "2.4.1";
|
|
scalaVersion = "2.12";
|
|
sha256 = "0ahsprmpjz026mhbr79187wfdrxcg352iipyfqfrx68q878wnxr1";
|
|
};
|
|
"2.5" = {
|
|
kafkaVersion = "2.5.0";
|
|
scalaVersion = "2.13";
|
|
sha256 = "0w3g7ii8x63m2blv2a8c491d0diczpliaqm9f7w5yn98hikh0aqi";
|
|
};
|
|
};
|
|
|
|
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 lib; {
|
|
homepage = "http://kafka.apache.org";
|
|
description = "A high-throughput distributed messaging system";
|
|
license = licenses.asl20;
|
|
maintainers = [ maintainers.ragge ];
|
|
platforms = platforms.unix;
|
|
};
|
|
|
|
}
|