[Nix-dev] Haskell dependencies in a project
Tomasz Czyż
tomasz.czyz at gmail.com
Sun Apr 3 04:15:06 CEST 2016
Hi,
I'm trying to make a nix/haskell package (with executable) with some
dependencies (from nixpkgs and some locally declared).
I have my-dep directory with haskell package exposing library and src
directory which contains application using my-dep dependency and aeson
package from nixpkgs.
Here is my nix expression:
{ pkgs ? import <nixpkgs> {} }:
let
my-dep = pkgs.haskellPackages.mkDerivation {
pname = "my-dep";
version = "0.1.0.0";
src = ./my-dep;
isLibrary=true;
isExecutable=false;
license = with pkgs; stdenv.lib.licenses.unfree;
doHaddock=false;
};
dependencies = with pkgs.haskellPackages; [
aeson my-dep
];
ghc = pkgs.haskellPackages.ghcWithPackages(hs:(dependencies));
in
pkgs.haskellPackages.mkDerivation {
pname = "haskell-project";
version = "0.1.0.0";
src = ./src;
isLibrary = false;
isExecutable = true;
buildTools = [ghc];
buildDepends = dependencies;
license = with pkgs; stdenv.lib.licenses.unfree;
}
(library expose 1 function which print text and main project just imports
aeson and my-dep and uses function from library)
When building it, I am getting error:
--------------------------------
Building haskell-project-0.1.0.0...
Preprocessing executable 'haskell-project' for haskell-project-0.1.0.0...
Main.hs:2:18:
Could not find module ‘MyDep’
Use -v to see a list of the files searched for.
builder for
‘/nix/store/43lbwp4qfigjwkf97nqp4h21hsrf5yr2-haskell-project-0.1.0.0.drv’
failed with exit code 1
error: build of
‘/nix/store/43lbwp4qfigjwkf97nqp4h21hsrf5yr2-haskell-project-0.1.0.0.drv’
failed
------------------------------------
There is no problem with aeson (it's complaining about aeson when I remove
dependency from nix expression), but there is a problem with my-dep
dependency.
Question is, how I should declare dependency for my-dep to make it working,
to make haskell-project to use that dependency correctly?
(if I run nix-shell with this expression I have the same error, but if I
"cd" to my-dep directory and run ghc ../src/Main.hs it's working, it looks
like ghs tries search for MyDep.hs only in current directory instead of
package directory).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.science.uu.nl/pipermail/nix-dev/attachments/20160403/5592a6cd/attachment.html
More information about the nix-dev
mailing list