If I build my Haskell project under nix-shell
it gives error about missing zlib
.
If I build the project in nix-shell using nix-shell -p zlib
then the project sees zlib
and builds successfully.
How can I add the zlib
package to shell.nix
file so that passing -p zlib
is no longer needed?
Note: the builds were done using cabal v2-build
For building with stack I had to do the following
This is how my shell.nix
is currently defined:
{ 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