[Nix-dev] [Hackage] How to install Hackage package, not presented in nixpkgs, locally?

Patrick Wheeler patrick.john.wheeler at gmail.com
Tue Aug 14 21:49:20 CEST 2012


I do not know if this is canonical method, but I clone the git repo
https://github.com/NixOS/nixpkgs

cabal2nix cabal://<package>-<version> >
.../nixpkgs/pkg/development/libraries/haskell/<pakcage>/(default |
<version>).nix

default.nix if you do not need multiple versions.

Add the following to nixpkgs/top-level/haskell-packages.nix

<package> = callPackage ../development/libraries/haskell/package {  };

You may need to override some packages in { }, an "attribute set", at
the end of the line. An example case when this is needed is if the
package depends on the zlib compression library in the pkgs attribute
set.  The local Haskell zlib attribute(used to install Haskell
bindings fro the zlib compression library) shadows the pkgs
zlib(compression library) so you need to tell the package to use the
zlib from pkgs not the zlib from the current attribute set.

example:

<package> = callPackage ../development/libraries/haskell/package {
  zlib = pkgs.zlib;
  };

Haskell packages with dashes in the name usually should be transformed
to camel case so:
parsing-combinators -> parsingCombinators

Otherwise the nix file will fail to parse.

Then I do a test install nix-env -iA
nixpkgs.haskellPackages.<package>. Run tests and enjoy, or commit code
and preform a pull request.

Hopefully someone who has more experience fills in an holes and
corrects my mistakes.

Patrick

On Tue, Aug 14, 2012 at 1:12 PM, Daniel Hlynskyi <abcz2.uprola at gmail.com> wrote:
> Hello. I'm trying to create an installable package for `pipes-core` Hackage
> package.
>
> But got in troubles.
>
> 1. I used cabal2nix, but failed on installing the .nix file. After googling
> some time, I've done `nix-env -f all-packages.nix -iA
> haskellPackages.pipesCore`, so I've got package locally. But it had not
> registered the package, log with reasons http://pastebin.com/jp350qvX
> Manual registration with `ghc-pkg register` helped not. I don't know what to
> do now.
>
> 2. How can I contribute to nixpkgs with this package? The main question is -
> how can I TEST my contribution, when I get it?
>
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>



-- 
Patrick Wheeler
Patrick.John.Wheeler at gmail.com
Patrick.J.Wheeler at rice.edu
Patrick.Wheeler at colorado.edu


More information about the nix-dev mailing list