summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorŁukasz Gołębiewski <lukasz.golebiewski@gmail.com>2020-10-06 15:03:59 +0200
committerGitHub <noreply@github.com>2020-10-06 15:03:59 +0200
commit70a7755719061e4b280a07578c6135762095e879 (patch)
treedc55e2fc5dadca62738cc256eddec036589a0a22
parent84ff4e57eb24b5b5ab95ad7b64419846922e00f7 (diff)
downloadstylish-haskell-70a7755719061e4b280a07578c6135762095e879.tar.gz
Add nix shell
-rw-r--r--default.nix10
-rw-r--r--haskell-pkgs.nix18
-rw-r--r--shell.nix27
3 files changed, 55 insertions, 0 deletions
diff --git a/default.nix b/default.nix
new file mode 100644
index 0000000..c870da5
--- /dev/null
+++ b/default.nix
@@ -0,0 +1,10 @@
+{ pkgs ? import ./haskell-pkgs.nix
+, haskellCompiler ? "ghc8101"
+}:
+pkgs.haskell-nix.cabalProject {
+ src = pkgs.haskell-nix.haskellLib.cleanGit {
+ name = "stylish-haskell";
+ src = ./.;
+ };
+ compiler-nix-name = haskellCompiler;
+}
diff --git a/haskell-pkgs.nix b/haskell-pkgs.nix
new file mode 100644
index 0000000..729c2aa
--- /dev/null
+++ b/haskell-pkgs.nix
@@ -0,0 +1,18 @@
+let
+ # Fetch the latest haskell.nix and import its default.nix
+ haskellNix = import (builtins.fetchTarball{
+ url = "https://github.com/input-output-hk/haskell.nix/archive/f6663a8449f5e4a7393aa24601600c8f6e352c97.tar.gz";
+ }) {};
+
+# haskell.nix provides access to the nixpkgs pins which are used by our CI,
+# hence you will be more likely to get cache hits when using these.
+# But you can also just use your own, e.g. '<nixpkgs>'.
+ nixpkgsSrc = haskellNix.sources.nixpkgs-2003;
+
+# haskell.nix provides some arguments to be passed to nixpkgs, including some
+# patches and also the haskell.nix functionality itself as an overlay.
+ nixpkgsArgs = haskellNix.nixpkgsArgs;
+
+# import nixpkgs with overlays
+in
+ import nixpkgsSrc nixpkgsArgs
diff --git a/shell.nix b/shell.nix
new file mode 100644
index 0000000..4614cc3
--- /dev/null
+++ b/shell.nix
@@ -0,0 +1,27 @@
+{ pkgs ? import ./haskell-pkgs.nix}:
+
+let
+ hsPkgs = import ./. { inherit pkgs; };
+in
+ hsPkgs.shellFor {
+ # Include only the *local* packages of your project.
+ # packages = ps: with ps; [
+ # ];
+
+ # Builds a Hoogle documentation index of all dependencies,
+ # and provides a "hoogle" command to search the index.
+ # withHoogle = true;
+
+ # You might want some extra tools in the shell (optional).
+ # Some common tools can be added with the `tools` argument
+ tools = { cabal = "3.2.0.0"; hlint = "2.2.11"; };
+ # See overlays/tools.nix for more details
+
+ # Some you may need to get some other way.
+ buildInputs = with pkgs.haskellPackages;
+ [ ghcid ];
+
+ # Prevents cabal from choosing alternate plans, so that
+ # *all* dependencies are provided by Nix.
+ exactDeps = true;
+ }