[Nix-dev] Haskell NG: Local packages

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


Hi Jeff,

I'm using a similar approach for non-Haskell packages.  However, for
Haskell packages it doesn't interact well with cabal2nix.  Hence my
question.  I have now solved it the following way in
`~/.nixpkgs/config.nix`:

    haskellPackageOverrides = self: super:
        let asDarcs = path:
                (self.callPackage (import path) {}).override (args: args // {
                    mkDerivation = expr:
                        args.mkDerivation (expr // {
                            src = nixos.pkgs.fetchdarcs { url = path; };
                        });
                });
        in {
            myxmonad   = self.callPackage <ertes-config/myxmonad> {};
            mytaffybar = self.callPackage <ertes-config/mytaffybar> {};
            testpkg1   = asDarcs <ertes-src/testpkg1/main>;
            testpkg2   = asDarcs <ertes-src/testpkg2/main>;
        };

The testpkg2 executable depends on the testpkg1 library, and it works.
The expressions are generated by cabal2nix, so no manual work is
involved.  So it seems to do exactly what it should.

> It's not specific to Haskell (and I haven't tried haskellng at all
> yet) but for personal packages I have mypkgs/<pkgname>/default.nix,
> and then a top-level mypkgs/default.nix:
>
> [...]
>
> I add that to my NIX_PATH so I can `import <mypkgs>` anywhere to get
> <nixpkgs> overridden with the stuff I'm working on.
-------------- 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/55ce156b/attachment.bin 


More information about the nix-dev mailing list