See my rapid introduction to Nix.
See also NixOS.
Links
- https://nix.dev โ An opinionated guide for developers getting things done using the Nix ecosystem.
See my rapid introduction to Nix.
See also NixOS.
haskell-template
The goal of haskell-template
is to enable anyone to get started with Haskell development without much fanfare (thanks to Nix). I also use haskell-template
to bootstrap all of my new Haskell projects. See Getting started to get started.
haskell-template
(https://github.com/srid/haskell-template) is a template Git repository for ready-made, fully reproducible and friendly Haskell development using Nix. It comes with full IDE support in VSCode (and other editors with LSP support). See Philosophy for whatโs (and why it is) included.
Make monorepos awesome when using Nix flakes.
You will notice that Obelisk uses Nix to build your project. The command ob run
(described below) will abstract over the Nix stuff, including any GHCi handling, so you do not have to deal directly with Nix except for overriding dependencies.
The goal of this article is to get you comfortable managing simple Haskell programs and projects using the Nix package manager without getting too much into the details. See haskell-template
if you want a ready-made Nix-based project template for Haskell.
Regardless of the platform, you can use the exact Nix specification to install and configure Neovim.
If you are feeling adventurous consider getting acquainted with Nix, which in turns allows you to leverage haskell-template
for bootstraping Haskell projects with full IDE support in VSCode. This works on Linux, macOS and Windows (via WSL) without having to install dependencies other than Nix itself. In my opinion, this is the best way to set up a Haskell development environment if you are willing to approach the learning curve of Nix with alacritty.
If this is your first time using Nix or haskell-template
(or a project based on it) you will initially need to setup a few things on your system.
Projects like Ema enable creating your own static-site generator in Haskell, while leveraging Nix for reproducibility. The challenge with deploying your Haskell-based static site on GitHub Pages, however, is the lack of Nix caching. Every time you update your site, the CI will run slowly due to having to:
As a first step, though, we should enable Himalaya itself using Nix. home-manager
provides a module for that. Without much ado:
Nix is used for both developent and deployment; the production version in particular is deployed to a DigitalOcean droplet running NixOS. Nix makes reproducible development environments easy and possible. A testament to this is how easy it is to contribute to neuron (see CONTRIBUTING.md) - as with one command, nix-shell
, you get the full development enviornment including Haskell IDE support starting from a pristine system with nothing but Nix installed.
Static binaries are useful to distribute Haskell applications without requiring the user to build it themselves. Fully static Haskell executables are mostly supported by Nix; see this issue for details on whatโs left.
A little over a year ago I created the rib static site generator in Haskell based on Shake and ghcid. The idea was to be able to write a more intuitive (so no Makefile-like rules) set of instructions for building a static site, in a type-safe language while enabling quick recompilation cycle that ghcid provided, all made reproducible in Nix.