Using nix-darwin on macOS June 28, 2026 on Savely Krasovsky's blog

I am not a regular macOS user, but I have never liked brew for some reason. Recently I got a MacBook for personal projects and occasional work. Almost immediately I needed to use brew, because the built-in OpenSSH doesn’t really work with FIDO2 SSH keys. Installing it from brew feels wrong to me, I don’t really know why; call it personal preference.

Then I tried to google the alternatives and found out that there is a nix-darwin project! Turns out you can enjoy nixpkgs repositories on macOS and nix’s declarative way of configuring your system.

I don’t want to describe the pros and cons of that approach, but for me it’s much more preferable to using plain brew.

I still use brew for all GUI apps as casks, because it’s a legitimate case, in my opinion. 90% of packages are part of my independent Home Manager configuration (so I could use it on the Linux machine as well), and the other 10% are system-wide packages like openssh and libfido2 and something like podman.

Here is a small guide for someone who has never used nix and nix-darwin before. A few years ago nix installation was pretty invasive. It was a simple bash script, and if you wanted to remove it later, it was an interesting quest, I would say.

Today you can just use nix-installer; I prefer the one provided by the NixOS community.

Install nix-installer

Use the following command from their README:

curl -sSfL https://artifacts.nixos.org/nix-installer | sh -s -- install --enable-flakes

Follow the instructions, it should be pretty straightforward.

Install nix-darwin

We can break down this process into these steps:

Those steps are described in detail in the nix-darwin README.

Example configuration

Since /etc/nix-darwin is owned by your user, you can open that directory in your favorite editor and start building your configuration. You can check my personal configuration here.

As of 2026, it’s pretty basic:

You can use it as an entry point for your own configuration.