Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds a
flake.nix
that uses: https://github.com/srid/haskell-flake/. This is (imo) a pretty nice nix library that lets you write clean and declarative flakes for haskell projects. It does introduce some magic and additional abstraction which may or may not be worth it depending on your tastes. It does make it harder to do some more complex or lower level stuff (e.g. building fully static binaries will probably be hard or not work at all with this framework).Apologies if this pr muddies the waters somewhat, I only realised that #20 existed once this was already written. In comparison to #20, this is a fully
cabal
based flake, and completely removes all dependencies on stack. Dependencies are parsed out from the cabal file and then pulled from thenixpkgs
haskell snapshot instead of the stackage lts snapshots.This pr only adds a flake, and so requires that anyone using it has the flakes features enabled in their nix instalation. Compatibility with the legacy nix commands could easily be provided using https://github.com/edolstra/flake-compat if desired.
There are two workflows:
nix build
: builds the project in a completely isolated nix based sandbox (this is essentially a highly restricted docker container)nix develop
: prepares a development shell with all required dependencies preinstalled (including ghc / cabal / haskell language server). Once inside this shell, you can build withcabal build
and enter a repl withcabal repl
Preparing the dev shell currently takes an outrageous amount of time (~1hr). This work needs to be done only once, and can be cached subsequently, but it's still obviously pretty painful. I suspect that this time is due to two things:
poly
which is currently marked as broken in nixpkgs (it seems as though some of the test suite is failing, not sure if that is of concern or not). This would ideally be investigated further and fixed upstream.I also added a
.envrc
file which provides a pretty nice workflow where it will automatically enter the development environment for this flake as soon as you cd into the repo root.