mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 06:53:01 +00:00
postgresqlPackages: enable update scripts by default
This enables update scripts via buildPostgresqlExtension. Extensions
must actively opt-out, if they don't support either the default
configuration or the unstable configuration.
To make the update script work, some extensions had to be changed to
pull their code from GitHub instead. Those with PostgreSQL-style version
tags (REL_X_Y) had to be changed to make src.rev the source of truth.
(cherry picked from commit 68254e438c
)
This commit is contained in:
parent
013c1ee860
commit
a7ab390051
@ -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))
|
||||
|
@ -28,6 +28,7 @@ buildPostgresqlExtension rec {
|
||||
"PERL=${perl}/bin/perl"
|
||||
];
|
||||
|
||||
enableUpdateScript = false;
|
||||
passthru.tests = stdenv.mkDerivation {
|
||||
inherit version src;
|
||||
|
||||
|
@ -36,6 +36,7 @@ buildPostgresqlExtension (finalAttrs: {
|
||||
runHook postPatch
|
||||
'';
|
||||
|
||||
enableUpdateScript = false;
|
||||
passthru.tests.extension = postgresqlTestExtension {
|
||||
inherit (finalAttrs) finalPackage;
|
||||
sql = ''
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
buildPostgresqlExtension rec {
|
||||
pname = "cstore_fdw";
|
||||
version = "unstable-2022-03-08";
|
||||
version = "1.7.0-unstable-2021-03-08";
|
||||
|
||||
nativeBuildInputs = [ protobufc ];
|
||||
|
||||
|
@ -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";
|
||||
|
@ -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";
|
||||
|
@ -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";
|
||||
@ -23,8 +23,6 @@ buildPostgresqlExtension {
|
||||
|
||||
makeFlags = [ "USE_PGXS=1" ];
|
||||
|
||||
passthru.updateScript = unstableGitUpdater {};
|
||||
|
||||
meta = {
|
||||
description = "Extension to support similarity queries on PostgreSQL";
|
||||
longDescription = ''
|
||||
|
@ -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 = ''
|
||||
|
@ -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";
|
||||
|
@ -1,18 +1,21 @@
|
||||
{ lib, stdenv, fetchurl, pkg-config, postgresql, msgpack-c, groonga, buildPostgresqlExtension }:
|
||||
{ lib, stdenv, fetchFromGitHub, pkg-config, postgresql, msgpack-c, groonga, buildPostgresqlExtension, xxHash }:
|
||||
|
||||
buildPostgresqlExtension rec {
|
||||
pname = "pgroonga";
|
||||
version = "3.2.3";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://packages.groonga.org/source/${pname}/${pname}-${version}.tar.gz";
|
||||
hash = "sha256-k9+DgiLzU2cA3jvw3pMF7/FmDGxsCYtAOaUtf2LMTnw=";
|
||||
src = fetchFromGitHub {
|
||||
owner = "pgroonga";
|
||||
repo = "pgroonga";
|
||||
rev = "${version}";
|
||||
hash = "sha256-bDCDfb78r/HUa7LuZZrwrSZEFcevA1pwSy8/tcCh/oE=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ pkg-config ];
|
||||
buildInputs = [ msgpack-c groonga ];
|
||||
buildInputs = [ msgpack-c groonga xxHash ];
|
||||
|
||||
makeFlags = [
|
||||
"HAVE_XXHASH=1"
|
||||
"HAVE_MSGPACK=1"
|
||||
"MSGPACK_PACKAGE_NAME=msgpack-c"
|
||||
];
|
||||
|
@ -2,12 +2,12 @@
|
||||
|
||||
buildPostgresqlExtension rec {
|
||||
pname = "plr";
|
||||
version = "8.4.7";
|
||||
version = "${builtins.replaceStrings ["_"] ["."] (lib.strings.removePrefix "REL" src.rev)}";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "postgres-plr";
|
||||
repo = "plr";
|
||||
rev = "REL${builtins.replaceStrings ["."] ["_"] version}";
|
||||
rev = "REL8_4_7";
|
||||
sha256 = "sha256-PdvFEmtKfLT/xfaf6obomPR5hKC9F+wqpfi1heBphRk=";
|
||||
};
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
fetchurl,
|
||||
fetchFromGitHub,
|
||||
lib,
|
||||
stdenv,
|
||||
perl,
|
||||
@ -22,6 +22,10 @@
|
||||
jitSupport,
|
||||
llvm,
|
||||
buildPostgresqlExtension,
|
||||
autoconf,
|
||||
automake,
|
||||
libtool,
|
||||
which,
|
||||
}:
|
||||
|
||||
let
|
||||
@ -36,9 +40,11 @@ buildPostgresqlExtension (finalAttrs: {
|
||||
"doc"
|
||||
];
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://download.osgeo.org/postgis/source/postgis-${finalAttrs.version}.tar.gz";
|
||||
hash = "sha256-ymmKIswrKzRnrE4GO0OihBPzAE3dUFvczddMVqZH9RA=";
|
||||
src = fetchFromGitHub {
|
||||
owner = "postgis";
|
||||
repo = "postgis";
|
||||
rev = "${finalAttrs.version}";
|
||||
hash = "sha256-wh7Lav2vnKzGWuSvvMFvAaGV7ynD+KgPsFUgujdtzlA=";
|
||||
};
|
||||
|
||||
buildInputs = [
|
||||
@ -51,8 +57,12 @@ buildPostgresqlExtension (finalAttrs: {
|
||||
pcre2.dev
|
||||
] ++ lib.optional stdenv.hostPlatform.isDarwin libiconv;
|
||||
nativeBuildInputs = [
|
||||
autoconf
|
||||
automake
|
||||
libtool
|
||||
perl
|
||||
pkg-config
|
||||
which
|
||||
] ++ lib.optional jitSupport llvm;
|
||||
dontDisableStatic = true;
|
||||
|
||||
@ -70,7 +80,7 @@ buildPostgresqlExtension (finalAttrs: {
|
||||
|
||||
setOutputFlags = false;
|
||||
preConfigure = ''
|
||||
sed -i 's@/usr/bin/file@${file}/bin/file@' configure
|
||||
./autogen.sh
|
||||
'';
|
||||
|
||||
configureFlags = [
|
||||
|
@ -8,12 +8,14 @@
|
||||
|
||||
buildPostgresqlExtension rec {
|
||||
pname = "wal2json";
|
||||
version = "2.6";
|
||||
version = "${builtins.replaceStrings [ "_" ] [ "." ] (
|
||||
lib.strings.removePrefix "wal2json_" src.rev
|
||||
)}";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "eulerto";
|
||||
repo = "wal2json";
|
||||
rev = "wal2json_${builtins.replaceStrings [ "." ] [ "_" ] version}";
|
||||
rev = "wal2json_2_6";
|
||||
sha256 = "sha256-+QoACPCKiFfuT2lJfSUmgfzC5MXf75KpSoc2PzPxKyM=";
|
||||
};
|
||||
|
||||
@ -24,7 +26,7 @@ buildPostgresqlExtension rec {
|
||||
meta = with lib; {
|
||||
description = "PostgreSQL JSON output plugin for changeset extraction";
|
||||
homepage = "https://github.com/eulerto/wal2json";
|
||||
changelog = "https://github.com/eulerto/wal2json/releases/tag/wal2json_${version}";
|
||||
changelog = "https://github.com/eulerto/wal2json/releases/tag/${src.rev}";
|
||||
maintainers = with maintainers; [ euank ];
|
||||
platforms = postgresql.meta.platforms;
|
||||
license = licenses.bsd3;
|
||||
|
Loading…
Reference in New Issue
Block a user