@@ -0,0 +1,39 @@
1+{ stdenv, fetchFromGitHub, postgresql, zeromq, openssl }:
2+
3+if stdenv.lib.versionOlder postgresql.version "10"
4+then throw "PipelineDB not supported for PostgreSQL ${postgresql.version}"
5+else
6+stdenv.mkDerivation rec {
7+ pname = "pipelinedb";
8+ version = "1.0.0-13";
9+
10+ src = fetchFromGitHub {
11+ owner = "pipelinedb";
12+ repo = pname;
13+ rev = version;
14+ sha256 = "1mnqpvx6g1r2n4kjrrx01vbdx7kvndfsbmm7zbzizjnjlyixz75f";
15+ };
16+
17+ buildInputs = [ postgresql openssl zeromq ];
18+
19+ makeFlags = [ "USE_PGXS=1" ];
20+
21+ preConfigure = ''
22+ substituteInPlace Makefile \
23+ --replace "/usr/lib/libzmq.a" "${zeromq}/lib/libzmq.a"
24+ '';
25+
26+ installPhase = ''
27+ mkdir -p $out/bin
28+ install -D -t $out/lib/ pipelinedb.so
29+ install -D -t $out/share/extension {pipelinedb-*.sql,pipelinedb.control}
30+ '';
31+
32+ meta = with stdenv.lib; {
33+ description = "High-performance time-series aggregation for PostgreSQL";
34+ homepage = https://www.pipelinedb.com/;
35+ license = licenses.asl20;
36+ platforms = postgresql.meta.platforms;
37+ maintainers = [ maintainers.marsam ];
38+ };
39+}