nixpkgs/pkgs/by-name/pg/pg-dump-anon/package.nix
Maximilian Bosch 0cdaede144
pg-dump-anon: init at 1.3.1
This is a Go program inside the sources of `postgresql_anonymizer` that
allows to perform database dumps, but with anonymized data. I figured
that it's a little awkward to have a client program to be part of the
extension package.

So I decided to create a second package called `pg-dump-anon`. Since
it's one repository, both share `version` & `src`.

Also extended the VM test to make sure we're getting properly anonymized
data when dumping with `pg_dump_anon`.
2024-03-13 16:15:54 +01:00

33 lines
970 B
Nix

{ lib, fetchFromGitLab, buildGoModule, nixosTests, postgresql, makeWrapper }:
buildGoModule rec {
pname = "pg-dump-anon";
version = "1.3.1";
src = fetchFromGitLab {
owner = "dalibo";
repo = "postgresql_anonymizer";
rev = version;
hash = "sha256-Z5Oz/cIYDxFUZwQijRk4xAOUdOK0LWR+px8WOcs+Rs0=";
};
sourceRoot = "${src.name}/pg_dump_anon";
vendorHash = "sha256-CwU1zoIayxvfnGL9kPdummPJiV+ECfSz4+q6gZGb8pw=";
passthru.tests = { inherit (nixosTests) pg_anonymizer; };
nativeBuildInputs = [ makeWrapper ];
postInstall = ''
wrapProgram $out/bin/pg_dump_anon \
--prefix PATH : ${lib.makeBinPath [ postgresql ]}
'';
meta = with lib; {
description = "Export databases with data being anonymized with the anonymizer extension";
homepage = "https://postgresql-anonymizer.readthedocs.io/en/stable/";
maintainers = teams.flyingcircus.members;
license = licenses.postgresql;
mainProgram = "pg_dump_anon";
};
}