Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport release-24.11] postgresqlPackages: enable update scripts and update many packages #357398

Merged
merged 16 commits into from
Nov 20, 2024
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
122 changes: 70 additions & 52 deletions pkgs/servers/sql/postgresql/buildPostgresqlExtension.nix
Original file line number Diff line number Diff line change
Expand Up @@ -60,70 +60,88 @@
lib,
stdenv,
postgresql,
nix-update-script,
}:

args:

let
buildPostgresqlExtension = finalAttrs: prevAttrs: {
buildInputs = [ postgresql ] ++ prevAttrs.buildInputs or [ ];
buildPostgresqlExtension =
finalAttrs:
{
enableUpdateScript ? true,
...
}@prevAttrs:
{
passthru =
prevAttrs.passthru or { }
// lib.optionalAttrs enableUpdateScript {
updateScript =
prevAttrs.passthru.updateScript or (nix-update-script (
lib.optionalAttrs (lib.hasInfix "unstable" prevAttrs.version) {
extraArgs = [ "--version=branch" ];
}
));
};

installFlags = [
"DESTDIR=${placeholder "out"}"
] ++ prevAttrs.installFlags or [ ];
buildInputs = [ postgresql ] ++ prevAttrs.buildInputs or [ ];

postInstall =
''
# DESTDIR + pg_config install the files into
# /nix/store/<extension>/nix/store/<postgresql>/...
# We'll now remove the /nix/store/<postgresql> part:
if [[ -d "$out${postgresql}" ]]; then
cp -alt "$out" "$out${postgresql}"/*
rm -r "$out${postgresql}"
fi
installFlags = [
"DESTDIR=${placeholder "out"}"
] ++ prevAttrs.installFlags or [ ];

if [[ -d "$out${postgresql.dev}" ]]; then
mkdir -p "''${dev:-$out}"
cp -alt "''${dev:-$out}" "$out${postgresql.dev}"/*
rm -r "$out${postgresql.dev}"
fi
postInstall =
''
# DESTDIR + pg_config install the files into
# /nix/store/<extension>/nix/store/<postgresql>/...
# We'll now remove the /nix/store/<postgresql> part:
if [[ -d "$out${postgresql}" ]]; then
cp -alt "$out" "$out${postgresql}"/*
rm -r "$out${postgresql}"
fi

if [[ -d "$out${postgresql.lib}" ]]; then
mkdir -p "''${lib:-$out}"
cp -alt "''${lib:-$out}" "$out${postgresql.lib}"/*
rm -r "$out${postgresql.lib}"
fi
if [[ -d "$out${postgresql.dev}" ]]; then
mkdir -p "''${dev:-$out}"
cp -alt "''${dev:-$out}" "$out${postgresql.dev}"/*
rm -r "$out${postgresql.dev}"
fi

if [[ -d "$out${postgresql.doc}" ]]; then
mkdir -p "''${doc:-$out}"
cp -alt "''${doc:-$out}" "$out${postgresql.doc}"/*
rm -r "$out${postgresql.doc}"
fi
if [[ -d "$out${postgresql.lib}" ]]; then
mkdir -p "''${lib:-$out}"
cp -alt "''${lib:-$out}" "$out${postgresql.lib}"/*
rm -r "$out${postgresql.lib}"
fi

if [[ -d "$out${postgresql.man}" ]]; then
mkdir -p "''${man:-$out}"
cp -alt "''${man:-$out}" "$out${postgresql.man}"/*
rm -r "$out${postgresql.man}"
fi
if [[ -d "$out${postgresql.doc}" ]]; then
mkdir -p "''${doc:-$out}"
cp -alt "''${doc:-$out}" "$out${postgresql.doc}"/*
rm -r "$out${postgresql.doc}"
fi

# In some cases (postgis) parts of the install script
# actually work "OK", before we add DESTDIR, so some
# files end up in
# /nix/store/<extension>/nix/store/<extension>/...
if [[ -d "$out$out" ]]; then
cp -alt "$out" "$out$out"/*
rm -r "$out$out"
fi
if [[ -d "$out${postgresql.man}" ]]; then
mkdir -p "''${man:-$out}"
cp -alt "''${man:-$out}" "$out${postgresql.man}"/*
rm -r "$out${postgresql.man}"
fi

if [[ -d "$out/nix/store" ]]; then
if ! rmdir "$out/nix/store" "$out/nix"; then
find "$out/nix"
nixErrorLog 'Found left-overs in $out/nix/store, make sure to move them into $out properly.'
exit 1
fi
fi
''
+ prevAttrs.postInstall or "";
};
# In some cases (postgis) parts of the install script
# actually work "OK", before we add DESTDIR, so some
# files end up in
# /nix/store/<extension>/nix/store/<extension>/...
if [[ -d "$out$out" ]]; then
cp -alt "$out" "$out$out"/*
rm -r "$out$out"
fi

if [[ -d "$out/nix/store" ]]; then
if ! rmdir "$out/nix/store" "$out/nix"; then
find "$out/nix"
nixErrorLog 'Found left-overs in $out/nix/store, make sure to move them into $out properly.'
exit 1
fi
fi
''
+ prevAttrs.postInstall or "";
};
in
stdenv.mkDerivation (lib.extends buildPostgresqlExtension (lib.toFunction args))
1 change: 1 addition & 0 deletions pkgs/servers/sql/postgresql/ext/age.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ buildPostgresqlExtension rec {
"PERL=${perl}/bin/perl"
];

enableUpdateScript = false;
passthru.tests = stdenv.mkDerivation {
inherit version src;

Expand Down
1 change: 1 addition & 0 deletions pkgs/servers/sql/postgresql/ext/apache_datasketches.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ buildPostgresqlExtension (finalAttrs: {
runHook postPatch
'';

enableUpdateScript = false;
passthru.tests.extension = postgresqlTestExtension {
inherit (finalAttrs) finalPackage;
sql = ''
Expand Down
6 changes: 3 additions & 3 deletions pkgs/servers/sql/postgresql/ext/citus.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@

buildPostgresqlExtension rec {
pname = "citus";
version = "12.1.2";
version = "12.1.6";

src = fetchFromGitHub {
owner = "citusdata";
repo = "citus";
rev = "v${version}";
hash = "sha256-0uYNMLAYigtGlDRvOEkQeC5i58QfXcdSVjTQwWVFX+8=";
hash = "sha256-PYABH4e5Wp5hMvEQMRHjPL7gDVu8Wud6d+BzrBBMjIQ=";
};

buildInputs = [
Expand All @@ -30,7 +30,7 @@ buildPostgresqlExtension rec {
broken = versionOlder postgresql.version "14" ||
# PostgreSQL 17 support issue upstream: https://github.com/citusdata/citus/issues/7708
# Check after next package update.
(versionAtLeast postgresql.version "17" && version == "12.1.2");
(versionAtLeast postgresql.version "17" && version == "12.1.6");
description = "Distributed PostgreSQL as an extension";
homepage = "https://www.citusdata.com/";
changelog = "https://github.com/citusdata/citus/blob/${src.rev}/CHANGELOG.md";
Expand Down
2 changes: 1 addition & 1 deletion pkgs/servers/sql/postgresql/ext/cstore_fdw.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

buildPostgresqlExtension rec {
pname = "cstore_fdw";
version = "unstable-2022-03-08";
version = "1.7.0-unstable-2021-03-08";

nativeBuildInputs = [ protobufc ];

Expand Down
11 changes: 7 additions & 4 deletions pkgs/servers/sql/postgresql/ext/h3-pg.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,24 @@

buildPostgresqlExtension (finalAttrs: {
pname = "h3-pg";
version = "4.1.3";
version = "4.1.4";

src = fetchFromGitHub {
owner = "zachasme";
repo = "h3-pg";
rev = "v${finalAttrs.version}";
hash = "sha256-nkaDZ+JuMtsGUJVx70DD2coLrmc/T8/cNov7pfNF1Eg=";
hash = "sha256-uZ4XI/VXRr636CI1r24D6ykPQqO5qZNxNQLUQKmoPtg=";
};

postPatch = ''
substituteInPlace CMakeLists.txt \
--replace "add_subdirectory(cmake/h3)" "include_directories(${lib.getDev h3_4}/include/h3)"
--replace-fail "add_subdirectory(cmake/h3)" "include_directories(${lib.getDev h3_4}/include/h3)"
'' + lib.optionalString stdenv.hostPlatform.isDarwin ''
substituteInPlace cmake/AddPostgreSQLExtension.cmake \
--replace "INTERPROCEDURAL_OPTIMIZATION TRUE" ""
--replace-fail "INTERPROCEDURAL_OPTIMIZATION TRUE" ""
# Commented upstream: https://github.com/zachasme/h3-pg/pull/141/files#r1844970927
substituteInPlace cmake/FindPostgreSQL.cmake \
--replace-fail 'list(APPEND PostgreSQL_INCLUDE_DIRS "/usr/local/include")' ""
'';

nativeBuildInputs = [
Expand Down
2 changes: 1 addition & 1 deletion pkgs/servers/sql/postgresql/ext/jsonb_deep_sum.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

buildPostgresqlExtension rec {
pname = "jsonb_deep_sum";
version = "unstable-2021-12-24";
version = "0-unstable-2021-12-24";

src = fetchFromGitHub {
owner = "furstenheim";
Expand Down
4 changes: 2 additions & 2 deletions pkgs/servers/sql/postgresql/ext/lantern.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@

buildPostgresqlExtension (finalAttrs: {
pname = "postgresql-lantern";
version = "0.4.1";
version = "0.5.0";

src = fetchFromGitHub {
owner = "lanterndata";
repo = "lantern";
rev = "v${finalAttrs.version}";
hash = "sha256-V8W61hELXeaVvNZgRUcckFlCMWis7NENlRKySxsK/L8=";
hash = "sha256-IsDD/um5pVvbzin8onf45DQVszl+Id/pJSQ2iijgHmg=";
fetchSubmodules = true;
};

Expand Down
4 changes: 2 additions & 2 deletions pkgs/servers/sql/postgresql/ext/periods.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

buildPostgresqlExtension rec {
pname = "periods";
version = "1.2.2";
version = "1.2.3";

src = fetchFromGitHub {
owner = "xocolatl";
repo = pname;
rev = "v${version}";
sha256 = "sha256-ezt+MtDqPM8OmJCD6oQTS644l+XHZoxuivq0PUIXOY8=";
sha256 = "sha256-97v6+WNDcYb/KivlE/JBlRIZ3gYHj68AlK0fylp1cPo=";
};

meta = with lib; {
Expand Down
12 changes: 2 additions & 10 deletions pkgs/servers/sql/postgresql/ext/pg_bigm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,15 @@

buildPostgresqlExtension rec {
pname = "pg_bigm";
version = "1.2-20200228";
version = "1.2-20240606";

src = fetchFromGitHub {
owner = "pgbigm";
repo = "pg_bigm";
rev = "v${version}";
hash = "sha256-3lspEglVWzEUTiRIWqW0DpQe8gDn9R/RxsWuI9znYc8=";
hash = "sha256-5Uy1DmGZR4WdtRUvNdZ5b9zBHJUb9idcEzW20rkreBs=";
};

patches = [
# Fix compatibility with PostgreSQL 16. Remove with the next release.
(fetchpatch {
url = "https://github.com/pgbigm/pg_bigm/commit/2a9d783c52a1d7a2eb414da6f091f6035da76edf.patch";
hash = "sha256-LuMpSUPnT8cPChQfA9sJEKP4aGpsbN5crfTKLnDzMN8=";
})
];

makeFlags = [ "USE_PGXS=1" ];

meta = with lib; {
Expand Down
2 changes: 2 additions & 0 deletions pkgs/servers/sql/postgresql/ext/pg_hint_plan.nix
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ buildPostgresqlExtension {
substituteInPlace Makefile --replace "LDFLAGS+=-Wl,--build-id" ""
'';

enableUpdateScript = false;

meta = with lib; {
description = "Extension to tweak PostgreSQL execution plans using so-called 'hints' in SQL comments";
homepage = "https://github.com/ossc-db/pg_hint_plan";
Expand Down
4 changes: 2 additions & 2 deletions pkgs/servers/sql/postgresql/ext/pg_net.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

buildPostgresqlExtension rec {
pname = "pg_net";
version = "0.8.0";
version = "0.13.0";

buildInputs = [ curl ];

src = fetchFromGitHub {
owner = "supabase";
repo = pname;
rev = "refs/tags/v${version}";
hash = "sha256-ZPsRPWV1G3lMM2mT+H139Wvgoy8QnmeUbzEnGeDJmZA=";
hash = "sha256-FRaTZPCJQPYAFmsJg22hYJJ0+gH1tMdDQoCQgiqEnaA=";
};

env.NIX_CFLAGS_COMPILE = "-Wno-error";
Expand Down
4 changes: 2 additions & 2 deletions pkgs/servers/sql/postgresql/ext/pg_repack.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@

buildPostgresqlExtension (finalAttrs: {
pname = "pg_repack";
version = "1.5.0";
version = "1.5.1";

buildInputs = postgresql.buildInputs;

src = fetchFromGitHub {
owner = "reorg";
repo = "pg_repack";
rev = "ver_${finalAttrs.version}";
sha256 = "sha256-do80phyMxwcRIkYyUt9z02z7byNQhK+pbSaCUmzG+4c=";
sha256 = "sha256-wJwy4qIt6/kgWqT6HbckUVqDayDkixqHpYiC1liLERw=";
};

passthru.tests = {
Expand Down
6 changes: 2 additions & 4 deletions pkgs/servers/sql/postgresql/ext/pg_similarity.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{ stdenv, lib, fetchFromGitHub, fetchpatch, postgresql, unstableGitUpdater, buildPostgresqlExtension }:
{ stdenv, lib, fetchFromGitHub, fetchpatch, postgresql, buildPostgresqlExtension }:

buildPostgresqlExtension {
pname = "pg_similarity";
version = "1.0-unstable-2021-01-12";
version = "pg_similarity_1_0-unstable-2021-01-12";

src = fetchFromGitHub {
owner = "eulerto";
Expand All @@ -23,8 +23,6 @@ buildPostgresqlExtension {

makeFlags = [ "USE_PGXS=1" ];

passthru.updateScript = unstableGitUpdater {};

meta = {
description = "Extension to support similarity queries on PostgreSQL";
longDescription = ''
Expand Down
7 changes: 4 additions & 3 deletions pkgs/servers/sql/postgresql/ext/pg_squeeze.nix
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
{ lib, stdenv, fetchFromGitHub, postgresql, postgresqlTestExtension, buildPostgresqlExtension }:
{ lib, stdenv, fetchFromGitHub, postgresql, postgresqlTestExtension, buildPostgresqlExtension, nix-update-script }:

buildPostgresqlExtension (finalAttrs: {
pname = "pg_squeeze";
version = "1.7.0";
version = "${builtins.replaceStrings ["_"] ["."] (lib.strings.removePrefix "REL" finalAttrs.src.rev)}";

src = fetchFromGitHub {
owner = "cybertec-postgresql";
repo = "pg_squeeze";
rev = "REL${builtins.replaceStrings ["."] ["_"] finalAttrs.version}";
rev = "REL1_7_0";
hash = "sha256-Kh1wSOvV5Rd1CG/na3yzbWzvaR8SJ6wmTZOnM+lbgik=";
};

passthru.updateScript = nix-update-script { extraArgs = [ "--version-regex=REL(.*)" ]; };
passthru.tests.extension = postgresqlTestExtension {
inherit (finalAttrs) finalPackage;
postgresqlExtraSettings = ''
Expand Down
4 changes: 2 additions & 2 deletions pkgs/servers/sql/postgresql/ext/pg_uuidv7.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@

buildPostgresqlExtension rec {
pname = "pg_uuidv7";
version = "1.5.0";
version = "1.6.0";

src = fetchFromGitHub {
owner = "fboulnois";
repo = "pg_uuidv7";
rev = "v${version}";
hash = "sha256-oVyRtjl3KsD3j96qvQb8bFLMhoWO81OudOL4wVXrjzI=";
hash = "sha256-lG6dCnbLALnfQc4uclqXXXfYjK/WXLV0lo5I8l1E5p4=";
};

meta = with lib; {
Expand Down
2 changes: 2 additions & 0 deletions pkgs/servers/sql/postgresql/ext/pgaudit.nix
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ buildPostgresqlExtension {

makeFlags = [ "USE_PGXS=1" ];

enableUpdateScript = false;

meta = with lib; {
description = "Open Source PostgreSQL Audit Logging";
homepage = "https://github.com/pgaudit/pgaudit";
Expand Down
Loading