Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ansible/vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ postgres_major:

# Full version strings for each major version
postgres_release:
postgresorioledb-17: "17.5.1.027-orioledb"
postgres17: "17.6.1.006"
postgres15: "15.14.1.006"
postgresorioledb-17: "17.5.1.028-orioledb"
postgres17: "17.6.1.007"
postgres15: "15.14.1.007"

# Non Postgres Extensions
pgbouncer_release: "1.19.0"
Expand Down
2 changes: 1 addition & 1 deletion nix/checks.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
pgpkg:
let
pg_prove = pkgs.perlPackages.TAPParserSourceHandlerpgTAP;
pg_regress = self'.packages.pg_regress;
inherit (self'.packages) pg_regress;
getkey-script = pkgs.stdenv.mkDerivation {
name = "pgsodium-getkey";
buildCommand = ''
Expand Down
107 changes: 87 additions & 20 deletions nix/ext/rum.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,100 @@
stdenv,
fetchFromGitHub,
postgresql,
buildEnv,
}:

stdenv.mkDerivation rec {
let
pname = "rum";
version = "1.3.14";

src = fetchFromGitHub {
owner = "postgrespro";
repo = "rum";
rev = version;
hash = "sha256-VsfpxQqRBu9bIAP+TfMRXd+B3hSjuhU2NsutocNiCt8=";
};
# Load version configuration from external file
allVersions = (builtins.fromJSON (builtins.readFile ./versions.json)).${pname};

# Filter versions compatible with current PostgreSQL version
supportedVersions = lib.filterAttrs (
_: value: builtins.elem (lib.versions.major postgresql.version) value.postgresql
) allVersions;

# Derived version information
versions = lib.naturalSort (lib.attrNames supportedVersions);
latestVersion = lib.last versions;
numberOfVersions = builtins.length versions;
packages = builtins.attrValues (
lib.mapAttrs (name: value: build name value.hash value.revision) supportedVersions
);

# Build function for individual versions
build =
version: hash: revision:
stdenv.mkDerivation {
inherit pname version;

src = fetchFromGitHub {
owner = "postgrespro";
repo = "rum";
rev = revision;
inherit hash;
};

buildInputs = [ postgresql ];

makeFlags = [ "USE_PGXS=1" ];

installPhase = ''
mkdir -p $out/{lib,share/postgresql/extension}

# Install shared library with version suffix
mv ${pname}${postgresql.dlSuffix} $out/lib/${pname}-${version}${postgresql.dlSuffix}

# Create version-specific control file
sed -e "/^default_version =/d" \
-e "s|^module_pathname = .*|module_pathname = '\$libdir/${pname}-${version}'|" \
${pname}.control > $out/share/postgresql/extension/${pname}--${version}.control

# For the latest version, create default control file and symlink and copy SQL upgrade scripts
if [[ "${version}" == "${latestVersion}" ]]; then
{
echo "default_version = '${version}'"
cat $out/share/postgresql/extension/${pname}--${version}.control
} > $out/share/postgresql/extension/${pname}.control
ln -sfn ${pname}-${latestVersion}${postgresql.dlSuffix} $out/lib/${pname}${postgresql.dlSuffix}
cp *.sql $out/share/postgresql/extension
fi
'';

meta = with lib; {
description = "Full text search index method for PostgreSQL";
homepage = "https://github.com/postgrespro/rum";
license = licenses.postgresql;
inherit (postgresql.meta) platforms;
};
};
in
buildEnv {
name = pname;
paths = packages;

buildInputs = [ postgresql ];
pathsToLink = [
"/lib"
"/share/postgresql/extension"
];

makeFlags = [ "USE_PGXS=1" ];
postBuild = ''
# Verify all expected library files are present
expectedFiles=${toString (numberOfVersions + 1)}
actualFiles=$(ls -l $out/lib/${pname}*${postgresql.dlSuffix} | wc -l)

installPhase = ''
install -D -t $out/lib *${postgresql.dlSuffix}
install -D -t $out/share/postgresql/extension *.control
install -D -t $out/share/postgresql/extension *.sql
if [[ "$actualFiles" != "$expectedFiles" ]]; then
echo "Error: Expected $expectedFiles library files, found $actualFiles"
echo "Files found:"
ls -la $out/lib/*${postgresql.dlSuffix} || true
exit 1
fi
'';

meta = with lib; {
description = "Full text search index method for PostgreSQL";
homepage = "https://github.com/postgrespro/rum";
license = licenses.postgresql;
platforms = postgresql.meta.platforms;
passthru = {
inherit versions numberOfVersions;
pname = "${pname}-all";
version =
"multi-" + lib.concatStringsSep "-" (map (v: lib.replaceStrings [ "." ] [ "-" ] v) versions);
};
}
10 changes: 10 additions & 0 deletions nix/ext/versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,16 @@
],
"hash": "sha256-Cpi2iASi1QJoED0Qs1dANqg/BNZTsz5S+pw8iYyW03Y="
}
},
"rum": {
"1.3": {
"postgresql": [
"15",
"17"
],
"hash": "sha256-VsfpxQqRBu9bIAP+TfMRXd+B3hSjuhU2NsutocNiCt8=",
"revision": "1.3.14"
}
},
"timescaledb": {
"2.9.1": {
Expand Down