[Nix-dev] nix-shell for a custom haskell library

m0rphism m0rphism at zankapfel.org
Sun May 31 11:54:57 CEST 2015


On 05/30/2015 08:49 PM, Dmitry Malikov wrote:
> I'm trying to setup a development environment for a custom haskell library
> basing on a tutorial by Oliver Charles (http://wiki.ocharles.org.uk/Nix).
> 
> So, here is a `shell.nix` of engine-io package
> with (import <nixpkgs> {}).pkgs;
> (haskellngPackages.callPackage ./. {}).env
> 
> After I did `nix-shell` engine-io package is not actually installed inside
> this shell:
>>> ghc-pkg list | grep engine
>>>
> 
> How to get Network.EngineIO available inside a nix-shell in this case?
> 
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev

I'm using this exact shell.nix for a few projects, where I have to
manually edit the default.nix.

How does your default.nix look like? Does it list engine-io as a
parameter and a build-dependency?

Here's an example default.nix, for which your shell.nix gets me into an
environment where `ghc-pkg list | grep engine` tells me that engine-io
is installed.

{ mkDerivation, stdenv, engine-io } :   # <-- engine-io
mkDerivation {
  pname = "myproject";
  version = "0.1.0.0";
  src = ./.;
  isLibrary = false;
  isExecutable = true;
  buildDepends = [ engine-io ];         # <-- engine-io
  description = "";
  license = stdenv.lib.licenses.publicDomain;
}

The haskellngPackages.callPackage in nix.shell then calls this function
in default.nix and supplies the package arguments, which it fetched from
the nixpkgs checkout referenced by <nixpkgs>, which is the location
described in your $NIX_PATH by `nixpkgs=...`.

Hope I could help! :)


More information about the nix-dev mailing list