Psycopg2 in pipenv

I have a project that uses pipenv and psycopg2.
When I do pipenv update I get an error that the installer does not find libpq-fe.h even through it is in the postgresql package that I have installed.
I am willing to replace psycopg2 with other similar packages,but they all give me the same error

The dev. headers will not be exposed in your environment if you just did a “nix-env -iA _.postgresql” or added it to your configuration.nix. So I’d suggest to use the nix infrastructure (eg. nix-shell) and add the postgresql package as a build input, which should make the header visible in your shell.

Ok,how do I convince nix to give me build headers without having to rewrite the project?

Esecially as pypi2nix broke for me and I’m in a hurry

open a nix-shell with the headers (but not pipenv) and then run pipenv