将 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 已经安装并且在我的路径上:
$ whereis pg_config
pg_config: /nix/store/5bc6hzqkyw8dpi91sqznd3ik42mllwyz-system-path/bin/pg_config
我使用的是堆栈1.0.2,似乎即使在不稳定的通道上的 nixos-rebuild switch --upgrade 之后它也不会更新。这是我的错误还是别的什么?
答案 0 :(得分:2)
我在nixos上使用堆栈遇到了这个问题,当我的stack.yaml
的nix块被更改为以下内容时,它已经过去了。
nix:
pure: true
enable: true
packages: [ postgresql ]
答案 1 :(得分:1)
我遇到了同样的问题,阅读Michael Snoyman联系的docs帮助了我。你需要将它添加到你的stack.yaml:
nix:
enable: true
pure: false
我正在构建不属于我的软件包,因此我没有编辑项目特定的配置,而是将这些行添加到 global config:~/.stack/config.yaml
。或者,您可以使用命令行选项:
stack --nix --no-nix-pure build
替代"非纯"在构建时,您应该能够在nix-shell
中指定所有系统依赖关系以强制执行再现性,但我没有尝试过。