Skip to content

Commit 70a7755

Browse files
Add nix shell
1 parent 84ff4e5 commit 70a7755

File tree

3 files changed

+55
-0
lines changed

3 files changed

+55
-0
lines changed

default.nix

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{ pkgs ? import ./haskell-pkgs.nix
2+
, haskellCompiler ? "ghc8101"
3+
}:
4+
pkgs.haskell-nix.cabalProject {
5+
src = pkgs.haskell-nix.haskellLib.cleanGit {
6+
name = "stylish-haskell";
7+
src = ./.;
8+
};
9+
compiler-nix-name = haskellCompiler;
10+
}

haskell-pkgs.nix

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
let
2+
# Fetch the latest haskell.nix and import its default.nix
3+
haskellNix = import (builtins.fetchTarball{
4+
url = "https://github.com/input-output-hk/haskell.nix/archive/f6663a8449f5e4a7393aa24601600c8f6e352c97.tar.gz";
5+
}) {};
6+
7+
# haskell.nix provides access to the nixpkgs pins which are used by our CI,
8+
# hence you will be more likely to get cache hits when using these.
9+
# But you can also just use your own, e.g. '<nixpkgs>'.
10+
nixpkgsSrc = haskellNix.sources.nixpkgs-2003;
11+
12+
# haskell.nix provides some arguments to be passed to nixpkgs, including some
13+
# patches and also the haskell.nix functionality itself as an overlay.
14+
nixpkgsArgs = haskellNix.nixpkgsArgs;
15+
16+
# import nixpkgs with overlays
17+
in
18+
import nixpkgsSrc nixpkgsArgs

shell.nix

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{ pkgs ? import ./haskell-pkgs.nix}:
2+
3+
let
4+
hsPkgs = import ./. { inherit pkgs; };
5+
in
6+
hsPkgs.shellFor {
7+
# Include only the *local* packages of your project.
8+
# packages = ps: with ps; [
9+
# ];
10+
11+
# Builds a Hoogle documentation index of all dependencies,
12+
# and provides a "hoogle" command to search the index.
13+
# withHoogle = true;
14+
15+
# You might want some extra tools in the shell (optional).
16+
# Some common tools can be added with the `tools` argument
17+
tools = { cabal = "3.2.0.0"; hlint = "2.2.11"; };
18+
# See overlays/tools.nix for more details
19+
20+
# Some you may need to get some other way.
21+
buildInputs = with pkgs.haskellPackages;
22+
[ ghcid ];
23+
24+
# Prevents cabal from choosing alternate plans, so that
25+
# *all* dependencies are provided by Nix.
26+
exactDeps = true;
27+
}

0 commit comments

Comments
 (0)