[Nix-dev] Haskell NG: Local packages

Ertugrul Söylemez ertesx at gmx.de
Tue Apr 28 22:11:57 CEST 2015


I believe Peter's message <87mw5qvj9x.fsf at write-only.cryp.to> could
answer my question.  I will give it a try.

> Hello fellow Haskellers,
>
> I have a bunch of local Haskell packages, mostly libraries.  The package
> X lives in the directory `<ertes-src/X/main>`.  There are lots of direct
> and indirect dependencies between them.  My current solution is ad hoc
> and rather ugly.  I'm using the following hand-crafted `shell.nix` file
> in every project:
>
>     { pkgs ? import <nixpkgs> {} }:
>
>     let inherit (pkgs.haskellngPackages) callPackage;
>
>         extPkg = path: deps:
>             (callPackage (import path) deps).override (args: args // {
>                 mkDerivation = expr:
>                     args.mkDerivation (expr // {
>                         src = pkgs.fetchdarcs { url = path; };
>                     });
>             });
>
>         thisPkg = callPackage (import ./devel.nix) {
>             direct-dep1 = extPkg <ertes-src/dep1/main> {
>                 indirect-dep1 = ...;
>                 indirect-dep2 = ...;
>             };
>             direct-dep2 = extPkg <ertes-src/dep2/main> {};
>         };
>
>     in thisPkg.env
>
> Do not pay too much attention to the `extPkg` function.  It just works
> around cabal2nix' lack of support for Darcs URLs.
>
> My question is:  Is there a nicer and more principled way to solve this?
> Ideally I could simply add all of my local packages in some way to my
> `~/.nixpkgs/config.nix`.  Then they could just depend on each other
> regularly and I wouldn't need any shell.nix hackery.  I'm guessing that
> I need to override haskellngPackages in some way or perhaps create my
> own using some override.
>
>
> Greets,
> Ertugrul
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 472 bytes
Desc: not available
Url : http://lists.science.uu.nl/pipermail/nix-dev/attachments/20150428/a8020f74/attachment.bin 


More information about the nix-dev mailing list