nixpkgs: reorganize the postgresql extensions

This is a backwards compatible change; it mostly puts all the extensions
for postgresql in a common directory to keep them isolated.

It also moves a few things that /were not/ extensions out into other parts of
the filesystem namespace; namely the postgresql_jdbc and psqlodbc libraries
were moved under development/java-modules and development/libraries,
respectively. Because these libraries use the libpq postgresql client drivers,
they're less sensitive to underlying version changes anyway (since the protocol
is relatively stable).

No attributes were renamed or harmed in the creation of this patch.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
This commit is contained in:
Austin Seipp
2018-08-06 10:17:52 -05:00
parent 73f56ae191
commit 8cbe6b9ce4
15 changed files with 27 additions and 24 deletions

View File

@@ -0,0 +1,32 @@
{ stdenv, fetchFromGitHub, postgresql, protobufc }:
stdenv.mkDerivation rec {
name = "cstore_fdw-${version}";
version = "1.6.2";
nativeBuildInputs = [ protobufc ];
buildInputs = [ postgresql ];
src = fetchFromGitHub {
owner = "citusdata";
repo = "cstore_fdw";
rev = "refs/tags/v${version}";
sha256 = "0kdmzpbhhjdg4p6i5963h7qbs88jzgpqc52gz450h7hwb9ckpv74";
};
installPhase = ''
mkdir -p $out/{lib,share/extension}
cp *.so $out/lib
cp *.sql $out/share/extension
cp *.control $out/share/extension
'';
meta = with stdenv.lib; {
description = "Columnar storage for PostgreSQL";
homepage = https://www.citusdata.com/;
maintainers = with maintainers; [ thoughtpolice ];
platforms = platforms.linux;
license = licenses.asl20;
};
}

View File

@@ -0,0 +1,31 @@
{ stdenv, fetchFromGitHub, postgresql }:
stdenv.mkDerivation rec {
name = "pg_cron-${version}";
version = "1.1.2";
buildInputs = [ postgresql ];
src = fetchFromGitHub {
owner = "citusdata";
repo = "pg_cron";
rev = "refs/tags/v${version}";
sha256 = "0n74dx1wkg9qxvjhnx03028465ap3p97v2kzqww833dws1wqk5m1";
};
installPhase = ''
mkdir -p $out/{lib,share/extension}
cp *.so $out/lib
cp *.sql $out/share/extension
cp *.control $out/share/extension
'';
meta = with stdenv.lib; {
description = "Run Cron jobs through PostgreSQL";
homepage = https://www.citusdata.com/;
maintainers = with maintainers; [ thoughtpolice ];
platforms = platforms.linux;
license = licenses.postgresql;
};
}

View File

@@ -0,0 +1,31 @@
{ stdenv, fetchFromGitHub, postgresql }:
stdenv.mkDerivation rec {
name = "pg_hll-${version}";
version = "2.12";
buildInputs = [ postgresql ];
src = fetchFromGitHub {
owner = "citusdata";
repo = "postgresql-hll";
rev = "refs/tags/v${version}";
sha256 = "1jdc9gjqc3dkjxv855q1p594j0awhrrymrcqnl5vw5vx2ny3bpgn";
};
installPhase = ''
mkdir -p $out/{lib,share/extension}
cp *.so $out/lib
cp *.sql $out/share/extension
cp *.control $out/share/extension
'';
meta = with stdenv.lib; {
description = "HyperLogLog for PostgreSQL";
homepage = https://www.citusdata.com/;
maintainers = with maintainers; [ thoughtpolice ];
platforms = platforms.linux;
license = licenses.asl20;
};
}

View File

@@ -0,0 +1,35 @@
{ stdenv, fetchFromGitHub, postgresql, openssl, zlib, readline }:
stdenv.mkDerivation rec {
name = "pg_repack-${version}";
version = "1.4.4";
buildInputs = [ postgresql openssl zlib readline ];
src = fetchFromGitHub {
owner = "reorg";
repo = "pg_repack";
rev = "refs/tags/ver_${version}";
sha256 = "0ynsmsxfkcp82ccpz2nrgg8wiil8yxqigvw6425lx8v80h5lszbw";
};
installPhase = ''
install -D bin/pg_repack -t $out/bin/
install -D lib/pg_repack.so -t $out/lib/
install -D lib/{pg_repack--${version}.sql,pg_repack.control} -t $out/share/extension
'';
meta = with stdenv.lib; {
description = "Reorganize tables in PostgreSQL databases with minimal locks";
longDescription = ''
pg_repack is a PostgreSQL extension which lets you remove bloat from tables and indexes, and optionally restore
the physical order of clustered indexes. Unlike CLUSTER and VACUUM FULL it works online, without holding an
exclusive lock on the processed tables during processing. pg_repack is efficient to boot,
with performance comparable to using CLUSTER directly.
'';
license = licenses.bsd3;
maintainers = with maintainers; [ danbst ];
inherit (postgresql.meta) platforms;
inherit (src.meta) homepage;
};
}

View File

@@ -0,0 +1,31 @@
{ stdenv, lib, fetchFromGitHub, gcc, postgresql }:
stdenv.mkDerivation {
name = "pg_similarity-1.0";
src = fetchFromGitHub {
owner = "eulerto";
repo = "pg_similarity";
rev = "be1a8b08c8716e59b89982557da9ea68cdf868c5";
sha256 = "1z4v4r2yccdr8kz3935fnk1bc5vj0qj0apscldyap4wxlyi89xim";
};
buildInputs = [ postgresql gcc ];
buildPhase = "USE_PGXS=1 make";
installPhase = ''
mkdir -p $out/bin # for buildEnv to setup proper symlinks
install -D pg_similarity.so -t $out/lib/
install -D ./{pg_similarity--unpackaged--1.0.sql,pg_similarity--1.0.sql,pg_similarity.control} -t $out/share/extension
'';
meta = {
description = ''
pg_similarity is an extension to support similarity queries on PostgreSQL. The implementation
is tightly integrated in the RDBMS in the sense that it defines operators so instead of the traditional
operators (= and <>) you can use ~~~ and ~!~ (any of these operators represents a similarity function).
'';
platforms = stdenv.lib.platforms.linux;
license = stdenv.lib.licenses.gpl2;
maintainers = with lib.maintainers; [ danbst ];
};
}

View File

@@ -0,0 +1,32 @@
{ stdenv, fetchFromGitHub, postgresql, protobufc }:
stdenv.mkDerivation rec {
name = "pg_topn-${version}";
version = "2.2.0";
nativeBuildInputs = [ protobufc ];
buildInputs = [ postgresql ];
src = fetchFromGitHub {
owner = "citusdata";
repo = "postgresql-topn";
rev = "refs/tags/v${version}";
sha256 = "1i5fn517mdvzfhlcj7fh4z0iniynanshcn7kzhsq19sgci0g31fr";
};
installPhase = ''
mkdir -p $out/{lib,share/extension}
cp *.so $out/lib
cp *.sql $out/share/extension
cp *.control $out/share/extension
'';
meta = with stdenv.lib; {
description = "Efficient querying of 'top values' for PostgreSQL";
homepage = https://www.citusdata.com/;
maintainers = with maintainers; [ thoughtpolice ];
platforms = platforms.linux;
license = licenses.agpl3;
};
}

View File

@@ -0,0 +1,29 @@
{ stdenv, fetchFromGitHub, postgresql }:
stdenv.mkDerivation rec {
name = "pgjwt-${version}";
version = "unstable-2017-04-24";
src = fetchFromGitHub {
owner = "michelp";
repo = "pgjwt";
rev = "546a2911027b716586e241be7fd4c6f1785237cd";
sha256 = "1riz0xvwb6y02j0fljbr9hcbqb2jqs4njlivmavy9ysbcrrv1vrf";
};
buildPhase = ":";
installPhase = ''
mkdir -p $out/bin # current postgresql extension mechanism in nixos requires bin directory
mkdir -p $out/share/extension
cp pg*sql *.control $out/share/extension
'';
meta = with stdenv.lib; {
description = "PostgreSQL implementation of JSON Web Tokens";
longDescription = ''
sign() and verify() functions to create and verify JSON Web Tokens.
'';
license = licenses.mit;
maintainers = with maintainers; [spinus];
};
}

View File

@@ -0,0 +1,30 @@
{ stdenv, fetchurl, pkgconfig, postgresql, msgpack, groonga }:
stdenv.mkDerivation rec {
name = "pgroonga-${version}";
version = "2.1.7";
src = fetchurl {
url = "https://packages.groonga.org/source/pgroonga/${name}.tar.gz";
sha256 = "1mpns28f5hk528i5x7rkj9jp3qdhxmicmz13aj4lzlwa8yssx9ws";
};
nativeBuildInputs = [ pkgconfig ];
buildInputs = [ postgresql msgpack groonga ];
makeFlags = [ "HAVE_MSGPACK=1" ];
installPhase = ''
mkdir -p $out/bin
install -D pgroonga.so -t $out/lib/
install -D ./{pgroonga-*.sql,pgroonga.control} -t $out/share/extension
'';
meta = with stdenv.lib; {
description = "A PostgreSQL extension to use Groonga as the index";
longDescription = "PGroonga is a PostgreSQL extension to use Groonga as the index. PostgreSQL supports full text search against languages that use only alphabet and digit. It means that PostgreSQL doesn't support full text search against Japanese, Chinese and so on. You can use super fast full text search feature against all languages by installing PGroonga into your PostgreSQL.";
homepage = https://pgroonga.github.io/;
license = licenses.postgresql;
maintainers = with maintainers; [ DerTim1 ];
};
}

View File

@@ -0,0 +1,33 @@
{ stdenv, fetchFromGitHub, postgresql, perl, perlPackages, which }:
stdenv.mkDerivation rec {
name = "pgtap-${version}";
version = "0.99.0";
src = fetchFromGitHub {
owner = "theory";
repo = "pgtap";
rev = "v${version}";
sha256 = "0xakjlbb99mgd8za6m0xa6n3s5fhif217iip6b3aywqw7nh1j6nv";
};
nativeBuildInputs = [ postgresql perl perlPackages.TAPParserSourceHandlerpgTAP which ];
installPhase = ''
install -D {sql/pgtap--${version}.sql,pgtap.control} -t $out/share/extension
'';
meta = with stdenv.lib; {
description = "pgTAP is a unit testing framework for PostgreSQL";
longDescription = ''
pgTAP is a unit testing framework for PostgreSQL written in PL/pgSQL and PL/SQL.
It includes a comprehensive collection of TAP-emitting assertion functions,
as well as the ability to integrate with other TAP-emitting test frameworks.
It can also be used in the xUnit testing style.
'';
maintainers = with maintainers; [ willibutz ];
homepage = https://pgtap.org;
inherit (postgresql.meta) platforms;
license = licenses.mit;
};
}

View File

@@ -0,0 +1,38 @@
{ stdenv, fetchFromGitHub, v8, perl, postgresql }:
stdenv.mkDerivation rec {
name = "plv8-${version}";
version = "2.3.8";
nativeBuildInputs = [ perl ];
buildInputs = [ v8 postgresql ];
src = fetchFromGitHub {
owner = "plv8";
repo = "plv8";
rev = "v${version}";
sha256 = "0hrmn1zzzdf52zwldg6axv57p0f3b279l9s8lbpijcv60fqrzx16";
};
makeFlags = [ "--makefile=Makefile.shared" ];
preConfigure = ''
patchShebangs ./generate_upgrade.sh
'';
buildPhase = "make -f Makefile.shared all";
installPhase = ''
mkdir -p $out/bin
install -D plv8*.so -t $out/lib
install -D {plls,plcoffee,plv8}{--${version}.sql,.control} -t $out/share/extension
'';
meta = with stdenv.lib; {
description = "PL/v8 - A Procedural Language in JavaScript powered by V8";
homepage = https://pgxn.org/dist/plv8/;
maintainers = with maintainers; [ volth ];
platforms = platforms.linux;
license = licenses.postgresql;
};
}

View File

@@ -0,0 +1,51 @@
{ stdenv, fetchFromGitHub, cmake, postgresql, openssl }:
# # To enable on NixOS:
# config.services.postgresql = {
# extraPlugins = [ pkgs.timescaledb ];
# extraConfig = "shared_preload_libraries = 'timescaledb'";
# }
stdenv.mkDerivation rec {
name = "timescaledb-${version}";
version = "1.0.0";
nativeBuildInputs = [ cmake ];
buildInputs = [ postgresql openssl ];
src = fetchFromGitHub {
owner = "timescale";
repo = "timescaledb";
rev = "refs/tags/${version}";
sha256 = "1359jc0dw8q3f0iipqfadzs8lvri9qa5w59ziz00x1d09ppw2q40";
};
# Fix the install phase which tries to install into the pgsql extension dir,
# and cannot be manually overridden. This is rather fragile but works OK.
patchPhase = ''
for x in CMakeLists.txt sql/CMakeLists.txt; do
substituteInPlace "$x" \
--replace 'DESTINATION "''${PG_SHAREDIR}/extension"' "DESTINATION \"$out/share/extension\""
done
for x in src/CMakeLists.txt src/loader/CMakeLists.txt; do
substituteInPlace "$x" \
--replace 'DESTINATION ''${PG_PKGLIBDIR}' "DESTINATION \"$out/lib\""
done
'';
postInstall = ''
# work around an annoying bug, by creating $out/bin, so buildEnv doesn't freak out later
# see https://github.com/NixOS/nixpkgs/issues/22653
mkdir -p $out/bin
'';
meta = with stdenv.lib; {
description = "Scales PostgreSQL for time-series data via automatic partitioning across time and space";
homepage = https://www.timescale.com/;
maintainers = with maintainers; [ volth ];
platforms = platforms.linux;
license = licenses.asl20;
};
}

View File

@@ -0,0 +1,29 @@
{ stdenv, fetchFromGitHub, pkgconfig, postgresql }:
stdenv.mkDerivation rec {
name = "tsearch-extras-${version}";
version = "0.4";
src = fetchFromGitHub {
owner = "zulip";
repo = "tsearch_extras";
rev = "84e78f00931c4ef261d98197d6b5d94fc141f742"; # no release tag?
sha256 = "18j0saqblg3jhrz38splk173xjwdf32c67ymm18m8n5y94h8d2ba";
};
nativenativeBuildInputs = [ pkgconfig ];
buildInputs = [ postgresql ];
installPhase = ''
mkdir -p $out/bin
install -D tsearch_extras.so -t $out/lib/
install -D ./{tsearch_extras--1.0.sql,tsearch_extras.control} -t $out/share/extension
'';
meta = with stdenv.lib; {
description = "Provides a few PostgreSQL functions for a lower-level data full text search";
homepage = https://github.com/zulip/tsearch_extras/;
license = licenses.postgresql;
maintainers = with maintainers; [ DerTim1 ];
};
}