1{ stdenv, fetchFromGitHub, postgresql, openssl, zlib, readline }:
2
3stdenv.mkDerivation rec {
4 name = "pg_repack-${version}.1";
5 version = "1.4.0";
6 rev = "ver_${version}.1";
7
8 buildInputs = [ postgresql openssl zlib readline ];
9
10 src = fetchFromGitHub {
11 owner = "reorg";
12 repo = "pg_repack";
13 inherit rev;
14 sha256 = "1ym2dlhgcizyy4p5dcfw7kadrq6g34pv3liyfx604irprzhw9k74";
15 };
16
17 installPhase = ''
18 install -D bin/pg_repack -t $out/bin/
19 install -D lib/pg_repack.so -t $out/lib/
20 install -D lib/{pg_repack--${version}.sql,pg_repack.control} -t $out/share/extension
21 '';
22
23 meta = with stdenv.lib; {
24 description = "Reorganize tables in PostgreSQL databases with minimal locks";
25 longDescription = ''
26 pg_repack is a PostgreSQL extension which lets you remove bloat from tables and indexes, and optionally restore
27 the physical order of clustered indexes. Unlike CLUSTER and VACUUM FULL it works online, without holding an
28 exclusive lock on the processed tables during processing. pg_repack is efficient to boot,
29 with performance comparable to using CLUSTER directly.
30 '';
31 license = licenses.bsd3;
32 maintainers = with maintainers; [ danbst ];
33 inherit (postgresql.meta) platforms;
34 inherit (src.meta) homepage;
35 };
36}