hello!
im trying to get a boilerplate for packaging haskell applications that I write.
I want it to be reproducible, and ideally I want to not have to worry about manually figuring out version constraints.
I had a look at haskell.nix, which looked promising, however I havent been able to get their flakes example to compile for a default stack project.
My two questions are:
1: is haskell.nix what I want for this? If not, what sholud I be using?
2: has anyone managed to get the flake example below working? is there something im missing?
Thank you:
https://input-output-hk.github.io/haskell.nix/tutorials/getting-started-flakes/#getting-started-with-flakes
I’m wondering exactly the same and found these 2 links that might help:
Packaging in nixpkgs
or for yourself or some internal deployments? Also are you interested in development environments using nix or is the stack nix integration enough for you?
While waiting for @techieAgnostic to answer, I will provide my own answers:
Packaging in nixpkgs
or for yourself or some internal deployments?
I’m adding nix infrastructure to my git project to get reproducible builds and to leverage cachix in GitHub Actions.
Also are you interested in development environments using nix or is the stack nix integration enough for you?
I would preferably have nix all-the-way down (for fast builds in GitHub Actions with cachix) and in sync with package.yaml so those without nix can also build and run the project.
If you need to use cabal’s solver to generate a Nix Haskell package set, or you want to create a Nix Haskell package set from an arbitrary Stackage resolver, then you’ll want to use haskell.nix.
Here’s a couple “getting started skeleton repos” you may want to take a look at:
If you can get away with using the Haskell package set from nixpkgs, then the two functions you’ll want to look into are developPackage
and shellFor
. There is some documentation inline directly above these two functions in the Nixpkgs repo, but I’m sure if you search for it someone has probably written a blog post about how to use these two functions.
The Nixpkgs Haskell infrastructure is somewhat simpler than haskell.nix, although less feature-rich.
If you use Nixpkgs Haskell package set, you can often get away with not using cachix, since most of your dependencies should come from the nixpkgs cache.
2 Likes
Thanks for this information, I really wanted to have Nix build my projects, but not have to manually do constraint solving, so haskell.nix looks like a good thing to use.
gonna spend a while trying to convert that template to a flake, thank you for all the help 
1 Like