diff --git a/ansible/vars.yml b/ansible/vars.yml index c72e5b1ba..fdcb1ab42 100644 --- a/ansible/vars.yml +++ b/ansible/vars.yml @@ -10,9 +10,9 @@ postgres_major: # Full version strings for each major version postgres_release: - postgresorioledb-17: "17.6.0.021-orioledb" - postgres17: "17.6.1.064" - postgres15: "15.14.1.064" + postgresorioledb-17: "17.6.0.021-orioledb-update-nixpkgs-3" + postgres17: "17.6.1.064-update-nixpkgs-3" + postgres15: "15.14.1.064-update-nixpkgs-3" # Non Postgres Extensions pgbouncer_release: 1.19.0 diff --git a/flake.lock b/flake.lock index a28edf942..4924941a8 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "flake-compat": { "flake": false, "locked": { - "lastModified": 1696426674, - "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "lastModified": 1761588595, + "narHash": "sha256-XKUZz9zewJNUj46b4AJdiRZJAvSZ0Dqj2BNfXvFlJC4=", "owner": "edolstra", "repo": "flake-compat", - "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "rev": "f387cd2afec9419c8ee37694406ca490c3f34ee5", "type": "github" }, "original": { @@ -21,32 +21,11 @@ "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1749398372, - "narHash": "sha256-tYBdgS56eXYaWVW3fsnPQ/nFlgWi/Z2Ymhyu21zVM98=", + "lastModified": 1763759067, + "narHash": "sha256-LlLt2Jo/gMNYAwOgdRQBrsRoOz7BPRkzvNaI/fzXi2Q=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "9305fe4e5c2a6fcf5ba6a3ff155720fbe4076569", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "flake-parts", - "type": "github" - } - }, - "flake-parts_2": { - "inputs": { - "nixpkgs-lib": [ - "nix-eval-jobs", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1759362264, - "narHash": "sha256-wfG0S7pltlYyZTM+qqlhJ7GMw2fTF4mLKCIVhLii/4M=", - "owner": "hercules-ci", - "repo": "flake-parts", - "rev": "758cf7296bee11f1706a574c77d072b8a7baa881", + "rev": "2cccadc7357c0ba201788ae99c4dfa90728ef5e0", "type": "github" }, "original": { @@ -60,11 +39,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1705309234, - "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", "owner": "numtide", "repo": "flake-utils", - "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", "type": "github" }, "original": { @@ -82,11 +61,11 @@ ] }, "locked": { - "lastModified": 1750779888, - "narHash": "sha256-wibppH3g/E2lxU43ZQHC5yA/7kIKLGxVEnsnVK1BtRg=", + "lastModified": 1765016596, + "narHash": "sha256-rhSqPNxDVow7OQKi4qS5H8Au0P4S3AYbawBSmJNUtBQ=", "owner": "cachix", "repo": "git-hooks.nix", - "rev": "16ec914f6fb6f599ce988427d9d94efddf25fe6d", + "rev": "548fc44fca28a5e81c5d6b846e555e6b9c2a5a3c", "type": "github" }, "original": { @@ -155,39 +134,17 @@ "type": "github" } }, - "nix-fast-build": { + "nix-eval-jobs": { "inputs": { "flake-parts": [ "flake-parts" ], - "nixpkgs": [ - "nixpkgs" - ], + "nix": "nix", + "nixpkgs": "nixpkgs", "treefmt-nix": [ "treefmt-nix" ] }, - "locked": { - "lastModified": 1763868605, - "narHash": "sha256-wO8Lk66GPQeSpzXUzXCBpe2Pj1De17xByrROXxnwIPY=", - "owner": "Mic92", - "repo": "nix-fast-build", - "rev": "0c7fd47fb587250e931a01c6645ab5c0cd737af8", - "type": "github" - }, - "original": { - "owner": "Mic92", - "repo": "nix-fast-build", - "type": "github" - } - }, - "nix-eval-jobs": { - "inputs": { - "flake-parts": "flake-parts_2", - "nix": "nix", - "nixpkgs": "nixpkgs_2", - "treefmt-nix": "treefmt-nix" - }, "locked": { "lastModified": 1760478325, "narHash": "sha256-hA+NOH8KDcsuvH7vJqSwk74PyZP3MtvI/l+CggZcnTc=", @@ -204,19 +161,16 @@ }, "nix2container": { "inputs": { - "flake-utils": [ - "flake-utils" - ], "nixpkgs": [ "nixpkgs" ] }, "locked": { - "lastModified": 1708764364, - "narHash": "sha256-+pOtDvmuVTg0Gi58hKDUyrNla5NbyUvt3Xs3gLR0Fws=", + "lastModified": 1761716996, + "narHash": "sha256-vdOuy2pid2/DasUgb08lDOswdPJkN5qjXfBYItVy/R4=", "owner": "nlewo", "repo": "nix2container", - "rev": "c891f90d2e3c48a6b33466c96e4851e0fc0cf455", + "rev": "e5496ab66e9de9e3f67dc06f692dfbc471b6316e", "type": "github" }, "original": { @@ -226,69 +180,6 @@ } }, "nixpkgs": { - "locked": { - "lastModified": 1712666087, - "narHash": "sha256-WwjUkWsjlU8iUImbivlYxNyMB1L5YVqE8QotQdL9jWc=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "a76c4553d7e741e17f289224eda135423de0491d", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-go124": { - "locked": { - "lastModified": 1754085309, - "narHash": "sha256-3RTSdhnqTcxS5wjKNEBpbt0hiSKfBZiQPlWHn90N1qQ=", - "owner": "Nixos", - "repo": "nixpkgs", - "rev": "d2ac4dfa61fba987a84a0a81555da57ae0b9a2b0", - "type": "github" - }, - "original": { - "owner": "Nixos", - "repo": "nixpkgs", - "rev": "d2ac4dfa61fba987a84a0a81555da57ae0b9a2b0", - "type": "github" - } - }, - "nixpkgs-lib": { - "locked": { - "lastModified": 1750555020, - "narHash": "sha256-/MjivcZIz8dyLOTFdJzS5Yazt2QCePQBh8uZooODaYw=", - "owner": "nix-community", - "repo": "nixpkgs.lib", - "rev": "6fb7349157ee1bffd053b1fdd454aa74ff7b4aee", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "nixpkgs.lib", - "type": "github" - } - }, - "nixpkgs-pgbackrest": { - "locked": { - "lastModified": 1761373498, - "narHash": "sha256-Q/uhWNvd7V7k1H1ZPMy/vkx3F8C13ZcdrKjO7Jv7v0c=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "6a08e6bb4e46ff7fcbb53d409b253f6bad8a28ce", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-unstable-small", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_2": { "locked": { "lastModified": 315532800, "narHash": "sha256-vhAtaRMIQiEghARviANBmSnhGz9Qf2IQJ+nQgsDXnVs=", @@ -301,51 +192,48 @@ "url": "https://nixos.org/channels/nixpkgs-unstable/nixexprs.tar.xz" } }, - "nixpkgs_3": { + "nixpkgs-lib": { "locked": { - "lastModified": 1697269602, - "narHash": "sha256-dSzV7Ud+JH4DPVD9od53EgDrxUVQOcSj4KGjggCDVJI=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "9cb540e9c1910d74a7e10736277f6eb9dff51c81", + "lastModified": 1761765539, + "narHash": "sha256-b0yj6kfvO8ApcSE+QmA6mUfu8IYG6/uU28OFn4PaC8M=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "719359f4562934ae99f5443f20aa06c2ffff91fc", "type": "github" }, "original": { - "owner": "NixOS", - "repo": "nixpkgs", + "owner": "nix-community", + "repo": "nixpkgs.lib", "type": "github" } }, - "nixpkgs_4": { + "nixpkgs-oldstable": { "locked": { "lastModified": 1712666087, "narHash": "sha256-WwjUkWsjlU8iUImbivlYxNyMB1L5YVqE8QotQdL9jWc=", - "owner": "nixos", + "owner": "NixOS", "repo": "nixpkgs", "rev": "a76c4553d7e741e17f289224eda135423de0491d", "type": "github" }, "original": { - "owner": "nixos", - "ref": "nixpkgs-unstable", + "owner": "NixOS", "repo": "nixpkgs", + "rev": "a76c4553d7e741e17f289224eda135423de0491d", "type": "github" } }, - "nixpkgs_5": { + "nixpkgs_2": { "locked": { - "lastModified": 1744536153, - "narHash": "sha256-awS2zRgF4uTwrOKwwiJcByDzDOdo3Q1rPZbiHQg/N38=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "18dd725c29603f582cf1900e0d25f9f1063dbf11", - "type": "github" + "lastModified": 1765186076, + "narHash": "sha256-fO54fp5kvvF8znmtV8QGwOsaBcB0NcFP41nC5Bhy/TM=", + "rev": "addf7cf5f383a3101ecfba091b98d0a1263dc9b8", + "type": "tarball", + "url": "https://releases.nixos.org/nixos/unstable/nixos-26.05pre908783.addf7cf5f383/nixexprs.tar.xz?lastModified=1765186076&rev=addf7cf5f383a3101ecfba091b98d0a1263dc9b8" }, "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" + "type": "tarball", + "url": "https://channels.nixos.org/nixos-unstable/nixexprs.tar.xz" } }, "root": { @@ -354,14 +242,12 @@ "flake-utils": "flake-utils", "git-hooks": "git-hooks", "nix-editor": "nix-editor", - "nix-fast-build": "nix-fast-build", - "nix2container": "nix2container", - "nixpkgs": "nixpkgs", "nix-eval-jobs": "nix-eval-jobs", - "nixpkgs-go124": "nixpkgs-go124", - "nixpkgs-pgbackrest": "nixpkgs-pgbackrest", + "nix2container": "nix2container", + "nixpkgs": "nixpkgs_2", + "nixpkgs-oldstable": "nixpkgs-oldstable", "rust-overlay": "rust-overlay", - "treefmt-nix": "treefmt-nix_2" + "treefmt-nix": "treefmt-nix" } }, "rust-overlay": { @@ -371,11 +257,11 @@ ] }, "locked": { - "lastModified": 1764038373, - "narHash": "sha256-M6w2wNBRelcavoDAyFL2iO4NeWknD40ASkH1S3C0YGM=", + "lastModified": 1765248027, + "narHash": "sha256-ngar+yP06x3+2k2Iey29uU0DWx5ur06h3iPBQXlU+yI=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "ab3536fe850211a96673c6ffb2cb88aab8071cc9", + "rev": "7b50ad68415ae5be7ee4cc68fa570c420741b644", "type": "github" }, "original": { @@ -400,38 +286,17 @@ } }, "treefmt-nix": { - "inputs": { - "nixpkgs": [ - "nix-eval-jobs", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1760120816, - "narHash": "sha256-gq9rdocpmRZCwLS5vsHozwB6b5nrOBDNc2kkEaTXHfg=", - "owner": "numtide", - "repo": "treefmt-nix", - "rev": "761ae7aff00907b607125b2f57338b74177697ed", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "treefmt-nix", - "type": "github" - } - }, - "treefmt-nix_2": { "inputs": { "nixpkgs": [ "nixpkgs" ] }, "locked": { - "lastModified": 1750931469, - "narHash": "sha256-0IEdQB1nS+uViQw4k3VGUXntjkDp7aAlqcxdewb/hAc=", + "lastModified": 1762938485, + "narHash": "sha256-AlEObg0syDl+Spi4LsZIBrjw+snSVU4T8MOeuZJUJjM=", "owner": "numtide", "repo": "treefmt-nix", - "rev": "ac8e6f32e11e9c7f153823abc3ab007f2a65d3e1", + "rev": "5b4ee75aeefd1e2d5a1cc43cf6ba65eba75e83e4", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index efd0b7e9e..595cd2d96 100644 --- a/flake.nix +++ b/flake.nix @@ -7,28 +7,26 @@ ]; }; inputs = { - nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; + flake-parts.url = "github:hercules-ci/flake-parts"; flake-utils.url = "github:numtide/flake-utils"; - nix2container.url = "github:nlewo/nix2container"; - nix2container.inputs.nixpkgs.follows = "nixpkgs"; - nix2container.inputs.flake-utils.follows = "flake-utils"; - nix-editor.url = "github:snowfallorg/nix-editor"; - nix-editor.inputs.utils.follows = "flake-utils"; + git-hooks.inputs.nixpkgs.follows = "nixpkgs"; + git-hooks.url = "github:cachix/git-hooks.nix"; nix-editor.inputs.nixpkgs.follows = "nixpkgs"; - rust-overlay.url = "github:oxalica/rust-overlay"; + nix-editor.inputs.utils.follows = "flake-utils"; + nix-editor.url = "github:snowfallorg/nix-editor"; + nix-eval-jobs.inputs.flake-parts.follows = "flake-parts"; + nix-eval-jobs.inputs.treefmt-nix.follows = "treefmt-nix"; + nix-eval-jobs.url = "github:nix-community/nix-eval-jobs"; + nix2container.inputs.nixpkgs.follows = "nixpkgs"; + nix2container.url = "github:nlewo/nix2container"; + # Pin to a specific nixpkgs version that has compatible v8 and curl versions + # for extensions that require older package versions + nixpkgs-oldstable.url = "github:NixOS/nixpkgs/a76c4553d7e741e17f289224eda135423de0491d"; + nixpkgs.url = "https://channels.nixos.org/nixos-unstable/nixexprs.tar.xz"; rust-overlay.inputs.nixpkgs.follows = "nixpkgs"; - nix-fast-build.url = "github:Mic92/nix-fast-build"; - nix-fast-build.inputs.flake-parts.follows = "flake-parts"; - nix-fast-build.inputs.nixpkgs.follows = "nixpkgs"; - nix-fast-build.inputs.treefmt-nix.follows = "treefmt-nix"; - flake-parts.url = "github:hercules-ci/flake-parts"; - treefmt-nix.url = "github:numtide/treefmt-nix"; + rust-overlay.url = "github:oxalica/rust-overlay"; treefmt-nix.inputs.nixpkgs.follows = "nixpkgs"; - git-hooks.url = "github:cachix/git-hooks.nix"; - git-hooks.inputs.nixpkgs.follows = "nixpkgs"; - nixpkgs-go124.url = "github:Nixos/nixpkgs/d2ac4dfa61fba987a84a0a81555da57ae0b9a2b0"; - nixpkgs-pgbackrest.url = "github:nixos/nixpkgs/nixos-unstable-small"; - nix-eval-jobs.url = "github:nix-community/nix-eval-jobs"; + treefmt-nix.url = "github:numtide/treefmt-nix"; }; outputs = diff --git a/migrations/schema-15.sql b/migrations/schema-15.sql index 20ecd988f..8f64dbda3 100644 --- a/migrations/schema-15.sql +++ b/migrations/schema-15.sql @@ -637,7 +637,7 @@ COMMENT ON TABLE auth.users IS 'Auth: Stores user login data within a secure sch -- CREATE TABLE public.schema_migrations ( - version character varying(128) NOT NULL + version character varying NOT NULL ); diff --git a/migrations/schema-17.sql b/migrations/schema-17.sql index da641e799..8017d8841 100644 --- a/migrations/schema-17.sql +++ b/migrations/schema-17.sql @@ -638,7 +638,7 @@ COMMENT ON TABLE auth.users IS 'Auth: Stores user login data within a secure sch -- CREATE TABLE public.schema_migrations ( - version character varying(128) NOT NULL + version character varying NOT NULL ); diff --git a/migrations/schema-orioledb-17.sql b/migrations/schema-orioledb-17.sql index 3c5e0ce56..b594bd502 100644 --- a/migrations/schema-orioledb-17.sql +++ b/migrations/schema-orioledb-17.sql @@ -652,7 +652,7 @@ COMMENT ON TABLE auth.users IS 'Auth: Stores user login data within a secure sch -- CREATE TABLE public.schema_migrations ( - version character varying(128) NOT NULL + version character varying NOT NULL ); diff --git a/nix/cargo-pgrx/buildPgrxExtension.nix b/nix/cargo-pgrx/buildPgrxExtension.nix index 828dd7f02..a316015a5 100644 --- a/nix/cargo-pgrx/buildPgrxExtension.nix +++ b/nix/cargo-pgrx/buildPgrxExtension.nix @@ -32,7 +32,6 @@ pkg-config, rustPlatform, stdenv, - darwin, writeShellScriptBin, defaultBindgenHook, }: @@ -86,6 +85,27 @@ let fakeRustfmt = writeShellScriptBin "rustfmt" '' exit 0 ''; + + # Rustc wrapper for pgrx < 0.12.0 to filter out empty postmaster_stub.rs arguments + # This fixes an issue that causes build failures. + # Fixed upstream in pgcentralfoundation/pgrx#1435 and #1441, available from pgrx >= 0.12. + rustcWrapper = writeShellScriptBin "rustc" '' + # ORIGINAL_RUSTC is set in the buildPhase before this wrapper is added to PATH + original_rustc="''${ORIGINAL_RUSTC:-rustc}" + filtered_args=() + for arg in "$@"; do + if [[ -z "$arg" ]]; then + continue + fi + if [[ "$arg" =~ postmaster_stub\.rs$ ]]; then + if [[ ! -s "$arg" ]]; then + continue + fi + fi + filtered_args+=("$arg") + done + exec "$original_rustc" "''${filtered_args[@]}" + ''; maybeDebugFlag = lib.optionalString (buildType != "release") "--debug"; maybeEnterBuildAndTestSubdir = lib.optionalString (buildAndTestSubdir != null) '' export CARGO_TARGET_DIR="$(pwd)/target" @@ -94,6 +114,10 @@ let maybeLeaveBuildAndTestSubdir = lib.optionalString (buildAndTestSubdir != null) "popd"; pgrxBinaryName = if builtins.compareVersions "0.7.4" cargo-pgrx.version >= 0 then "pgx" else "pgrx"; + # The rustc wrapper is only needed for pgrx < 0.12.0 + # fixed upstream in pgcentralfoundation/pgrx#1435 and #1441 + needsRustcWrapper = builtins.compareVersions cargo-pgrx.version "0.12.0" < 0; + pgrxPostgresMajor = lib.versions.major postgresql.version; preBuildAndTest = '' export PGRX_HOME=$(mktemp -d) @@ -124,9 +148,7 @@ let # so we don't accidentally `(rustPlatform.buildRustPackage argsForBuildRustPackage) // { ... }` because # we forgot parentheses finalArgs = argsForBuildRustPackage // { - buildInputs = - (args.buildInputs or [ ]) - ++ lib.optionals stdenv.hostPlatform.isDarwin [ darwin.apple_sdk.frameworks.Security ]; + buildInputs = (args.buildInputs or [ ]); nativeBuildInputs = (args.nativeBuildInputs or [ ]) @@ -147,6 +169,13 @@ let export PGRX_BUILD_FLAGS="--frozen -j $NIX_BUILD_CORES ${builtins.concatStringsSep " " cargoBuildFlags}" export PGX_BUILD_FLAGS="$PGRX_BUILD_FLAGS" + + ${lib.optionalString needsRustcWrapper '' + export ORIGINAL_RUSTC="$(command -v ${stdenv.cc.targetPrefix}rustc || command -v rustc)" + export PATH="${rustcWrapper}/bin:$PATH" + export RUSTC="${rustcWrapper}/bin/rustc" + ''} + ${lib.optionalString stdenv.hostPlatform.isDarwin ''RUSTFLAGS="''${RUSTFLAGS:+''${RUSTFLAGS} }-Clink-args=-Wl,-undefined,dynamic_lookup"''} \ cargo ${pgrxBinaryName} package \ --pg-config ${lib.getDev postgresql}/bin/pg_config \ diff --git a/nix/cargo-pgrx/default.nix b/nix/cargo-pgrx/default.nix index 86dfa4c19..87dbf6fe1 100644 --- a/nix/cargo-pgrx/default.nix +++ b/nix/cargo-pgrx/default.nix @@ -1,6 +1,5 @@ { lib, - darwin, fetchCrate, openssl, pkg-config, @@ -34,9 +33,7 @@ let src = fetchCrate { inherit version pname hash; }; inherit cargoHash; nativeBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [ pkg-config ]; - buildInputs = - lib.optionals stdenv.hostPlatform.isLinux [ openssl ] - ++ lib.optionals stdenv.hostPlatform.isDarwin [ darwin.apple_sdk.frameworks.Security ]; + buildInputs = lib.optionals stdenv.hostPlatform.isLinux [ openssl ]; OPENSSL_DIR = "${openssl.dev}"; OPENSSL_INCLUDE_DIR = "${openssl.dev}/include"; @@ -73,17 +70,17 @@ in cargo-pgrx_0_12_6 = mkCargoPgrx { version = "0.12.6"; hash = "sha256-7aQkrApALZe6EoQGVShGBj0UIATnfOy2DytFj9IWdEA="; - cargoHash = "sha256-Di4UldQwAt3xVyvgQT1gUhdvYUVp7n/a72pnX45kP0w="; + cargoHash = "sha256-pnMxWWfvr1/AEp8DvG4awig8zjdHizJHoZ5RJA8CL08="; }; cargo-pgrx_0_12_9 = mkCargoPgrx { version = "0.12.9"; hash = "sha256-aR3DZAjeEEAjLQfZ0ZxkjLqTVMIEbU0UiZ62T4BkQq8="; - cargoHash = "sha256-KTKcol9qSNLQZGW32e6fBb6cPkUGItknyVpLdBYqrBY="; + cargoHash = "sha256-yZpD3FriL9UbzRtdFkfIfFfYIrRPYxr/lZ5rb0YBTPc="; }; cargo-pgrx_0_14_3 = mkCargoPgrx { version = "0.14.3"; hash = "sha256-3TsNpEqNm3Uol5XPW1i0XEbP2fF2+RKB2d7lO6BDnvQ="; - cargoHash = "sha256-Ny7j56pwB+2eEK62X0nWfFKQy5fBz+Q1oyvecivxLkk="; + cargoHash = "sha256-LZUXhjMxkBs3O5feH4X5NQC7Qk4Ja6M5+sAYaSCikrY="; }; inherit mkCargoPgrx; } diff --git a/nix/cargo-pgrx/versions.json b/nix/cargo-pgrx/versions.json index 422bd749c..7f28c940b 100644 --- a/nix/cargo-pgrx/versions.json +++ b/nix/cargo-pgrx/versions.json @@ -3,7 +3,7 @@ "hash": "sha256-O4eHVbJBudybsPab+zr2eXnfheREMqLAHAKm2GDbfrs=", "rust": { "1.82.0": { - "cargoHash": "sha256-MucGrA3qXgJOcT2LMNmoNOhQi8QA3LuqgZEHKycLCCo=" + "cargoHash": "sha256-lcnUVO8dJET5g6wM1YgTsj4uP4I3vVZy5PWBKIsvLB8=" } } }, @@ -11,7 +11,7 @@ "hash": "sha256-t/gdlrBeP6KFkBFJiZUa8KKVJVYMf6753vQGKJdytss=", "rust": { "1.82.0": { - "cargoHash": "sha256-muce9wT4LAJmfNLWWEShARnpZgglXe/KrfxlitmGgXk=" + "cargoHash": "sha256-bLS/pKJnwgcp38wAHej6vOkzVb/E2UHRCQ/OMDI6GqU=" } } }, @@ -19,7 +19,7 @@ "hash": "sha256-GpXQUOBuojAqPXyRR+k8AVW2XzBbn6V0+2dhP4w4Vs8=", "rust": { "1.70.0": { - "cargoHash": "sha256-YbwGh3tbt8W9/VOu11fTWO9fRMUlrwJnG4wxUHuyX10=" + "cargoHash": "sha256-TGeHOA5kRZ7KclRfYj6V+/ZbPiPx/4xUyKxNm4o7ubM=" } } }, @@ -27,7 +27,7 @@ "hash": "sha256-uDBq7tUZ9f8h5nlRFR1mv4+Ty1OFtAk5P7OTNQPI1gI=", "rust": { "1.70.0": { - "cargoHash": "sha256-YTkjqMNF+cz5XtELh7+l8KwvRoVKQP7t98nkJwkW218=" + "cargoHash": "sha256-uc1/zWMLt5U0egsf3xu/5RxouSl0m+81qY+ZZd8BSxU=" } } }, @@ -35,10 +35,10 @@ "hash": "sha256-FqjfbJmSy5UCpPPPk4bkEyvQCnaH9zYtkI7txgIn+ls=", "rust": { "1.70.0": { - "cargoHash": "sha256-syZ3cQq8qDHBLvqmNDGoxeK6zXHJ47Jwkw3uhaXNCzI=" + "cargoHash": "sha256-VlxXXSwegKGYIO3r3XtclwdtkJNz4r5H35Tkkw0nl9c=" }, "1.76.0": { - "cargoHash": "sha256-syZ3cQq8qDHBLvqmNDGoxeK6zXHJ47Jwkw3uhaXNCzI=" + "cargoHash": "sha256-VlxXXSwegKGYIO3r3XtclwdtkJNz4r5H35Tkkw0nl9c=" } } }, @@ -46,13 +46,13 @@ "hash": "sha256-8NlpMDFaltTIA8G4JioYm8LaPJ2RGKH5o6sd6lBHmmM=", "rust": { "1.70.0": { - "cargoHash": "sha256-qTb3JV3u42EilaK2jP9oa5D09mkuHyRbGGRs9Rg4TzI=" + "cargoHash": "sha256-TMuJ7kyMckCT4JJVWuEE14HpD5uw3Vjym96GA71vOMo=" }, "1.76.0": { - "cargoHash": "sha256-qTb3JV3u42EilaK2jP9oa5D09mkuHyRbGGRs9Rg4TzI=" + "cargoHash": "sha256-TMuJ7kyMckCT4JJVWuEE14HpD5uw3Vjym96GA71vOMo=" }, "1.85.1": { - "cargoHash": "sha256-CbU5B0pvB9ApTZOdYP/ZwuIG8bqGzk/ING2PCM0q2bQ=" + "cargoHash": "sha256-TMuJ7kyMckCT4JJVWuEE14HpD5uw3Vjym96GA71vOMo=" } } }, @@ -60,10 +60,10 @@ "hash": "sha256-UHIfwOdXoJvR4Svha6ud0FxahP1wPwUtviUwUnTmLXU=", "rust": { "1.76.0": { - "cargoHash": "sha256-j4HnD8Zt9uhlV5N7ldIy9564o9qFEqs5KfXHmnQ1WEw=" + "cargoHash": "sha256-giL077I5VzWJ+fAbxqp/Oc28Qjc7ontVm7of5LQz+uY=" }, "1.85.1": { - "cargoHash": "sha256-KBlT3FARjGcbtHIGDoC6ir3aNXXfDRmIoy990SOqoFg=" + "cargoHash": "sha256-giL077I5VzWJ+fAbxqp/Oc28Qjc7ontVm7of5LQz+uY=" } } }, @@ -71,10 +71,10 @@ "hash": "sha256-7aQkrApALZe6EoQGVShGBj0UIATnfOy2DytFj9IWdEA=", "rust": { "1.80.0": { - "cargoHash": "sha256-Di4UldQwAt3xVyvgQT1gUhdvYUVp7n/a72pnX45kP0w=" + "cargoHash": "sha256-pnMxWWfvr1/AEp8DvG4awig8zjdHizJHoZ5RJA8CL08=" }, "1.81.0": { - "cargoHash": "sha256-Di4UldQwAt3xVyvgQT1gUhdvYUVp7n/a72pnX45kP0w=" + "cargoHash": "sha256-pnMxWWfvr1/AEp8DvG4awig8zjdHizJHoZ5RJA8CL08=" } } }, @@ -82,13 +82,13 @@ "hash": "sha256-aR3DZAjeEEAjLQfZ0ZxkjLqTVMIEbU0UiZ62T4BkQq8=", "rust": { "1.81.0": { - "cargoHash": "sha256-53HKhvsKLTa2JCByLEcK3UzWXoM+LTatd98zvS1C9no=" + "cargoHash": "sha256-yZpD3FriL9UbzRtdFkfIfFfYIrRPYxr/lZ5rb0YBTPc=" }, "1.84.0": { - "cargoHash": "sha256-KTKcol9qSNLQZGW32e6fBb6cPkUGItknyVpLdBYqrBY=" + "cargoHash": "sha256-yZpD3FriL9UbzRtdFkfIfFfYIrRPYxr/lZ5rb0YBTPc=" }, "1.87.0": { - "cargoHash": "sha256-KTKcol9qSNLQZGW32e6fBb6cPkUGItknyVpLdBYqrBY=" + "cargoHash": "sha256-yZpD3FriL9UbzRtdFkfIfFfYIrRPYxr/lZ5rb0YBTPc=" } } }, @@ -96,7 +96,7 @@ "hash": "sha256-3TsNpEqNm3Uol5XPW1i0XEbP2fF2+RKB2d7lO6BDnvQ=", "rust": { "1.87.0": { - "cargoHash": "sha256-Ny7j56pwB+2eEK62X0nWfFKQy5fBz+Q1oyvecivxLkk=" + "cargoHash": "sha256-LZUXhjMxkBs3O5feH4X5NQC7Qk4Ja6M5+sAYaSCikrY=" } } }, @@ -104,7 +104,7 @@ "hash": "sha256-emNR7fXNVD9sY/Mdno7mwpH6l/7AD28cBUsFRn9je50=", "rust": { "1.87.0": { - "cargoHash": "sha256-pK6OxRNubcWhohLvIJIliRtaHSIQOhQp7Q9brPygZYA=" + "cargoHash": "sha256-3eyBDWDoCzSU0tbab8qbjSnBkkN0oOgd7YbuyHLEHYw=" } } }, @@ -112,9 +112,8 @@ "hash": "sha256-AjoBr+/sEPdzbD0wLUNVm2syCySkGaFOFQ70TST1U9w=", "rust": { "1.88.0": { - "cargoHash": "sha256-uWj/V2lJa6HF2GlHX+i5RbSMZFOxZsBzOf6okKDb0j8=" + "cargoHash": "sha256-95DHq5GLnAqb3bbKwwaeBeKEmkfRh81ZTRaJ7L59DAg=" } } } - } diff --git a/nix/checks.nix b/nix/checks.nix index 566f8d048..7370aee9b 100644 --- a/nix/checks.nix +++ b/nix/checks.nix @@ -2,10 +2,10 @@ { perSystem = { - lib, self', system, pkgs, + lib, ... }: let diff --git a/nix/ext/gdal.nix b/nix/ext/gdal.nix index 739f7e432..c4dba3e69 100644 --- a/nix/ext/gdal.nix +++ b/nix/ext/gdal.nix @@ -47,15 +47,14 @@ stdenv.mkDerivation rec { zlib ]; - cmakeFlags = - [ - "-DGDAL_USE_INTERNAL_LIBS=OFF" - "-DGEOTIFF_INCLUDE_DIR=${lib.getDev libgeotiff}/include" - "-DGEOTIFF_LIBRARY_RELEASE=${lib.getLib libgeotiff}/lib/libgeotiff${stdenv.hostPlatform.extensions.sharedLibrary}" - "-DBUILD_PYTHON_BINDINGS=OFF" - ] - ++ lib.optionals (!stdenv.isDarwin) [ "-DCMAKE_SKIP_BUILD_RPATH=ON" ] - ++ lib.optionals stdenv.isDarwin [ "-DCMAKE_BUILD_WITH_INSTALL_NAME_DIR=ON" ]; + cmakeFlags = [ + "-DGDAL_USE_INTERNAL_LIBS=OFF" + "-DGEOTIFF_INCLUDE_DIR=${lib.getDev libgeotiff}/include" + "-DGEOTIFF_LIBRARY_RELEASE=${lib.getLib libgeotiff}/lib/libgeotiff${stdenv.hostPlatform.extensions.sharedLibrary}" + "-DBUILD_PYTHON_BINDINGS=OFF" + ] + ++ lib.optionals (!stdenv.isDarwin) [ "-DCMAKE_SKIP_BUILD_RPATH=ON" ] + ++ lib.optionals stdenv.isDarwin [ "-DCMAKE_BUILD_WITH_INSTALL_NAME_DIR=ON" ]; enableParallelBuilding = true; diff --git a/nix/ext/pg_jsonschema/default.nix b/nix/ext/pg_jsonschema/default.nix index 1a2e8ee58..d3a72036f 100644 --- a/nix/ext/pg_jsonschema/default.nix +++ b/nix/ext/pg_jsonschema/default.nix @@ -6,7 +6,6 @@ fetchFromGitHub, postgresql, rust-bin, - darwin, }: let pname = "pg_jsonschema"; @@ -43,12 +42,9 @@ let ""; nativeBuildInputs = [ cargo ]; - buildInputs = [ - postgresql - ] ++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.SystemConfiguration ]; + buildInputs = [ postgresql ]; # update the following array when the pg_jsonschema version is updated # required to ensure that extensions update scripts from previous versions are generated - previousVersions = [ "0.3.1" "0.3.0" @@ -84,7 +80,17 @@ let cargo pgrx init --pg${lib.versions.major postgresql.version} $PGRX_HOME/${lib.versions.major postgresql.version}/bin/pg_config ''; - doCheck = true; + # Tests are disabled for specific versions because pgrx tests require + # `cargo pgrx install --test` which fails in the nix sandbox due to + # write permission restrictions. Unlike pg_graphql which has a custom + # installcheck script, pg_jsonschema only has pgrx cargo tests. + # See: https://github.com/supabase/pg_jsonschema/blob/v0.3.3/src/lib.rs#L45-L195 + doCheck = + !(builtins.elem version [ + "0.2.0" + "0.3.1" + "0.3.3" + ]); preBuild = '' echo "Processing git tags..." diff --git a/nix/ext/pg_net.nix b/nix/ext/pg_net.nix index 229971a81..60304138d 100644 --- a/nix/ext/pg_net.nix +++ b/nix/ext/pg_net.nix @@ -3,13 +3,16 @@ lib, stdenv, fetchFromGitHub, - curl, postgresql, libuv, makeWrapper, switch-ext-version, + curl_8_6, }: +let + curl = curl_8_6; +in let pname = "pg_net"; build = @@ -20,7 +23,8 @@ let buildInputs = [ curl postgresql - ] ++ lib.optional (version == "0.6") libuv; + ] + ++ lib.optional (version == "0.6") libuv; src = fetchFromGitHub { owner = "supabase"; @@ -45,7 +49,14 @@ let rm sql/pg_net--0.5.1--0.6.sql ''; - env.NIX_CFLAGS_COMPILE = lib.optionalString (lib.versionOlder version "0.19.1") "-Wno-error"; + env.NIX_CFLAGS_COMPILE = + if (lib.versionOlder version "0.19.1") then + "-Wno-error" + else if (version == "0.19.5" && stdenv.isDarwin && stdenv.isAarch64) then + # Fix for dangling pointer warning in src/core.c:177 on aarch64-darwin with newer clang + "-Wno-error=dangling-assignment" + else + ""; installPhase = '' mkdir -p $out/{lib,share/postgresql/extension} diff --git a/nix/ext/pgaudit.nix b/nix/ext/pgaudit.nix index 7660f2bd1..55dd237f7 100644 --- a/nix/ext/pgaudit.nix +++ b/nix/ext/pgaudit.nix @@ -184,22 +184,20 @@ buildEnv { echo "Found control version: $controlVer from package ${pkg}" # Create migrations from control version to all supported versions on this PG major - ${ - lib.concatMapStringsSep "\n" (targetVer: '' - # Skip if control version equals target version - if [[ "$controlVer" != "${targetVer}" ]]; then - # Skip if migration already exists - if [[ ! -f "$out/share/postgresql/extension/${pname}--$controlVer--${targetVer}.sql" ]]; then - # Create symlink to migration if target SQL exists - if [[ -f "$out/share/postgresql/extension/${pname}--${targetVer}.sql" ]]; then - echo "Creating migration symlink from control version $controlVer to ${targetVer}" - ln -s "$out/share/postgresql/extension/${pname}--${targetVer}.sql" \ - "$out/share/postgresql/extension/${pname}--$controlVer--${targetVer}.sql" - fi + ${lib.concatMapStringsSep "\n" (targetVer: '' + # Skip if control version equals target version + if [[ "$controlVer" != "${targetVer}" ]]; then + # Skip if migration already exists + if [[ ! -f "$out/share/postgresql/extension/${pname}--$controlVer--${targetVer}.sql" ]]; then + # Create symlink to migration if target SQL exists + if [[ -f "$out/share/postgresql/extension/${pname}--${targetVer}.sql" ]]; then + echo "Creating migration symlink from control version $controlVer to ${targetVer}" + ln -s "$out/share/postgresql/extension/${pname}--${targetVer}.sql" \ + "$out/share/postgresql/extension/${pname}--$controlVer--${targetVer}.sql" fi fi - '') versions - } + fi + '') versions} fi '') packages} diff --git a/nix/ext/pgroonga/default.nix b/nix/ext/pgroonga/default.nix index 22a8c2dfc..89aca72a2 100644 --- a/nix/ext/pgroonga/default.nix +++ b/nix/ext/pgroonga/default.nix @@ -57,7 +57,8 @@ let msgpack-c supabase-groonga mecab - ] ++ lib.optionals stdenv.isDarwin [ xxHash ]; + ] + ++ lib.optionals stdenv.isDarwin [ xxHash ]; propagatedBuildInputs = [ supabase-groonga diff --git a/nix/packages/groonga/default.nix b/nix/ext/pgroonga/groonga.nix similarity index 90% rename from nix/packages/groonga/default.nix rename to nix/ext/pgroonga/groonga.nix index bef491109..c6d734db6 100644 --- a/nix/packages/groonga/default.nix +++ b/nix/ext/pgroonga/groonga.nix @@ -36,21 +36,20 @@ stdenv.mkDerivation (finalAttrs: { pkg-config makeWrapper ]; - buildInputs = - [ - rapidjson - xxHash - zstd - mecab - kytea - msgpack-c - ] - ++ lib.optionals lz4Support [ lz4 ] - ++ lib.optional zlibSupport [ zlib ] - ++ lib.optionals suggestSupport [ - zeromq - libevent - ]; + buildInputs = [ + rapidjson + xxHash + zstd + mecab + kytea + msgpack-c + ] + ++ lib.optionals lz4Support [ lz4 ] + ++ lib.optional zlibSupport [ zlib ] + ++ lib.optionals suggestSupport [ + zeromq + libevent + ]; cmakeFlags = [ "-DWITH_MECAB=ON" "-DMECAB_DICDIR=${mecab-naist-jdic}/lib/mecab/dic/naist-jdic" diff --git a/nix/ext/pgrouting.nix b/nix/ext/pgrouting/default.nix similarity index 87% rename from nix/ext/pgrouting.nix rename to nix/ext/pgrouting/default.nix index 48833791e..a05101dd8 100644 --- a/nix/ext/pgrouting.nix +++ b/nix/ext/pgrouting/default.nix @@ -12,7 +12,7 @@ let pname = "pgrouting"; # Load version configuration from external file - allVersions = (builtins.fromJSON (builtins.readFile ./versions.json)).${pname}; + allVersions = (builtins.fromJSON (builtins.readFile ../versions.json)).${pname}; # Filter versions compatible with current PostgreSQL version supportedVersions = lib.filterAttrs ( @@ -49,18 +49,24 @@ let inherit hash; }; + patches = lib.optionals (version == "3.4.1" && lib.versionAtLeast postgresql.version "17") [ + ./pgrouting-3.4.1-pg17.patch + ]; + #disable compile time warnings for incompatible pointer types only on macos and pg16 NIX_CFLAGS_COMPILE = lib.optionalString ( stdenv.isDarwin && lib.versionAtLeast postgresql.version "16" ) "-Wno-error=int-conversion -Wno-error=incompatible-pointer-types"; - cmakeFlags = - [ "-DPOSTGRESQL_VERSION=${postgresql.version}" ] - ++ lib.optionals (stdenv.isDarwin && lib.versionAtLeast postgresql.version "16") [ - "-DCMAKE_MACOSX_RPATH=ON" - "-DCMAKE_SHARED_MODULE_SUFFIX=.dylib" - "-DCMAKE_SHARED_LIBRARY_SUFFIX=.dylib" - ]; + cmakeFlags = [ + "-DPOSTGRESQL_VERSION=${postgresql.version}" + "-DCMAKE_POLICY_VERSION_MINIMUM=3.5" + ] + ++ lib.optionals (stdenv.isDarwin && lib.versionAtLeast postgresql.version "16") [ + "-DCMAKE_MACOSX_RPATH=ON" + "-DCMAKE_SHARED_MODULE_SUFFIX=.dylib" + "-DCMAKE_SHARED_LIBRARY_SUFFIX=.dylib" + ]; preConfigure = lib.optionalString (stdenv.isDarwin && lib.versionAtLeast postgresql.version "16") '' export DLSUFFIX=.dylib diff --git a/nix/ext/pgrouting/pgrouting-3.4.1-pg17.patch b/nix/ext/pgrouting/pgrouting-3.4.1-pg17.patch new file mode 100644 index 000000000..5f86e6c57 --- /dev/null +++ b/nix/ext/pgrouting/pgrouting-3.4.1-pg17.patch @@ -0,0 +1,39 @@ +From ce195442200452ae50b63528647e3837e9f121e0 Mon Sep 17 00:00:00 2001 +From: Yvan Sraka +Date: Thu, 4 Dec 2025 19:33:44 +0100 +Subject: [PATCH] Fix PostgreSQL 17 compatibility in SPI_getvalue calls + +SPI_getvalue already returns a char* in PostgreSQL 17, so wrapping +it in DatumGetCString (which expects a Datum) causes a compilation +error. This patch removes the unnecessary DatumGetCString wrapper +in both get_check_data.c and trsp.c files. +--- + src/common/get_check_data.c | 2 +- + src/trsp/trsp.c | 4 ++-- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/common/get_check_data.c b/src/common/get_check_data.c +index 85ea70d..82a81d1 100644 +--- a/src/common/get_check_data.c ++++ b/src/common/get_check_data.c +@@ -304,5 +304,5 @@ pgr_SPI_getFloat8(HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info) { + */ + char* + pgr_SPI_getText(HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info) { +- return DatumGetCString(SPI_getvalue(*tuple, *tupdesc, info.colNumber)); ++ return SPI_getvalue(*tuple, *tupdesc, info.colNumber); + } +diff --git a/src/trsp/trsp.c b/src/trsp/trsp.c +index 7f9397a..52b68dd 100644 +--- a/src/trsp/trsp.c ++++ b/src/trsp/trsp.c +@@ -114,8 +114,8 @@ fetch_restrict(HeapTuple *tuple, TupleDesc *tupdesc, + if (isnull) + elog(ERROR, "to_cost contains a null value"); + rest->to_cost = DatumGetFloat8(binval); +- char *str = DatumGetCString(SPI_getvalue(*tuple, *tupdesc, +- restrict_columns->via_path)); ++ char *str = SPI_getvalue(*tuple, *tupdesc, ++ restrict_columns->via_path); + + // PGR_DBG("restriction: %f, %i, %s", rest->to_cost, rest->target_id, str); diff --git a/nix/ext/plv8/default.nix b/nix/ext/plv8/default.nix index d858405ed..50927521b 100644 --- a/nix/ext/plv8/default.nix +++ b/nix/ext/plv8/default.nix @@ -2,7 +2,6 @@ stdenv, lib, fetchFromGitHub, - v8, perl, postgresql, # For passthru test on various systems, and local development on macos @@ -10,11 +9,11 @@ # to nixpkgs clang, xcbuild, - darwin, patchelf, buildEnv, nodejs_20, libcxx, + v8_oldstable, }: let @@ -36,6 +35,9 @@ let lib.mapAttrs (name: value: build name value.hash) supportedVersions ); + # plv8 3.1 requires an older version of v8 (we cannot use nodejs.libv8) + v8 = v8_oldstable; + # Build function for individual versions build = version: hash: @@ -43,6 +45,8 @@ let inherit pname version; #version = "3.1.10"; + v8 = (if (builtins.compareVersions "3.1.10" version >= 0) then v8 else nodejs_20.libv8); + src = fetchFromGitHub { owner = "plv8"; repo = "plv8"; @@ -50,49 +54,43 @@ let inherit hash; }; - patches = - [ - # Allow building with system v8. - # https://github.com/plv8/plv8/pull/505 (rejected) - ./0001-build-Allow-using-V8-from-system-${version}.patch - ] - ++ lib.optionals (builtins.compareVersions "3.1.10" version >= 0) [ - # Apply https://github.com/plv8/plv8/pull/552/ patch to fix extension upgrade problems - ./0001-fix-upgrade-related-woes-with-GUC-redefinitions-${version}.patch - ]; + patches = [ + # Allow building with system v8. + # https://github.com/plv8/plv8/pull/505 (rejected) + ./0001-build-Allow-using-V8-from-system-${version}.patch + ] + ++ lib.optionals (builtins.compareVersions "3.1.10" version >= 0) [ + # Apply https://github.com/plv8/plv8/pull/552/ patch to fix extension upgrade problems + ./0001-fix-upgrade-related-woes-with-GUC-redefinitions-${version}.patch + ]; - nativeBuildInputs = - [ perl ] - ++ lib.optionals stdenv.isDarwin [ - clang - xcbuild - ]; + nativeBuildInputs = [ + perl + ] + ++ lib.optionals stdenv.isDarwin [ + clang + xcbuild + ]; - buildInputs = - [ - (if (builtins.compareVersions "3.1.10" version >= 0) then v8 else nodejs_20.libv8) - postgresql - ] - ++ lib.optionals stdenv.isDarwin [ - darwin.apple_sdk.frameworks.CoreFoundation - darwin.apple_sdk.frameworks.Kerberos - ]; + buildInputs = [ + (if (builtins.compareVersions "3.1.10" version >= 0) then v8 else nodejs_20.libv8) + postgresql + ]; buildFlags = [ "all" ]; - makeFlags = - [ - # Nixpkgs build a v8 monolith instead of separate v8_libplatform. - "USE_SYSTEM_V8=1" - "V8_OUTDIR=${v8}/lib" - "PG_CONFIG=${postgresql}/bin/pg_config" - ] - ++ lib.optionals stdenv.isDarwin [ - "CC=${clang}/bin/clang" - "CXX=${clang}/bin/clang++" - "SHLIB_LINK=-L${v8}/lib -lv8_monolith -Wl,-rpath,${v8}/lib" - ] - ++ lib.optionals (!stdenv.isDarwin) [ "SHLIB_LINK=-lv8" ]; + makeFlags = [ + # Nixpkgs build a v8 monolith instead of separate v8_libplatform. + "USE_SYSTEM_V8=1" + "V8_OUTDIR=${v8}/lib" + "PG_CONFIG=${postgresql}/bin/pg_config" + ] + ++ lib.optionals stdenv.isDarwin [ + "CC=${clang}/bin/clang" + "CXX=${clang}/bin/clang++" + "SHLIB_LINK=-L${v8}/lib -lv8_monolith -Wl,-rpath,${v8}/lib -Wl,-headerpad_max_install_names" + ] + ++ lib.optionals (!stdenv.isDarwin) [ "SHLIB_LINK=-lv8" ]; NIX_LDFLAGS = lib.optionals stdenv.isDarwin [ "-L${postgresql}/lib" @@ -101,15 +99,14 @@ let "-lpq" "-lpgcommon" "-lpgport" - "-F${darwin.apple_sdk.frameworks.CoreFoundation}/Library/Frameworks" "-framework" "CoreFoundation" - "-F${darwin.apple_sdk.frameworks.Kerberos}/Library/Frameworks" "-framework" "Kerberos" "-undefined" "dynamic_lookup" "-flat_namespace" + "-headerpad_max_install_names" ]; # No configure script. @@ -144,11 +141,9 @@ let install_name_tool -change @rpath/libv8_monolith.dylib ${v8}/lib/libv8_monolith.dylib $out/lib/$LIB_NAME ''} - ${ - lib.optionalString (!stdenv.isDarwin) '' - ${patchelf}/bin/patchelf --set-rpath "${v8}/lib:${postgresql}/lib:${libcxx}/lib" $out/lib/$LIB_NAME - '' - } + ${lib.optionalString (!stdenv.isDarwin) '' + ${patchelf}/bin/patchelf --set-rpath "${v8}/lib:${postgresql}/lib:${libcxx}/lib" $out/lib/$LIB_NAME + ''} else ${lib.optionalString stdenv.isDarwin '' install_name_tool -add_rpath "${v8}/lib" $out/lib/$LIB_NAME @@ -157,11 +152,9 @@ let install_name_tool -change @rpath/libv8_monolith.dylib ${v8}/lib/libv8_monolith.dylib $out/lib/$LIB_NAME ''} - ${ - lib.optionalString (!stdenv.isDarwin) '' - ${patchelf}/bin/patchelf --set-rpath "${v8}/lib:${postgresql}/lib:${libcxx}/lib" $out/lib/$LIB_NAME - '' - } + ${lib.optionalString (!stdenv.isDarwin) '' + ${patchelf}/bin/patchelf --set-rpath "${v8}/lib:${postgresql}/lib:${libcxx}/lib" $out/lib/$LIB_NAME + ''} fi # plv8 3.2.x removed support for coffeejs and livescript diff --git a/nix/ext/postgis.nix b/nix/ext/postgis.nix index cdf48fb24..3989e8aae 100644 --- a/nix/ext/postgis.nix +++ b/nix/ext/postgis.nix @@ -16,10 +16,10 @@ nixosTests, callPackage, buildEnv, + sfcgal, }: let - sfcgal = callPackage ../packages/sfcgal.nix { }; gdal = callPackage ./gdal.nix { inherit postgresql; }; pname = "postgis"; @@ -79,7 +79,8 @@ let protobufc pcre2.dev sfcgal - ] ++ lib.optional stdenv.isDarwin libiconv; + ] + ++ lib.optional stdenv.isDarwin libiconv; nativeBuildInputs = [ perl pkg-config diff --git a/nix/ext/tests/default.nix b/nix/ext/tests/default.nix index 57644ee7f..fe6aa0276 100644 --- a/nix/ext/tests/default.nix +++ b/nix/ext/tests/default.nix @@ -29,6 +29,9 @@ let inherit (postgresql) version psqlSchema; lib = pkg; withPackages = _: pkg; + withJIT = pkg; + withoutJIT = pkg; + installedExtensions = [ (installedExtension majorVersion) ]; }; nativeBuildInputs = [ pkgs.makeWrapper ]; pathsToLink = [ @@ -165,7 +168,7 @@ let server.wait_for_unit("multi-user.target") server.wait_for_unit("postgresql.service") - test = PostgresExtensionTest(server, extension_name, versions, sql_test_directory, support_upgrade, ext_schema) + test = PostgresExtensionTest(server, extension_name, versions, sql_test_directory, support_upgrade, ext_schema, lib_name) test.create_schema() with subtest("Check upgrade path with postgresql 15"): diff --git a/nix/ext/tests/http.nix b/nix/ext/tests/http.nix index f465da254..1477b6c4a 100644 --- a/nix/ext/tests/http.nix +++ b/nix/ext/tests/http.nix @@ -19,8 +19,11 @@ let ]; passthru = { inherit (postgresql) version psqlSchema; + installedExtensions = [ (installedExtension majorVersion) ]; lib = pkg; withPackages = _: pkg; + withJIT = pkg; + withoutJIT = pkg; }; nativeBuildInputs = [ pkgs.makeWrapper ]; pathsToLink = [ diff --git a/nix/ext/tests/lib.py b/nix/ext/tests/lib.py index d04f830fd..26bd42d49 100644 --- a/nix/ext/tests/lib.py +++ b/nix/ext/tests/lib.py @@ -5,7 +5,7 @@ installation, upgrades, and version verification of PostgreSQL extensions. """ -from typing import Sequence, Mapping +from typing import Sequence, Mapping, Optional from pathlib import Path from test_driver.machine import Machine @@ -21,6 +21,7 @@ def __init__( sql_test_dir: Path, support_upgrade: bool = True, schema: str = "public", + lib_name: Optional[str] = None, ): """Initialize the PostgreSQL extension test framework. @@ -30,6 +31,7 @@ def __init__( versions: Mapping of PostgreSQL versions to available extension versions sql_test_dir: Directory containing SQL test files for pg_regress support_upgrade: Whether the extension supports in-place upgrades + lib_name: Name of the shared library (defaults to extension_name) """ self.vm = vm self.extension_name = extension_name @@ -37,6 +39,7 @@ def __init__( self.support_upgrade = support_upgrade self.sql_test_dir = sql_test_dir self.schema = schema + self.lib_name = lib_name or extension_name def create_schema(self): self.run_sql(f"CREATE SCHEMA IF NOT EXISTS {self.schema};") @@ -93,9 +96,9 @@ def assert_version_matches(self, expected_version: str): AssertionError: If the installed version does not match the expected version """ installed_version = self.get_installed_version() - assert ( - installed_version == expected_version - ), f"Expected version {expected_version}, but found {installed_version}" + assert installed_version == expected_version, ( + f"Expected version {expected_version}, but found {installed_version}" + ) def check_upgrade_path(self, pg_version: str): """Test the complete upgrade path for a PostgreSQL version. @@ -163,9 +166,9 @@ def check_switch_extension_with_background_worker( f"No versions available for PostgreSQL version {pg_version}" ) last_version = available_versions[-1] - assert ext_version.endswith( - f"{last_version}.so" - ), f"Expected {self.extension_name} version {last_version}, but found {ext_version}" + assert ext_version.endswith(f"{self.lib_name}-{last_version}.so"), ( + f"Expected {self.extension_name} version {last_version}, but found {ext_version}" + ) # Switch to the first version first_version = available_versions[0] @@ -173,17 +176,17 @@ def check_switch_extension_with_background_worker( # Check that we are using the first version now ext_version = self.vm.succeed(f"readlink -f {extension_lib_path}").strip() - assert ext_version.endswith( - f"{first_version}.so" - ), f"Expected {self.extension_name} version {first_version}, but found {ext_version}" + assert ext_version.endswith(f"{self.lib_name}-{first_version}.so"), ( + f"Expected {self.extension_name} version {first_version}, but found {ext_version}" + ) # Switch to the last version self.vm.succeed(f"switch_{self.extension_name}_version {last_version}") # Check that we are using the last version now ext_version = self.vm.succeed(f"readlink -f {extension_lib_path}").strip() - assert ext_version.endswith( - f"{last_version}.so" - ), f"Expected {self.extension_name} version {last_version}, but found {ext_version}" + assert ext_version.endswith(f"{self.lib_name}-{last_version}.so"), ( + f"Expected {self.extension_name} version {last_version}, but found {ext_version}" + ) def check_pg_regress(self, pg_regress: Path, pg_version: str, test_name: str): """Run pg_regress tests for the extension on a given PostgreSQL version. diff --git a/nix/ext/tests/orioledb.nix b/nix/ext/tests/orioledb.nix index 7d0475cef..cc1b09b98 100644 --- a/nix/ext/tests/orioledb.nix +++ b/nix/ext/tests/orioledb.nix @@ -15,8 +15,11 @@ let ]; passthru = { inherit (postgresql) version psqlSchema; + installedExtensions = [ (self.legacyPackages.${pkgs.system}."psql_orioledb-17".exts.orioledb) ]; lib = pkg; withPackages = _: pkg; + withJIT = pkg; + withoutJIT = pkg; }; nativeBuildInputs = [ pkgs.makeWrapper ]; pathsToLink = [ diff --git a/nix/ext/tests/pg_plan_filter.nix b/nix/ext/tests/pg_plan_filter.nix index c9efb4809..677c30ae3 100644 --- a/nix/ext/tests/pg_plan_filter.nix +++ b/nix/ext/tests/pg_plan_filter.nix @@ -19,8 +19,11 @@ let ]; passthru = { inherit (postgresql) version psqlSchema; + installedExtensions = [ (installedExtension majorVersion) ]; lib = pkg; withPackages = _: pkg; + withJIT = pkg; + withoutJIT = pkg; }; nativeBuildInputs = [ pkgs.makeWrapper ]; pathsToLink = [ diff --git a/nix/ext/tests/pg_repack.nix b/nix/ext/tests/pg_repack.nix index ff06a9b45..c02674d74 100644 --- a/nix/ext/tests/pg_repack.nix +++ b/nix/ext/tests/pg_repack.nix @@ -19,8 +19,11 @@ let ]; passthru = { inherit (postgresql) version psqlSchema; + installedExtensions = [ (installedExtension majorVersion) ]; lib = pkg; withPackages = _: pkg; + withJIT = pkg; + withoutJIT = pkg; }; nativeBuildInputs = [ pkgs.makeWrapper ]; pathsToLink = [ diff --git a/nix/ext/tests/pg_safeupdate.nix b/nix/ext/tests/pg_safeupdate.nix index 1c7e09c7f..a4431cfa5 100644 --- a/nix/ext/tests/pg_safeupdate.nix +++ b/nix/ext/tests/pg_safeupdate.nix @@ -19,8 +19,11 @@ let ]; passthru = { inherit (postgresql) version psqlSchema; + installedExtensions = [ (installedExtension majorVersion) ]; lib = pkg; withPackages = _: pkg; + withJIT = pkg; + withoutJIT = pkg; }; nativeBuildInputs = [ pkgs.makeWrapper ]; pathsToLink = [ diff --git a/nix/ext/tests/pgjwt.nix b/nix/ext/tests/pgjwt.nix index ef2e6b935..aede7e9a0 100644 --- a/nix/ext/tests/pgjwt.nix +++ b/nix/ext/tests/pgjwt.nix @@ -19,8 +19,11 @@ let ]; passthru = { inherit (postgresql) version psqlSchema; + installedExtensions = [ (installedExtension majorVersion) ]; lib = pkg; withPackages = _: pkg; + withJIT = pkg; + withoutJIT = pkg; }; nativeBuildInputs = [ pkgs.makeWrapper ]; pathsToLink = [ diff --git a/nix/ext/tests/pgmq.nix b/nix/ext/tests/pgmq.nix index b0c432921..7d96e057c 100644 --- a/nix/ext/tests/pgmq.nix +++ b/nix/ext/tests/pgmq.nix @@ -19,8 +19,11 @@ let ]; passthru = { inherit (postgresql) version psqlSchema; + installedExtensions = [ (installedExtension majorVersion) ]; lib = pkg; withPackages = _: pkg; + withJIT = pkg; + withoutJIT = pkg; }; nativeBuildInputs = [ pkgs.makeWrapper ]; pathsToLink = [ diff --git a/nix/ext/tests/pgroonga.nix b/nix/ext/tests/pgroonga.nix index abfef8804..f40da3367 100644 --- a/nix/ext/tests/pgroonga.nix +++ b/nix/ext/tests/pgroonga.nix @@ -19,8 +19,11 @@ let ]; passthru = { inherit (postgresql) version psqlSchema; + installedExtensions = [ (installedExtension majorVersion) ]; lib = pkg; withPackages = _: pkg; + withJIT = pkg; + withoutJIT = pkg; }; nativeBuildInputs = [ pkgs.makeWrapper ]; pathsToLink = [ diff --git a/nix/ext/tests/pgrouting.nix b/nix/ext/tests/pgrouting.nix index f4550b576..3fe656977 100644 --- a/nix/ext/tests/pgrouting.nix +++ b/nix/ext/tests/pgrouting.nix @@ -12,20 +12,22 @@ let majorVersion = lib.versions.major postgresql.version; pkg = pkgs.buildEnv { name = "postgresql-${majorVersion}-${pname}"; - paths = - [ - postgresql - postgresql.lib - (installedExtension majorVersion) - (self.legacyPackages.${pkgs.system}."psql_${majorVersion}".exts.postgis) - ] - ++ lib.optional (postgresql.isOrioleDB) ( - self.legacyPackages.${pkgs.system}."psql_orioledb-17".exts.orioledb - ); + paths = [ + postgresql + postgresql.lib + (installedExtension majorVersion) + (self.legacyPackages.${pkgs.system}."psql_${majorVersion}".exts.postgis) + ] + ++ lib.optional (postgresql.isOrioleDB) ( + self.legacyPackages.${pkgs.system}."psql_orioledb-17".exts.orioledb + ); passthru = { inherit (postgresql) version psqlSchema; + installedExtensions = [ (installedExtension majorVersion) ]; lib = pkg; withPackages = _: pkg; + withJIT = pkg; + withoutJIT = pkg; }; nativeBuildInputs = [ pkgs.makeWrapper ]; pathsToLink = [ diff --git a/nix/ext/tests/pgsodium.nix b/nix/ext/tests/pgsodium.nix index 0eae3c0a0..8fb945eeb 100644 --- a/nix/ext/tests/pgsodium.nix +++ b/nix/ext/tests/pgsodium.nix @@ -20,8 +20,11 @@ let ]; passthru = { inherit (postgresql) version psqlSchema; + installedExtensions = [ (installedExtension majorVersion) ]; lib = pkg; withPackages = _: pkg; + withJIT = pkg; + withoutJIT = pkg; }; nativeBuildInputs = [ pkgs.makeWrapper ]; pathsToLink = [ diff --git a/nix/ext/tests/plpgsql_check.nix b/nix/ext/tests/plpgsql_check.nix index 4d964ad9f..422a37982 100644 --- a/nix/ext/tests/plpgsql_check.nix +++ b/nix/ext/tests/plpgsql_check.nix @@ -19,8 +19,11 @@ let ]; passthru = { inherit (postgresql) version psqlSchema; + installedExtensions = [ (installedExtension majorVersion) ]; lib = pkg; withPackages = _: pkg; + withJIT = pkg; + withoutJIT = pkg; }; nativeBuildInputs = [ pkgs.makeWrapper ]; pathsToLink = [ diff --git a/nix/ext/tests/plv8.nix b/nix/ext/tests/plv8.nix index 26a349637..38c3a51b1 100644 --- a/nix/ext/tests/plv8.nix +++ b/nix/ext/tests/plv8.nix @@ -20,8 +20,11 @@ let ]; passthru = { inherit (postgresql) version psqlSchema; + installedExtensions = [ (installedExtension majorVersion) ]; lib = pkg; withPackages = _: pkg; + withJIT = pkg; + withoutJIT = pkg; }; nativeBuildInputs = [ pkgs.makeWrapper ]; pathsToLink = [ diff --git a/nix/ext/tests/postgis.nix b/nix/ext/tests/postgis.nix index f20e2de24..68bcbe381 100644 --- a/nix/ext/tests/postgis.nix +++ b/nix/ext/tests/postgis.nix @@ -19,8 +19,11 @@ let ]; passthru = { inherit (postgresql) version psqlSchema; + installedExtensions = [ (installedExtension majorVersion) ]; lib = pkg; withPackages = _: pkg; + withJIT = pkg; + withoutJIT = pkg; }; nativeBuildInputs = [ pkgs.makeWrapper ]; pathsToLink = [ diff --git a/nix/ext/tests/timescaledb.nix b/nix/ext/tests/timescaledb.nix index 0cea7a507..16a286f15 100644 --- a/nix/ext/tests/timescaledb.nix +++ b/nix/ext/tests/timescaledb.nix @@ -19,8 +19,11 @@ let ]; passthru = { inherit (postgresql) version psqlSchema; + installedExtensions = [ (installedExtension majorVersion) ]; lib = pkg; withPackages = _: pkg; + withJIT = pkg; + withoutJIT = pkg; }; nativeBuildInputs = [ pkgs.makeWrapper ]; pathsToLink = [ @@ -85,12 +88,12 @@ self.inputs.nixpkgs.lib.nixos.runTest { support_upgrade = True sql_test_directory = Path("${../../tests}") - test = PostgresExtensionTest(server, extension_name, versions, sql_test_directory, support_upgrade) + test = PostgresExtensionTest(server, extension_name, versions, sql_test_directory, support_upgrade, "public", "timescaledb-loader") with subtest("Check upgrade path with postgresql 15"): test.check_upgrade_path("15") with subtest("Test switch_${pname}_version"): - test.check_switch_extension_with_background_worker(Path("${psql_15}/lib/${pname}.so"), "15") + test.check_switch_extension_with_background_worker(Path("${psql_15}/lib/timescaledb-loader.so"), "15") ''; } diff --git a/nix/ext/tests/vault.nix b/nix/ext/tests/vault.nix index a3f9cb24f..763f85f84 100644 --- a/nix/ext/tests/vault.nix +++ b/nix/ext/tests/vault.nix @@ -20,8 +20,11 @@ let ]; passthru = { inherit (postgresql) version psqlSchema; + installedExtensions = [ (installedExtension majorVersion) ]; lib = pkg; withPackages = _: pkg; + withJIT = pkg; + withoutJIT = pkg; }; nativeBuildInputs = [ pkgs.makeWrapper ]; pathsToLink = [ diff --git a/nix/ext/timescaledb.nix b/nix/ext/timescaledb.nix index 91605a48c..765ca5267 100644 --- a/nix/ext/timescaledb.nix +++ b/nix/ext/timescaledb.nix @@ -39,7 +39,8 @@ let "-DREGRESS_CHECKS=OFF" "-DTAP_CHECKS=OFF" "-DAPACHE_ONLY=1" - ] ++ lib.optionals stdenv.isDarwin [ "-DLINTER=OFF" ]; + ] + ++ lib.optionals stdenv.isDarwin [ "-DLINTER=OFF" ]; postPatch = '' for x in CMakeLists.txt sql/CMakeLists.txt; do @@ -107,6 +108,7 @@ let EXT_LOADER_TO_USE="$EXT_WRAPPER_LIB/$EXT_NAME-loader-$VERSION${postgresql.dlSuffix}" if [ -f "$EXT_LOADER_TO_USE" ]; then ln -sfnv "$EXT_LOADER_TO_USE" "$EXT_WRAPPER_LIB/$EXT_NAME${postgresql.dlSuffix}" + ln -sfnv "$EXT_LOADER_TO_USE" "$EXT_WRAPPER_LIB/$EXT_NAME-loader${postgresql.dlSuffix}" fi ''; }; @@ -124,6 +126,9 @@ buildEnv { # Create symlink from the latest versioned loader to timescaledb.so ln -sfn ${pname}-loader-${latestVersion}${postgresql.dlSuffix} $out/lib/${pname}${postgresql.dlSuffix} + # Create symlink for timescaledb-loader.so (used by background worker tests) + ln -sfn ${pname}-loader-${latestVersion}${postgresql.dlSuffix} $out/lib/${pname}-loader${postgresql.dlSuffix} + # The versioned extension libraries (timescaledb-VERSION.so) are already in place # checks - we should have loader files and versioned extension files @@ -142,6 +147,7 @@ buildEnv { passthru = { inherit versions numberOfVersions switch-ext-version; hasBackgroundWorker = true; + libName = "timescaledb-loader"; defaultSettings = { shared_preload_libraries = [ "timescaledb" ]; }; diff --git a/nix/ext/vault.nix b/nix/ext/vault.nix index cb90882a7..537febc0b 100644 --- a/nix/ext/vault.nix +++ b/nix/ext/vault.nix @@ -44,31 +44,30 @@ let inherit hash; }; - installPhase = - '' - mkdir -p $out/{lib,share/postgresql/extension} + installPhase = '' + mkdir -p $out/{lib,share/postgresql/extension} - # Create version-specific control file - sed -e "/^default_version =/d" \ - -e "s|^module_pathname = .*|module_pathname = '\$libdir/${pname}'|" \ - ${pname}.control > $out/share/postgresql/extension/${pname}--${version}.control + # Create version-specific control file + sed -e "/^default_version =/d" \ + -e "s|^module_pathname = .*|module_pathname = '\$libdir/${pname}'|" \ + ${pname}.control > $out/share/postgresql/extension/${pname}--${version}.control - '' - # for versions <= 0.2.8, we don't have a library to install - + lib.optionalString (builtins.compareVersions "0.2.8" version < 0) '' - # Install shared library with version suffix - mv ${pname}${postgresql.dlSuffix} $out/lib/${pname}-${version}${postgresql.dlSuffix} + '' + # for versions <= 0.2.8, we don't have a library to install + + lib.optionalString (builtins.compareVersions "0.2.8" version < 0) '' + # Install shared library with version suffix + mv ${pname}${postgresql.dlSuffix} $out/lib/${pname}-${version}${postgresql.dlSuffix} - # For the latest version, copy the sql files - if [[ "${version}" == "${latestVersion}" ]]; then - install -D -t $out/share/postgresql/extension sql/*.sql - { - echo "default_version = '${latestVersion}'" - cat $out/share/postgresql/extension/${pname}--${latestVersion}.control - } > $out/share/postgresql/extension/${pname}.control - fi - ln -sfn ${pname}-${latestVersion}${postgresql.dlSuffix} $out/lib/${pname}${postgresql.dlSuffix} - ''; + # For the latest version, copy the sql files + if [[ "${version}" == "${latestVersion}" ]]; then + install -D -t $out/share/postgresql/extension sql/*.sql + { + echo "default_version = '${latestVersion}'" + cat $out/share/postgresql/extension/${pname}--${latestVersion}.control + } > $out/share/postgresql/extension/${pname}.control + fi + ln -sfn ${pname}-${latestVersion}${postgresql.dlSuffix} $out/lib/${pname}${postgresql.dlSuffix} + ''; meta = with lib; { description = "Store encrypted secrets in PostgreSQL"; diff --git a/nix/ext/wal2json.nix b/nix/ext/wal2json.nix index bd1e8ddd8..43ddab8df 100644 --- a/nix/ext/wal2json.nix +++ b/nix/ext/wal2json.nix @@ -10,7 +10,7 @@ let pname = "wal2json"; build = - version: rev: hash: + version: _rev: hash: stdenv.mkDerivation rec { inherit version pname; diff --git a/nix/ext/wrappers/default.nix b/nix/ext/wrappers/default.nix index c9f22dc4a..696358ea4 100644 --- a/nix/ext/wrappers/default.nix +++ b/nix/ext/wrappers/default.nix @@ -7,7 +7,6 @@ pkg-config, postgresql, buildEnv, - darwin, rust-bin, git, }: @@ -37,17 +36,10 @@ let cargo git ]; - buildInputs = - [ - openssl - postgresql - ] - ++ lib.optionals stdenv.isDarwin [ - darwin.apple_sdk.frameworks.CoreFoundation - darwin.apple_sdk.frameworks.CoreServices - darwin.apple_sdk.frameworks.Security - darwin.apple_sdk.frameworks.SystemConfiguration - ]; + buildInputs = [ + openssl + postgresql + ]; NIX_LDFLAGS = "-L${postgresql}/lib -lpq"; diff --git a/nix/nixpkgs.nix b/nix/nixpkgs.nix index 005dd80aa..34bfae126 100644 --- a/nix/nixpkgs.nix +++ b/nix/nixpkgs.nix @@ -10,6 +10,19 @@ overlays = [ (import inputs.rust-overlay) self.overlays.default + ( + let + # Provide older versions of packages required by some extensions + oldstable = import inputs.nixpkgs-oldstable { + inherit system; + config.allowUnfree = true; + }; + in + _final: _prev: { + curl_8_6 = oldstable.curl; + v8_oldstable = oldstable.v8; + } + ) ]; }; }; diff --git a/nix/overlays/default.nix b/nix/overlays/default.nix index 9c28c1082..a5a18d5c9 100644 --- a/nix/overlays/default.nix +++ b/nix/overlays/default.nix @@ -19,7 +19,6 @@ cargo-pgrx = final.callPackage ../cargo-pgrx/default.nix { inherit (final) lib; - inherit (final) darwin; inherit (final) fetchCrate; inherit (final) openssl; inherit (final) pkg-config; diff --git a/nix/packages/default.nix b/nix/packages/default.nix index 6c9993bc9..a764fcd33 100644 --- a/nix/packages/default.nix +++ b/nix/packages/default.nix @@ -41,19 +41,18 @@ github-matrix = pkgs.callPackage ./github-matrix { nix-eval-jobs = inputs'.nix-eval-jobs.packages.default; }; - supabase-groonga = pkgs.callPackage ./groonga { }; + supabase-groonga = pkgs.callPackage ../ext/pgroonga/groonga.nix { }; http-mock-server = pkgs.callPackage ./http-mock-server.nix { }; local-infra-bootstrap = pkgs.callPackage ./local-infra-bootstrap.nix { }; mecab-naist-jdic = pkgs.callPackage ./mecab-naist-jdic.nix { }; 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-pgbackrest.legacyPackages.${pkgs.system}.pgbackrest; + pg-backrest = inputs.nixpkgs.legacyPackages.${pkgs.system}.pgbackrest; pg-restore = pkgs.callPackage ./pg-restore.nix { psql_15 = self'.packages."psql_15/bin"; }; pg_prove = pkgs.perlPackages.TAPParserSourceHandlerpgTAP; pg_regress = makePgRegress activeVersion; run-testinfra = pkgs.callPackage ./run-testinfra.nix { }; - sfcgal = pkgs.callPackage ./sfcgal.nix { }; show-commands = pkgs.callPackage ./show-commands.nix { }; start-client = pkgs.callPackage ./start-client.nix { psql_15 = self'.packages."psql_15/bin"; diff --git a/nix/packages/groonga/do-not-use-vendored-libraries.patch b/nix/packages/groonga/do-not-use-vendored-libraries.patch deleted file mode 100644 index 6a005349d..000000000 --- a/nix/packages/groonga/do-not-use-vendored-libraries.patch +++ /dev/null @@ -1,15 +0,0 @@ -Do not use vendored libraries - ---- a/vendor/CMakeLists.txt -+++ b/vendor/CMakeLists.txt -@@ -14,10 +14,7 @@ - # License along with this library; if not, write to the Free Software - # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - - add_subdirectory(onigmo) --add_subdirectory(mruby) --add_subdirectory(mecab) --add_subdirectory(message_pack) - if(GRN_WITH_MRUBY) - add_subdirectory(groonga-log) - endif() \ No newline at end of file diff --git a/nix/packages/groonga/fix-cmake-install-path.patch b/nix/packages/groonga/fix-cmake-install-path.patch deleted file mode 100644 index 1fe317b6c..000000000 --- a/nix/packages/groonga/fix-cmake-install-path.patch +++ /dev/null @@ -1,21 +0,0 @@ -Fix CMake install path - ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -1141,11 +1141,11 @@ - - set(prefix "${CMAKE_INSTALL_PREFIX}") - set(exec_prefix "\${prefix}") --set(bindir "\${exec_prefix}/${CMAKE_INSTALL_BINDIR}") --set(sbindir "\${exec_prefix}/${CMAKE_INSTALL_SBINDIR}") --set(libdir "\${prefix}/${CMAKE_INSTALL_LIBDIR}") --set(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}") --set(datarootdir "\${prefix}/${CMAKE_INSTALL_DATAROOTDIR}") -+set(bindir "${CMAKE_INSTALL_FULL_BINDIR}") -+set(sbindir "${CMAKE_INSTALL_FULL_SBINDIR}") -+set(libdir "${CMAKE_INSTALL_FULL_LIBDIR}") -+set(includedir "${CMAKE_INSTALL_FULL_INCLUDEDIR}") -+set(datarootdir "${CMAKE_INSTALL_FULL_DATAROOTDIR}") - set(datadir "\${datarootdir}") - set(expanded_pluginsdir "${GRN_PLUGINS_DIR}") - set(GRN_EXPANDED_DEFAULT_DOCUMENT_ROOT "${GRN_DEFAULT_DOCUMENT_ROOT}") \ No newline at end of file diff --git a/nix/packages/lib.nix b/nix/packages/lib.nix index cf541913d..ef8f64069 100644 --- a/nix/packages/lib.nix +++ b/nix/packages/lib.nix @@ -100,7 +100,8 @@ PGBOUNCER_AUTH_SCHEMA_SQL = "${paths.pgbouncerAuthSchemaSql}"; STAT_EXTENSION_SQL = "${paths.statExtensionSql}"; CURRENT_SYSTEM = "${system}"; - } // extraSubstitutions; # Merge in any extra substitutions + } + // extraSubstitutions; # Merge in any extra substitutions in pkgs.runCommand name { @@ -129,13 +130,11 @@ chmod 644 $out/etc/postgresql/pg_hba.conf substitute ${../tools/run-server.sh.in} $out/bin/start-postgres-server \ - ${ - builtins.concatStringsSep " " ( - builtins.attrValues ( - builtins.mapAttrs (name: value: "--subst-var-by '${name}' '${value}'") substitutions - ) + ${builtins.concatStringsSep " " ( + builtins.attrValues ( + builtins.mapAttrs (name: value: "--subst-var-by '${name}' '${value}'") substitutions ) - } + )} chmod +x $out/bin/start-postgres-server ''; } diff --git a/nix/packages/packer.nix b/nix/packages/packer.nix index 7f0063c30..aa0d797c9 100644 --- a/nix/packages/packer.nix +++ b/nix/packages/packer.nix @@ -1,14 +1,12 @@ { pkgs, - inputs, lib, fetchFromGitHub, installShellFiles, ... }: let - go124 = inputs.nixpkgs-go124.legacyPackages.${pkgs.system}.go_1_24; - buildGoModule = pkgs.buildGoModule.override { go = go124; }; + buildGoModule = pkgs.buildGoModule; in buildGoModule rec { pname = "packer"; @@ -32,11 +30,6 @@ buildGoModule rec { nativeBuildInputs = [ installShellFiles ]; - buildInputs = lib.optionals pkgs.stdenv.isDarwin [ - pkgs.darwin.apple_sdk.frameworks.IOKit - pkgs.darwin.apple_sdk.frameworks.Security - ]; - postInstall = '' installShellCompletion --zsh contrib/zsh-completion/_packer ''; diff --git a/nix/packages/postgres.nix b/nix/packages/postgres.nix index aa6cc9e4c..611f60542 100644 --- a/nix/packages/postgres.nix +++ b/nix/packages/postgres.nix @@ -25,7 +25,7 @@ ../ext/pgjwt.nix ../ext/pgaudit.nix ../ext/postgis.nix - ../ext/pgrouting.nix + ../ext/pgrouting ../ext/pgtap.nix ../ext/pg_cron ../ext/pgsql-http.nix diff --git a/nix/packages/sfcgal.nix b/nix/packages/sfcgal.nix deleted file mode 100644 index da962cbf8..000000000 --- a/nix/packages/sfcgal.nix +++ /dev/null @@ -1,52 +0,0 @@ -{ - lib, - stdenv, - fetchFromGitLab, - cgal, - cmake, - pkg-config, - gmp, - mpfr, - boost, -}: - -stdenv.mkDerivation rec { - pname = "sfcgal"; - version = "61f3b08ade49493b56c6bafa98c7c1f84addbc10"; - - src = fetchFromGitLab { - owner = "sfcgal"; - repo = "SFCGAL"; - rev = "${version}"; - hash = "sha256-nKSqiFyMkZAYptIeShb1zFg9lYSny3kcGJfxdeTFqxw="; - }; - - nativeBuildInputs = [ - cmake - pkg-config - cgal - gmp - mpfr - boost - ]; - - cmakeFlags = [ - "-DCGAL_DIR=${cgal}" - "-DCMAKE_PREFIX_PATH=${cgal}" - ]; - - postPatch = '' - substituteInPlace sfcgal.pc.in \ - --replace '$'{prefix}/@CMAKE_INSTALL_LIBDIR@ @CMAKE_INSTALL_FULL_LIBDIR@ - ''; - - meta = with lib; { - description = "A wrapper around CGAL that intents to implement 2D and 3D operations on OGC standards models"; - homepage = "https://sfcgal.gitlab.io/SFCGAL/"; - license = with licenses; [ - gpl3Plus - lgpl3Plus - ]; - platforms = platforms.all; - }; -} diff --git a/nix/packages/supascan.nix b/nix/packages/supascan.nix index cd094db4e..daa51f19b 100644 --- a/nix/packages/supascan.nix +++ b/nix/packages/supascan.nix @@ -1,11 +1,7 @@ -{ - pkgs, - lib, - inputs, -}: +{ pkgs, lib, ... }: let # Use Go 1.24 for the scanner which requires Go >= 1.23.2 - go124 = inputs.nixpkgs-go124.legacyPackages.${pkgs.system}.go_1_24; + go124 = pkgs.go_1_24; buildGoModule124 = pkgs.buildGoModule.override { go = go124; }; # Package GOSS - server validation spec runner @@ -42,6 +38,9 @@ let subPackages = [ "cmd/supascan" ]; + # Disable CGO to avoid Darwin framework dependencies + env.CGO_ENABLED = "0"; + ldflags = [ "-s" "-w" @@ -56,11 +55,6 @@ let --prefix PATH : ${goss}/bin ''; - buildInputs = lib.optionals pkgs.stdenv.isDarwin [ - pkgs.darwin.apple_sdk.frameworks.IOKit - pkgs.darwin.apple_sdk.frameworks.CoreFoundation - ]; - doCheck = true; checkPhase = '' go test -v ./... diff --git a/nix/packages/sync-exts-versions.nix b/nix/packages/sync-exts-versions.nix index d76e66553..02fa3deaa 100644 --- a/nix/packages/sync-exts-versions.nix +++ b/nix/packages/sync-exts-versions.nix @@ -11,7 +11,7 @@ runCommand "sync-exts-versions" { } '' --subst-var-by 'YQ' '${yq}/bin/yq' \ --subst-var-by 'JQ' '${jq}/bin/jq' \ --subst-var-by 'NIX_EDITOR' '${nix-editor.packages.nix-editor}/bin/nix-editor' \ - --subst-var-by 'NIXPREFETCHURL' '${nixVersions.nix_2_20}/bin/nix-prefetch-url' \ - --subst-var-by 'NIX' '${nixVersions.nix_2_20}/bin/nix' + --subst-var-by 'NIXPREFETCHURL' '${nixVersions.nix_2_29}/bin/nix-prefetch-url' \ + --subst-var-by 'NIX' '${nixVersions.nix_2_29}/bin/nix' chmod +x $out/bin/sync-exts-versions '' diff --git a/nix/postgresql/generic.nix b/nix/postgresql/generic.nix index ea67cbc91..95034e060 100644 --- a/nix/postgresql/generic.nix +++ b/nix/postgresql/generic.nix @@ -12,7 +12,7 @@ let zlib, readline, openssl, - icu, + icu75, lz4, zstd, systemd, @@ -21,6 +21,7 @@ let libxml2, tzdata, libkrb5, + replaceVars, darwin, linux-pam, #orioledb specific @@ -65,7 +66,7 @@ let # for <13 (where it got removed: https://github.com/postgres/postgres/commit/c45643d618e35ec2fe91438df15abd4f3c0d85ca) libxcrypt, - isOrioleDB ? false, + isOrioleDB ? (builtins.match "[0-9][0-9]_.*" version) != null, }@args: let atLeast = lib.versionAtLeast version; @@ -105,7 +106,8 @@ let inherit hash; }; - hardeningEnable = lib.optionals (!stdenv'.cc.isClang) [ "pie" ]; + # The 'pie' hardening flag has been removed in favor of enabling PIE by default in compilers and should no longer be used. + # hardeningEnable = lib.optionals (!stdenv'.cc.isClang) [ "pie" ]; outputs = [ "out" @@ -113,47 +115,48 @@ let ]; setOutputFlags = false; # $out retains configureFlags :-/ - buildInputs = - [ - zlib - readline - openssl - (libxml2.override { python = python3; }) - icu - ] - ++ lib.optionals (olderThan "13") [ libxcrypt ] - ++ lib.optionals jitSupport [ llvmPackages.llvm ] - ++ lib.optionals lz4Enabled [ lz4 ] - ++ lib.optionals zstdEnabled [ zstd ] - ++ lib.optionals systemdSupport' [ systemd ] - ++ lib.optionals pythonSupport [ python3 ] - ++ lib.optionals gssSupport [ libkrb5 ] - ++ lib.optionals stdenv'.isLinux [ linux-pam ] - ++ lib.optionals (!stdenv'.isDarwin) [ libossp_uuid ] - ++ lib.optionals (isOrioleDB || (lib.versionAtLeast version "17")) [ - perl - bison - flex - docbook_xsl - docbook_xml_dtd_45 - docbook_xsl_ns - libxslt - ]; + buildInputs = [ + zlib + readline + openssl + (libxml2.override { python3 = python3; }) + # Pin ICU to version 75 to maintain collation version 153.120 + # This prevents collation mismatch warnings when upgrading nixpkgs + icu75 + ] + ++ lib.optionals (olderThan "13") [ libxcrypt ] + ++ lib.optionals jitSupport [ llvmPackages.llvm ] + ++ lib.optionals lz4Enabled [ lz4 ] + ++ lib.optionals zstdEnabled [ zstd ] + ++ lib.optionals systemdSupport' [ systemd ] + ++ lib.optionals pythonSupport [ python3 ] + ++ lib.optionals gssSupport [ libkrb5 ] + ++ lib.optionals stdenv'.isLinux [ linux-pam ] + ++ lib.optionals (!stdenv'.isDarwin) [ libossp_uuid ] + ++ lib.optionals (isOrioleDB || (lib.versionAtLeast version "17")) [ + perl + bison + flex + docbook_xsl + docbook_xml_dtd_45 + docbook_xsl_ns + libxslt + ]; - nativeBuildInputs = - [ - makeWrapper - pkg-config - ] - ++ lib.optionals jitSupport [ - llvmPackages.llvm.dev - nukeReferences - patchelf - ]; + nativeBuildInputs = [ + makeWrapper + pkg-config + ] + ++ lib.optionals jitSupport [ + llvmPackages.llvm.dev + nukeReferences + patchelf + ]; enableParallelBuilding = true; separateDebugInfo = true; + __structuredAttrs = true; buildFlags = [ "world-bin" ]; @@ -161,113 +164,109 @@ let # Fixed upstream in https://github.com/postgres/postgres/commit/0bc8cebdb889368abdf224aeac8bc197fe4c9ae6 env.NIX_CFLAGS_COMPILE = lib.optionalString (olderThan "13") "-I${libxml2.dev}/include/libxml2"; - configureFlags = - [ - "--with-openssl" - "--with-libxml" - "--with-icu" - "--sysconfdir=/etc" - "--libdir=$(lib)/lib" - "--with-system-tzdata=${tzdata}/share/zoneinfo" - "--enable-debug" - (lib.optionalString systemdSupport' "--with-systemd") - (if stdenv'.isDarwin then "--with-uuid=e2fs" else "--with-ossp-uuid") - ] - ++ lib.optionals lz4Enabled [ "--with-lz4" ] - ++ lib.optionals zstdEnabled [ "--with-zstd" ] - ++ lib.optionals gssSupport [ "--with-gssapi" ] - ++ lib.optionals pythonSupport [ "--with-python" ] - ++ lib.optionals jitSupport [ "--with-llvm" ] - ++ lib.optionals stdenv'.isLinux [ "--with-pam" ]; - - patches = - [ - ( - if atLeast "16" then - ./patches/relative-to-symlinks-16+.patch - else - ./patches/relative-to-symlinks.patch - ) - ./patches/less-is-more.patch - ./patches/paths-for-split-outputs.patch - ./patches/specify_pkglibdir_at_runtime.patch - ./patches/paths-with-postgresql-suffix.patch - ./patches/locale-binary-path.patch - ] - ++ lib.optionals stdenv'.hostPlatform.isMusl ( - # Using fetchurl instead of fetchpatch on purpose: https://github.com/NixOS/nixpkgs/issues/240141 - map fetchurl (lib.attrValues muslPatches) + configureFlags = [ + "--with-openssl" + "--with-libxml" + "--with-icu" + "--sysconfdir=/etc" + "--libdir=$(lib)/lib" + "--with-system-tzdata=${tzdata}/share/zoneinfo" + "--enable-debug" + (lib.optionalString systemdSupport' "--with-systemd") + (if stdenv'.isDarwin then "--with-uuid=e2fs" else "--with-ossp-uuid") + ] + ++ lib.optionals lz4Enabled [ "--with-lz4" ] + ++ lib.optionals zstdEnabled [ "--with-zstd" ] + ++ lib.optionals gssSupport [ "--with-gssapi" ] + ++ lib.optionals pythonSupport [ "--with-python" ] + ++ lib.optionals jitSupport [ "--with-llvm" ] + ++ lib.optionals stdenv'.isLinux [ "--with-pam" ]; + + patches = [ + ( + if atLeast "16" then + ./patches/relative-to-symlinks-16+.patch + else + ./patches/relative-to-symlinks.patch ) - ++ lib.optionals stdenv'.isLinux [ - (if atLeast "13" then ./patches/socketdir-in-run-13+.patch else ./patches/socketdir-in-run.patch) - ]; + ./patches/less-is-more.patch + ./patches/paths-for-split-outputs.patch + ./patches/specify_pkglibdir_at_runtime.patch + ./patches/paths-with-postgresql-suffix.patch + + (replaceVars ./patches/locale-binary-path.patch { + locale = "${if stdenv.isDarwin then darwin.adv_cmds else lib.getBin stdenv.cc.libc}/bin/locale"; + }) + ] + ++ lib.optionals stdenv'.hostPlatform.isMusl ( + # Using fetchurl instead of fetchpatch on purpose: https://github.com/NixOS/nixpkgs/issues/240141 + map fetchurl (lib.attrValues muslPatches) + ) + ++ lib.optionals stdenv'.isLinux [ + (if atLeast "13" then ./patches/socketdir-in-run-13+.patch else ./patches/socketdir-in-run.patch) + ]; installTargets = [ "install-world-bin" ]; - postPatch = - '' - # Hardcode the path to pgxs so pg_config returns the path in $out - substituteInPlace "src/common/config_info.c" --subst-var out - substituteInPlace "src/backend/commands/collationcmds.c" --replace-fail '@locale@' '${ - if stdenv.isDarwin then darwin.adv_cmds else lib.getBin stdenv.cc.libc - }/bin/locale' - '' - + lib.optionalString jitSupport '' - # Force lookup of jit stuff in $out instead of $lib - substituteInPlace src/backend/jit/jit.c --replace pkglib_path \"$out/lib\" - substituteInPlace src/backend/jit/llvm/llvmjit.c --replace pkglib_path \"$out/lib\" - substituteInPlace src/backend/jit/llvm/llvmjit_inline.cpp --replace pkglib_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 - '' - + lib.optionalString jitSupport '' - # Move the bitcode and libllvmjit.so library out of $lib; otherwise, every client that - # depends on libpq.so will also have libLLVM.so in its closure too, bloating it - moveToOutput "lib/bitcode" "$out" - moveToOutput "lib/llvmjit*" "$out" - - # In the case of JIT support, prevent a retained dependency on clang-wrapper - substituteInPlace "$out/lib/pgxs/src/Makefile.global" --replace ${stdenv'.cc}/bin/clang clang - nuke-refs $out/lib/llvmjit_types.bc $(find $out/lib/bitcode -type f) - - # Stop out depending on the default output of llvm - substituteInPlace $out/lib/pgxs/src/Makefile.global \ - --replace ${llvmPackages.llvm.out}/bin "" \ - --replace '$(LLVM_BINPATH)/' "" - - # Stop out depending on the -dev output of llvm - substituteInPlace $out/lib/pgxs/src/Makefile.global \ - --replace ${llvmPackages.llvm.dev}/bin/llvm-config llvm-config \ - --replace -I${llvmPackages.llvm.dev}/include "" - - ${lib.optionalString (!stdenv'.isDarwin) '' - # Stop lib depending on the -dev output of llvm - rpath=$(patchelf --print-rpath $out/lib/llvmjit.so) - nuke-refs -e $out $out/lib/llvmjit.so - # Restore the correct rpath - patchelf $out/lib/llvmjit.so --set-rpath "$rpath" - ''} - ''; + postPatch = '' + # Hardcode the path to pgxs so pg_config returns the path in $out + substituteInPlace "src/common/config_info.c" --subst-var out + '' + + lib.optionalString jitSupport '' + # Force lookup of jit stuff in $out instead of $lib + substituteInPlace src/backend/jit/jit.c --replace pkglib_path \"$out/lib\" + substituteInPlace src/backend/jit/llvm/llvmjit.c --replace pkglib_path \"$out/lib\" + substituteInPlace src/backend/jit/llvm/llvmjit_inline.cpp --replace pkglib_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 + '' + + lib.optionalString jitSupport '' + # Move the bitcode and libllvmjit.so library out of $lib; otherwise, every client that + # depends on libpq.so will also have libLLVM.so in its closure too, bloating it + moveToOutput "lib/bitcode" "$out" + moveToOutput "lib/llvmjit*" "$out" + + # In the case of JIT support, prevent a retained dependency on clang-wrapper + substituteInPlace "$out/lib/pgxs/src/Makefile.global" --replace ${stdenv'.cc}/bin/clang clang + nuke-refs $out/lib/llvmjit_types.bc $(find $out/lib/bitcode -type f) + + # Stop out depending on the default output of llvm + substituteInPlace $out/lib/pgxs/src/Makefile.global \ + --replace ${llvmPackages.llvm.out}/bin "" \ + --replace '$(LLVM_BINPATH)/' "" + + # Stop out depending on the -dev output of llvm + substituteInPlace $out/lib/pgxs/src/Makefile.global \ + --replace ${llvmPackages.llvm.dev}/bin/llvm-config llvm-config \ + --replace -I${llvmPackages.llvm.dev}/include "" + + ${lib.optionalString (!stdenv'.isDarwin) '' + # Stop lib depending on the -dev output of llvm + rpath=$(patchelf --print-rpath $out/lib/llvmjit.so) + nuke-refs -e $out $out/lib/llvmjit.so + # Restore the correct rpath + patchelf $out/lib/llvmjit.so --set-rpath "$rpath" + ''} + ''; postFixup = lib.optionalString (!stdenv'.isDarwin && stdenv'.hostPlatform.libc == "glibc") '' # initdb needs access to "locale" command from glibc. @@ -321,22 +320,21 @@ let postgresql = this; } this.pkgs; - tests = - { - postgresql-wal-receiver = import ../../../../nixos/tests/postgresql-wal-receiver.nix { - inherit (stdenv) system; - pkgs = self; - package = this; - }; - pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage; - } - // lib.optionalAttrs jitSupport { - postgresql-jit = import ../../../../nixos/tests/postgresql-jit.nix { - inherit (stdenv) system; - pkgs = self; - package = this; - }; + tests = { + postgresql-wal-receiver = import ../../../../nixos/tests/postgresql-wal-receiver.nix { + inherit (stdenv) system; + pkgs = self; + package = this; }; + pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage; + } + // lib.optionalAttrs jitSupport { + postgresql-jit = import ../../../../nixos/tests/postgresql-jit.nix { + inherit (stdenv) system; + pkgs = self; + package = this; + }; + }; }; meta = with lib; { @@ -344,6 +342,7 @@ let description = "Powerful, open source object-relational database system"; license = licenses.postgresql; changelog = "https://www.postgresql.org/docs/release/${finalAttrs.version}/"; + teams = [ ]; maintainers = with maintainers; [ thoughtpolice danbst diff --git a/testinfra/test_ami_nix.py b/testinfra/test_ami_nix.py index ceed6c763..a3669965b 100644 --- a/testinfra/test_ami_nix.py +++ b/testinfra/test_ami_nix.py @@ -432,9 +432,9 @@ def is_healthy(ssh) -> bool: def test_postgrest_is_running(host): """Check if postgrest service is running using our SSH connection.""" result = run_ssh_command(host["ssh"], "systemctl is-active postgrest") - assert ( - result["succeeded"] and result["stdout"].strip() == "active" - ), "PostgREST service is not running" + assert result["succeeded"] and result["stdout"].strip() == "active", ( + "PostgREST service is not running" + ) def test_postgrest_responds_to_requests(host): @@ -557,9 +557,9 @@ def test_postgresql_version(host): if version_match: major_version = int(version_match.group(1)) print(f"PostgreSQL major version: {major_version}") - assert ( - major_version >= 14 - ), f"PostgreSQL version {major_version} is less than 14" + assert major_version >= 14, ( + f"PostgreSQL version {major_version} is less than 14" + ) else: assert False, "Could not parse PostgreSQL version number" else: @@ -589,9 +589,9 @@ def test_libpq5_version(host): if version_match: major_version = int(version_match.group(1)) print(f"libpq5 major version: {major_version}") - assert ( - major_version >= 14 - ), f"libpq5 version {major_version} is less than 14" + assert major_version >= 14, ( + f"libpq5 version {major_version} is less than 14" + ) else: print("Could not parse libpq5 version from dpkg output") else: @@ -624,9 +624,9 @@ def test_libpq5_version(host): if version_match: major_version = int(version_match.group(1)) print(f"psql/libpq major version: {major_version}") - assert ( - major_version >= 14 - ), f"psql/libpq version {major_version} is less than 14" + assert major_version >= 14, ( + f"psql/libpq version {major_version} is less than 14" + ) else: print("Could not parse psql version") @@ -787,7 +787,9 @@ def test_postgrest_read_only_session_attrs(host): print( f"\nFound 'session is not read-only' errors in PostgREST logs:\n{result['stdout']}" ) - assert False, "PostgREST logs contain 'session is not read-only' errors even though PostgreSQL is configured for read-only mode" + assert False, ( + "PostgREST logs contain 'session is not read-only' errors even though PostgreSQL is configured for read-only mode" + ) else: print("\nNo 'session is not read-only' errors found in PostgREST logs")