From 26d668784f61cccbf69ed20e393513e6a46f7900 Mon Sep 17 00:00:00 2001 From: Douglas J Hunley Date: Sun, 12 Jul 2026 18:06:01 -0400 Subject: [PATCH 1/3] feat(nix): build pgbackrest from source instead of nixpkgs passthrough nix/packages/default.nix's pg-backrest output was a raw passthrough to nixpkgs.legacyPackages.pgbackrest, so the AMI and multigres Docker images got whatever version nixpkgs-unstable happened to have pinned, with no control over optional build features. Add nix/packages/pgbackrest.nix, a from-scratch meson/ninja build pinned to pgBackRest 2.58.0 (latest stable), mirroring the wal-g.nix pattern of an explicit, version-pinned source build. libzstd is forced enabled (not left on meson's "auto" detection) and libssh2/SFTP is disabled since only S3 is needed for now; S3/GCS/Azure support itself isn't meson-gated so nothing else changes there. Registers the new derivation in nix/packages/default.nix and adds it to the enumerated build-check list in nix/checks.nix (mirroring wal-g-2) so CI verifies it builds. No changes needed in ansible/tasks/setup-pgbackrest.yml or Dockerfile-multigres: both consume the pg-backrest flake output by name and continue to get a pgbackrest binary in $out/bin. --- nix/checks.nix | 1 + nix/packages/default.nix | 2 +- nix/packages/pgbackrest.nix | 66 +++++++++++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 nix/packages/pgbackrest.nix diff --git a/nix/checks.nix b/nix/checks.nix index b328ccb2cf..94ce025667 100644 --- a/nix/checks.nix +++ b/nix/checks.nix @@ -926,6 +926,7 @@ docker-image-test goss image-size-analyzer + pg-backrest pg_regress pg_isolation_regress pg-startup-profiler diff --git a/nix/packages/default.nix b/nix/packages/default.nix index a452a9b784..606969f595 100644 --- a/nix/packages/default.nix +++ b/nix/packages/default.nix @@ -67,7 +67,7 @@ migrate-tool = pkgs.callPackage ./migrate-tool.nix { psql_15 = self'.packages."psql_15/bin"; }; overlayfs-on-package = pkgs.callPackage ./overlayfs-on-package.nix { }; packer = pkgs.callPackage ./packer.nix { inherit inputs; }; - pg-backrest = inputs.nixpkgs.legacyPackages.${pkgs.stdenv.hostPlatform.system}.pgbackrest; + pg-backrest = pkgs.callPackage ./pgbackrest.nix { }; pgctld = pkgs.callPackage ./pgctld.nix { multigres-src = inputs.multigres; }; diff --git a/nix/packages/pgbackrest.nix b/nix/packages/pgbackrest.nix new file mode 100644 index 0000000000..dc113f5ae1 --- /dev/null +++ b/nix/packages/pgbackrest.nix @@ -0,0 +1,66 @@ +{ + lib, + stdenv, + fetchFromGitHub, + meson, + ninja, + pkg-config, + python3, + openssl, + zlib, + libpq, + lz4, + bzip2, + libxml2, + libyaml, + zstd, + libbacktrace, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "pgbackrest"; + version = "2.58.0"; + + src = fetchFromGitHub { + owner = "pgbackrest"; + repo = "pgbackrest"; + tag = "release/${finalAttrs.version}"; + hash = "sha256-RxvVqThfGnTCWTaM54Job+2HgJ7baf6ciFYTz496aKQ="; + }; + + strictDeps = true; + + nativeBuildInputs = [ + meson + ninja + pkg-config + python3 + ]; + + buildInputs = [ + openssl + zlib + libpq + lz4 + bzip2 + libxml2 + libyaml + zstd + libbacktrace + ]; + + # S3-only deployment: no SFTP repo support needed, and zstd compression + # must be present (not left to "auto" detection). + mesonFlags = [ + "-Dlibzstd=enabled" + "-Dlibssh2=disabled" + ]; + + meta = { + homepage = "https://pgbackrest.org"; + changelog = "https://github.com/pgbackrest/pgbackrest/releases/tag/release%2F${finalAttrs.version}"; + license = lib.licenses.mit; + description = "Reliable PostgreSQL backup & restore"; + mainProgram = "pgbackrest"; + }; +}) From b5cc53453dd2fdf0a55dffacbae7925f58265e2e Mon Sep 17 00:00:00 2001 From: Douglas J Hunley Date: Mon, 13 Jul 2026 11:27:25 -0400 Subject: [PATCH 2/3] fix(nix): use nixpkgs pgbackrest instead of a from-source build nixpkgs already tracks pgbackrest releases directly and carries 2.58.0 on current nixos-unstable, so the from-scratch meson build added in this PR duplicated a recipe nixpkgs already maintains. Per review feedback, drop nix/packages/pgbackrest.nix and go back to the legacyPackages passthrough for pg-backrest, and bump the nixpkgs flake input so that passthrough resolves to 2.58.0 now rather than waiting for the monthly update-flake-lock automation. --- flake.lock | 8 ++--- nix/packages/default.nix | 2 +- nix/packages/pgbackrest.nix | 66 ------------------------------------- 3 files changed, 5 insertions(+), 71 deletions(-) delete mode 100644 nix/packages/pgbackrest.nix diff --git a/flake.lock b/flake.lock index c2d6ea1fe9..6a49d5ea99 100644 --- a/flake.lock +++ b/flake.lock @@ -281,11 +281,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1767379071, - "narHash": "sha256-3xDI4xtzovwqE/eAxCwmXxUqBg6Yoam2L1u0IwRNhW4=", - "rev": "fb7944c166a3b630f177938e478f0378e64ce108", + "lastModified": 1783776592, + "narHash": "sha256-+GVwKnbbSmf4cWMJyRzvw8H5yFknmkLoPD5v6snqPzo=", + "rev": "e7a3ca8092b61ff85b6a45bf863ea2b2d6a661b3", "type": "tarball", - "url": "https://releases.nixos.org/nixos/unstable/nixos-26.05pre921484.fb7944c166a3/nixexprs.tar.xz" + "url": "https://releases.nixos.org/nixos/unstable/nixos-26.11pre1032869.e7a3ca8092b6/nixexprs.tar.xz" }, "original": { "type": "tarball", diff --git a/nix/packages/default.nix b/nix/packages/default.nix index 606969f595..a452a9b784 100644 --- a/nix/packages/default.nix +++ b/nix/packages/default.nix @@ -67,7 +67,7 @@ migrate-tool = pkgs.callPackage ./migrate-tool.nix { psql_15 = self'.packages."psql_15/bin"; }; overlayfs-on-package = pkgs.callPackage ./overlayfs-on-package.nix { }; packer = pkgs.callPackage ./packer.nix { inherit inputs; }; - pg-backrest = pkgs.callPackage ./pgbackrest.nix { }; + pg-backrest = inputs.nixpkgs.legacyPackages.${pkgs.stdenv.hostPlatform.system}.pgbackrest; pgctld = pkgs.callPackage ./pgctld.nix { multigres-src = inputs.multigres; }; diff --git a/nix/packages/pgbackrest.nix b/nix/packages/pgbackrest.nix deleted file mode 100644 index dc113f5ae1..0000000000 --- a/nix/packages/pgbackrest.nix +++ /dev/null @@ -1,66 +0,0 @@ -{ - lib, - stdenv, - fetchFromGitHub, - meson, - ninja, - pkg-config, - python3, - openssl, - zlib, - libpq, - lz4, - bzip2, - libxml2, - libyaml, - zstd, - libbacktrace, -}: - -stdenv.mkDerivation (finalAttrs: { - pname = "pgbackrest"; - version = "2.58.0"; - - src = fetchFromGitHub { - owner = "pgbackrest"; - repo = "pgbackrest"; - tag = "release/${finalAttrs.version}"; - hash = "sha256-RxvVqThfGnTCWTaM54Job+2HgJ7baf6ciFYTz496aKQ="; - }; - - strictDeps = true; - - nativeBuildInputs = [ - meson - ninja - pkg-config - python3 - ]; - - buildInputs = [ - openssl - zlib - libpq - lz4 - bzip2 - libxml2 - libyaml - zstd - libbacktrace - ]; - - # S3-only deployment: no SFTP repo support needed, and zstd compression - # must be present (not left to "auto" detection). - mesonFlags = [ - "-Dlibzstd=enabled" - "-Dlibssh2=disabled" - ]; - - meta = { - homepage = "https://pgbackrest.org"; - changelog = "https://github.com/pgbackrest/pgbackrest/releases/tag/release%2F${finalAttrs.version}"; - license = lib.licenses.mit; - description = "Reliable PostgreSQL backup & restore"; - mainProgram = "pgbackrest"; - }; -}) From c261fda8d9c798a0a43192122fc0a16b1d843952 Mon Sep 17 00:00:00 2001 From: Douglas J Hunley Date: Mon, 13 Jul 2026 11:45:28 -0400 Subject: [PATCH 3/3] revert(nix): drop the manual nixpkgs bump, keep the pg-backrest check add The monthly update-flake-lock.yml automation hit the same nixpkgs-jump breakage independently (confirmed by Marton in Slack), so it's being tracked and fixed there instead of bundled into this PR. Reverting flake.lock to develop's current nixpkgs pin unblocks nix-eval CI here; pg-backrest still resolves via the plain nixpkgs.legacyPackages passthrough and will pick up 2.58.0 whenever that separate nixpkgs bump lands. --- flake.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index 6a49d5ea99..c2d6ea1fe9 100644 --- a/flake.lock +++ b/flake.lock @@ -281,11 +281,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1783776592, - "narHash": "sha256-+GVwKnbbSmf4cWMJyRzvw8H5yFknmkLoPD5v6snqPzo=", - "rev": "e7a3ca8092b61ff85b6a45bf863ea2b2d6a661b3", + "lastModified": 1767379071, + "narHash": "sha256-3xDI4xtzovwqE/eAxCwmXxUqBg6Yoam2L1u0IwRNhW4=", + "rev": "fb7944c166a3b630f177938e478f0378e64ce108", "type": "tarball", - "url": "https://releases.nixos.org/nixos/unstable/nixos-26.11pre1032869.e7a3ca8092b6/nixexprs.tar.xz" + "url": "https://releases.nixos.org/nixos/unstable/nixos-26.05pre921484.fb7944c166a3/nixexprs.tar.xz" }, "original": { "type": "tarball",