[Nix-dev] WIKI question misc.collection, multiple ghc in PATH, "bit of problem",

Marc Weber marco-oweber at gmx.de
Tue Aug 23 14:38:14 CEST 2011


Hi Peter Simon,

If you have $out_1/bin/ghc and $out_2/bin/ghc of course there will be a
problem (which is not that huge cause all ghcs have symlinks to
ghc-version anyway).

So in which way is going to talk about a potential problem going to help
anybody? I see the following solutions: Which one do you like most?
Then we can document it and drop the potential issue.

solutions 1:

  Replace it by a request on nixpkgs:

  What about providing run-haskell-$VERSION  symlinks the way its done for
  ghc and ghci?

solution 2:

  Manage multiple environments (and this is unrelated to misc.collection)
  or its intended usage:

  nix-env -p ~/ghc-7-profile -iA yourGHC7Collection
  nix-env -p ~/ghc-6-profile -iA yourGHC6Collection

  Then add either ~/ghc-6-profile/bin to PATH or use my bash zshrc patch for nixos
  introducing a useful function:

  nix_add_profile_vars ~/ghc-7-profile --suffix or --prefix

  which should get the job done. It may be overkill in this simple case
  because ghc only reads PATH, no PYTHONPATH or such.

solution 3:

  install this instead: ( ghc6Collection being misc.collection)

  myLodableEnv = runCommand "loadable-env-ghc" {} "mkdir -p $out/envs; ln -s ${ghc6Collection} $out/envs/ghc6";

  then use this (bashrc)
  loadEnv(){ PATH=~/.nix-profile/envs/$1/bin:$PATH; }

  and in shell:
  loadEnv ghc6

Marc Weber



More information about the nix-dev mailing list