TLDR;

How to setup MacOS with Nix.

Context

Being a long time Linux user, I wanted to know if I can reproduce my development environment on a brand new ARM 64 MacOS machine.

Package Manager

MacOS doesn’t have a builtin package manager, which is quite confusing when coming from the Linux world. I already tried MacPorts and Homebrew in the past but was not convinced by them.

Nix

This time, I wanted to try something new, namely Nix, which I already use in other projects to setup my development environment (via nix-shell). Thanks to the package nix-darwin, this is in fact quite powerful: you can install all the Nix packages, as well as configuring your MacOS declaratively (ex: use the Touch ID to unlock sudo). I followed the article Setting up Nix on macOS and this works extremely well 🎉