about summary refs log tree commit diff
path: root/nixpkgs/pkgs/servers/confluent-platform/default.nix
blob: 2c4e1c5d4f474b0ea5cb06aad7300aef0a88df87 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
{
  bash
, fetchurl
, gnused
, jre
, lib
, makeBinaryWrapper
, stdenv
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "confluent-platform";
  version = "7.5.0";

  src = fetchurl {
    url = "https://packages.confluent.io/archive/${lib.versions.majorMinor finalAttrs.version}/confluent-${finalAttrs.version}.tar.gz";
    hash = "sha256-HaK3Do6oRGm6ovvNNGvZE34rYNRQnrmt1GKglTSZ9ls=";
  };

  nativeBuildInputs = [
    makeBinaryWrapper
  ];

  buildInputs = [
    bash
    jre
  ];

  installPhase = ''
    runHook preInstall

    mkdir -p $out
    cp -R bin etc share src $out
    rm -rf $out/bin/windows

    patchShebangs $out/bin

    # allow us the specify logging directory using env
    substituteInPlace $out/bin/kafka-run-class \
      --replace 'LOG_DIR="$base_dir/logs"' 'LOG_DIR="$KAFKA_LOG_DIR"'

    substituteInPlace $out/bin/ksql-run-class \
      --replace 'LOG_DIR="$base_dir/logs"' 'LOG_DIR="$KAFKA_LOG_DIR"'

    for p in $out/bin\/*; do
      wrapProgram $p \
        --set JAVA_HOME "${jre}" \
        --set KAFKA_LOG_DIR "/tmp/apache-kafka-logs" \
        --prefix PATH : "${jre}/bin:${bash}/bin:${gnused}/bin"
    done

    runHook postInstall
  '';

  meta = {
    description = "Confluent event streaming platform based on Apache Kafka";
    homepage = "https://www.confluent.io/";
    license = lib.licenses.asl20;
    maintainers = with lib.maintainers; [ zoedsoupe autophagy ];
    platforms = lib.platforms.unix;
  };
})