- GHC
- Cabal
- Grip
- Stack
stack.yamlshell.nix
- implicit-hie
- haskell-language-server
.gitignore.envrcclean.sh- Nix flake
flake.nix
- zlib
It should be easy to add the following by un-commenting code in flake.nix:
Checkout this repository:
git clone https://github.com/dsunshi/haskell-flake-template.git <my-project>cd <my-project>There are two ways to use the flake:
nix develop(this would need to be done each time entering the <my-project> folder.
Allow direnv (once):
direnv allowSince haskell-flake-template is it's own git repository you may want to delete this information and restart your project as it's own git project. You can do this by:
- Remove all
haskell-flake-templategitdata:
rm -rf .git/- Create a new
gitproject:
git initTip
It is also possible to run the included clean.sh to revert the template into a fresh
state, ready to start a new project (the next steps).
Caution
Once you create your project, this should never be used again.
- Setup Cabal:
cabal initor
cabal init --non-interactiveNote
In order to add a Haskell library, add the name of the library:
- In
flake.nixunder the comment# Other Haskell modules go here:inside the variableghc - In the
build-dependssection of your.cabalfile
In flake.nix:
ghc = hPkgs.ghcWithPackages (ps:
with ps;
[
# Packages to make available to GHC
ghcid # Needed for nixvim LSP
# Other Haskell modules go here:
microlens
]);In <my-project>.cabal:
build-depends: base ^>=4.19.2.0, microlensif you are facing code completion errors such as:
Caution
Failed to run ["cabal","v2-repl" ...
when using vim/nvim it may be necesarry to have a hie.yaml file. This flake includes
a tool gen-hie which will echo the proper outputs to stdout. Therefore, if you would like to
auto-generate hie.yaml it is as simple as:
gen-hie > hie.yamlin the root directory of your project.
For the sake of cabal, and the haskell-lsp any new modules (haskell source files) need to be
added to your .cabal file in the other-modules: section.
Download local hoogle index:
hoogle generate --download