2

我最近开始使用reflex-platform进行开发,其中一些额外的配置类似于优秀的reflex-project-skeleton中描述的内容。

现在我遇到了无法解决的包冲突。我使用与 相同的 cabal 脚本,它使用 cabal 命令以非交互模式reflex-project-skeleton调用。nix-shell

如果我尝试

./cabal new-build --allow-newer all

我明白了

these derivations will be built:
  /nix/store/d6ji516i7pry5l6gv18y6hpj9k1bvgg5-heist-1.0.1.0.drv
  /nix/store/zj1clks7mzq8gn91ahhwa3nvpi5rwra9-snap-1.0.0.2.drv
  /nix/store/mx861972jnjabn7yxyr3y3q1yhf25jfq-snaplet-acid-state-0.2.7.drv
  /nix/store/grhp4dhavmpi6bgns5a6vdzg8ny2bsf8-hoogle-local-0.1.drv
  /nix/store/y3sszsj58f6ad3r06540w0mlr1pncd59-ghc-8.0.2-with-packages.drv

...

Configuring heist-1.0.1.0...
Setup: Encountered missing dependencies:
aeson >=0.6 && <1.2

builder for '/nix/store/d6ji516i7pry5l6gv18y6hpj9k1bvgg5-heist-1.0.1.0.drv' failed with exit code 1
cannot build derivation '/nix/store/y3sszsj58f6ad3r06540w0mlr1pncd59-ghc-8.0.2-with-packages.drv': 1 dependencies couldn't be built

有问题的包似乎是snaplet-acid-state,所以我尝试从 nix-shell 内部安装它:

cabal install snaplet-acid-state
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: snaplet-acid-state-0.2.7 (user goal)
trying: base-4.9.1.0/installed-4.9... (dependency of snaplet-acid-state-0.2.7)
next goal: mtl (dependency of snaplet-acid-state-0.2.7)
rejecting: mtl-2.2.1/installed-BLK... (conflict: mtl =>
transformers==0.5.2.0/installed-0.5..., snaplet-acid-state =>
transformers>=0.3.0.0 && <0.5)
trying: mtl-2.2.2
next goal: transformers (dependency of snaplet-acid-state-0.2.7)
rejecting: transformers-0.5.2.0/installed-0.5..., transformers-0.5.5.0,
transformers-0.5.4.0, transformers-0.5.2.0, transformers-0.5.1.0,
transformers-0.5.0.1, transformers-0.5.0.0 (conflict: snaplet-acid-state =>
transformers>=0.3.0.0 && <0.5)
rejecting: transformers-0.4.3.0, transformers-0.4.2.0 (conflict:
base==4.9.1.0/installed-4.9..., transformers => base>=2 && <4.9)
rejecting: transformers-0.4.1.0 (conflict: base==4.9.1.0/installed-4.9...,
transformers => base>=2 && <4.8 || >=1.0 && <2)
rejecting: transformers-0.3.0.0 (conflict: mtl => transformers>=0.4 && <0.6)
rejecting: transformers-0.2.2.1, transformers-0.2.1.0, transformers-0.2.0.0,
transformers-0.1.4.0, transformers-0.1.3.0, transformers-0.1.1.0,
transformers-0.1.0.1, transformers-0.0.1.0, transformers-0.0.0.0,
transformers-0.5.3.1, transformers-0.5.3.0, transformers-0.5.0.2 (conflict:
snaplet-acid-state => transformers>=0.3.0.0 && <0.5)
rejecting: transformers-0.4.0.0 (conflict: base==4.9.1.0/installed-4.9...,
transformers => base>=2 && <4.8 || >=1.0 && <2)
rejecting: transformers-0.2.2.0, transformers-0.1.0.0 (conflict:
snaplet-acid-state => transformers>=0.3.0.0 && <0.5)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: transformers, snap, base,
snaplet-acid-state, mtl

尝试在 cabal 文件中指定版本约束等,但没有效果。

有什么线索吗?我什至不确定确切的问题是什么。为什么aeson第一次安装失败,第二次出现snplet-acid-state和mtl冲突?

4

1 回答 1

4

这个工作流会发生什么cabal2nix,基本上依赖求解器被迫只考虑 Nixpkgs 提供的包,或者在这种情况下是 reflex-platform + Nixpkgs。通过取消选择多个版本之一的自由,Cabal 依赖求解器被简化为依赖检查器

现在,如果版本限制过于严格,您可以考虑 Nixpkgs 中所谓的“越狱”:从 cabal 文件中删除所有版本限制。另一种选择是更改软件包版本。

Gabriel Gonzalez对使用 Nixpkgs 的 Haskell 基础架构进行版本管理进行了很好的解释。你也可以看看这个线程。它有点冗长,但它讨论了非常有用的callHackage和函数。callCabal2nix

于 2018-09-13T07:51:07.383 回答