about summary refs log tree commit diff
path: root/nixpkgs/pkgs/servers/redpanda/server.nix
blob: fa86b5437c8674e753f8e1996a9599df82737f87 (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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
{ abseil-cpp_202206
, avro-cpp
, callPackage
, ccache
, cmake
, crc32c
, croaring
, ctre
, curl
, dpdk
, git
, lib
, llvmPackages_14
, llvm_14
, ninja
, p11-kit
, pkg-config
, procps
, protobuf3_21
, python3
, snappy
, src
, unzip
, version
, writeShellScriptBin
, xxHash
, zip
, zstd
}:
let
  pname = "redpanda";
  pythonPackages = p: with p; [ jinja2 ];
  seastar = callPackage ./seastar.nix { };
  base64 = callPackage ./base64.nix { };
  hdr-histogram = callPackage ./hdr-histogram.nix { };
  kafka-codegen-venv = python3.withPackages (ps: [
    ps.jinja2
    ps.jsonschema
  ]);
  rapidjson = callPackage ./rapidjson.nix { };
in
llvmPackages_14.stdenv.mkDerivation rec {
  inherit pname version src;

  preConfigure = ''
    # setup sccache
    export CCACHE_DIR=$TMPDIR/sccache-redpanda
    mkdir -p $CCACHE_DIR
  '';
  patches = [
    ./redpanda.patch
  ];
  postPatch = ''
    # Fix 'error: use of undeclared identifier 'roaring'; did you mean 'Roaring
    #      qualified reference to 'Roaring' is a constructor name rather than a type in this context'
    substituteInPlace \
        ./src/v/storage/compacted_offset_list.h \
        ./src/v/storage/compaction_reducers.cc \
        ./src/v/storage/compaction_reducers.h \
        ./src/v/storage/segment_utils.h \
        ./src/v/storage/segment_utils.cc \
        --replace 'roaring::Roaring' 'Roaring'

    patchShebangs ./src/v/rpc/rpc_compiler.py
  '';

  doCheck = false;

  nativeBuildInputs = [
    (python3.withPackages pythonPackages)
    (writeShellScriptBin "kafka-codegen-venv" "exec -a $0 ${kafka-codegen-venv}/bin/python3 $@")
    ccache
    cmake
    curl
    git
    llvm_14
    ninja
    pkg-config
    procps
    seastar
    unzip
    zip
  ];

  cmakeFlags = [
    "-DREDPANDA_DEPS_SKIP_BUILD=ON"
    "-DRP_ENABLE_TESTS=OFF"
    "-Wno-dev"
    "-DGIT_VER=${version}"
    "-DGIT_CLEAN_DIRTY=\"\""
  ];

  buildInputs = [
    abseil-cpp_202206
    avro-cpp
    base64
    crc32c
    croaring
    ctre
    dpdk
    hdr-histogram
    p11-kit
    protobuf3_21
    rapidjson
    seastar
    snappy
    xxHash
    zstd
  ];

  meta = with lib; {
    description = "Kafka-compatible streaming platform.";
    license = licenses.bsl11;
    longDescription = ''
      Redpanda is a Kafka-compatible streaming data platform that is
      proven to be 10x faster and 6x lower in total costs. It is also JVM-free,
      ZooKeeper-free, Jepsen-tested and source available.
    '';
    homepage = "https://redpanda.com/";
    maintainers = with maintainers; [ avakhrenev happysalada ];
    platforms = platforms.linux;
  };
}