Fixes https://github.com/PostgREST/postgrest/issues/1512 Helps on environments where you can't send unix signals(Windows, managed containers). Also provides better UX for schema reloads - NOTIFY can be sent from pg clients(psql, pgadmin). `NOTIFY pgrst` - with no payload - should be done to reload the schema cache. Notifications with a payload will be ignored. The channel can be enabled with `db-channel-enabled`(false by default) and its name can be configured with `db-channel`. The LISTEN thread uses a dedicated pg connection. This connection is recovered if it fails. A debounce of 1ms is done in case too many NOTIFYs arrive.
38 lines
1.1 KiB
Nix
38 lines
1.1 KiB
Nix
{ runCommand }:
|
|
|
|
{
|
|
applyPatches =
|
|
name: src: patches:
|
|
runCommand
|
|
name
|
|
{ inherit src patches; }
|
|
''
|
|
set -eou pipefail
|
|
|
|
cp -r $src $out
|
|
chmod -R u+w $out
|
|
|
|
for patch in $patches; do
|
|
echo "Applying patch $patch"
|
|
patch -d "$out" -p1 < "$patch"
|
|
done
|
|
'';
|
|
|
|
# Patch is required for static builds on GHC 8.8.3, see:
|
|
# https://github.com/NixOS/nixpkgs/issues/85924
|
|
nixpkgs-revert-ghc-bootstrap =
|
|
./nixpkgs-revert-ghc-bootstrap.patch;
|
|
|
|
# See: https://github.com/NixOS/nixpkgs/pull/87879
|
|
nixpkgs-openssl-split-runtime-dependencies-of-static-builds =
|
|
./nixpkgs-openssl-split-runtime-dependencies-of-static-builds.patch;
|
|
|
|
# Fix how openssl is linked on static builds, see:
|
|
# https://github.com/nh2/static-haskell-nix/pull/91
|
|
static-haskell-nix-postgrest-openssl-linking-fix =
|
|
./static-haskell-nix-postgrest-openssl-linking-fix.patch;
|
|
|
|
static-haskell-nix-hasql-notifications-openssl-linking-fix =
|
|
./static-haskell-nix-hasql-notifications-openssl-linking-fix.patch;
|
|
}
|