Live data from Hacker News

Package management on macOS with Nix-Darwin

davi.sh

1–10 of 33 posts

Re: Package management on macOS with Nix-Darwin

#4
I have all the love and appreciation in the world for enjoying a weekend spent in configuration files. But I feel the need to state the obvious:

This is a long blog post ending with a preview to "future installments of the guide" to use nix, while almost everything that you need to know with homebrew is `brew install/update/upgrade/uninstall`, and I have rarely run into any trouble with brew, and none at all in recent memory.

Re: Package management on macOS with Nix-Darwin

#5
I’ve wrapped nix-darwin, home-manager etc in a Nix configuration for macOS, with a starter template and simple installer.

I’ve been running it for a couple years, you can use it to try Nix without as much up front learning.

Almost 1000 stars!

https://github.com/dustinlyons/nixos-config

Edit: Just crossed 1k! Thanks HN

Re: Package management on macOS with Nix-Darwin

#6
post #3

That's pretty cool that it can install Homebrew packages. Can anyone speak to how well that actually works in practice?

Extremely well, even supports passing arguments (`--HEAD`) through and integrates with services for casks too, so it can restart things like postgresql when homebrew updates it.

Having nix-darwin uninstall brews not declared in the flake makes me stay honest about keeping my configuration up to date as well, if I've just `brew install x` to try something it'll get removed next time I apply my config. Needs adding to the flake to keep it installed persistently, which in turn means my config tends to be up to date.

Re: Package management on macOS with Nix-Darwin

#7
post #3

That's pretty cool that it can install Homebrew packages. Can anyone speak to how well that actually works in practice?

I use it to install a bunch of Homebrew casks and a small number of regular packages to support those casks. It works perfectly well!

My biggest annoyance is that Homebrew is really slow; the Homebrew part of my Nix-Darwin rebuilds usuay takes 3-5x as long as everything else combined. Homebrew is really slow even when it has nothing to do.

The only caveat worth mentioning is that the module built into Nix-Darwin doesn't support installing Homebrew itself. Instead you tell it the prefix for an existing Homebrew installation.

(There is an out-of-tree module for installing Homebrew as well, but I haven't tried it.)

Re: Package management on macOS with Nix-Darwin

#8

I have all the love and appreciation in the world for enjoying a weekend spent in configuration files. But I feel the need to state the obvious: This is a long blog post ending with a preview to "future installments of the guide" to use nix, while almost everything that you need to know with homebrew is `brew install/update/upgrade/uninstall`, and I have rarely run into any trouble with brew, and none at all in recen…

I have used brew trouble free for many years.

Re: Package management on macOS with Nix-Darwin

#9
I could never get into nix on Mac os. Maybe it's a different thing if you use nixOS but I'm not willing to make that jump.

It seems the clear barrier to entry to nix is UX and to an extent the custom language they use. Maybe this problem can be solved with LLMs. We need an LLM fine tuned to write nix language.

Re: Package management on macOS with Nix-Darwin

#10

I have all the love and appreciation in the world for enjoying a weekend spent in configuration files. But I feel the need to state the obvious: This is a long blog post ending with a preview to "future installments of the guide" to use nix, while almost everything that you need to know with homebrew is `brew install/update/upgrade/uninstall`, and I have rarely run into any trouble with brew, and none at all in recen…

I'm recently back on macOS for work, and I wanted to love nix-darwin, but just couldn't get it even installed / basics running well enough to start to enjoy configuring things with it. The whole flakes mess really doesn't help.

(Maybe if you're already running NixOS and familiar with the latest it's a lot easier.)

I couldn't even uninstall it cleanly, since the Mac was new I gave up after some time and decided it was easier to reinstall macOS (which takes several hours but at least I can just leave it and then know that it's done).

So I'm back to (purely) brew (and scripts to `defaults write` etc.).

My frustration with brew is that it's getting increasingly opinionated, and those opinions are not familiar to me from any other OS/package manager... Like if you want postgres v15 you have to `brew install postgresql@15`, and then even if that's your only installed version it's 'keg-only', which means it's not on your PATH, and their suggestion is to dump some stuff at the end of your ~/.zshrc, which aside from the fact you're not using zsh and they could tell that, just seems dumb.

Then there's python & npm packages... They're deprecated and being removed as independent formulae, so don't do it like that. You're not allowed to install them with the python/node formula you installed, so don't do that. So what do you do, `python -m venv ~/system-python-venv` or something, activate it, and install in there. And now remember to activate that every time you want to use a command that happens to be a python package so you had to install it there. Or dump it in the end of your zshrc, I guess!

Post reply on HN