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

mhe*_*rzl 3 postgresql nixos haskell-stack

在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.
Run Code Online (Sandbox Code Playgroud)

我已经按照nixos手册安装了postgres 并且已经pg_config安装了,如图所示

$ which pg_config
/run/current-system/sw/bin/pg_config
Run Code Online (Sandbox Code Playgroud)

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

我如何继续取得$ stack --nix build成功?

iEl*_*ric 5

您需要将Nix包添加到它正在构建Haskell包的nix-shell环境中.

stack.yaml:

nix:
  packages: [postgresql]
Run Code Online (Sandbox Code Playgroud)


Bed*_*mez 5

如果你在 mac 上得到这个,brew install postgres然后运行stack build