Skip to content

Instantly share code, notes, and snippets.

@aaronlevin
Last active August 29, 2015 14:13
Show Gist options
  • Save aaronlevin/0e8d006ca748b24cc7f9 to your computer and use it in GitHub Desktop.
Save aaronlevin/0e8d006ca748b24cc7f9 to your computer and use it in GitHub Desktop.
Nix n00b templates
# This template will give you a prompt with:
# - ghc
# - cabal
# - ghc-mod
# - the libraries: free, mtl, transformers
#
# to run: nix-shell haskell-project.nix
#
# to specify specific version of haskell, you can:
# nix-shell --arg haskellPackages 'with import <nixpkgs> {}; haskellPackages_ghc783_profiling'
# (I think) to specify a specific set of nixpkgs via nix channel
# 1. nix-channel --add http://nixos.org/channels/name my-new-nixos-channel
# 2. nix-channel --update
# 3. nix-shell --args nixpkgs 'import <my-new-nixos-channel> {}'
{ nixpkgs ? (import <nixpkgs> {})
, haskell ? (import <nixpkgs> {}).haskellPackages }:
let
myEnvFun = nixpkgs.myEnvFun;
cabalInstall = haskell.cabalInstall;
free = haskell.free;
ghc = haskell.ghc;
ghcmod = haskell.ghcMod;
mtl = haskell.mtl;
transformers = haskell.transformers;
in rec {
tmpEnv = myEnvFun {·
name = "tmp-haskell-project-env";
buildInputs = [
# build tools
cabalInstall
ghc
ghcmod
# libs
free
mtl
transformers
];
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment