here are the directions I followed which outline how to specify the socket:
https://docs.nextcloud.com/server/13/admin_manual/configuration_server/config_sample_php_parameters.html
it says that you should do this:
to specify a Unix socket use localhost:/path/to/socket
under the database configuration I specified the socket:
localhost:/run/postgresql
which can be found with the following command:
sudo find / -type s
here is the error I get when trying to install nextcloud:
EDIT: leaving this here and posting the solution.
instead of using:
localhost:/run/postgresql
I simply used:
/run/postgresql
hope this helps somebody, I actually figured this out buy looking at the database configuration page instead of the installation page: Database Configuration — Nextcloud 12 Server Administration Manual 12 documentation