[Nix-dev] Haskell: Using Nix with cabal.config

Daniel Bergey bergey at alum.mit.edu
Sun Feb 1 15:30:29 CET 2015


I've been doing something similar, to build with specific versions that
aren't in Nixpkgs.  My current approach is a directory tree with a
directory per package, and a .nix file per version, and a nix function
that imports a particular package/version from that tree.  For each
package I maintain, I call cabal2nix to make the default.nix, and I put
any local or pinned dependencies in shell.nix

Here's a fairly typical example, with some versioned deps and some
relative paths to git checkout directories.
https://github.com/bergey/diagrams-stow/blob/c89d0d79d7a35373582e25efd2c0abde427d2829/nix/postscript/shell.nix

I've started working on a tool to automate this sort of thing. (
https://github.com/bergey/hscache ) It's not usable yet, but I'd like to
hear what your current workflow is, and ideal workflow would be.

Daniel

On 2015-02-01 at 03:41, Nikita Karetnikov <nikita at karetnikov.org> wrote:
> I’d like to build an application using the versions specified in a
> cabal.config file (cabal-install is included in the shell.nix file).  Is
> there an easy way to do it?
>
> After talking to people on #nixos, I got the impression that having your
> own Nixpkgs branch is the only way if you want to share your environment
> with NixOS and plain Nix users.  Parsing a cabal.config file and running
> cabal2nix on every package is not difficult.  But where do I need to put
> the new recipes?
>
> For packages with the default.nix file, you just compare the versions
> and replace the existing recipe if they don’t match.  For packages
> having multiple versions, you also need to change
> pkgs/top-level/haskell-packages.nix.  The latter makes me a bit
> uncomfortable because it’s easy to make a mistake.  I’d rather put all
> the new recipes in a different place, say, in the directory of my
> application, and somehow instruct Nix to use them first.  Can it be
> done?  Or is there a better way?
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev


More information about the nix-dev mailing list