Hacker News new | ask | show | jobs
by lambdaba 388 days ago
Nix (and nix-darwin for persistent config) already does the job for non-GUI apps better than anything else could (its catalog is unmatched), and homebrew (also available in nix-darwin) handles GUI apps.
3 comments

I doubt nix is ever going to enjoy popularity on the scale of Homebrew due to its differing model. People are too used to doing a simple “x install y” without any backing configuration or flakes or anything like that.

Personally speaking I might learn it at some point but for now nix's friction/overhead isn’t proportional to the occaisional inconvenience with traditional package managers.

I think Nix has a marketing issue as it goes so deep. But if you're going to consider it only as an alternative to homebrew, you don't have to know anything aside from different CLI invocations: `nix-shell -iA <package>` to install, and maybe a step up with `nix-shell -p <package> --run <cmd>` to run without installing. You don't have to use nix-darwin or managing configs and the Nix language at all.
That’s still more to remember than `x install y`, which might sound trivial but that’s the exact kind of friction that impedes adoption.

Maybe it would make sense for nix to add a mode that basically aliases that first command to `nix install <package>`.

Yeah, I'm just addressing you specifically, you could switch easily and Nix has a much larger package selection (outside of GUI apps on macOS). And it immediately can do more via nix-shell -p, which can be also be used as shebang.

But yeah, Nix is much more than a homebrew replacement and that has its downsides.

Nix may have a larger selection, but I sampled a few of the projects I install from homebrew and...

1. Did't actually exist

2. Outdated version

3. Incorrect build

I'll keep the quality of Homebrew packages over the quantity in Nix

I'm curious of what the packages are because I only have ~10 packages that I use from homebrew, either very Mac-specific or that have better packaging (ffmpeg, mpv)
That's essentially what Devbox does for you as a package manager, a hand wrapper around nix for using nix just for its package ecosystem.
Oh yeah, I knew about devbox but hadn't seen (perhaps it's new) that it can handle global packages: https://www.jetify.com/docs/devbox/devbox_global/
I tried nix a few times in the past and it has too many issues on Mac (never got it working), also the learning curve is too steep, maybe I'll give it a try again.
An easy option nowadays is Determinate Nix https://docs.determinate.systems/determinate-nix/
So, an "easy" "better" option is:

- worse ux (nix commands are much more cumbersome and often make no sense compared to `brew install`)

- you have to use some third-party wrappers to make it work on Mac

- features incomplete and outdated packages (and is missing others apparently https://news.ycombinator.com/item?id=44034446)

... but it "does the job better than anything else could".

---

This is the issue I have with the whole nix discourse: it's hailed as this great magical tool. But when pressed for details it's always this: weird commands, configs, working or non-working wrappers etc.

This is just from my experience, I'm not part of any kind of Nix cult or anything, not that I'm aware of.

I don't know what you're talking about re: third party wrappers, this is just an option for a slightly easier and perhaps more robust install. And homebrew isn't free of issues at all.

Before getting a new MacBook, I was using MacPorts since Homebrew had several problems, including what the GP mentioned. For over a year now, I have used home-manager with Nix. Nixpkgs has the "important" subset of GUI programs that I use. Major exception to this is OrbStack, but there is a homebrew-to-nix converter that I use to handle that.

I briefly experimented with nix-darwin, but concluded that it was overkill for my needs. Home Manager also has the benefit of not being Mac-specific (so plenty of questions and examples exist online).

Most importantly, I no longer have to mentally prepare myself when updating Mac OS. If I recall correctly, both MacPorts and Homebrew require the user to re-install all installed packages after a major version update, but this problem doesn't really exist on Nix. It's also nice being able to store flakes in a Git repository and effortlessly rollback changes or replicate a whole development environment across several machines.

I'm interested in how you use that homebrew-to-nix converter, if you have links to configs or can describe it briefly!

I agree that nix-darwin is a bit overkill, I mainly use it for the homebrew integration, but I think so is home-manager, I don't keep user app configs in Nix since they are never exhaustive and more effort than it's worth.

Coming from nixos, I didn't want to use brew but I found nix-darwin to be poorly documented and supported.

Several upgrades wrecked havoc on my system, a lot of things didn't work as expected, I had to package a lot of stuff; eventually I just bit the bullet and started using homebrew

I sort of get what you're saying and I've had a few sporadic issues myself, once or twice I had to reinstall (although might have been my mishandling), but overall I can't see a better solution than this. Plus I can share the configs with Linux.