From cdc837dfc595a4f851debb4aad95429f97033a04 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 11 Jul 2026 08:22:49 +0200 Subject: [PATCH] Add postgresql-unit extension --- nix/ext/postgresql-unit.nix | 39 +++++++++++++++++++++++++++++++++++++ nix/packages/postgres.nix | 1 + 2 files changed, 40 insertions(+) create mode 100644 nix/ext/postgresql-unit.nix diff --git a/nix/ext/postgresql-unit.nix b/nix/ext/postgresql-unit.nix new file mode 100644 index 0000000000..d10f66d017 --- /dev/null +++ b/nix/ext/postgresql-unit.nix @@ -0,0 +1,39 @@ +{ lib, stdenv, fetchFromGitHub, postgresql, flex, bison }: + +stdenv.mkDerivation rec { + pname = "postgresql-unit"; + version = "7.10"; + name = "postgresql-unit"; + buildInputs = [ postgresql ]; + nativeBuildInputs = [ flex bison ]; + + src = fetchFromGitHub { + owner = "df7cb"; + repo = pname; + rev = "${version}"; + hash = "sha256-glVyW0n34I3QArlTscV+p1/sfhIfFbeH192rf9uYJp0="; + }; + + + installPhase = '' + mkdir -p $out/{lib,share/postgresql/extension} + + # Fix the @MODULEDIR@ / postgresql path reference + substituteInPlace *.sql \ + --replace "${postgresql}/share/postgresql/extension/" "$out/share/postgresql/extension/" + + cp *.so $out/lib + cp *.sql $out/share/postgresql/extension + cp *.data $out/share/postgresql/extension + cp *.control $out/share/postgresql/extension + + ''; + + meta = with lib; { + description = "Unit testing framework for PostgreSQL"; + homepage = "https://github.com/${src.owner}/${src.repo}"; + maintainers = [ "df7cb" ]; + platforms = postgresql.meta.platforms; + license = licenses.postgresql; + }; +} diff --git a/nix/packages/postgres.nix b/nix/packages/postgres.nix index 87daccdae7..07456811ac 100644 --- a/nix/packages/postgres.nix +++ b/nix/packages/postgres.nix @@ -50,6 +50,7 @@ ../ext/wrappers/default.nix ../ext/supautils.nix ../ext/plv8 + ../ext/postgresql-unit.nix ]; #Where we import and build the orioledb extension, we add on our custom extensions