Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
51cab3e
chores(ci): opted-out nix-fast-build
yvan-sraka Jul 22, 2025
04afad0
chores(ci): set up nix-github-actions
yvan-sraka Jul 24, 2025
e2db368
chores(ci): comment out vestigal testinfra-ami-build
yvan-sraka Aug 11, 2025
877f3c3
chores(ci): use custom github runners
yvan-sraka Aug 11, 2025
a4badb8
chores(ci): use nix-eval-jobs and sets AWS creds to /etc/nix/aws
yvan-sraka Sep 29, 2025
62305a7
feat(ci): do not build if already cached
jfroche Sep 29, 2025
46c66e4
chore: improve reproducibility of postgresql builds
jfroche Sep 29, 2025
eed0d78
chore: remove nix-github-actions dependency
jfroche Sep 29, 2025
ddf6b6c
feat(ci): split nix build workflow into separate extensions and check…
jfroche Sep 30, 2025
1e9f185
feat(ci): extract nix build setup into reusable action and split buil…
jfroche Sep 30, 2025
48f3d00
fix(ci): do not hide cached builds
jfroche Sep 30, 2025
e352434
Revert "fix(ci): do not hide cached builds"
jfroche Sep 30, 2025
726c9f3
chore: Temporarily disable x86_64-linux builds
jfroche Sep 30, 2025
32d9ae5
fix: sort packages and filter out cached ones
jfroche Sep 30, 2025
094736d
fix: do not skip checks-matrix if dependencies are skipped
jfroche Sep 30, 2025
cd6fec2
fix: do not return debug fields in GitHub Actions matrix output
jfroche Sep 30, 2025
ebf76d6
debugging
jfroche Sep 30, 2025
ea6dafa
fix(ci): use !cancelled() instead of always() for dependent job condi…
jfroche Oct 2, 2025
c7f1653
fix(ci): stop chaining aws roles
jfroche Oct 2, 2025
16c6005
ci: run nixos test on aarch64-linux
jfroche Oct 2, 2025
dc80fb9
fix(ci): disable eval-cache and accept-flake-config
jfroche Oct 2, 2025
ed9415b
ci: split checks build jobs by system architecture
jfroche Oct 2, 2025
e0bfe74
fix(ci): use correct architecture name in aarch64-linux builds
jfroche Oct 3, 2025
dd4f250
fix(ci): do not try to build already cached checks
jfroche Oct 3, 2025
728223a
fix(ci): simplify GitHub Actions workflow for Nix builds
jfroche Oct 3, 2025
dd3ad19
Revert "chores(ci): comment out vestigal testinfra-ami-build"
jfroche Oct 3, 2025
bac931a
chore: add our substituter config to flake.nix
jfroche Oct 3, 2025
7459e89
feat: remove git revision from postgres package
jfroche Oct 3, 2025
38f7257
feat(ci): eval on blacksmith-32vcpu-ubuntu-2404
jfroche Oct 3, 2025
b6ad602
feat: add ephemeral Nix install action for GitHub runners
jfroche Oct 3, 2025
43e882b
refactor(ci): extract nix eval into reusable workflow
jfroche Oct 3, 2025
5abba2b
feat: enable x86_64-linux builds in CI
jfroche Oct 6, 2025
61d1133
feat: add PostgreSQL version to GitHub Actions job names
jfroche Oct 6, 2025
4119f66
fix: disable treefmt flake check
jfroche Oct 6, 2025
d137b24
feat: run actionlint on new GitHub Actions workflows
jfroche Oct 6, 2025
7e9cc69
chore: improve github matrix script type annotations
jfroche Oct 6, 2025
8ae83cb
feat: optimize CI runner selection based on package size
jfroche Oct 6, 2025
0582c7a
chore: fix package meta maintainers format
jfroche Oct 6, 2025
20bffac
fix: use ephemeral runner for aarch64 builds
jfroche Oct 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/actionlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
self-hosted-runner:
labels:
- aarch64-darwin
- aarch64-linux
- blacksmith-32vcpu-ubuntu-2404
46 changes: 46 additions & 0 deletions .github/actions/nix-install-ephemeral/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: 'Install Nix on ephemeral runners'
description: 'Installs Nix and sets up AWS credentials to push to the Nix binary cache'
inputs:
push-to-cache:
description: 'Whether to push build outputs to the Nix binary cache'
required: false
default: 'true'
runs:
using: 'composite'
steps:
- name: aws-creds
uses: aws-actions/configure-aws-credentials@v4
if: ${{ inputs.push-to-cache == 'true' }}
with:
role-to-assume: ${{ env.DEV_AWS_ROLE }}
aws-region: "us-east-1"
output-credentials: true
role-duration-seconds: 7200
- name: Setup AWS credentials for Nix
if: ${{ inputs.push-to-cache == 'true' }}
shell: bash
run: |
sudo -H aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID
sudo -H aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY
sudo -H aws configure set aws_session_token $AWS_SESSION_TOKEN
sudo mkdir -p /etc/nix
sudo -E python -c "import os; file = open('/etc/nix/nix-secret-key', 'w'); file.write(os.environ['NIX_SIGN_SECRET_KEY']); file.close()"
cat << 'EOF' | sudo tee /etc/nix/upload-to-cache.sh > /dev/null
#!/usr/bin/env bash
set -euo pipefail
set -f

export IFS=' '
/nix/var/nix/profiles/default/bin/nix copy --to 's3://nix-postgres-artifacts?secret-key=/etc/nix/nix-secret-key' $OUT_PATHS
EOF
sudo chmod +x /etc/nix/upload-to-cache.sh
env:
NIX_SIGN_SECRET_KEY: ${{ env.NIX_SIGN_SECRET_KEY }}
- name: Install nix
uses: cachix/install-nix-action@v31
with:
install_url: https://releases.nixos.org/nix/nix-2.31.2/install
extra_nix_config: |
substituters = https://cache.nixos.org https://nix-postgres-artifacts.s3.amazonaws.com
trusted-public-keys = nix-postgres-artifacts:dGZlQOvKcNEjvT7QEAJbcV6b6uk7VF/hWMjhYleiaLI=% cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
${{ inputs.push-to-cache == 'true' && 'post-build-hook = /etc/nix/upload-to-cache.sh' || '' }}
30 changes: 30 additions & 0 deletions .github/actions/nix-install-self-hosted/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: 'Configure Nix on self hosted runners'
description: 'Sets up AWS credentials to push to the Nix binary cache'
inputs:
aws-role-duration:
description: 'AWS role session duration in seconds'
required: false
default: '18000'

runs:
using: 'composite'
steps:
- name: aws-creds
uses: aws-actions/[email protected]
with:
disable-retry: true
aws-region: us-east-2
role-to-assume: arn:aws:iam::436098097459:role/nix-artifacts-deploy-role # supabase-dev
role-session-name: gha-oidc-${{ github.run_id }}
role-duration-seconds: ${{ inputs.aws-role-duration }}

- name: Write creds files
shell: bash
run: |
umask 006
cat > /etc/nix/aws/nix-aws-credentials <<EOF
[ci-uploader]
aws_access_key_id = ${AWS_ACCESS_KEY_ID}
aws_secret_access_key = ${AWS_SECRET_ACCESS_KEY}
aws_session_token = ${AWS_SESSION_TOKEN}
EOF
171 changes: 73 additions & 98 deletions .github/workflows/nix-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,118 +14,93 @@ permissions:
contents: write
packages: write

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
build-run-image:
nix-eval:
uses: ./.github/workflows/nix-eval.yml
secrets:
DEV_AWS_ROLE: ${{ secrets.DEV_AWS_ROLE }}
NIX_SIGN_SECRET_KEY: ${{ secrets.NIX_SIGN_SECRET_KEY }}

nix-build-aarch64-linux:
name: >-
${{ matrix.name }}${{ matrix.postgresql_version && format(' - Postgres {0}', matrix.postgresql_version) || '' }}
(aarch64-linux)
needs: nix-eval
runs-on: ${{ matrix.runs_on.group && matrix.runs_on || matrix.runs_on.labels }}
if: ${{ fromJSON(needs.nix-eval.outputs.matrix).aarch64_linux != null }}
strategy:
fail-fast: false
matrix:
include:
- runner: blacksmith-32vcpu-ubuntu-2404
arch: amd64
- runner: blacksmith-32vcpu-ubuntu-2404-arm
arch: arm64
- runner: macos-latest-xlarge
arch: arm64
runs-on: ${{ matrix.runner }}
timeout-minutes: 180
max-parallel: 5
matrix: ${{ fromJSON(needs.nix-eval.outputs.matrix).aarch64_linux }}
steps:
- name: Checkout Repo
uses: supabase/postgres/.github/actions/shared-checkout@HEAD
- name: aws-creds
uses: aws-actions/configure-aws-credentials@v4
if: ${{ github.secret_source == 'Actions' }}
with:
role-to-assume: ${{ secrets.DEV_AWS_ROLE }}
aws-region: "us-east-1"
output-credentials: true
role-duration-seconds: 7200
- name: Setup AWS credentials for Nix
if: ${{ github.secret_source == 'Actions' }}
run: |
sudo -H aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID
sudo -H aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY
sudo -H aws configure set aws_session_token $AWS_SESSION_TOKEN
- name: write secret key
# use python so we don't interpolate the secret into the workflow logs, in case of bugs
run: |
sudo mkdir -p /etc/nix
sudo -E python -c "import os; file = open('/etc/nix/nix-secret-key', 'w'); file.write(os.environ['NIX_SIGN_SECRET_KEY']); file.close()"
uses: actions/checkout@v4
- name: Install nix
uses: ./.github/actions/nix-install-ephemeral
env:
DEV_AWS_ROLE: ${{ secrets.DEV_AWS_ROLE }}
NIX_SIGN_SECRET_KEY: ${{ secrets.NIX_SIGN_SECRET_KEY }}
- name: Setup cache script
if: ${{ github.secret_source == 'Actions' }}
run: |
cat << 'EOF' | sudo tee /etc/nix/upload-to-cache.sh > /dev/null
#!/usr/bin/env bash
set -euf
export IFS=' '
/nix/var/nix/profiles/default/bin/nix copy --to 's3://nix-postgres-artifacts?secret-key=/etc/nix/nix-secret-key' $OUT_PATHS
EOF
sudo chmod +x /etc/nix/upload-to-cache.sh
- name: Install nix
uses: cachix/install-nix-action@v27
if: ${{ github.secret_source == 'Actions' }}
with:
install_url: https://releases.nixos.org/nix/nix-2.29.1/install
extra_nix_config: |
substituters = https://cache.nixos.org https://nix-postgres-artifacts.s3.amazonaws.com
trusted-public-keys = nix-postgres-artifacts:dGZlQOvKcNEjvT7QEAJbcV6b6uk7VF/hWMjhYleiaLI=% cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
post-build-hook = /etc/nix/upload-to-cache.sh
- name: nix build
shell: bash
run: nix build --accept-flake-config -L .#${{ matrix.attr }}

nix-build-aarch64-darwin:
name: >-
${{ matrix.name }}${{ matrix.postgresql_version && format(' - Postgres {0}', matrix.postgresql_version) || '' }}
(aarch64-darwin)
needs: nix-eval
runs-on: ${{ matrix.runs_on.group && matrix.runs_on || matrix.runs_on.labels }}
if: ${{ fromJSON(needs.nix-eval.outputs.matrix).aarch64_darwin != null }}
strategy:
fail-fast: false
max-parallel: 5
matrix: ${{ fromJSON(needs.nix-eval.outputs.matrix).aarch64_darwin }}
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Build Nix Package
uses: ./.github/actions/nix-install-self-hosted
- name: nix build
shell: bash
run: nix build --accept-flake-config -L .#${{ matrix.attr }}

nix-build-x86_64-linux:
name: >-
${{ matrix.name }}${{ matrix.postgresql_version && format(' - Postgres {0}', matrix.postgresql_version) || '' }}
(x86_64-linux)
needs: nix-eval
runs-on: ${{ matrix.runs_on.group && matrix.runs_on || matrix.runs_on.labels }}
if: ${{ fromJSON(needs.nix-eval.outputs.matrix).x86_64_linux != null }}
strategy:
fail-fast: false
max-parallel: 5
matrix: ${{ fromJSON(needs.nix-eval.outputs.matrix).x86_64_linux }}
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Install nix
uses: cachix/install-nix-action@v27
if: ${{ github.secret_source == 'None' }}
with:
install_url: https://releases.nixos.org/nix/nix-2.29.1/install
extra_nix_config: |
substituters = https://cache.nixos.org https://nix-postgres-artifacts.s3.amazonaws.com
trusted-public-keys = nix-postgres-artifacts:dGZlQOvKcNEjvT7QEAJbcV6b6uk7VF/hWMjhYleiaLI=% cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
- name: Aggressive disk cleanup for DuckDB build
if: matrix.runner == 'macos-latest-xlarge'
run: |
nix --version
echo "=== BEFORE CLEANUP ==="
df -h
# Remove major space consumers
sudo rm -rf /usr/share/dotnet || true
sudo rm -rf /usr/local/lib/android || true
sudo rm -rf /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform || true
sudo rm -rf /Applications/Xcode.app/Contents/Developer/Platforms/watchOS.platform || true
sudo rm -rf /Applications/Xcode.app/Contents/Developer/Platforms/tvOS.platform || true
# Clean everything possible
sudo rm -rf /opt/ghc || true
sudo rm -rf /usr/local/share/boost || true
sudo rm -rf /opt/homebrew || true
sudo xcrun simctl delete all 2>/dev/null || true
# Aggressive cache cleanup
sudo rm -rf /System/Library/Caches/* 2>/dev/null || true
sudo rm -rf /Library/Caches/* 2>/dev/null || true
sudo rm -rf ~/Library/Caches/* 2>/dev/null || true
sudo rm -rf /private/var/log/* 2>/dev/null || true
sudo rm -rf /tmp/* 2>/dev/null || true
echo "=== AFTER CLEANUP ==="
df -h
- name: Build psql bundle
run: >
nix run "github:Mic92/nix-fast-build?rev=b1dae483ab7d4139a6297e02b6de9e5d30e43d48"
-- --skip-cached --no-nom ${{ matrix.runner == 'macos-latest-xlarge' && '--max-jobs 1' || '' }}
--flake ".#checks.$(nix eval --raw --impure --expr 'builtins.currentSystem')"
uses: ./.github/actions/nix-install-ephemeral
env:
AWS_ACCESS_KEY_ID: ${{ env.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ env.AWS_SECRET_ACCESS_KEY }}
AWS_SESSION_TOKEN: ${{ env.AWS_SESSION_TOKEN }}
DEV_AWS_ROLE: ${{ secrets.DEV_AWS_ROLE }}
NIX_SIGN_SECRET_KEY: ${{ secrets.NIX_SIGN_SECRET_KEY }}
- name: nix build
shell: bash
run: nix build --accept-flake-config -L .#${{ matrix.attr }}

run-testinfra:
needs: build-run-image
if: ${{ success() }}
needs: [nix-build-aarch64-linux, nix-build-aarch64-darwin, nix-build-x86_64-linux]
if: |
!cancelled() &&
(needs.nix-build-aarch64-linux.result == 'skipped' || needs.nix-build-aarch64-linux.result == 'success') &&
(needs.nix-build-aarch64-darwin.result == 'skipped' || needs.nix-build-aarch64-darwin.result == 'success')
uses: ./.github/workflows/testinfra-ami-build.yml
secrets:
DEV_AWS_ROLE: ${{ secrets.DEV_AWS_ROLE }}

run-tests:
needs: build-run-image
if: ${{ success() }}
needs: [nix-build-aarch64-linux, nix-build-aarch64-darwin, nix-build-x86_64-linux]
if: |
!cancelled() &&
(needs.nix-build-aarch64-linux.result == 'skipped' || needs.nix-build-aarch64-linux.result == 'success') &&
(needs.nix-build-aarch64-darwin.result == 'skipped' || needs.nix-build-aarch64-darwin.result == 'success')
uses: ./.github/workflows/test.yml
32 changes: 32 additions & 0 deletions .github/workflows/nix-eval.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Nix Eval

on:
workflow_call:
outputs:
matrix:
description: 'Generated build matrix'
value: ${{ jobs.eval.outputs.matrix }}
secrets:
DEV_AWS_ROLE:
required: false
NIX_SIGN_SECRET_KEY:
required: false

jobs:
eval:
runs-on: blacksmith-32vcpu-ubuntu-2404
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Install nix
uses: ./.github/actions/nix-install-ephemeral
env:
DEV_AWS_ROLE: ${{ secrets.DEV_AWS_ROLE }}
NIX_SIGN_SECRET_KEY: ${{ secrets.NIX_SIGN_SECRET_KEY }}
- id: set-matrix
name: Generate Nix Matrix
run: |
set -Eeu
echo matrix="$(nix shell github:nix-community/nix-eval-jobs/v2.31.0 --command scripts/github-matrix.py checks legacyPackages)" >> "$GITHUB_OUTPUT"
7 changes: 6 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
{
description = "Prototype tooling for deploying PostgreSQL";

nixConfig = {
extra-substituters = [ "https://nix-postgres-artifacts.s3.amazonaws.com" ];
extra-trusted-public-keys = [
"nix-postgres-artifacts:dGZlQOvKcNEjvT7QEAJbcV6b6uk7VF/hWMjhYleiaLI=%"
];
};
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
Expand Down
22 changes: 10 additions & 12 deletions nix/checks.nix
Original file line number Diff line number Diff line change
Expand Up @@ -344,24 +344,22 @@
pg_regress
;
}
// pkgs.lib.optionalAttrs (system == "aarch64-linux") {
inherit (self'.packages)
postgresql_15_debug
postgresql_15_src
postgresql_orioledb-17_debug
postgresql_orioledb-17_src
postgresql_17_debug
postgresql_17_src
;
}
// pkgs.lib.optionalAttrs (system == "x86_64-linux") (
// pkgs.lib.optionalAttrs (system == "aarch64-linux") (
{
devShell = self'.devShells.default;
inherit (self'.packages)
postgresql_15_debug
postgresql_15_src
postgresql_orioledb-17_debug
postgresql_orioledb-17_src
postgresql_17_debug
postgresql_17_src
;
}
// (import ./ext/tests {
inherit self;
inherit pkgs;
})
// pkgs.lib.optionalAttrs (system == "x86_64-linux") { devShell = self'.devShells.default; }
);
};
}
2 changes: 1 addition & 1 deletion nix/docs/adding-new-package.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ stdenv.mkDerivation rec {
meta = with lib; {
description = "Open-source vector similarity search for Postgres";
homepage = "https://github.com/${src.owner}/${src.repo}";
maintainers = with maintainers; [ olirice ];
maintainers = [ "olirice" ];
platforms = postgresql.meta.platforms;
license = licenses.postgresql;
};
Expand Down
2 changes: 1 addition & 1 deletion nix/ext/pgmq.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ stdenv.mkDerivation rec {
meta = with lib; {
description = "A lightweight message queue. Like AWS SQS and RSMQ but on Postgres.";
homepage = "https://github.com/tembo-io/pgmq";
maintainers = with maintainers; [ olirice ];
maintainers = [ "olirice" ];
platforms = postgresql.meta.platforms;
license = licenses.postgresql;
};
Expand Down
2 changes: 1 addition & 1 deletion nix/ext/pgvector.nix
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ let
meta = with lib; {
description = "Open-source vector similarity search for Postgres";
homepage = "https://github.com/${src.owner}/${src.repo}";
maintainers = with maintainers; [ olirice ];
maintainers = [ "olirice" ];
platforms = postgresql.meta.platforms;
license = licenses.postgresql;
};
Expand Down
1 change: 1 addition & 0 deletions nix/fmt.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
perSystem =
{ pkgs, ... }:
{
treefmt.flakeCheck = false;
treefmt.programs = {
deadnix.enable = true;
nixfmt = {
Expand Down
Loading
Loading