From 5e403d02e7e594deccf47c8df9bb3be74d855d02 Mon Sep 17 00:00:00 2001 From: Benjamin Sparks Date: Wed, 19 Aug 2026 01:30:00 +0200 Subject: [PATCH] pgschema: init at 1.12.3 (cherry picked from commit 7dc3643a32b03cc0a75606959f1751d00fb0cc7c) --- pkgs/by-name/pg/pgschema/package.nix | 55 ++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 pkgs/by-name/pg/pgschema/package.nix diff --git a/pkgs/by-name/pg/pgschema/package.nix b/pkgs/by-name/pg/pgschema/package.nix new file mode 100644 index 000000000000..6d826859b09f --- /dev/null +++ b/pkgs/by-name/pg/pgschema/package.nix @@ -0,0 +1,55 @@ +{ + lib, + buildGoModule, + fetchFromGitHub, + versionCheckHook, + postgresql, + nix-update-script, +}: + +buildGoModule (finalAttrs: { + pname = "pgschema"; + version = "1.12.3"; + __structuredAttrs = true; + + src = fetchFromGitHub { + owner = "pgplex"; + repo = "pgschema"; + tag = "v${finalAttrs.version}"; + hash = "sha256-zfG87Uc5bx14zhYnuT3CF+sW5EEQLBRRMyBe57FBHJ4="; + }; + + # Adapted from $src/nix/pgschema.nix + proxyVendor = true; + vendorHash = "sha256-3nV7AEsWyEvIbxHetoEsA8PPXJ6ENvU/sz7Wn5aysss="; + + env.CGO_ENABLED = "0"; + ldflags = [ + "-s" + "-w" + "-X" + "github.com/pgplex/pgschema/cmd.GitCommit=${finalAttrs.src.rev}" + # "-X" + # "github.com/pgplex/pgschema/cmd.BuildDate=${buildDate}" + "-X" + "github.com/pgplex/pgschema/internal/postgres.binariesPath=${postgresql}" + ]; + + doInstallCheck = true; + nativeInstallCheckInputs = [ + versionCheckHook + ]; + versionCheckProgramArg = "--help"; # there is no -v/--version + + passthru.updateScript = nix-update-script { }; + + meta = { + description = "Terraform-style, declarative Postgres schema migration"; + homepage = "https://github.com/pgplex/pgschema"; + changelog = "https://github.com/pgplex/pgschema/releases/tag/${finalAttrs.src.tag}"; + license = lib.licenses.asl20; + maintainers = [ lib.maintainers.bengsparks ]; + mainProgram = "pgschema"; + platforms = lib.platforms.unix; + }; +})