[Nix-dev] some basic questions from a new NixOS user

Linus Arver linusarver at gmail.com
Wed Nov 30 06:49:04 CET 2011


Hi Peter!

I see that you're on NixOS as well. You might remember me from the
Arch-Haskell list some time ago...

On Tue, Nov 29, 2011 at 06:02:33PM +0100, Peter Simons wrote:
> Hi Linus,
> 
>  > But I must ask, how did you install xmonad? I tried "nix-env -i
>  > xmonad" but it did not work [...]
> 
> Haskell packages that contain library code generally depend on the
> version of the compiler they've been built with. Almost all Haskell
> packages have the appropriate compiler version baked into their package
> name. Consequently, there are many different versions of XMonad:
> 
>   $ nix-env -qaP \* | grep xmonad-ghc
>   haskellPackages_ghc6104.xmonad                   haskell-xmonad-ghc6.10.4-0.10
>   haskellPackages_ghc6123.xmonad                   haskell-xmonad-ghc6.12.3-0.10
>   haskellPackages_ghc704_no_profiling.xmonad       haskell-xmonad-ghc7.0.4-0.10
>   haskellPackages_ghc704_profiling.xmonad          haskell-xmonad-ghc7.0.4-0.10-profiling
>   haskellPackages_ghc721.xmonad                    haskell-xmonad-ghc7.2.1-0.10
>   haskellPackages_ghc722.xmonad                    haskell-xmonad-ghc7.2.2-0.10
> 
> Which version is preferable to you depends on the compiler that you
> prefer. At the moment, I would recommend to stick to GHC 7.0.4.

Yes, I got this impression from seeing all the different xmonad/ghc
packages with the different versions. I did

    $ nix-env -qa \* > pkgs

and kept that file around as a sort of primitive reference for all the
available packages, and that's how I learned about all the different
versions. I did something like

    $ nix-env -i haskell-xmonad-ghc7.0.4
    $ nix-env -i haskell-ghc7.0.4

to get my Haskell packages installd.

>  > Strangely, it appears that the haskell packages cannot see each other
>  > properly, because I cannot use any of the xmonad-contrib modules in
>  > my xmonad.hs, even though I've installed xmonad-contrib. I can fire
>  > up ghci, but I can't even load up the "XMonad" Haskell module,
>  > either. Strange...
> 
> I cannot reproduce that problem:
> 
>   $ nix-env -iA haskellPackages.{xmonad,ghc}
>   installing `haskell-xmonad-ghc7.0.4-0.10'
>   installing `ghc-7.0.4-wrapper'
>   building path(s) `/nix/store/6k520bqkbmcbqgl1s1371jr7zj2774b9-user-environment'
>   created 7452 symlinks in user environment
>   $ ghci
>   GHCi, version 7.0.4: http://www.haskell.org/ghc/  :? for help
>   Loading package ghc-prim ... linking ... done.
>   Loading package integer-gmp ... linking ... done.
>   Loading package base ... linking ... done.
>   Loading package ffi-1.0 ... linking ... done.
>   Prelude> :m XMonad
>   Prelude XMonad> :browse
>   (-->) :: (Monad m, Data.Monoid.Monoid a) => m Bool -> m a -> m a
>   class Num a => Data.Bits.Bits a where
>   [...]

If I had known about the simple "haskellPackages.foo" syntax I would
have used it with my nix-env invocations! Another thing to add to the
wiki...

Strangely, I can't use this convenient syntax, because nix throws an
error:

    $ nix-env -iA haskellPackages.{xmonad,ghc}
    error: attribute `haskellPackages' in selection path `haskellPackages' not found

I've already done a nixos-checkout, so, I don't understand why my
freshly-installed NixOS is coughing up this error...

> Generally speaking, GHC can see all Haskell packages that have been
> installed into the same profile as the compiler itself.

Evidently, my newbie, trial-and-error attempt to install xmonad/ghc with
nix-env has already broken my Haskell-package setup...

I just read the manual for nix-env to find out more about the -A flag,
and found this sentence: "To find out the attribute paths of available
packages, use nix-env -qaA '*'." Unfortunately, this does not work for
me:

    $ nix-env -qaA '*'
    warning: you probably meant to specify the argument '*' to show all packages
    error: attribute `*' in selection path `*' not found

It appears that something has gone horribly wrong...

-Linus

P.S. I apologize in advance for any typos in the error messages/console
output --- the problematic NixOS install on my spare laptop is not in a
workable state so I'm just copying everything by hand into another
laptop to send these emails.


More information about the nix-dev mailing list