[Nix-dev] Haskell-env (via nix-shell) - am I doing this right?

Peter Jones mlists at pmade.com
Sat May 23 03:54:16 CEST 2015


Peter Simons <simons at cryp.to> writes:
> I use the following "shell.nix" to switch between compiler versions:
>
>     { compiler ? "ghc7101" }:
>
>     with (import <nixpkgs> {}).pkgs;
>     let
>       ghc = haskell.packages.${compiler}.ghcWithPackages
>               (pkgs: with pkgs; [ aeson lens monad-par ]);
>     in
>     stdenv.mkDerivation {
>       name = "my-haskell-env-0";
>       buildInputs = [ ghc ];
>       shellHook = "eval $(grep export ${ghc}/bin/ghc)";
>     }
>
> Now run "nix-shell --argstr compiler ghc784" to select a compiler other
> than the default.

Neat trick!  Thanks for sharing.

-- 
Peter Jones, Founder, Devalot.com
Defending the honor of good code



More information about the nix-dev mailing list