【发布时间】:2019-10-10 15:54:38
【问题描述】:
如果我在 nix-shell 下构建我的 Haskell 项目,则会出现关于缺少 zlib 的错误。
如果我在 nix-shell 中使用 nix-shell -p zlib 构建项目,那么项目会看到 zlib 并成功构建。
如何将zlib 包添加到shell.nix 文件中,以便不再需要传递-p zlib?
注意:构建是使用 cabal v2-build 完成的
为了使用堆栈构建,我必须这样做 the following
这就是我的shell.nix 当前的定义方式:
{ nixpkgs ? import <nixpkgs> {}, compiler ? "default", doBenchmark ? false }:
let
inherit (nixpkgs) pkgs;
f = { mkDerivation, base, directory, stdenv, text, turtle, zlib }:
mkDerivation {
pname = "haskell-editor-setup";
version = "0.1.0.0";
src = ./.;
isLibrary = false;
isExecutable = true;
executableHaskellDepends = [ base directory text turtle zlib ];
description = "Terminal program that will set up Haskell environment with a target selected editor or IDE";
license = stdenv.lib.licenses.gpl3;
};
haskellPackages = if compiler == "default"
then pkgs.haskellPackages
else pkgs.haskell.packages.${compiler};
variant = if doBenchmark then pkgs.haskell.lib.doBenchmark else pkgs.lib.id;
drv = variant (haskellPackages.callPackage f {});
in
if pkgs.lib.inNixShell then drv.env else drv
【问题讨论】:
标签: haskell nix cabal-install nix-shell