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

Peter Simons simons at cryp.to
Wed Nov 30 17:45:37 CET 2011


Hi Linus,

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

ah, of course! Now that you've mentioned it, I recognize your name. :-)
After supporting Haskell on ArchLinux for a while, I found that most of
the tasks I had to do (i.e. figure out which packages need to be rebuilt
after an update, etc.) come for free with Nix, so I switched to NixOS a
while ago.


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

You probably want to install "ghc-7.0.4-wrapper" into your profile
instead of "ghc-7.0.4". The wrapper ensures that the real compiler is
called with all those extra paths on the command-line that are required
to make GHC see the library packages installed in the profile.

NixOS has those wrappers for many packages (like gcc, python, and so on)
for precisely that purpose. It's a bit of inconvenience at first, but in
the long run the benefits outweigh the extra effort.


 > 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...

The exact attribute path that you have to use depends on the way your
system is installed. "nix-env -qaP \*" should print the proper paths for
your system.


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

I guess that you meant to use the "P" option instead of "A"?

I hope this helps,
Peter



More information about the nix-dev mailing list