Hacker News new | ask | show | jobs
by rafaelRiv 21 days ago
How this was ever a problem ? and today we have ghcup, stack and nix
1 comments

That's the problem!

If I'm on NixOS, should I be installing via ghcup, stack, or nix?

The Haskell ecosystem seems obsessed with NixOS in a way I haven't seen anywhere else.

I recall wanting to use Haskell packages that were only available in Nix, but nobody had bothered to make just a normal package.

I’ve been using Haskell for about eighteen years and can’t think of a single example of anything that was only available via nix, other than Obsidian System’s stuff that used WASM back when building for that as a target was _complicated_ and having a reproducible environment was kind of a necessity.
Yeah. That tickles my memory, so that's probably what I'm talking about.
If you want to create an ecosystem optimized towards correctness, you'll have to curate what you let inside, and drop many things. And Nix is probably the best package manager for correctness.

That of course hurts market share.

There is no correct, only pros and cons. How you weight the pros and cons will not be the same as everyone else.
in correct i meant "minimizes the amount of bugs".
NixOS is subtly marketed to Haskell folks.

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.

https://edolstra.github.io/pubs/nixos-jfp-final.pdf

To be fair, that’s a general problem on NixOS (and other OSes), and one that tools like devenv have tried to solve. You can take what’s included with OS packages, but then you’re stuck with whatever version that is.
> You can take what’s included with OS packages, but then you’re stuck with whatever version that is.

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...

There is no such problem with Haskell! You either use your distro version of GHC or you use ghcup for the latest GHC.

Every other language does/must do the same since Ubuntu/Debian have 2+ years old packages.

This wasn't a hypothetical. I'm still not sure I made the right choice.

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.

if you're on NixOS, why don't you know how to install stuff? seems like you somehow don't know Nix??