uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead

https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948
this can do it nicely.

Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
Anton Arapov 2021-04-03 12:58:10 +02:00 committed by Alan Daniels
commit 56de2bcd43
30691 changed files with 3076956 additions and 0 deletions

View file

@ -0,0 +1,249 @@
let
generic =
# dependencies
{ stdenv, lib, fetchurl, makeWrapper
, glibc, zlib, readline, openssl, icu, lz4, systemd, libossp_uuid
, pkg-config, libxml2, tzdata
# This is important to obtain a version of `libpq` that does not depend on systemd.
, enableSystemd ? (lib.versionAtLeast version "9.6" && !stdenv.isDarwin)
, gssSupport ? with stdenv.hostPlatform; !isWindows && !isStatic, libkrb5
# for postgreql.pkgs
, this, self, newScope, buildEnv
# source specification
, version, sha256, psqlSchema,
# for tests
nixosTests, thisAttr
}:
let
atLeast = lib.versionAtLeast version;
icuEnabled = atLeast "10";
lz4Enabled = atLeast "14";
in stdenv.mkDerivation rec {
pname = "postgresql";
inherit version;
src = fetchurl {
url = "mirror://postgresql/source/v${version}/${pname}-${version}.tar.bz2";
inherit sha256;
};
hardeningEnable = lib.optionals (!stdenv.cc.isClang) [ "pie" ];
outputs = [ "out" "lib" "doc" "man" ];
setOutputFlags = false; # $out retains configureFlags :-/
buildInputs =
[ zlib readline openssl libxml2 ]
++ lib.optionals icuEnabled [ icu ]
++ lib.optionals lz4Enabled [ lz4 ]
++ lib.optionals enableSystemd [ systemd ]
++ lib.optionals gssSupport [ libkrb5 ]
++ lib.optionals (!stdenv.isDarwin) [ libossp_uuid ];
nativeBuildInputs = [ makeWrapper ] ++ lib.optionals icuEnabled [ pkg-config ];
enableParallelBuilding = !stdenv.isDarwin;
separateDebugInfo = true;
buildFlags = [ "world" ];
NIX_CFLAGS_COMPILE = "-I${libxml2.dev}/include/libxml2";
# Otherwise it retains a reference to compiler and fails; see #44767. TODO: better.
preConfigure = "CC=${stdenv.cc.targetPrefix}cc";
configureFlags = [
"--with-openssl"
"--with-libxml"
"--sysconfdir=/etc"
"--libdir=$(lib)/lib"
"--with-system-tzdata=${tzdata}/share/zoneinfo"
"--enable-debug"
(lib.optionalString enableSystemd "--with-systemd")
(if stdenv.isDarwin then "--with-uuid=e2fs" else "--with-ossp-uuid")
] ++ lib.optionals icuEnabled [ "--with-icu" ]
++ lib.optionals lz4Enabled [ "--with-lz4" ]
++ lib.optionals gssSupport [ "--with-gssapi" ]
++ lib.optionals stdenv.hostPlatform.isRiscV [ "--disable-spinlocks" ];
patches =
[ (if atLeast "9.4" then ./patches/disable-resolve_symlinks-94.patch else ./patches/disable-resolve_symlinks.patch)
(if atLeast "9.6" then ./patches/less-is-more-96.patch else ./patches/less-is-more.patch)
(if atLeast "9.6" then ./patches/hardcode-pgxs-path-96.patch else ./patches/hardcode-pgxs-path.patch)
./patches/specify_pkglibdir_at_runtime.patch
./patches/findstring.patch
]
++ lib.optional stdenv.isLinux (if atLeast "13" then ./patches/socketdir-in-run-13.patch else ./patches/socketdir-in-run.patch);
installTargets = [ "install-world" ];
LC_ALL = "C";
postConfigure =
let path = if atLeast "9.6" then "src/common/config_info.c" else "src/bin/pg_config/pg_config.c"; in
''
# Hardcode the path to pgxs so pg_config returns the path in $out
substituteInPlace "${path}" --replace HARDCODED_PGXS_PATH $out/lib
'';
postInstall =
''
moveToOutput "lib/pgxs" "$out" # looks strange, but not deleting it
moveToOutput "lib/libpgcommon*.a" "$out"
moveToOutput "lib/libpgport*.a" "$out"
moveToOutput "lib/libecpg*" "$out"
# Prevent a retained dependency on gcc-wrapper.
substituteInPlace "$out/lib/pgxs/src/Makefile.global" --replace ${stdenv.cc}/bin/ld ld
if [ -z "''${dontDisableStatic:-}" ]; then
# Remove static libraries in case dynamic are available.
for i in $out/lib/*.a $lib/lib/*.a; do
name="$(basename "$i")"
ext="${stdenv.hostPlatform.extensions.sharedLibrary}"
if [ -e "$lib/lib/''${name%.a}$ext" ] || [ -e "''${i%.a}$ext" ]; then
rm "$i"
fi
done
fi
'';
postFixup = lib.optionalString (!stdenv.isDarwin && stdenv.hostPlatform.libc == "glibc")
''
# initdb needs access to "locale" command from glibc.
wrapProgram $out/bin/initdb --prefix PATH ":" ${glibc.bin}/bin
'';
doCheck = !stdenv.isDarwin;
# autodetection doesn't seem to able to find this, but it's there.
checkTarget = "check";
preCheck =
# On musl, comment skip the following tests, because they break due to
# ! ERROR: could not load library "/build/postgresql-11.5/tmp_install/nix/store/...-postgresql-11.5-lib/lib/libpqwalreceiver.so": Error loading shared library libpq.so.5: No such file or directory (needed by /build/postgresql-11.5/tmp_install/nix/store/...-postgresql-11.5-lib/lib/libpqwalreceiver.so)
# See also here:
# https://git.alpinelinux.org/aports/tree/main/postgresql/disable-broken-tests.patch?id=6d7d32c12e073a57a9e5946e55f4c1fbb68bd442
if stdenv.hostPlatform.isMusl then ''
substituteInPlace src/test/regress/parallel_schedule \
--replace "subscription" "" \
--replace "object_address" ""
'' else null;
doInstallCheck = false; # needs a running daemon?
disallowedReferences = [ stdenv.cc ];
passthru = {
inherit readline psqlSchema;
pkgs = let
scope = { postgresql = this; };
newSelf = self // scope;
newSuper = { callPackage = newScope (scope // this.pkgs); };
in import ./packages.nix newSelf newSuper;
withPackages = postgresqlWithPackages {
inherit makeWrapper buildEnv;
postgresql = this;
}
this.pkgs;
tests.postgresql = nixosTests.postgresql-wal-receiver.${thisAttr};
};
meta = with lib; {
homepage = "https://www.postgresql.org";
description = "A powerful, open source object-relational database system";
license = licenses.postgresql;
maintainers = with maintainers; [ thoughtpolice danbst globin marsam ivan ];
platforms = platforms.unix;
knownVulnerabilities = optional (!atLeast "9.4")
"PostgreSQL versions older than 9.4 are not maintained anymore!";
};
};
postgresqlWithPackages = { postgresql, makeWrapper, buildEnv }: pkgs: f: buildEnv {
name = "postgresql-and-plugins-${postgresql.version}";
paths = f pkgs ++ [
postgresql
postgresql.lib
postgresql.man # in case user installs this into environment
];
buildInputs = [ makeWrapper ];
# We include /bin to ensure the $out/bin directory is created, which is
# needed because we'll be removing the files from that directory in postBuild
# below. See #22653
pathsToLink = ["/" "/bin"];
# Note: the duplication of executables is about 4MB size.
# So a nicer solution was patching postgresql to allow setting the
# libdir explicitely.
postBuild = ''
mkdir -p $out/bin
rm $out/bin/{pg_config,postgres,pg_ctl}
cp --target-directory=$out/bin ${postgresql}/bin/{postgres,pg_config,pg_ctl}
wrapProgram $out/bin/postgres --set NIX_PGLIBDIR $out/lib
'';
passthru.version = postgresql.version;
passthru.psqlSchema = postgresql.psqlSchema;
};
in self: {
postgresql_10 = self.callPackage generic {
version = "10.21";
psqlSchema = "10.0"; # should be 10, but changing it is invasive
sha256 = "sha256-0yGYhW1Sqab11QZC74ZoesBYvW78pcntV754CElvRdE=";
this = self.postgresql_10;
thisAttr = "postgresql_10";
inherit self;
icu = self.icu67;
};
postgresql_11 = self.callPackage generic {
version = "11.16";
psqlSchema = "11.1"; # should be 11, but changing it is invasive
sha256 = "sha256-LdnhEfCllJ7nyswGXOoPshCSkpuuMQzgW/AbT/xRA6U=";
this = self.postgresql_11;
thisAttr = "postgresql_11";
inherit self;
};
postgresql_12 = self.callPackage generic {
version = "12.11";
psqlSchema = "12";
sha256 = "sha256-ECYkil/Svur0PkxyNqyBflbVi2gaM1hWRl37x1s+gwI=";
this = self.postgresql_12;
thisAttr = "postgresql_12";
inherit self;
};
postgresql_13 = self.callPackage generic {
version = "13.7";
psqlSchema = "13";
sha256 = "sha256-G5Bb9PPYNhSjk7PFH9NFkQ/SYeT1Ekpo2aH906KkY5k=";
this = self.postgresql_13;
thisAttr = "postgresql_13";
inherit self;
};
postgresql_14 = self.callPackage generic {
version = "14.3";
psqlSchema = "14";
sha256 = "sha256-J5BXNov1mpGcBa2o+VxeBKu0PnS5oqacPUaiDgeprzg=";
this = self.postgresql_14;
thisAttr = "postgresql_14";
inherit self;
};
}

View file

@ -0,0 +1,65 @@
{ lib, stdenv, fetchFromGitHub, bison, flex, postgresql }:
stdenv.mkDerivation rec {
pname = "age";
version = "0.6.0";
src = fetchFromGitHub {
owner = "apache";
repo = "incubator-age";
rev = "v${version}";
sha256 = "1cl6p9qz2yhgm603ljlyjdn0msk3hzga1frjqsmqmpp3nw4dbkka";
};
buildInputs = [ postgresql ];
makeFlags = [
"BISON=${bison}/bin/bison"
"FLEX=${flex}/bin/flex"
];
installPhase = ''
install -D -t $out/lib *.so
install -D -t $out/share/postgresql/extension *.sql
install -D -t $out/share/postgresql/extension *.control
'';
passthru.tests = stdenv.mkDerivation {
inherit version src;
pname = "age-regression";
dontConfigure = true;
buildPhase = let
postgresqlAge = postgresql.withPackages (ps: [ ps.age ]);
in ''
# The regression tests need to be run in the order specified in the Makefile.
echo -e "include Makefile\nfiles:\n\t@echo \$(REGRESS)" > Makefile.regress
REGRESS_TESTS=$(make -f Makefile.regress files)
${postgresql}/lib/pgxs/src/test/regress/pg_regress \
--inputdir=./ \
--bindir='${postgresqlAge}/bin' \
--encoding=UTF-8 \
--load-extension=age \
--inputdir=./regress --outputdir=./regress --temp-instance=./regress/instance \
--port=61958 --dbname=contrib_regression \
$REGRESS_TESTS
'';
installPhase = ''
touch $out
'';
};
meta = with lib; {
broken = true;
description = "A graph database extension for PostgreSQL";
homepage = "https://age.apache.org/";
changelog = "https://github.com/apache/incubator-age/releases/tag/v${version}";
maintainers = with maintainers; [ ];
platforms = postgresql.meta.platforms;
license = licenses.asl20;
};
}

View file

@ -0,0 +1,33 @@
{ lib, stdenv, fetchFromGitHub, postgresql, protobufc }:
stdenv.mkDerivation rec {
pname = "cstore_fdw";
version = "unstable-2022-03-08";
nativeBuildInputs = [ protobufc ];
buildInputs = [ postgresql ];
src = fetchFromGitHub {
owner = "citusdata";
repo = "cstore_fdw";
rev = "90e22b62fbee6852529104fdd463f532cf7a3311";
sha256 = "sha256-02wcCqs8A5ZOZX080fgcNJTQrYQctnlwnA8+YPaRTZc=";
};
installPhase = ''
mkdir -p $out/{lib,share/postgresql/extension}
cp *.so $out/lib
cp *.sql $out/share/postgresql/extension
cp *.control $out/share/postgresql/extension
'';
meta = with lib; {
broken = versionAtLeast postgresql.version "14";
description = "Columnar storage for PostgreSQL";
homepage = "https://github.com/citusdata/cstore_fdw";
maintainers = with maintainers; [ thoughtpolice ];
platforms = postgresql.meta.platforms;
license = licenses.asl20;
};
}

View file

@ -0,0 +1,31 @@
{ lib, stdenv, fetchFromGitHub, postgresql }:
stdenv.mkDerivation rec {
pname = "jsonb_deep_sum";
version = "unstable-2021-12-24";
src = fetchFromGitHub {
owner = "furstenheim";
repo = "jsonb_deep_sum";
rev = "d9c69aa6b7da860e5522a9426467e67cb787980c";
sha256 = "sha256-W1wNILAwTAjFPezq+grdRMA59KEnMZDz69n9xQUqdc0=";
};
buildInputs = [ postgresql ];
installPhase = ''
mkdir -p $out/{lib,share/postgresql/extension}
cp *.so $out/lib
cp *.sql $out/share/postgresql/extension
cp *.control $out/share/postgresql/extension
'';
meta = with lib; {
description = "PostgreSQL extension to easily add jsonb numeric";
homepage = "https://github.com/furstenheim/jsonb_deep_sum";
maintainers = with maintainers; [ _1000101 ];
platforms = postgresql.meta.platforms;
license = licenses.mit;
};
}

View file

@ -0,0 +1,30 @@
{ lib, stdenv, fetchFromGitHub, postgresql }:
stdenv.mkDerivation rec {
pname = "periods";
version = "1.2";
src = fetchFromGitHub {
owner = "xocolatl";
repo = pname;
rev = "v${version}";
sha256 = "13aix61qzlb7cs042dz4x0z4sc2xayg4nzi2cks46zibxm5i4gzm";
};
buildInputs = [ postgresql ];
installPhase = ''
install -D -t $out/lib *.so
install -D -t $out/share/postgresql/extension *.sql
install -D -t $out/share/postgresql/extension *.control
'';
meta = with lib; {
description = "PostgreSQL extension implementing SQL standard functionality for PERIODs and SYSTEM VERSIONING";
homepage = "https://github.com/xocolatl/periods";
maintainers = with maintainers; [ ivan ];
platforms = postgresql.meta.platforms;
license = licenses.postgresql;
broken = versionOlder postgresql.version "9.5";
};
}

View file

@ -0,0 +1,32 @@
{ lib, stdenv, fetchFromGitHub, postgresql, openssl, zlib, readline, libkrb5 }:
stdenv.mkDerivation rec {
pname = "pg_auto_failover";
version = "1.6.4";
src = fetchFromGitHub {
owner = "citusdata";
repo = pname;
rev = "v${version}";
sha256 = "sha256-MzMKVS86ymfRwZqTzJsdophRrIIPDp50Wpt7QkGA6Nc=";
};
buildInputs = [ postgresql openssl zlib readline libkrb5 ];
installPhase = ''
install -D -t $out/bin src/bin/pg_autoctl/pg_autoctl
install -D -t $out/lib src/monitor/pgautofailover.so
install -D -t $out/share/postgresql/extension src/monitor/*.sql
install -D -t $out/share/postgresql/extension src/monitor/pgautofailover.control
'';
meta = with lib; {
description = "PostgreSQL extension and service for automated failover and high-availability";
homepage = "https://github.com/citusdata/pg_auto_failover";
changelog = "https://github.com/citusdata/pg_auto_failover/raw/v${version}/CHANGELOG.md";
maintainers = [ maintainers.marsam ];
platforms = postgresql.meta.platforms;
license = licenses.postgresql;
broken = versionOlder postgresql.version "10";
};
}

View file

@ -0,0 +1,32 @@
{ lib, stdenv, fetchurl, postgresql }:
stdenv.mkDerivation rec {
pname = "pg_bigm";
version = "1.2-20200228";
src = fetchurl {
url = "mirror://osdn/pgbigm/72448/${pname}-${version}.tar.gz";
sha256 = "1hxn90prldwriqmqlf33ypgbxw5v54gkzx1305yzghryzfg7rhbl";
};
buildInputs = [ postgresql ];
makeFlags = [ "USE_PGXS=1" ];
installPhase = ''
mkdir -p $out/bin # For buildEnv to setup proper symlinks. See #22653
mkdir -p $out/{lib,share/postgresql/extension}
cp *.so $out/lib
cp *.sql $out/share/postgresql/extension
cp *.control $out/share/postgresql/extension
'';
meta = with lib; {
description = "Text similarity measurement and index searching based on bigrams";
homepage = "https://pgbigm.osdn.jp/";
maintainers = [ maintainers.marsam ];
platforms = postgresql.meta.platforms;
license = licenses.postgresql;
};
}

View file

@ -0,0 +1,32 @@
{ lib, stdenv, fetchFromGitHub, postgresql }:
stdenv.mkDerivation rec {
pname = "pg_cron";
version = "1.4.1";
buildInputs = [ postgresql ];
src = fetchFromGitHub {
owner = "citusdata";
repo = pname;
rev = "v${version}";
sha256 = "1fknr7z1m24dpp4hm5s6y5phdns7yvvj88cl481wjhw8bigz6kns";
};
installPhase = ''
mkdir -p $out/{lib,share/postgresql/extension}
cp *.so $out/lib
cp *.sql $out/share/postgresql/extension
cp *.control $out/share/postgresql/extension
'';
meta = with lib; {
description = "Run Cron jobs through PostgreSQL";
homepage = "https://github.com/citusdata/pg_cron";
changelog = "https://github.com/citusdata/pg_cron/raw/v${version}/CHANGELOG.md";
maintainers = with maintainers; [ thoughtpolice ];
platforms = postgresql.meta.platforms;
license = licenses.postgresql;
};
}

View file

@ -0,0 +1,32 @@
{ lib, stdenv, fetchFromGitLab, postgresql }:
stdenv.mkDerivation rec {
pname = "pg_ed25519";
version = "0.2";
src = fetchFromGitLab {
owner = "dwagin";
repo = "pg_ed25519";
rev = version;
sha256 = "16w3qx3wj81bzfhydl2pjhn8b1jak6h7ja9wq1kc626g0siggqi0";
};
buildInputs = [ postgresql ];
installPhase = ''
mkdir -p $out/bin # For buildEnv to setup proper symlinks. See #22653
mkdir -p $out/{lib,share/postgresql/extension}
cp *.so $out/lib
cp *.sql $out/share/postgresql/extension
cp *.control $out/share/postgresql/extension
'';
meta = with lib; {
description = "PostgreSQL extension for signing and verifying ed25519 signatures";
homepage = "https://gitlab.com/dwagin/pg_ed25519";
maintainers = [ maintainers.renzo ];
platforms = postgresql.meta.platforms;
license = licenses.mit;
};
}

View file

@ -0,0 +1,32 @@
{ lib, stdenv, fetchFromGitHub, postgresql }:
stdenv.mkDerivation rec {
pname = "pg_hll";
version = "2.16";
buildInputs = [ postgresql ];
src = fetchFromGitHub {
owner = "citusdata";
repo = "postgresql-hll";
rev = "refs/tags/v${version}";
sha256 = "0icns4m3dkm20fs6gznciwsb8ba8gcc316igz6j7qwjdnyg2ppbf";
};
installPhase = ''
mkdir -p $out/{lib,share/postgresql/extension}
cp *.so $out/lib
cp *.sql $out/share/postgresql/extension
cp *.control $out/share/postgresql/extension
'';
meta = with lib; {
description = "HyperLogLog for PostgreSQL";
homepage = "https://github.com/citusdata/postgresql-hll";
changelog = "https://github.com/citusdata/postgresql-hll/raw/v${version}/CHANGELOG.md";
maintainers = with maintainers; [ thoughtpolice ];
platforms = postgresql.meta.platforms;
license = licenses.asl20;
};
}

View file

@ -0,0 +1,32 @@
{ lib, stdenv, fetchFromGitHub, postgresql }:
stdenv.mkDerivation rec {
pname = "pg_partman";
version = "4.6.0";
buildInputs = [ postgresql ];
src = fetchFromGitHub {
owner = "pgpartman";
repo = pname;
rev = "refs/tags/v${version}";
sha256 = "sha256-DpK3D7PEZ1sO9bYvwwT9L8jtDmUGMbHtx2s9juzL6RQ=";
};
installPhase = ''
mkdir -p $out/{lib,share/postgresql/extension}
cp src/*.so $out/lib
cp updates/* $out/share/postgresql/extension
cp -r sql/* $out/share/postgresql/extension
cp *.control $out/share/postgresql/extension
'';
meta = with lib; {
description = "Partition management extension for PostgreSQL";
homepage = "https://github.com/pgpartman/pg_partman";
maintainers = with maintainers; [ ggpeti ];
platforms = postgresql.meta.platforms;
license = licenses.postgresql;
};
}

View file

@ -0,0 +1,39 @@
{ stdenv
, fetchFromGitHub
, lib
, postgresql
}:
stdenv.mkDerivation rec {
pname = "pg_rational";
version = "0.0.2";
src = fetchFromGitHub {
owner = "begriffs";
repo = "pg_rational";
rev = "v${version}";
sha256 = "sha256-Sp5wuX2nP3KGyWw7MFa11rI1CPIKIWBt8nvBSsASIEw=";
};
buildInputs = [ postgresql ];
installPhase = ''
runHook preInstall
mkdir -p $out/{lib,share/postgresql/extension}
cp *.so $out/lib
cp *.sql $out/share/postgresql/extension
cp *.control $out/share/postgresql/extension
runHook postInstall
'';
meta = with lib; {
description = "Precise fractional arithmetic for PostgreSQL";
homepage = "https://github.com/begriffs/pg_rational";
maintainers = with maintainers; [ netcrns ];
platforms = postgresql.meta.platforms;
license = licenses.mit;
};
}

View file

@ -0,0 +1,35 @@
{ lib, stdenv, fetchFromGitHub, postgresql, openssl, zlib, readline }:
stdenv.mkDerivation rec {
pname = "pg_repack";
version = "1.4.7";
buildInputs = [ postgresql openssl zlib readline ];
src = fetchFromGitHub {
owner = "reorg";
repo = "pg_repack";
rev = "refs/tags/ver_${version}";
sha256 = "12j8crgljvkm9dz790xcsr8l7sv8ydvb2imrb0jh1jvj0r9yg1v5";
};
installPhase = ''
install -D bin/pg_repack -t $out/bin/
install -D lib/pg_repack.so -t $out/lib/
install -D lib/{pg_repack--${version}.sql,pg_repack.control} -t $out/share/postgresql/extension
'';
meta = with lib; {
description = "Reorganize tables in PostgreSQL databases with minimal locks";
longDescription = ''
pg_repack is a PostgreSQL extension which lets you remove bloat from tables and indexes, and optionally restore
the physical order of clustered indexes. Unlike CLUSTER and VACUUM FULL it works online, without holding an
exclusive lock on the processed tables during processing. pg_repack is efficient to boot,
with performance comparable to using CLUSTER directly.
'';
license = licenses.bsd3;
maintainers = with maintainers; [ danbst ];
inherit (postgresql.meta) platforms;
inherit (src.meta) homepage;
};
}

View file

@ -0,0 +1,27 @@
{ lib, stdenv, fetchFromGitHub, postgresql }:
stdenv.mkDerivation rec {
pname = "pg-safeupdate";
version = "1.4";
buildInputs = [ postgresql ];
src = fetchFromGitHub {
owner = "eradman";
repo = pname;
rev = version;
sha256 = "sha256-1cyvVEC9MQGMr7Tg6EUbsVBrMc8ahdFS3+CmDkmAq4Y=";
};
installPhase = ''
mkdir -p $out/bin # for buildEnv, see https://github.com/NixOS/nixpkgs/issues/22653
install -D safeupdate.so -t $out/lib
'';
meta = with lib; {
description = "A simple extension to PostgreSQL that requires criteria for UPDATE and DELETE";
homepage = "https://github.com/eradman/pg-safeupdate";
platforms = postgresql.meta.platforms;
license = licenses.postgresql;
};
}

View file

@ -0,0 +1,32 @@
{ stdenv, lib, fetchFromGitHub, gcc, postgresql }:
stdenv.mkDerivation {
pname = "pg_similarity";
version = "1.0";
src = fetchFromGitHub {
owner = "eulerto";
repo = "pg_similarity";
rev = "be1a8b08c8716e59b89982557da9ea68cdf868c5";
sha256 = "1z4v4r2yccdr8kz3935fnk1bc5vj0qj0apscldyap4wxlyi89xim";
};
buildInputs = [ postgresql gcc ];
buildPhase = "USE_PGXS=1 make";
installPhase = ''
install -D pg_similarity.so -t $out/lib/
install -D ./{pg_similarity--unpackaged--1.0.sql,pg_similarity--1.0.sql,pg_similarity.control} -t $out/share/postgresql/extension
'';
meta = {
description = "An extension to support similarity queries on PostgreSQL";
longDescription = ''
pg_similarity is an extension to support similarity queries on PostgreSQL. The implementation
is tightly integrated in the RDBMS in the sense that it defines operators so instead of the traditional
operators (= and <>) you can use ~~~ and ~!~ (any of these operators represents a similarity function).
'';
platforms = postgresql.meta.platforms;
license = lib.licenses.gpl2;
maintainers = with lib.maintainers; [ danbst ];
};
}

View file

@ -0,0 +1,32 @@
{ lib, stdenv, fetchFromGitHub, postgresql }:
stdenv.mkDerivation rec {
pname = "pg_topn";
version = "2.4.0";
buildInputs = [ postgresql ];
src = fetchFromGitHub {
owner = "citusdata";
repo = "postgresql-topn";
rev = "refs/tags/v${version}";
sha256 = "1appxriw7h29kyhv3h6b338g5m2nz70q3mxasy4mjimqhbz1zyqs";
};
installPhase = ''
mkdir -p $out/{lib,share/postgresql/extension}
cp *.so $out/lib
cp *.sql $out/share/postgresql/extension
cp *.control $out/share/postgresql/extension
'';
meta = with lib; {
description = "Efficient querying of 'top values' for PostgreSQL";
homepage = "https://github.com/citusdata/postgresql-topn";
changelog = "https://github.com/citusdata/postgresql-topn/raw/v${version}/CHANGELOG.md";
maintainers = with maintainers; [ thoughtpolice ];
platforms = postgresql.meta.platforms;
license = licenses.agpl3Only;
};
}

View file

@ -0,0 +1,29 @@
{ lib, stdenv, fetchFromGitHub, postgresql }:
stdenv.mkDerivation {
pname = "pgjwt";
version = "unstable-2017-04-24";
src = fetchFromGitHub {
owner = "michelp";
repo = "pgjwt";
rev = "546a2911027b716586e241be7fd4c6f1785237cd";
sha256 = "1riz0xvwb6y02j0fljbr9hcbqb2jqs4njlivmavy9ysbcrrv1vrf";
};
dontBuild = true;
installPhase = ''
mkdir -p $out/share/postgresql/extension
cp pg*sql *.control $out/share/postgresql/extension
'';
meta = with lib; {
description = "PostgreSQL implementation of JSON Web Tokens";
longDescription = ''
sign() and verify() functions to create and verify JSON Web Tokens.
'';
license = licenses.mit;
platforms = postgresql.meta.platforms;
maintainers = with maintainers; [spinus];
};
}

View file

@ -0,0 +1,36 @@
{ lib, stdenv, fetchurl, pkg-config, postgresql, msgpack, groonga }:
stdenv.mkDerivation rec {
pname = "pgroonga";
version = "2.3.6";
src = fetchurl {
url = "https://packages.groonga.org/source/${pname}/${pname}-${version}.tar.gz";
sha256 = "sha256-/GimaiFuMEuw4u9if3Z//1KPT78rvaJ+jNjbG3ugkLA=";
};
nativeBuildInputs = [ pkg-config ];
buildInputs = [ postgresql msgpack groonga ];
makeFlags = [ "HAVE_MSGPACK=1" ];
installPhase = ''
install -D pgroonga.so -t $out/lib/
install -D pgroonga.control -t $out/share/postgresql/extension
install -D data/pgroonga-*.sql -t $out/share/postgresql/extension
'';
meta = with lib; {
description = "A PostgreSQL extension to use Groonga as the index";
longDescription = ''
PGroonga is a PostgreSQL extension to use Groonga as the index.
PostgreSQL supports full text search against languages that use only alphabet and digit.
It means that PostgreSQL doesn't support full text search against Japanese, Chinese and so on.
You can use super fast full text search feature against all languages by installing PGroonga into your PostgreSQL.
'';
homepage = "https://pgroonga.github.io/";
license = licenses.postgresql;
platforms = postgresql.meta.platforms;
maintainers = with maintainers; [ DerTim1 ];
};
}

View file

@ -0,0 +1,31 @@
{ lib, stdenv, fetchFromGitHub, postgresql, perl, cmake, boost }:
stdenv.mkDerivation rec {
pname = "pgrouting";
version = "3.3.0";
nativeBuildInputs = [ cmake perl ];
buildInputs = [ postgresql boost ];
src = fetchFromGitHub {
owner = "pgRouting";
repo = pname;
rev = "v${version}";
sha256 = "sha256-GWufuOsAYLIOy5MXYVNFWVeVdLntd5ZeUnSdEahlkak=";
};
installPhase = ''
install -D lib/*.so -t $out/lib
install -D sql/pgrouting--${version}.sql -t $out/share/postgresql/extension
install -D sql/common/pgrouting.control -t $out/share/postgresql/extension
'';
meta = with lib; {
description = "A PostgreSQL/PostGIS extension that provides geospatial routing functionality";
homepage = "https://pgrouting.org/";
changelog = "https://github.com/pgRouting/pgrouting/releases/tag/v${version}";
maintainers = [ maintainers.steve-chavez ];
platforms = postgresql.meta.platforms;
license = licenses.gpl2Plus;
};
}

View file

@ -0,0 +1,33 @@
{ lib, stdenv, fetchFromGitHub, postgresql, perl, perlPackages, which }:
stdenv.mkDerivation rec {
pname = "pgtap";
version = "1.2.0";
src = fetchFromGitHub {
owner = "theory";
repo = "pgtap";
rev = "v${version}";
sha256 = "sha256-lb0PRffwo6J5a6Hqw1ggvn0cW7gPZ02OEcLPi9ineI8=";
};
nativeBuildInputs = [ postgresql perl perlPackages.TAPParserSourceHandlerpgTAP which ];
installPhase = ''
install -D {sql/pgtap--${version}.sql,pgtap.control} -t $out/share/postgresql/extension
'';
meta = with lib; {
description = "A unit testing framework for PostgreSQL";
longDescription = ''
pgTAP is a unit testing framework for PostgreSQL written in PL/pgSQL and PL/SQL.
It includes a comprehensive collection of TAP-emitting assertion functions,
as well as the ability to integrate with other TAP-emitting test frameworks.
It can also be used in the xUnit testing style.
'';
maintainers = with maintainers; [ willibutz ];
homepage = "https://pgtap.org";
inherit (postgresql.meta) platforms;
license = licenses.mit;
};
}

View file

@ -0,0 +1,30 @@
{ lib, stdenv, fetchFromGitHub, postgresql }:
stdenv.mkDerivation rec {
pname = "pgvector";
version = "0.2.6";
src = fetchFromGitHub {
owner = "ankane";
repo = pname;
rev = "v${version}";
sha256 = "sha256-NmUI4pXwf6PHuLbkFy/hoA67j++A2Ju7zG/4og9U+qk=";
};
buildInputs = [ postgresql ];
installPhase = ''
install -D -t $out/lib vector.so
install -D -t $out/share/postgresql/extension sql/vector-*.sql
install -D -t $out/share/postgresql/extension vector.control
'';
meta = with lib; {
description = "Open-source vector similarity search for PostgreSQL";
homepage = "https://github.com/ankane/pgvector";
changelog = "https://github.com/ankane/pgvector/raw/v${version}/CHANGELOG.md";
license = licenses.postgresql;
platforms = postgresql.meta.platforms;
maintainers = [ maintainers.marsam ];
};
}

View file

@ -0,0 +1,39 @@
{ lib, stdenv, fetchFromGitHub, postgresql, zeromq, openssl, libsodium, libkrb5 }:
stdenv.mkDerivation rec {
pname = "pipelinedb";
version = "1.0.0-13";
src = fetchFromGitHub {
owner = "pipelinedb";
repo = pname;
rev = version;
sha256 = "1mnqpvx6g1r2n4kjrrx01vbdx7kvndfsbmm7zbzizjnjlyixz75f";
};
buildInputs = [ postgresql openssl zeromq libsodium libkrb5 ];
makeFlags = [ "USE_PGXS=1" ];
NIX_LDFLAGS = lib.optionalString stdenv.isDarwin "-lsodium";
preConfigure = ''
substituteInPlace Makefile \
--replace "/usr/lib/libzmq.a" "${zeromq}/lib/libzmq.a"
'';
installPhase = ''
mkdir -p $out/bin
install -D -t $out/lib/ pipelinedb.so
install -D -t $out/share/postgresql/extension {pipelinedb-*.sql,pipelinedb.control}
'';
meta = with lib; {
description = "High-performance time-series aggregation for PostgreSQL";
homepage = "https://www.pipelinedb.com/";
license = licenses.asl20;
platforms = postgresql.meta.platforms;
maintainers = [ maintainers.marsam ];
broken = versions.major postgresql.version != "11";
};
}

View file

@ -0,0 +1,29 @@
{ lib, stdenv, fetchFromGitHub, postgresql }:
stdenv.mkDerivation rec {
pname = "plpgsql_check";
version = "2.1.5";
src = fetchFromGitHub {
owner = "okbob";
repo = pname;
rev = "v${version}";
sha256 = "sha256-DYdZuHraecQZ33xHX6ugiUJVfFVAayD2spIQt2Qqa5U=";
};
buildInputs = [ postgresql ];
installPhase = ''
install -D -t $out/lib *.so
install -D -t $out/share/postgresql/extension *.sql
install -D -t $out/share/postgresql/extension *.control
'';
meta = with lib; {
description = "Linter tool for language PL/pgSQL";
homepage = "https://github.com/okbob/plpgsql_check";
platforms = postgresql.meta.platforms;
license = licenses.mit;
maintainers = [ maintainers.marsam ];
};
}

View file

@ -0,0 +1,31 @@
{ lib, stdenv, fetchFromGitHub, pkg-config, R, postgresql }:
stdenv.mkDerivation rec {
pname = "plr";
version = "8.4.5";
src = fetchFromGitHub {
owner = "postgres-plr";
repo = "plr";
rev = "REL${builtins.replaceStrings ["."] ["_"] version}";
sha256 = "sha256-G/V3I1JI6dWto/hK6lfOTBYEvbmkovvnvk2TwSQq4no=";
};
nativeBuildInputs = [ pkg-config ];
buildInputs = [ R postgresql ];
preBuild = ''
export USE_PGXS=1
'';
installPhase = ''
install -D plr.so -t $out/lib/
install -D {plr--*.sql,plr.control} -t $out/share/postgresql/extension
'';
meta = with lib; {
description = "PL/R - R Procedural Language for PostgreSQL";
homepage = "https://github.com/postgres-plr/plr";
maintainers = with maintainers; [ qoelet ];
platforms = postgresql.meta.platforms;
license = licenses.gpl2Only;
};
}

View file

@ -0,0 +1,87 @@
{ lib, stdenv, fetchFromGitHub, v8, perl, postgresql
# For test
, runCommand, coreutils, gnugrep }:
let self = stdenv.mkDerivation rec {
pname = "plv8";
version = "3.0.0";
nativeBuildInputs = [ perl ];
buildInputs = [ v8 postgresql ];
src = fetchFromGitHub {
owner = "plv8";
repo = "plv8";
rev = "v${version}";
sha256 = "KJz8wnGcTXnVn6umpP+UquuJTtQrkBTJ33rB/JIH4kU=";
};
makefile = "Makefile.shared";
buildFlags = [ "all" ];
makeFlags = [
# Nixpkgs build a v8 monolith instead of separate v8_libplatform.
"V8_OUTDIR=${v8}/lib"
];
installFlags = [
# PGXS only supports installing to postgresql prefix so we need to redirect this
"DESTDIR=${placeholder "out"}"
];
preConfigure = ''
# We build V8 as a monolith, so this is unnecessary.
substituteInPlace Makefile.shared --replace "-lv8_libplatform" ""
patchShebangs ./generate_upgrade.sh
substituteInPlace generate_upgrade.sh \
--replace " 2.3.10)" " 2.3.10 2.3.11 2.3.12 2.3.13 2.3.14 2.3.15)"
'';
postInstall = ''
# Move the redirected to proper directory.
# There appear to be no references to the install directories
# so changing them does not cause issues.
mv "$out/nix/store"/*/* "$out"
rmdir "$out/nix/store"/* "$out/nix/store" "$out/nix"
'';
NIX_CFLAGS_COMPILE = [
# V8 depends on C++14.
"-std=c++14"
# Without this, PostgreSQL will crash at runtime.
# The flags are only included in Makefile, not Makefile.shared.
# https://github.com/plv8/plv8/pull/469
"-DJSONB_DIRECT_CONVERSION" "-DV8_COMPRESS_POINTERS=1" "-DV8_31BIT_SMIS_ON_64BIT_ARCH=1"
];
passthru.tests.smoke = runCommand "${pname}-test" {} ''
export PATH=${lib.makeBinPath [ (postgresql.withPackages (_: [self])) coreutils gnugrep ]}
db="$PWD/testdb"
initdb "$db"
postgres -k "$db" -D "$db" &
pid="$!"
for i in $(seq 1 100); do
if psql -h "$db" -d postgres -c "" 2>/dev/null; then
break
elif ! kill -0 "$pid"; then
exit 1
else
sleep 0.1
fi
done
psql -h "$db" -d postgres -c 'CREATE EXTENSION plv8; DO $$ plv8.elog(NOTICE, plv8.version); $$ LANGUAGE plv8;' 2> "$out"
grep -q "${version}" "$out"
kill -0 "$pid"
'';
meta = with lib; {
description = "V8 Engine Javascript Procedural Language add-on for PostgreSQL";
homepage = "https://plv8.github.io/";
maintainers = with maintainers; [ volth marsam ];
platforms = [ "x86_64-linux" ];
license = licenses.postgresql;
};
}; in self

View file

@ -0,0 +1,79 @@
{ fetchurl
, lib, stdenv
, perl
, libxml2
, postgresql
, geos
, proj
, gdal
, json_c
, pkg-config
, file
, protobufc
, libiconv
, nixosTests
}:
stdenv.mkDerivation rec {
pname = "postgis";
version = "3.2.1";
outputs = [ "out" "doc" ];
src = fetchurl {
url = "https://download.osgeo.org/postgis/source/postgis-${version}.tar.gz";
sha256 = "sha256-+6to3ebKOTSyS6CMirDP8llPV/k96rQaFcgq4btpiT4=";
};
buildInputs = [ libxml2 postgresql geos proj gdal json_c protobufc ]
++ lib.optional stdenv.isDarwin libiconv;
nativeBuildInputs = [ perl pkg-config ];
dontDisableStatic = true;
# postgis config directory assumes /include /lib from the same root for json-c library
NIX_LDFLAGS = "-L${lib.getLib json_c}/lib";
preConfigure = ''
sed -i 's@/usr/bin/file@${file}/bin/file@' configure
configureFlags="--datadir=$out/share/postgresql --datarootdir=$out/share/postgresql --bindir=$out/bin --with-gdalconfig=${gdal}/bin/gdal-config --with-jsondir=${json_c.dev}"
makeFlags="PERL=${perl}/bin/perl datadir=$out/share/postgresql pkglibdir=$out/lib bindir=$out/bin"
'';
postConfigure = ''
sed -i "s|@mkdir -p \$(DESTDIR)\$(PGSQL_BINDIR)||g ;
s|\$(DESTDIR)\$(PGSQL_BINDIR)|$prefix/bin|g
" \
"raster/loader/Makefile";
sed -i "s|\$(DESTDIR)\$(PGSQL_BINDIR)|$prefix/bin|g
" \
"raster/scripts/python/Makefile";
mkdir -p $out/bin
# postgis' build system assumes it is being installed to the same place as postgresql, and looks
# for the postgres binary relative to $PREFIX. We gently support this system using an illusion.
ln -s ${postgresql}/bin/postgres $out/bin/postgres
'';
# create aliases for all commands adding version information
postInstall = ''
# Teardown the illusory postgres used for building; see postConfigure.
rm $out/bin/postgres
for prog in $out/bin/*; do # */
ln -s $prog $prog-${version}
done
mkdir -p $doc/share/doc/postgis
mv doc/* $doc/share/doc/postgis/
'';
passthru.tests.postgis = nixosTests.postgis;
meta = with lib; {
description = "Geographic Objects for PostgreSQL";
homepage = "https://postgis.net/";
changelog = "https://git.osgeo.org/gitea/postgis/postgis/raw/tag/${version}/NEWS";
license = licenses.gpl2;
maintainers = [ maintainers.marcweber ];
inherit (postgresql.meta) platforms;
};
}

View file

@ -0,0 +1,40 @@
{ lib, stdenv, fetchFromGitHub
, postgresql
, openssl
, zlib
, readline
, flex
}:
stdenv.mkDerivation rec {
pname = "repmgr";
version = "5.3.1";
src = fetchFromGitHub {
owner = "2ndQuadrant";
repo = "repmgr";
rev = "v${version}";
sha256 = "sha256-fHoXbFOF3xj/eNHgQIghF15vbDObnuwl2DAH+zRVGZQ=";
};
nativeBuildInputs = [ flex ];
buildInputs = [ postgresql openssl zlib readline ];
installPhase = ''
mkdir -p $out/{bin,lib,share/postgresql/extension}
cp repmgr{,d} $out/bin
cp *.so $out/lib
cp *.sql $out/share/postgresql/extension
cp *.control $out/share/postgresql/extension
'';
meta = with lib; {
homepage = "https://repmgr.org/";
description = "Replication manager for PostgreSQL cluster";
license = licenses.postgresql;
platforms = postgresql.meta.platforms;
maintainers = with maintainers; [ zimbatm ];
};
}

View file

@ -0,0 +1,31 @@
{ lib, stdenv, fetchFromGitHub, postgresql }:
stdenv.mkDerivation rec {
pname = "rum";
version = "1.3.11";
src = fetchFromGitHub {
owner = "postgrespro";
repo = "rum";
rev = version;
sha256 = "sha256-OuVyZ30loPycQkDwlL0289H/4RRPneibqgibgzqhWo4=";
};
buildInputs = [ postgresql ];
makeFlags = [ "USE_PGXS=1" ];
installPhase = ''
install -D -t $out/lib *.so
install -D -t $out/share/postgresql/extension *.control
install -D -t $out/share/postgresql/extension *.sql
'';
meta = with lib; {
description = "Full text search index method for PostgreSQL";
homepage = "https://github.com/postgrespro/rum";
license = licenses.postgresql;
platforms = postgresql.meta.platforms;
maintainers = with maintainers; [ DeeUnderscore ];
};
}

View file

@ -0,0 +1,30 @@
{ lib, stdenv, fetchgit, postgresql }:
stdenv.mkDerivation rec {
pname = "smlar-unstable";
version = "2020-10-07";
src = fetchgit {
url = "git://sigaev.ru/smlar.git";
rev = "25a4fef344f5c2b90e6a9d32144ee12b9198487d";
sha256 = "14mj63mbkcphrzw6890pb5n8igh27i9g7kh4wjdhgx3g7llbjbdw";
};
buildInputs = [ postgresql ];
makeFlags = [ "USE_PGXS=1" ];
installPhase = ''
install -D -t $out/lib *.so
install -D -t $out/share/postgresql/extension *.sql
install -D -t $out/share/postgresql/extension *.control
'';
meta = with lib; {
description = "Compute similary of any one-dimensional arrays";
homepage = "http://sigaev.ru/git/gitweb.cgi?p=smlar.git";
platforms = postgresql.meta.platforms;
license = licenses.bsd2;
maintainers = [ maintainers.marsam ];
};
}

View file

@ -0,0 +1,31 @@
{ lib, stdenv, fetchFromGitHub, postgresql, freetds }:
stdenv.mkDerivation rec {
pname = "tds_fdw";
# Move to stable version when it's released.
version = "unstable-2021-12-14";
buildInputs = [ postgresql freetds ];
src = fetchFromGitHub {
owner = "tds-fdw";
repo = pname;
rev = "1611a2805f85d84f463ae50c4e0765cb9bed72dc";
sha256 = "sha256-SYHo/o9fJjB1yzN4vLJB0RrF3HEJ4MzmEO44/Jih/20=";
};
installPhase = ''
version="$(sed -En "s,^default_version *= *'([^']*)'.*,\1,p" tds_fdw.control)"
install -D tds_fdw.so -t $out/lib
install -D sql/tds_fdw.sql "$out/share/postgresql/extension/tds_fdw--$version.sql"
install -D tds_fdw.control -t $out/share/postgresql/extension
'';
meta = with lib; {
description = "A PostgreSQL foreign data wrapper to connect to TDS databases (Sybase and Microsoft SQL Server)";
homepage = "https://github.com/tds-fdw/tds_fdw";
maintainers = [ maintainers.steve-chavez ];
platforms = postgresql.meta.platforms;
license = licenses.postgresql;
};
}

View file

@ -0,0 +1,32 @@
{ lib, stdenv, fetchFromGitHub, postgresql }:
stdenv.mkDerivation rec {
pname = "temporal_tables";
version = "1.2.0";
buildInputs = [ postgresql ];
src = fetchFromGitHub {
owner = "mlt";
repo = pname;
rev = "6cc86eb03d618d6b9fc09ae523f1a1e5228d22b5";
sha256 = "0ykv37rm511n5955mbh9dcp7pgg88z1nwgszav7z6pziaj3nba8x";
};
installPhase = ''
mkdir -p $out/{lib,share/postgresql/extension}
cp *.so $out/lib
cp *.sql $out/share/postgresql/extension
cp *.control $out/share/postgresql/extension
'';
meta = with lib; {
broken = stdenv.isDarwin;
description = "Temporal Tables PostgreSQL Extension ";
homepage = "https://github.com/mlt/temporal_tables";
maintainers = with maintainers; [ ggpeti ];
platforms = postgresql.meta.platforms;
license = licenses.bsd2;
};
}

View file

@ -0,0 +1,49 @@
{ lib, stdenv, fetchFromGitHub, cmake, postgresql, openssl, libkrb5 }:
# # To enable on NixOS:
# config.services.postgresql = {
# extraPlugins = [ pkgs.timescaledb ];
# extraConfig = "shared_preload_libraries = 'timescaledb'";
# }
stdenv.mkDerivation rec {
pname = "timescaledb";
version = "2.7.0";
nativeBuildInputs = [ cmake ];
buildInputs = [ postgresql openssl libkrb5 ];
src = fetchFromGitHub {
owner = "timescale";
repo = "timescaledb";
rev = version;
sha256 = "sha256-h9mDa4dfr7ksIqd6OZg6L3jyiwPL+fmJJzoXFZH8mqM=";
};
cmakeFlags = [ "-DSEND_TELEMETRY_DEFAULT=OFF" "-DREGRESS_CHECKS=OFF" "-DTAP_CHECKS=OFF" ]
++ lib.optionals stdenv.isDarwin [ "-DLINTER=OFF" ];
# Fix the install phase which tries to install into the pgsql extension dir,
# and cannot be manually overridden. This is rather fragile but works OK.
postPatch = ''
for x in CMakeLists.txt sql/CMakeLists.txt; do
substituteInPlace "$x" \
--replace 'DESTINATION "''${PG_SHAREDIR}/extension"' "DESTINATION \"$out/share/postgresql/extension\""
done
for x in src/CMakeLists.txt src/loader/CMakeLists.txt tsl/src/CMakeLists.txt; do
substituteInPlace "$x" \
--replace 'DESTINATION ''${PG_PKGLIBDIR}' "DESTINATION \"$out/lib\""
done
'';
meta = with lib; {
description = "Scales PostgreSQL for time-series data via automatic partitioning across time and space";
homepage = "https://www.timescale.com/";
changelog = "https://github.com/timescale/timescaledb/raw/${version}/CHANGELOG.md";
maintainers = with maintainers; [ volth marsam ];
platforms = postgresql.meta.platforms;
license = licenses.asl20;
broken = versionOlder postgresql.version "12";
};
}

View file

@ -0,0 +1,29 @@
{ lib, stdenv, fetchFromGitHub, pkg-config, postgresql }:
stdenv.mkDerivation {
pname = "tsearch-extras";
version = "0.4";
src = fetchFromGitHub {
owner = "zulip";
repo = "tsearch_extras";
rev = "84e78f00931c4ef261d98197d6b5d94fc141f742"; # no release tag?
sha256 = "18j0saqblg3jhrz38splk173xjwdf32c67ymm18m8n5y94h8d2ba";
};
nativenativeBuildInputs = [ pkg-config ];
buildInputs = [ postgresql ];
installPhase = ''
install -D tsearch_extras.so -t $out/lib/
install -D ./{tsearch_extras--1.0.sql,tsearch_extras.control} -t $out/share/postgresql/extension
'';
meta = with lib; {
description = "Provides a few PostgreSQL functions for a lower-level data full text search";
homepage = "https://github.com/zulip/tsearch_extras/";
license = licenses.postgresql;
platforms = postgresql.meta.platforms;
maintainers = with maintainers; [ DerTim1 ];
};
}

View file

@ -0,0 +1,31 @@
{ lib, stdenv, fetchFromGitHub, bison, flex, postgresql }:
stdenv.mkDerivation rec {
pname = "wal2json";
version = "2.4";
src = fetchFromGitHub {
owner = "eulerto";
repo = "wal2json";
rev = "wal2json_${builtins.replaceStrings ["."] ["_"] version}";
sha256 = "sha256-EB+tCaILWsU9fDhqosl6EyMoYBd6SHISFfyxiZ9pNOk=";
};
buildInputs = [ postgresql ];
makeFlags = [ "USE_PGXS=1" ];
installPhase = ''
install -D -t $out/lib *.so
install -D -t $out/share/postgresql/extension sql/*.sql
'';
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}";
maintainers = with maintainers; [ euank ];
platforms = postgresql.meta.platforms;
license = licenses.bsd3;
};
}

View file

@ -0,0 +1,70 @@
self: super: {
age = super.callPackage ./ext/age.nix { };
jsonb_deep_sum = super.callPackage ./ext/jsonb_deep_sum.nix { };
periods = super.callPackage ./ext/periods.nix { };
postgis = super.callPackage ./ext/postgis.nix { };
pg_auto_failover = super.callPackage ./ext/pg_auto_failover.nix { };
pg_bigm = super.callPackage ./ext/pg_bigm.nix { };
pg_ed25519 = super.callPackage ./ext/pg_ed25519.nix { };
pg_rational = super.callPackage ./ext/pg_rational.nix { };
pg_repack = super.callPackage ./ext/pg_repack.nix { };
pg_similarity = super.callPackage ./ext/pg_similarity.nix { };
pgroonga = super.callPackage ./ext/pgroonga.nix { };
pgvector = super.callPackage ./ext/pgvector.nix { };
plpgsql_check = super.callPackage ./ext/plpgsql_check.nix { };
plr = super.callPackage ./ext/plr.nix { };
plv8 = super.callPackage ./ext/plv8.nix {
v8 = self.v8_8_x;
};
pgjwt = super.callPackage ./ext/pgjwt.nix { };
cstore_fdw = super.callPackage ./ext/cstore_fdw.nix { };
pg_hll = super.callPackage ./ext/pg_hll.nix { };
pg_cron = super.callPackage ./ext/pg_cron.nix { };
pg_topn = super.callPackage ./ext/pg_topn.nix { };
pgtap = super.callPackage ./ext/pgtap.nix { };
pipelinedb = super.callPackage ./ext/pipelinedb.nix { };
smlar = super.callPackage ./ext/smlar.nix { };
temporal_tables = super.callPackage ./ext/temporal_tables.nix { };
timescaledb = super.callPackage ./ext/timescaledb.nix { };
tsearch_extras = super.callPackage ./ext/tsearch_extras.nix { };
tds_fdw = super.callPackage ./ext/tds_fdw.nix { };
pgrouting = super.callPackage ./ext/pgrouting.nix { };
pg_partman = super.callPackage ./ext/pg_partman.nix { };
pg_safeupdate = super.callPackage ./ext/pg_safeupdate.nix { };
repmgr = super.callPackage ./ext/repmgr.nix { };
rum = super.callPackage ./ext/rum.nix { };
wal2json = super.callPackage ./ext/wal2json.nix { };
}

View file

@ -0,0 +1,12 @@
--- a/src/common/exec.c 2014-09-04 20:19:12.236057588 +0200
+++ b/src/common/exec.c 2014-09-04 20:19:50.550251633 +0200
@@ -218,6 +218,9 @@
static int
resolve_symlinks(char *path)
{
+ // On NixOS we *want* stuff relative to symlinks.
+ return 0;
+
#ifdef HAVE_READLINK
struct stat buf;
char orig_wd[MAXPGPATH],

View file

@ -0,0 +1,14 @@
diff --git a/src/port/exec.c b/src/port/exec.c
index c79e8ba..42c4091 100644
--- a/src/port/exec.c
+++ b/src/port/exec.c
@@ -216,6 +216,9 @@ find_my_exec(const char *argv0, char *retpath)
static int
resolve_symlinks(char *path)
{
+ // On NixOS we *want* stuff relative to symlinks.
+ return 0;
+
#ifdef HAVE_READLINK
struct stat buf;
char orig_wd[MAXPGPATH],

View file

@ -0,0 +1,59 @@
From: Matthew Bauer <mjbauer95@gmail.com>
Date: Wed, 29 May 2019 22:51:52 -0400
Subject: [PATCH] Add /postgresql suffix for Nix outputs
Nix outputs put the `name' in each store path like
/nix/store/...-<name>. This was confusing the Postgres make script
because it thought its data directory already had postgresql in its
directory. This lead to Postgres installing all of its fils in
$out/share. To fix this, we just look for postgres or psql in the part
after the / using make's notdir.
---
From: Matthew Bauer <mjbauer95@gmail.com>
Date: Wed, 29 May 2019 22:51:52 -0400
Subject: [PATCH] Add /postgresql suffix for Nix outputs
Nix outputs put the `name' in each store path like
/nix/store/...-<name>. This was confusing the Postgres make script
because it thought its data directory already had postgresql in its
directory. This lead to Postgres installing all of its fils in
$out/share. To fix this, we just look for postgres or psql in the part
after the / using make's notdir.
---
diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index b9d86acaa9..bce05464c3 100644
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -102,15 +102,15 @@ datarootdir := @datarootdir@
bindir := @bindir@
datadir := @datadir@
-ifeq "$(findstring pgsql, $(datadir))" ""
-ifeq "$(findstring postgres, $(datadir))" ""
+ifeq "$(findstring pgsql, $(notdir $(datadir)))" ""
+ifeq "$(findstring postgres, $(notdir $(datadir)))" ""
override datadir := $(datadir)/postgresql
endif
endif
sysconfdir := @sysconfdir@
-ifeq "$(findstring pgsql, $(sysconfdir))" ""
-ifeq "$(findstring postgres, $(sysconfdir))" ""
+ifeq "$(findstring pgsql, $(notdir $(sysconfdir)))" ""
+ifeq "$(findstring postgres, $(notdir $(sysconfdir)))" ""
override sysconfdir := $(sysconfdir)/postgresql
endif
endif
@@ -136,8 +136,8 @@ endif
mandir := @mandir@
docdir := @docdir@
-ifeq "$(findstring pgsql, $(docdir))" ""
-ifeq "$(findstring postgres, $(docdir))" ""
+ifeq "$(findstring pgsql, $(notdir $(docdir)))" ""
+ifeq "$(findstring postgres, $(notdir $(docdir)))" ""
override docdir := $(docdir)/postgresql
endif
endif

View file

@ -0,0 +1,14 @@
diff -Naur postgresql-9.6.1-orig/src/common/config_info.c postgresql-9.6.1/src/common/config_info.c
--- postgresql-9.6.1-orig/src/common/config_info.c 2016-11-22 21:39:29.231929261 +0100
+++ postgresql-9.6.1/src/common/config_info.c 2016-11-22 23:36:53.685163543 +0100
@@ -118,7 +118,10 @@
i++;
configdata[i].name = pstrdup("PGXS");
+ strlcpy(path, "HARDCODED_PGXS_PATH", sizeof(path));
+/* commented out to be able to point to nix $out path
get_pkglib_path(my_exec_path, path);
+*/
strlcat(path, "/pgxs/src/makefiles/pgxs.mk", sizeof(path));
cleanup_path(path);
configdata[i].setting = pstrdup(path);

View file

@ -0,0 +1,17 @@
--- a/src/bin/pg_config/pg_config.c
+++ b/src/bin/pg_config/pg_config.c
@@ -220,11 +220,13 @@ show_sysconfdir(bool all)
static void
show_pgxs(bool all)
{
- char path[MAXPGPATH];
+ char path[MAXPGPATH] = "HARDCODED_PGXS_PATH";
if (all)
printf("PGXS = ");
+ /* commented out to be able to point to nix $out path
get_pkglib_path(mypath, path);
+ */
strlcat(path, "/pgxs/src/makefiles/pgxs.mk", sizeof(path));
cleanup_path(path);
printf("%s\n", path);

View file

@ -0,0 +1,12 @@
diff -Naur postgresql-9.6.1-orig/src/include/fe_utils/print.h postgresql-9.6.1/src/include/fe_utils/print.h
--- postgresql-9.6.1-orig/src/include/fe_utils/print.h 2016-11-22 21:39:29.148932827 +0100
+++ postgresql-9.6.1/src/include/fe_utils/print.h 2016-11-22 21:39:36.283626258 +0100
@@ -18,7 +18,7 @@
/* This is not a particularly great place for this ... */
#ifndef __CYGWIN__
-#define DEFAULT_PAGER "more"
+#define DEFAULT_PAGER "less"
#else
#define DEFAULT_PAGER "less"
#endif

View file

@ -0,0 +1,12 @@
diff -Naur postgresql-9.2.7-orig/src/bin/psql/print.h postgresql-9.2.7/src/bin/psql/print.h
--- postgresql-9.2.7-orig/src/bin/psql/print.h 2014-02-17 14:38:15.000000000 -0500
+++ postgresql-9.2.7/src/bin/psql/print.h 2014-03-04 14:42:28.874014415 -0500
@@ -178,7 +178,7 @@
extern const printTextFormat *get_line_style(const printTableOpt *opt);
#ifndef __CYGWIN__
-#define DEFAULT_PAGER "more"
+#define DEFAULT_PAGER "less"
#else
#define DEFAULT_PAGER "less"
#endif

View file

@ -0,0 +1,13 @@
diff --git i/src/include/pg_config_manual.h w/src/include/pg_config_manual.h
index 8f3ec6bde1..4fc01e4a0a 100644
--- i/src/include/pg_config_manual.h
+++ w/src/include/pg_config_manual.h
@@ -201,7 +201,7 @@
* support them yet.
*/
#ifndef WIN32
-#define DEFAULT_PGSOCKET_DIR "/tmp"
+#define DEFAULT_PGSOCKET_DIR "/run/postgresql"
#else
#define DEFAULT_PGSOCKET_DIR ""
#endif

View file

@ -0,0 +1,13 @@
diff --git a/src/include/pg_config_manual.h b/src/include/pg_config_manual.h
index 743401cb96..be5c5f61d2 100644
--- a/src/include/pg_config_manual.h
+++ b/src/include/pg_config_manual.h
@@ -179,7 +179,7 @@
* here's where to twiddle it. You can also override this at runtime
* with the postmaster's -k switch.
*/
-#define DEFAULT_PGSOCKET_DIR "/tmp"
+#define DEFAULT_PGSOCKET_DIR "/run/postgresql"
/*
* This is the default event source for Windows event log.

View file

@ -0,0 +1,29 @@
diff -ur postgresql-9.5.3-orig/src/port/path.c postgresql-9.5.3/src/port/path.c
--- postgresql-9.5.3-orig/src/port/path.c 2016-05-09 22:50:23.000000000 +0200
+++ postgresql-9.5.3/src/port/path.c 2016-08-29 22:44:10.507377613 +0200
@@ -714,7 +714,11 @@
void
get_lib_path(const char *my_exec_path, char *ret_path)
{
- make_relative_path(ret_path, LIBDIR, PGBINDIR, my_exec_path);
+ char const * const nix_pglibdir = getenv("NIX_PGLIBDIR");
+ if(nix_pglibdir == NULL)
+ make_relative_path(ret_path, LIBDIR, PGBINDIR, my_exec_path);
+ else
+ make_relative_path(ret_path, nix_pglibdir, PGBINDIR, my_exec_path);
}
/*
@@ -723,7 +727,11 @@
void
get_pkglib_path(const char *my_exec_path, char *ret_path)
{
- make_relative_path(ret_path, PKGLIBDIR, PGBINDIR, my_exec_path);
+ char const * const nix_pglibdir = getenv("NIX_PGLIBDIR");
+ if(nix_pglibdir == NULL)
+ make_relative_path(ret_path, PKGLIBDIR, PGBINDIR, my_exec_path);
+ else
+ make_relative_path(ret_path, nix_pglibdir, PGBINDIR, my_exec_path);
}
/*