by rafaelRiv · 3w ago · 0 comments
If I'm on NixOS, should I be installing via ghcup, stack, or nix?
I recall wanting to use Haskell packages that were only available in Nix, but nobody had bothered to make just a normal package.
That of course hurts market share.
I got into Haskell because I wanted to learn ADTs, and quickly found I really appreciate the ways that purely functional programming tickles my brain!
NixOS has been described as a "purely functional Linux distribution" and I liked the sound of that at first. I haven't figured out what this means, lol, but I tried it anyway and quickly found I really appreciate it's declarative configuration.
It's pretty easy to override things in Nixpkgs though, whether at the system level, or for one application, or just a particular dependency deep in the tree of one script.
Nixpkgs has a bunch of powerful functions to make this easier, e.g. callCabal2nix, makePackageSet, etc.
https://nixos.org/manual/nixpkgs/stable/#haskell-overriding-...
https://github.com/NixOS/nixpkgs/blob/master/pkgs/developmen...
Every other language does/must do the same since Ubuntu/Debian have 2+ years old packages.
I decided to go with GHC via nix-shell, which worked fine, but it's a different path than I went with installing Rust (global rustup), and I'm not sure how to evaluate the pros/cons of each. I miss having ghci invocable anywhere, but doubt that's a good reason to change.
Also, ghcup failing on my Rasberry Pi was a fun troubleshooting experience! I don't remember how I got around that one either, but they eventually fixed the issue.