From 5449a0ea741becd0643ad507695e51baf4942d21 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Sun, 23 Mar 2025 15:14:09 +0100 Subject: [PATCH 1/2] doc/release-notes: fix spelling mistake --- doc/release-notes/rl-2505.section.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/release-notes/rl-2505.section.md b/doc/release-notes/rl-2505.section.md index 5d4a789498d0..b9e6cebc3c11 100644 --- a/doc/release-notes/rl-2505.section.md +++ b/doc/release-notes/rl-2505.section.md @@ -11,7 +11,7 @@ - `squid` has been updated to version 7, this release includes multiple breaking changes, like ESI removal. For more information, [check the release notes](https://github.com/squid-cache/squid/releases/tag/SQUID_7_0_1). -- `postgresql` and `libpq` don't provide `pg_config` by default anymore. Instead, `pg_config` is available via `postgresql.pg_config` or `libpq.pg_config`. This allowed implementing it as a shell script, which can be build for both the build and host systems when cross-compiling. If your build fails to find `pg_config`, add `postgresql.pg_config` or `libpq.pg_config` to `nativeBuildInputs`. +- `postgresql` and `libpq` don't provide `pg_config` by default anymore. Instead, `pg_config` is available via `postgresql.pg_config` or `libpq.pg_config`. This allowed implementing it as a shell script, which can be built for both the build and host systems when cross-compiling. If your build fails to find `pg_config`, add `postgresql.pg_config` or `libpq.pg_config` to `nativeBuildInputs`. - The [`no-broken-symlinks` hook](https://nixos.org/manual/nixpkgs/unstable/#no-broken-symlinks.sh) was added to catch builds containing dangling or reflexive symlinks, as these are indicative of problems with packaging. The hook can be disabled by providing `dontCheckForBrokenSymlinks = true;` as an argument to `mkDerivation`. From 6db5dcc01347a404ba53316fa48aa1bb30069f43 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Sun, 23 Mar 2025 16:24:51 +0100 Subject: [PATCH 2/2] postgresql.pg_config: add check to confirm output is correct This is only tested on native builds against the output of the original pg_config, which should be enough. --- pkgs/servers/sql/postgresql/generic.nix | 8 +++++++- pkgs/servers/sql/postgresql/pg_config.nix | 10 ++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/pkgs/servers/sql/postgresql/generic.nix b/pkgs/servers/sql/postgresql/generic.nix index 906d3094c399..15a85c2a9960 100644 --- a/pkgs/servers/sql/postgresql/generic.nix +++ b/pkgs/servers/sql/postgresql/generic.nix @@ -366,6 +366,7 @@ let postPatch = '' substituteInPlace "src/Makefile.global.in" --subst-var out + substituteInPlace "src/common/config_info.c" --subst-var dev cat ${./pg_config.env.mk} >> src/common/Makefile ''; @@ -373,7 +374,12 @@ let '' moveToOutput "bin/ecpg" "$dev" moveToOutput "lib/pgxs" "$dev" - + '' + + lib.optionalString (stdenv'.buildPlatform.canExecute stdenv'.hostPlatform) '' + mkdir -p "$dev/nix-support" + "$out/bin/pg_config" > "$dev/nix-support/pg_config.expected" + '' + + '' rm "$out/bin/pg_config" make -C src/common pg_config.env install -D src/common/pg_config.env "$dev/nix-support/pg_config.env" diff --git a/pkgs/servers/sql/postgresql/pg_config.nix b/pkgs/servers/sql/postgresql/pg_config.nix index 04b71f6935af..20544cdb0614 100644 --- a/pkgs/servers/sql/postgresql/pg_config.nix +++ b/pkgs/servers/sql/postgresql/pg_config.nix @@ -1,7 +1,9 @@ { + diffutils, lib, replaceVarsWith, runtimeShell, + stdenv, # PostgreSQL package finalPackage, }: @@ -15,4 +17,12 @@ replaceVarsWith { inherit runtimeShell; postgresql-dev = lib.getDev finalPackage; }; + nativeCheckInputs = [ + diffutils + ]; + postCheck = '' + if [ -e ${lib.getDev finalPackage}/nix-support/pg_config.expected ]; then + diff ${lib.getDev finalPackage}/nix-support/pg_config.expected <($out/bin/pg_config) + fi + ''; }