setup:程序'pg_config'是必需的但无法找到

时间:2017-07-13 20:42:24

标签: postgresql haskell-stack nixos

在nixos上,当我尝试使用$ stack --nix build构建项目时,遇到以下错误。

$ 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.

我在nixos manual之后安装了postgres,并且安装了pg_config,如

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

看来堆栈不知道我的pg_config的这个位置。

如何让$ stack --nix build成功?

2 个答案:

答案 0 :(得分:5)

您需要将Nix软件包添加到构建Haskell软件包的nix-shell环境中。

stack.yaml

nix:
  packages: [postgresql]

答案 1 :(得分:3)

如果您在Mac上获取此功能,请运行brew install postgres,然后stack build