如果我在它下面构建我的 Haskell 项目,nix-shell
则会给出有关 missing 的错误zlib
。
如果我使用 nix-shell 构建项目,nix-shell -p zlib
则项目可以zlib
成功查看并构建。
如何将zlib
包添加到shell.nix
文件以便-p zlib
不再需要传递?
注意:构建是使用完成的cabal v2-build
对于使用堆栈构建,我必须执行以下操作
这是 myshell.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