不幸的是,安装了haskell包' Euterpea'在NixOS上失败了:
Nixpkgs manual表示在hackage上注册的所有haskell包(Euterpea包都是)都包含在nix包管理器中,必须像这样安装:
nix-env -f "<nixpkgs>" -iA haskellPackages.Euterpea
在进行一些下载和编译之后,会发生以下错误,并且该过程被中断:
[ 7 of 46] Compiling Euterpea.IO.MIDI.MidiIO ( Euterpea/IO/MIDI/MidiIO.lhs, dist/build/Euterpea/IO/MIDI/MidiIO.o )
Euterpea/IO/MIDI/MidiIO.lhs:153:25:
Not in scope: ‘Heap.extractHead’
Euterpea/IO/MIDI/MidiIO.lhs:160:34: Not in scope: ‘Heap.head’
builder for ‘/nix/store/wc8d02s0kin4l0siwixlylssizfsrzgx-Euterpea-1.1.1.drv’ failed with exit code 1
error: build of ‘/nix/store/wc8d02s0kin4l0siwixlylssizfsrzgx-Euterpea-1.1.1.drv’ failed
有没有人知道如何解决这个问题?
答案 0 :(得分:2)
这里的问题是Euterpea
无法针对nixpkgs中可用的更新版本的依赖项进行编译。这是一个可以成功构建Euterpea
的表达式(在当前nixpkgs unstable上测试):
将以下nix表达式写入名为euterpea.nix
的文件:
# let's get nixpkgs into scope
with (import <nixpkgs> {});
let
lib = haskell.lib;
# build a "package set" (collection of packages) that has the correct versions of the dependencies
# needed by Euterpea
customHaskellPackages = haskellPackages.override (old: {
overrides = self: super: {
heap = self.callHackage "heap" "0.6.0" {};
PortMidi = self.callHackage "PortMidi" "0.1.5.2" {};
stm = self.callHackage "stm" "2.4.2" {};
};
});
in {
# this is a ghc wrapper that has only Euterpea as its visible packages
ghc = customHaskellPackages.ghcWithPackages (pkgs: [ pkgs.Euterpea ]);
# this is just the output of the build for Euterpea
pkg = customHackagePackages.Euterpea;
# for convenience, also expose the package set that we build against
pkgset = customHaskellPackages;
}
然后您可以运行以下命令:
$ nix-build euterpea.nix -A ghc # build a GHC with the Euterpea package included
/nix/store/mjlp6rxcsiv5w8ay1qp0lrj8m40r3cyl-ghc-8.0.1-with-packages
$ result/bin/ghci # result contains a GHC installation that has Euterpea, so we can run GHCI from it
GHCi, version 8.0.1: http://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/.ghci
λ: import Euterpea
λ:
Leaving GHCi.
$ nix-env --install --file euterpea.nix -A ghc # we can also install this ghc into our user environment
installing ‘ghc-8.0.1-with-packages’
building path(s) ‘/nix/store/7jwrwxaxyig6hf747rsan5514gw7qi51-user-environment’
created 5840 symlinks in user environment
$