[Nix-dev] Help with ghc errors after nix-channel --update

Carlo Nucera meditans at gmail.com
Mon Dec 8 09:20:24 CET 2014


Yes, thank you, this was exactly what I was in search of!
Now my configuration works :)

Bests
Carlo Nucera

2014-12-06 23:39 GMT+01:00 Peter Simons <simons at cryp.to>:
> 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
>
> _______________________________________________
> 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