Search code examples
haskellhaskell-stacknixos

Haskell Stack does not build postgresql-libpq on Nixos


After adding postgresql-libpq to my project's cabal file, stack build fails with the following:

Configuring postgresql-libpq-0.9.1.1...
setup: The program 'pg_config' is required but it could not be found.

I'm on Nixos and pg_config is both installed and on my PATH:

$ whereis pg_config
pg_config: /nix/store/5bc6hzqkyw8dpi91sqznd3ik42mllwyz-system-path/bin/pg_config

I'm using stack 1.0.2, and it seems that it won't update even after nixos-rebuild switch --upgrade on the unstable channel. Is this a mistake on my side or is it something else?


Solution

  • I ran into this issue with stack on nixos, and got past it when the nix block of my stack.yaml had been changed to the following.

    nix:
      pure: true
      enable: true
      packages: [ postgresql ]