at 24.11-pre 66 lines 2.1 kB view raw
1{ lib 2, stdenv 3, fetchFromGitHub 4, openssl 5, postgresql 6, postgresqlTestHook 7, readline 8, testers 9, zlib 10}: 11 12stdenv.mkDerivation (finalAttrs: { 13 pname = "pg_repack"; 14 version = "1.5.0"; 15 16 buildInputs = postgresql.buildInputs ++ [ postgresql ]; 17 18 src = fetchFromGitHub { 19 owner = "reorg"; 20 repo = "pg_repack"; 21 rev = "ver_${finalAttrs.version}"; 22 sha256 = "sha256-do80phyMxwcRIkYyUt9z02z7byNQhK+pbSaCUmzG+4c="; 23 }; 24 25 installPhase = '' 26 install -D bin/pg_repack -t $out/bin/ 27 install -D lib/pg_repack${postgresql.dlSuffix} -t $out/lib/ 28 install -D lib/{pg_repack--${finalAttrs.version}.sql,pg_repack.control} -t $out/share/postgresql/extension 29 ''; 30 31 passthru.tests = { 32 version = testers.testVersion { 33 package = finalAttrs.finalPackage; 34 }; 35 extension = stdenv.mkDerivation { 36 name = "plpgsql-check-test"; 37 dontUnpack = true; 38 doCheck = true; 39 buildInputs = [ postgresqlTestHook ]; 40 nativeCheckInputs = [ (postgresql.withPackages (ps: [ ps.pg_repack ])) ]; 41 postgresqlTestUserOptions = "LOGIN SUPERUSER"; 42 failureHook = "postgresqlStop"; 43 checkPhase = '' 44 runHook preCheck 45 psql -a -v ON_ERROR_STOP=1 -c "CREATE EXTENSION pg_repack;" 46 runHook postCheck 47 ''; 48 installPhase = "touch $out"; 49 }; 50 }; 51 52 meta = with lib; { 53 description = "Reorganize tables in PostgreSQL databases with minimal locks"; 54 longDescription = '' 55 pg_repack is a PostgreSQL extension which lets you remove bloat from tables and indexes, and optionally restore 56 the physical order of clustered indexes. Unlike CLUSTER and VACUUM FULL it works online, without holding an 57 exclusive lock on the processed tables during processing. pg_repack is efficient to boot, 58 with performance comparable to using CLUSTER directly. 59 ''; 60 homepage = "https://github.com/reorg/pg_repack"; 61 license = licenses.bsd3; 62 maintainers = with maintainers; [ danbst ]; 63 inherit (postgresql.meta) platforms; 64 mainProgram = "pg_repack"; 65 }; 66})