at master 84 lines 2.4 kB view raw
1{ 2 curl, 3 fetchFromGitHub, 4 fetchpatch, 5 lib, 6 lz4, 7 postgresql, 8 postgresqlBuildExtension, 9 postgresqlTestExtension, 10}: 11 12postgresqlBuildExtension (finalAttrs: { 13 pname = "citus"; 14 version = "13.0.3"; 15 16 src = fetchFromGitHub { 17 owner = "citusdata"; 18 repo = "citus"; 19 tag = "v${finalAttrs.version}"; 20 hash = "sha256-tQ2YkMUeziz+dhfXtfuK0x8PWH3vfoJiVbE+YvQ/Gzc="; 21 }; 22 23 patches = [ 24 # Even though this commit is on main since Sep 2023, it hasn't made its way to the release-13.0 branch, yet. 25 # https://github.com/citusdata/citus/pull/7221 26 # Fixes build for PG 16 + 17 on darwin 27 (fetchpatch { 28 url = "https://github.com/citusdata/citus/commit/0f28a69f12418d211ffba5f7ddd222fd0c47daeb.patch"; 29 hash = "sha256-8JAM+PUswzbdlAZUpRApgO0eBsMbUHFdFGsdATsG88I="; 30 }) 31 ]; 32 33 buildInputs = [ 34 curl 35 lz4 36 ]; 37 38 passthru.tests.extension = postgresqlTestExtension { 39 inherit (finalAttrs) finalPackage; 40 postgresqlExtraSettings = '' 41 shared_preload_libraries=citus 42 ''; 43 sql = '' 44 CREATE EXTENSION citus; 45 46 CREATE TABLE examples ( 47 id bigserial, 48 shard_key int, 49 PRIMARY KEY (id, shard_key) 50 ); 51 52 SELECT create_distributed_table('examples', 'shard_key'); 53 54 INSERT INTO examples (shard_key) SELECT shard % 10 FROM generate_series(1,1000) shard; 55 ''; 56 asserts = [ 57 { 58 query = "SELECT count(*) FROM examples"; 59 expected = "1000"; 60 description = "Distributed table can be queried successfully."; 61 } 62 ]; 63 }; 64 65 meta = { 66 # "Our soft policy for Postgres version compatibility is to support Citus' 67 # latest release with Postgres' 3 latest releases." 68 # https://www.citusdata.com/updates/v12-0/#deprecated_features 69 broken = 70 lib.versionOlder postgresql.version "15" 71 || 72 # PostgreSQL 18 support issue upstream: https://github.com/citusdata/citus/issues/7978 73 # Check after next package update. 74 lib.warnIf (finalAttrs.version != "13.0.3") "Is postgresql18Packages.citus still broken?" ( 75 lib.versionAtLeast postgresql.version "18" 76 ); 77 description = "Distributed PostgreSQL as an extension"; 78 homepage = "https://www.citusdata.com/"; 79 changelog = "https://github.com/citusdata/citus/blob/${finalAttrs.src.rev}/CHANGELOG.md"; 80 license = lib.licenses.agpl3Only; 81 maintainers = [ ]; 82 inherit (postgresql.meta) platforms; 83 }; 84})