supabase-postgres.git / summary / log / commit / refs
commit 659cf9938ab3c19e1807bf906077ea05f62f0add
Author: Manuel Mendez <708570+mmlb@users.noreply.github.com>
Commit: GitHub <noreply@github.com>
Date: Tue Sep 22 12:52:10 2026 +0000
Drop explicit pgrx outputs/packages (#2475)
pgrx is a build dep for rust extensions but not really necessary as an
output in this repo. These attributes aren't even used anyway since we
use mkPgrxExtension to build rust extensions and that uses pgrxs defined
in nix/ext/versions.json which builds pgrx using hashes from
nix/cargo-pgrx/versions.json.
These were only used for devshells for the extensions but those are
better off in their own repos.
nix/cargo-pgrx/default.nix | 35 +--------------
nix/devShells.nix | 19 --------
nix/docs/creating-pgrx-extension.md | 87 +++++++++---------------------------
nix/docs/updating-pgrx-extensions.md | 27 ++---------
nix/packages/default.nix | 6 ---
5 files changed, 28 insertions(+), 146 deletions(-)
diff --git a/nix/cargo-pgrx/default.nix b/nix/cargo-pgrx/default.nix
index d1c890fc..f2342c02 100644
--- a/nix/cargo-pgrx/default.nix
+++ b/nix/cargo-pgrx/default.nix
@@ -15,6 +15,8 @@ let
cargo = rust-bin.stable.${rustVersion}.default;
rustc = rust-bin.stable.${rustVersion}.default;
});
+in
+{
mkCargoPgrx =
{
version,
@@ -65,37 +67,4 @@ let
mainProgram = "cargo-pgrx";
};
};
-in
-{
- cargo-pgrx_0_10_2 = mkCargoPgrx {
- version = "0.10.2";
- hash = "sha256-FqjfbJmSy5UCpPPPk4bkEyvQCnaH9zYtkI7txgIn+ls=";
- cargoHash = "sha256-syZ3cQq8qDHBLvqmNDGoxeK6zXHJ47Jwkw3uhaXNCzI=";
- };
- cargo-pgrx_0_11_3 = mkCargoPgrx {
- version = "0.11.3";
- hash = "sha256-UHIfwOdXoJvR4Svha6ud0FxahP1wPwUtviUwUnTmLXU=";
- cargoHash = "sha256-j4HnD8Zt9uhlV5N7ldIy9564o9qFEqs5KfXHmnQ1WEw=";
- };
- cargo-pgrx_0_12_6 = mkCargoPgrx {
- version = "0.12.6";
- hash = "sha256-7aQkrApALZe6EoQGVShGBj0UIATnfOy2DytFj9IWdEA=";
- cargoHash = "sha256-pnMxWWfvr1/AEp8DvG4awig8zjdHizJHoZ5RJA8CL08=";
- };
- cargo-pgrx_0_12_9 = mkCargoPgrx {
- version = "0.12.9";
- hash = "sha256-aR3DZAjeEEAjLQfZ0ZxkjLqTVMIEbU0UiZ62T4BkQq8=";
- cargoHash = "sha256-yZpD3FriL9UbzRtdFkfIfFfYIrRPYxr/lZ5rb0YBTPc=";
- };
- cargo-pgrx_0_14_3 = mkCargoPgrx {
- version = "0.14.3";
- hash = "sha256-3TsNpEqNm3Uol5XPW1i0XEbP2fF2+RKB2d7lO6BDnvQ=";
- cargoHash = "sha256-LZUXhjMxkBs3O5feH4X5NQC7Qk4Ja6M5+sAYaSCikrY=";
- };
- cargo-pgrx_0_19_2 = mkCargoPgrx {
- version = "0.19.2";
- hash = "sha256-PANc819AhIE9yJ6NFHGJxHJHWZyR2Srmj2cEz3vQmJk=";
- cargoHash = "sha256-cTD7x36FvFUIwVLuAqrOJ75vLDppITiDrY8Fs3RjPqU=";
- };
- inherit mkCargoPgrx;
}
diff --git a/nix/devShells.nix b/nix/devShells.nix
index a20e92c0..652a41a0 100644
--- a/nix/devShells.nix
+++ b/nix/devShells.nix
@@ -21,17 +21,6 @@
paramiko
]
);
- mkCargoPgrxDevShell =
- { pgrxVersion, rustVersion }:
- pkgs.mkShell {
- packages = with pkgs; [
- self'.packages."cargo-pgrx_${pgrxVersion}"
- (rust-bin.stable.${rustVersion}.default.override { extensions = [ "rust-src" ]; })
- ];
- shellHook = ''
- export HISTFILE=.history
- '';
- };
docvenv = pkgs.python3.buildEnv.override {
extraLibs = self'.packages.docs.nativeBuildInputs;
};
@@ -147,14 +136,6 @@
}
];
};
- cargo-pgrx_0_11_3 = mkCargoPgrxDevShell {
- pgrxVersion = "0_11_3";
- rustVersion = "1.80.0";
- };
- cargo-pgrx_0_12_6 = mkCargoPgrxDevShell {
- pgrxVersion = "0_12_6";
- rustVersion = "1.80.0";
- };
};
};
}
diff --git a/nix/docs/creating-pgrx-extension.md b/nix/docs/creating-pgrx-extension.md
index 863d9309..6bc944f9 100644
--- a/nix/docs/creating-pgrx-extension.md
+++ b/nix/docs/creating-pgrx-extension.md
@@ -1,8 +1,8 @@
-# Creating a New pgrx Extension
+# Creating a new pgrx extension
This guide covers how to set up a new cargo pgrx PostgreSQL extension in this project.
-## Template: New pgrx Extension
+## Template: New pgrx extension
### 1. Directory Structure
@@ -122,7 +122,7 @@ Edit `nix/ext/versions.json` and add your extension:
"my_extension": {
"0.1.0": {
"postgresql": ["15", "17"],
- "hash": "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=",
+ "hash": "",
"pgrx": "0.12.6",
"rust": "1.80.0"
}
@@ -130,11 +130,13 @@ Edit `nix/ext/versions.json` and add your extension:
}
```
-**To calculate the hash:** Use a dummy hash first, then run:
+Run the following to calculate content hash:
+
```bash
nix build .#psql_15.exts.my_extension -L
```
-The error message will show the correct hash.
+
+The error message will show the correct hash, update the `hash` attribute in versions.json.
### 4. Register in postgres.nix
@@ -149,59 +151,14 @@ ourExtensions = [
## Files to Modify (Summary)
-| File | Change |
-|------|--------|
-| `nix/ext/my_extension/default.nix` | Create new file |
-| `nix/ext/versions.json` | Add version entry |
-| `nix/packages/postgres.nix` | Add to `ourExtensions` list |
-| `nix/tests/sql/my_extension.sql` | (optional) Add test SQL |
+| File | Change |
+| ------------------------------------- | ------------------------------- |
+| `nix/ext/my_extension/default.nix` | Create new file |
+| `nix/ext/versions.json` | Add version entry |
+| `nix/packages/postgres.nix` | Add to `ourExtensions` list |
+| `nix/tests/sql/my_extension.sql` | (optional) Add test SQL |
| `nix/tests/expected/my_extension.out` | (optional) Expected test output |
-## Using nix develop for Extension Development
-
-### Available Dev Shells
-
-```bash
-# List all available dev shells
-nix flake show | grep devShells
-
-# Enter pgrx 0.12.6 development environment (Rust 1.80.0)
-nix develop .#cargo-pgrx_0_12_6
-
-# Enter pgrx 0.14.3 development environment (Rust 1.87.0)
-nix develop .#cargo-pgrx_0_14_3
-
-# Default shell (general tooling, not pgrx-specific)
-nix develop
-```
-
-### Inside the Dev Shell
-
-Once inside `nix develop .#cargo-pgrx_0_12_6`:
-
-```bash
-# Initialize pgrx (first time only)
-cargo pgrx init --pg15 $(which pg_config)
-
-# Create a new extension from scratch
-cargo pgrx new my_extension
-cd my_extension
-
-# Build and test your extension
-cargo pgrx run pg15
-
-# Package for release
-cargo pgrx package
-```
-
-### Dev Shell Contents
-
-The pgrx dev shells provide:
-- Correct Rust toolchain version
-- `cargo-pgrx` CLI matching the pgrx version
-- PostgreSQL headers and pg_config
-- Required build tools (pkg-config, openssl, etc.)
-
## Build Commands
```bash
@@ -222,17 +179,17 @@ nix flake check -L
From `nix/cargo-pgrx/versions.json`:
-| pgrx Version | Rust Version |
-|--------------|--------------|
-| 0.12.6 | 1.80.0, 1.81.0 |
-| 0.14.3 | 1.87.0 |
+| pgrx Version | Rust Version |
+| ------------ | -------------- |
+| 0.12.6 | 1.80.0, 1.81.0 |
+| 0.14.3 | 1.87.0 |
Match your extension's pgrx dependency to a supported combination.
## Existing Examples to Reference
-| Extension | Path | Notes |
-|-----------|------|-------|
-| pg_graphql | `nix/ext/pg_graphql/default.nix` | Clean pgrx example |
-| pg_jsonschema | `nix/ext/pg_jsonschema/default.nix` | Simple single-crate |
-| wrappers | `nix/ext/wrappers/default.nix` | Complex with git deps |
+| Extension | Path | Notes |
+| ------------- | ----------------------------------- | --------------------- |
+| pg_graphql | `nix/ext/pg_graphql/default.nix` | Clean pgrx example |
+| pg_jsonschema | `nix/ext/pg_jsonschema/default.nix` | Simple single-crate |
+| wrappers | `nix/ext/wrappers/default.nix` | Complex with git deps |
diff --git a/nix/docs/updating-pgrx-extensions.md b/nix/docs/updating-pgrx-extensions.md
index 6b282beb..3cbbd390 100644
--- a/nix/docs/updating-pgrx-extensions.md
+++ b/nix/docs/updating-pgrx-extensions.md
@@ -119,8 +119,6 @@ Use this when the extension requires a newer pgrx version.
| `nix/ext/versions.json` | Add new version with new pgrx version |
| `nix/ext/<extension>/default.nix` | Add old version to `allPreviouslyPackagedVersions` |
| `nix/cargo-pgrx/versions.json` | Add new pgrx version (if not already present) |
-| `nix/cargo-pgrx/default.nix` | Add new `cargo-pgrx_x_y_z` entry (if not already present) |
-| `nix/overlays/default.nix` | Add new `buildPgrxExtension_x_y_z` (if not already present) |
### Steps
@@ -143,27 +141,10 @@ Use this when the extension requires a newer pgrx version.
}
```
- The `rust` object maps Rust versions to their corresponding `cargoHash`. You'll need to calculate both the `hash` (for the pgrx crate) and `cargoHash` (for cargo dependencies).
+ The `rust` object maps Rust versions to their corresponding `cargoHash`.
+ You'll need to calculate both the `hash` (for the pgrx crate) and `cargoHash` (for cargo dependencies).
-3. **Add cargo-pgrx entry** in `nix/cargo-pgrx/default.nix`:
-
- ```nix
- cargo-pgrx_0_16_1 = mkCargoPgrx {
- version = "0.16.1";
- hash = "";
- cargoHash = "";
- };
- ```
-
-4. **Add overlay entry** in `nix/overlays/default.nix`:
-
- ```nix
- buildPgrxExtension_0_16_1 = prev.buildPgrxExtension.override {
- cargo-pgrx = final.cargo-pgrx.cargo-pgrx_0_16_1;
- };
- ```
-
-5. **Update `nix/ext/versions.json`** with the new extension version:
+3. **Update `nix/ext/versions.json`** with the new extension version:
```json
"0.5.7": {
@@ -174,7 +155,7 @@ Use this when the extension requires a newer pgrx version.
}
```
-6. **Stage and build** to calculate hashes:
+4. **Stage and build** to calculate hashes:
```bash
git add .
diff --git a/nix/packages/default.nix b/nix/packages/default.nix
index 9cc337e9..bcb8ab00 100644
--- a/nix/packages/default.nix
+++ b/nix/packages/default.nix
@@ -123,12 +123,6 @@
inherit (pkgs.callPackage ./wal-g.nix { }) wal-g-2 wal-g-3;
inherit (supascan-pkgs) goss supascan supascan-specs;
inherit (pg-startup-profiler-pkgs) pg-startup-profiler;
- inherit (pkgs.cargo-pgrx)
- cargo-pgrx_0_11_3
- cargo-pgrx_0_12_6
- cargo-pgrx_0_12_9
- cargo-pgrx_0_14_3
- ;
}
// lib.optionalAttrs pkgs.stdenv.isDarwin {
setup-darwin-linux-builder = pkgs.callPackage ./setup-darwin-linux-builder.nix {
[parent: 9d7f4ea73d66]