5

postgresql-libpq添加到我的项目的 cabal 文件后,堆栈构建失败并显示以下内容:

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

我在 Nixos 上,并且pg_config已安装并在我的 PATH 上:

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

我正在使用堆栈 1.0.2,似乎即使在不稳定通道上的nixos-rebuild switch --upgrade之后它也不会更新。这是我的错误还是其他原因?

4

2 回答 2

3

我在 nixos 上的堆栈遇到了这个问题,当我的 nix 块stack.yaml更改为以下时,我解决了这个问题。

nix:
  pure: true
  enable: true
  packages: [ postgresql ]
于 2017-07-13T23:20:51.497 回答
1

我遇到了同样的问题,阅读Michael Snoyman 链接的文档对我有帮助您需要将其添加到您的 stack.yaml 中:

nix:
  enable: true
  pure: false

我正在构建不属于我的包,因此我没有编辑项目特定的配置,而是将这些行添加到我的全局配置~/.stack/config.yaml中:或者,您可以使用命令行选项:

stack --nix --no-nix-pure build

作为“非纯”构建的替代方案,您应该能够指定所有系统依赖项nix-shell以强制重现性,但我没有尝试过。

于 2016-10-22T09:22:42.110 回答