This blog post was inspired by the work of Gabriel Gonzalez at haskell-nix github repository which has a lot of practical information on how to structure a Haskell project in NixOS. Here I will show my own view on a typical Haskell project structure in NixOS taking into account Gabriel’s work. I would encourage everyone interested to fork haskell-nix and go through Gabriel’s tutorial. That helped me understand some of the issues I was not aware before.
If you are like me, sometimes you need to update all you repositories somewhere in ~/Projects folder. And it is best to be automated. So, if you are on Linux you can try commands I am going to show here. Example here would be to update paket.dependencies and paket.lock files in each and every repository, then commit and push this change. Here is how easy it is to do it:
You can find concrete implementation in the GitHub repository - rabbitmq (Tree: 6f2b504008). This post is based on the previous post in the series “Building RabbitMQ cluster in Docker Swarm Mode” that elaborated on how to setup fixed RabbitMQ cluster in Docker Swarm. Over time it became clear that there are some caveats with how it was suggested to do it. For example: the delay was built into image nodes once disconnected from a cluster could not join it again Available images There is a docker image available on hub.
Expectations Not long passed since I first started using Nix and NixOS, that I realized that I would like to have my haskell development to be better integrated with it. I myself is a Vim user (even though I do try Emacs/Spacemacs from time to time) and as such not so much spoiled with lots and lots of tools available. But what I had I would like to be able to reliably use in my new OS.
Earlier I went through a solution to this problem based on inotifywait utility which is fairly common approach (“Triggering a build on file change in Linux”). Though after using this solution for some time I came to conclusion that there is an issue that is very difficult to overcome - terminal colors from an invoked script are lost and after the first build you see monochrome picture. I ended up thinking this is due to inotifywait or piping in bash.