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 @@ -10,9 +10,9 @@ postgres_major:

# Full version strings for each major version
postgres_release:
postgresorioledb-17: "17.5.1.062-orioledb"
postgres17: "17.6.1.041"
postgres15: "15.14.1.041"
postgresorioledb-17: "17.5.1.063-orioledb"
postgres17: "17.6.1.042"
postgres15: "15.14.1.042"

# Non Postgres Extensions
pgbouncer_release: 1.19.0
Expand Down
118 changes: 92 additions & 26 deletions nix/ext/pg_tle.nix
Original file line number Diff line number Diff line change
@@ -1,45 +1,111 @@
{
lib,
stdenv,
buildEnv,
fetchFromGitHub,
postgresql,
flex,
openssl,
libkrb5,
}:

stdenv.mkDerivation rec {
let
pname = "pg_tle";
version = "1.4.0";
build =
version: hash:
stdenv.mkDerivation rec {
inherit pname version;

nativeBuildInputs = [ flex ];
buildInputs = [
openssl
postgresql
libkrb5
];
nativeBuildInputs = [ flex ];
buildInputs = [
openssl
postgresql
libkrb5
];

src = fetchFromGitHub {
owner = "aws";
repo = pname;
rev = "refs/tags/v${version}";
hash = "sha256-crxj5R9jblIv0h8lpqddAoYe2UqgUlnvbOajKTzVces=";
};
src = fetchFromGitHub {
owner = "aws";
repo = pname;
rev = "refs/tags/v${version}";
inherit hash;
};

makeFlags = [ "FLEX=flex" ];

installPhase = ''

makeFlags = [ "FLEX=flex" ];
mkdir -p $out/{lib,share/postgresql/extension}

installPhase = ''
mkdir -p $out/{lib,share/postgresql/extension}
mv ${pname}${postgresql.dlSuffix} $out/lib/${pname}-${version}${postgresql.dlSuffix}

cp *${postgresql.dlSuffix} $out/lib
cp *.sql $out/share/postgresql/extension
cp *.control $out/share/postgresql/extension
create_sql_files() {
if test -f ${pname}--${version}.sql; then
cp ${pname}--${version}.sql $out/share/postgresql/extension
fi
echo "Creating SQL files for previous versions..."
if [[ "${version}" == "${latestVersion}" ]]; then
cp *.sql $out/share/postgresql/extension
fi
}

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

if [[ "${version}" == "${latestVersion}" ]]; then
{
echo "default_version = '${latestVersion}'"
cat $out/share/postgresql/extension/${pname}--${latestVersion}.control
} > $out/share/postgresql/extension/${pname}.control
ln -sfn ${pname}-${latestVersion}${postgresql.dlSuffix} $out/lib/${pname}${postgresql.dlSuffix}
fi
}

create_sql_files
create_control_files
'';

meta = with lib; {
description = "Framework for 'Trusted Language Extensions' in PostgreSQL";
homepage = "https://github.com/aws/${pname}";
license = licenses.postgresql;
inherit (postgresql.meta) platforms;
};
};
allVersions = (builtins.fromJSON (builtins.readFile ./versions.json)).${pname};
supportedVersions = lib.filterAttrs (
_: value: builtins.elem (lib.versions.major postgresql.version) value.postgresql
) allVersions;
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) supportedVersions
);
in
buildEnv {
name = pname;
paths = packages;
pathsToLink = [
"/lib"
"/share/postgresql/extension"
];
postBuild = ''
# checks
(set -x
test "$(ls -A $out/lib/${pname}*${postgresql.dlSuffix} | wc -l)" = "${
toString (numberOfVersions + 1)
}"
)
'';

meta = with lib; {
description = "Framework for 'Trusted Language Extensions' in PostgreSQL";
homepage = "https://github.com/aws/${pname}";
platforms = postgresql.meta.platforms;
license = licenses.postgresql;
passthru = {
inherit versions numberOfVersions;
pname = "${pname}-all";
defaultSettings = {
shared_preload_libraries = [ "pg_tle" ];
};
version =
"multi-" + lib.concatStringsSep "-" (map (v: lib.replaceStrings [ "." ] [ "-" ] v) versions);
};
}
1 change: 1 addition & 0 deletions nix/ext/tests/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ builtins.listToAttrs (
"pg_jsonschema"
"pg_net"
"pgaudit"
"pg_tle"
"vector"
"wrappers"
]
Expand Down
43 changes: 36 additions & 7 deletions nix/ext/versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,24 @@
"rust": "1.87.0"
}
},
"pg_hashids": {
"1.2.1": {
"postgresql": [
"15",
"17"
],
"revision": "v1.2.1",
"hash": "sha256-2yQ0JrhwZF9dGEIydOviDpQ+3ZhJ8T16dQt6KIirAJ0="
},
"1.3.0-cd0e1b31d52b394a0df64079406a14a4f7387cd6": {
"postgresql": [
"15",
"17"
],
"revision": "cd0e1b31d52b394a0df64079406a14a4f7387cd6",
"hash": "sha256-Nmb7XLqQflYZfqj0yrewfb1Hl5YgEB5wfjBunPwIuOU="
}
},
"pg_repack": {
"1.4.8": {
"postgresql": [
Expand Down Expand Up @@ -711,22 +729,33 @@
"hash": "sha256-wfjiLkx+S3zVrAynisX1GdazueVJ3EOwQEPcgUQt7eA="
}
},
"pg_hashids": {
"1.2.1": {
"pg_tle": {
"1.0.1": {
"postgresql": [
"15"
],
"hash": "sha256-yAe37nIgObjs0kZY1A0QBGMP/s45sC1HVRwxVRaXwXs="
},
"1.0.4": {
"postgresql": [
"15",
"17"
],
"revision": "v1.2.1",
"hash": "sha256-2yQ0JrhwZF9dGEIydOviDpQ+3ZhJ8T16dQt6KIirAJ0="
"hash": "sha256-W/7pLy/27VatCdzUh1NZ4K2FRMD1erfHiFV2eY2x2W0="
},
"1.3.0-cd0e1b31d52b394a0df64079406a14a4f7387cd6": {
"1.3.0": {
"postgresql": [
"15",
"17"
],
"revision": "cd0e1b31d52b394a0df64079406a14a4f7387cd6",
"hash": "sha256-Nmb7XLqQflYZfqj0yrewfb1Hl5YgEB5wfjBunPwIuOU="
"hash": "sha256-Q4D4+eYPBONd8IKlDVfQa8wI4PJyKHkMPPqONqEWFLE="
},
"1.4.0": {
"postgresql": [
"15",
"17"
],
"hash": "sha256-crxj5R9jblIv0h8lpqddAoYe2UqgUlnvbOajKTzVces="
}
}
}