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?
You'll need to add Nix packages to the nix-shell environment that it's building Haskell packages in.
In stack.yaml
:
nix:
packages: [postgresql]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With