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

Carlo Nucera meditans at gmail.com
Sat Dec 6 18:29:09 CET 2014


Hi Peter

I added this snippet to my ~/.nix-packages/config.nix

  ghcTestEnv = self.haskellPackages_ghc783.ghcWithPackages (p: with p; [
    mtl
  ]);

and ran:

  $ nix-env -p /tmp/haskell -iA ghcTestEnv
  $ /tmp/haskell/bin/ghci
  Prelude> import Control.Monad.State.Lazy

These commands worked well. However, when adding abcnotation, it
complains rightfully that it doesn't know what we are talking about:

error: undefined variable `abcnotation' at
/home/carlo/settings/nix-local/config.nix:34:5

this happens probably because 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?

> Generally speaking, ghc-wrapper is fundamentally broken and many
> discerning Nix hackers gave up using it entirely a long time ago
> (precisely because of the kind of trouble that you seem to be having).

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

Regrettably, I really don't know how to set up such a thing.  Before I
copied the configuration I'm using (from Fuuzetsu), I was using a
function like ghcWithPackages similar to the one you proposed, but I
was unable to integrate that with things packaged by me (and so I
switched).

Can you point me towards some dotFiles that obtaining what I'm
searching for with the ghcWithPackages function?

Best regards,
Carlo

2014-12-06 18:04 GMT+01:00 Peter Simons <simons at cryp.to>:
> Hi Carlo,
>
>  > ghc-pkg check is full of errors
>
> I don't think that "ghc-pkg check" ever succeeded in any ghc-wrapper
> based installation.
>
>  > packages I installed no longer load in ghci
>
> There is no obvious explanation for the errors you've described. As
> random suggestion how you might obtain some additional insight, you
> could add
>
>   ghcTestEnv = self.haskellPackages_ghc783.ghcWithPackages (p: with p; [
>     mtl
>   ]);
>
> to your ~/.nix-pkgs/config.nix and then run:
>
>   $ nix-env -p /tmp/haskell -iA ghcTestEnv
>   $ /tmp/haskell/ghci
>   Prelude> import Control.Monad.State.Lazy
>
> Does that succeed? If it does, you try adding 'abcnotation', too, to see
> whether that makes a difference.
>
> Generally speaking, ghc-wrapper is fundamentally broken and many
> discerning Nix hackers gave up using it entirely a long time ago
> (precisely because of the kind of trouble that you seem to be having).
>
> Best regards,
> 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