[Nix-dev] Help with ghc errors after nix-channel --update
Peter Simons
simons at cryp.to
Sat Dec 6 23:39:39 CET 2014
Hi Carlo,
> I wrote the nix expression for abcnotation, and it's not yet present
> in the channel. What would be the right way to add an expression made
> by me in this setup?
run the commands
$ cabal2nix cabal://prettify >~/.nixpkgs/prettify.nix
$ cabal2nix cabal://abcnotation >~/.nixpkgs/abcnotation.nix
and define in ~/.nixpkgs/config.nix:
packageOverrides = super: let self = super.pkgs; in
{
haskellPackages = super.haskellPackages.override {
extension = self: super: {
abcnotation = self.callPackage ./abcnotation.nix {};
prettify = self.callPackage ./prettify.nix {};
};
};
};
This will make abcnotation (and prettify) available like any other
package defined in Nixpkgs, and you can use them with 'ghcWithPackages'.
> More generally, I'd like a configuration in which I'm able to:
>
> 1) install packages from nixos-unstable,
> 2) from a nixpkgs local repo,
> 3) from expressions mantained by me
> 4) using ghc-mod and similar in emacs
You can do all those things easily with ghcWithPackages. Just add
'ghcMod' to the package set, and add these definitions to your
~/.bashrc:
NIX_GHC_VERSION=$(ghc --numeric-version)
export NIX_GHC="$HOME/.nix-profile/bin/ghc"
export NIX_GHCPKG="$HOME/.nix-profile/bin/ghc-pkg"
export NIX_GHC_DOCDIR="$HOME/.nix-profile/share/doc/ghc/html"
export NIX_GHC_LIBDIR="$HOME/.nix-profile/lib/ghc-${NIX_GHC_VERSION}"
With that setup, ghc-mod will work just fine (for those packages that
you've declared).
I hope this helps
Peter
More information about the nix-dev
mailing list