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

Mateusz Kowalczyk fuuzetsu at fuuzetsu.co.uk
Fri Dec 19 07:53:59 CET 2014


On 12/06/2014 05:29 PM, Carlo Nucera wrote:
> 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).

I never use nix-env -i for Haskell stuff, it just does not end well.

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

My personal advice is to purge everything Haskell related from nix-env
and start using nix-shell/nix-build only. Maybe you have done so
already, I have not finished reading all the replies yet.

> 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
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
> 


-- 
Mateusz K.


More information about the nix-dev mailing list