setup: The program 'pg_config' is required but it could not be found

Viewed 2760

On nixos, when attempting to build my project with $ stack --nix build, I run into the following error.

$ stack --nix build

...

Linking /run/user/1000/stack25943/postgresql-libpq-0.9.2.0/.stack-work/dist/x86_64-linux-nix/Cabal-1.24.2.0/setup/setup ...
Configuring postgresql-libpq-0.9.2.0...
setup: The program 'pg_config' is required but it could not be found.

I have installed postgres following the nixos manual and do have pg_config installed, as shown by

$ which pg_config
/run/current-system/sw/bin/pg_config

It appears that stack does not know this location of my pg_config.

How do I proceed to get $ stack --nix build to succeed?

2 Answers

If you're getting this on mac, run brew install postgres then stack build

Related