I don’t know anything about the LibreOffice or SDBC so here is how I proceeded to find the information I needed:
First I searched “libreoffice-sdbc-postgresql” on Ecosia to find more general information about it. I found this page: https://wiki.documentfoundation.org/PostgreSQL-SDBC. The page mentions that the plugin is part of LibreOffice since version 3.5. Ok so let’s see what nixpkgs has to say:
nix edit nixpkgs.libreoffice. Then I spend a bit of time looking at how it’s packaged and found this line that explicitly disables the postgresql-sdbc plugin: https://github.com/NixOS/nixpkgs/blob/ee4b93eab4fe7e97340810eb1b275a26117c8d05/pkgs/applications/office/libreoffice/still.nix#L242
At this point I am quite confident that editing nixpkgs and removing that line would allow me to rebuild libreoffice with postgresql ( plus add the postgres package in the buildInputs ).
The problem is that libreoffice is quite heavy to compile so we want to avoid doing that if possible. It would be nice if there was a facility to compile the plugins separately. (spoiler: nope). So I look into the folder and in pkgs/top-level/all-packages.nix but don’t find anything related to that unfortunately.
So that’s where I am. Editing nixpkgs manually will probably work.
The next thing that I would look into is look how to make an override so I don’t have to maintain another patch on top of nixpkgs.
So no good solution but hopefully the train of thoughts will help you in your future endeavors.