1{ lib
2, stdenv
3, curl
4, fetchFromGitHub
5, lz4
6, postgresql
7}:
8
9stdenv.mkDerivation rec {
10 pname = "citus";
11 version = "12.1.2";
12
13 src = fetchFromGitHub {
14 owner = "citusdata";
15 repo = "citus";
16 rev = "v${version}";
17 hash = "sha256-0uYNMLAYigtGlDRvOEkQeC5i58QfXcdSVjTQwWVFX+8=";
18 };
19
20 buildInputs = [
21 curl
22 lz4
23 postgresql
24 ];
25
26 installPhase = ''
27 runHook preInstall
28
29 install -D -t $out/lib src/backend/columnar/citus_columnar${postgresql.dlSuffix}
30 install -D -t $out/share/postgresql/extension src/backend/columnar/build/sql/*.sql
31 install -D -t $out/share/postgresql/extension src/backend/columnar/*.control
32
33 install -D -t $out/lib src/backend/distributed/citus${postgresql.dlSuffix}
34 install -D -t $out/share/postgresql/extension src/backend/distributed/build/sql/*.sql
35 install -D -t $out/share/postgresql/extension src/backend/distributed/*.control
36
37 runHook postInstall
38 '';
39
40 meta = with lib; {
41 # "Our soft policy for Postgres version compatibility is to support Citus'
42 # latest release with Postgres' 3 latest releases."
43 # https://www.citusdata.com/updates/v12-0/#deprecated_features
44 broken = versionOlder postgresql.version "14";
45 description = "Distributed PostgreSQL as an extension";
46 homepage = "https://www.citusdata.com/";
47 changelog = "https://github.com/citusdata/citus/blob/${src.rev}/CHANGELOG.md";
48 license = licenses.agpl3Only;
49 maintainers = [ ];
50 inherit (postgresql.meta) platforms;
51 };
52}