pgsty / pgsty/pigsty

Feature Request: nix packages support

Open
#637 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Shell
Stars
5.7k
Forks
384
Avg merge
2h 36m
Merged PRs (30d)
2

Description

Thank you for maintaining the valuable PostgreSQL packages and extensions in this repository! To expand accessibility and reliability for modern deployment workflows, we request official support for Nix packaging (including a dedicated nix branch).

Why Nix? Key advantages:

  • Unified packaging workflow
    Single Nix expression → deb, rpm, tarballs, Docker images, and Nix packages
    Eliminates per-format maintenance overhead
  • Reproducible environments
    Cryptographic hashes guarantee identical builds across all systems
  • Atomic upgrades & rollbacks
    Instantly revert failed deployments with zero downtime
  • Multi-version coexistence
    Run parallel PostgreSQL/extension versions without conflicts (ideal for CI/CD)
  • Declarative configuration
    Define entire stacks in version-controlled .nix files
  • Cross-platform support
    Consistent behavior across Linux/macOS

Requested Implementation

Component Purpose
nix branch Host Nix expressions versioned with main releases
default.nix Base package definition
release.nix Cross-format build pipeline (deb/rpm/Nix/etc.)

Impact

  • Single source-of-truth for all package formats
  • Reduce maintenance by 50-70% (no separate spec/dsc files)
  • Serve Debian/RPM users + Nix ecosystem simultaneously
  • Enable CI/CD parity from dev to production

I am happy to:

  • Provide implementation guidance
  • Contribute draft Nix expressions
  • Test initial builds

Example expression from nix-community for discussion:

{
  fetchFromGitHub,
  lib,
  postgresql,
  postgresqlBuildExtension,
}:

postgresqlBuildExtension (finalAttrs: {
  pname = "pgvector";
  version = "0.8.0";

  src = fetchFromGitHub {
    owner = "pgvector";
    repo = "pgvector";
    tag = "v${finalAttrs.version}";
    hash = "sha256-JsZV+I4eRMypXTjGmjCtMBXDVpqTIPHQa28ogXncE/Q=";
  };

  meta = {
    description = "Open-source vector similarity search for PostgreSQL";
    homepage = "https://github.com/pgvector/pgvector";
    changelog = "https://github.com/pgvector/pgvector/raw/v${finalAttrs.version}/CHANGELOG.md";
    license = lib.licenses.postgresql;
    platforms = postgresql.meta.platforms;
    maintainers = [ ];
  };
})

Example workflow

# Build all package formats from one expression  
nix-build release.nix -A deb -A rpm -A nixpkg  

# Output:  
# ./result/deb/postgresql-custom_15.3.deb  
# ./result/rpm/postgresql-custom-15.3.rpm  
# ./result/nixpkg/*.nix  

Example release.nix

{ pkgs ? import <nixpkgs> {} }:  

let  
  pkg = import ./default.nix { inherit pkgs; };  
in {  
  deb = pkgs.runCommand "${pkg.name}-deb" {} ''  
    ${pkgs.nixpack}/bin/nixpack -f deb ${pkg} > $out  
  '';  

  rpm = pkgs.runCommand "${pkg.name}-rpm" {} ''  
    ${pkgs.nixpack}/bin/nixpack -f rpm ${pkg} > $out  
  '';  
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the repository's existing packaging workflow, then compare it with the proposed default.nix and release.nix structure in the issue. Determine how a Nix branch and package definitions would fit alongside the current release artifacts. Done means reproducible Nix builds are integrated without breaking existing Debian and RPM packaging.

Written by the indexing model from the issue text.

Assessment

Tech stack
shell
Domain
build-system, devops, release
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.