@@ -0,0 +1,32 @@
1+{ stdenv, fetchFromGitHub, postgresql, protobufc }:
2+
3+stdenv.mkDerivation rec {
4+ name = "pg_topn-${version}";
5+ version = "2.0.2";
6+
7+ nativeBuildInputs = [ protobufc ];
8+ buildInputs = [ postgresql ];
9+
10+ src = fetchFromGitHub {
11+ owner = "citusdata";
12+ repo = "postgresql-topn";
13+ rev = "refs/tags/v${version}";
14+ sha256 = "00hc3hgnqv9xaalizbcvprb7s55sydj2qgk3rhgrdlwg2g025h62";
15+ };
16+
17+ installPhase = ''
18+ mkdir -p $out/{lib,share/extension}
19+
20+ cp *.so $out/lib
21+ cp *.sql $out/share/extension
22+ cp *.control $out/share/extension
23+ '';
24+
25+ meta = with stdenv.lib; {
26+ description = "Efficient querying of 'top values' for PostgreSQL";
27+ homepage = https://www.citusdata.com/;
28+ maintainers = with maintainers; [ thoughtpolice ];
29+ platforms = platforms.linux;
30+ license = licenses.agpl3;
31+ };
32+}