我最近开始使用reflex-platform进行开发,其配置与优秀的reflex-project-skeleton中描述的配置类似。
现在我遇到无法解决的程序包冲突。
我使用与reflex-project-skeleton
相同的cabal脚本,该脚本以cabal命令在非交互模式下调用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
试图在阴谋文件中指定版本约束,但没有任何效果。
有任何线索吗?我什至不确定确切的问题是什么。为什么aeson在第一个实例中无法安装,而第二个中的snaplet-acid-state和mtl之间存在冲突?
答案 0 :(得分:2)
此cabal2nix
工作流程所发生的事情是,基本上,依赖关系求解程序仅被迫考虑由Nixpkgs提供的软件包,或者在本例中为reflex-platform + Nixpkgs。通过取消选择多个版本之一的自由,Cabal依赖解决程序被简化为依赖 checker 。
现在,如果版本限制太严格,您可以考虑在Nixpkgs中所谓的“越狱”:从cabal文件中删除所有版本限制。另一个选择是更改软件包版本。
Gabriel Gonzalez写了a good explanation of version management with Nixpkgs' Haskell infrastructure。您也可以签出this thread。有点冗长,但它讨论了很有用的callHackage
和callCabal2nix
函数。