Making My Local MacOS 100% Auto-Configured With Nix


Imagine your MacBook suddenly dies.

Years of careful customization - your apps, desktop layout, and system settings - are gone in an instant.

Setting up a new machine exactly like your old one typically takes hours, if not days.
It’s frustrating, time-consuming, and prone to errors.

Maybe your Mac didn’t die, maybe you’ve made a few quick changes you picked on Google and now it’s completely messed up and you want to roll it back.

Most users tackle this problem manually. We’ve all been there.

We install apps one by one, tweak system settings individually, and try to remember all their customizations. Some might use backup software or cloud syncing for parts of their setup, but it’s often incomplete and doesn’t cover system-level configurations.

This approach is slow, tedious, and inconsistent.

It’s easy to forget specific settings or apps, leading to an imperfect recreation of your work environment. Plus, if you switch between multiple machines or need to set up a new computer, this process becomes a major time sink. It also doesn’t solve issues like Homebrew environments breaking or system configurations becoming messy over time.

Enter Nix Darwin - a game-changer for Mac configuration

  1. Code-based Configuration: Your entire Mac setup, from installed apps to system preferences, is defined in a single code file. This includes everything from your dock layout to your screen saver.
  2. Version Control: Since your configuration is just code, you can track changes over time using Git, making it easy to revert changes or share setups with others.
  3. Quick Setup: With your configuration in code, setting up a new Mac becomes as simple as installing Nix and running one single command. What used to take hours now takes minutes.
  4. Homebrew Integration: Nix Darwin can manage your Homebrew applications, ensuring it never breaks and stays clean.
  5. Customization Heaven: You can control parts of your Mac you never knew were programmable. For example, you can set up Touch ID for sudo commands or customize your login screen message.
  6. App Management: Install and configure both command-line tools and GUI applications through code. No more clicking through installers!
  7. System Defaults: Customize Mac OS defaults like dock behavior, Finder settings, and more, all through code.

Getting Nix Darwin starts with getting Nix. I made a video about it recently to help you get started.

Once Nix is ready it’s time to install Nix Darwin; I went with the flakes option but there are a bunch of other alternatives in the project’s docs.

When you’ve got everything installed, you can now start configuring your local flake, and run:
darwin-rebuils --switch --flake .
in the flake’s path (or change . to the real path of your flake.nix).

That’s pretty much it. Every addition you make to the flake, run the command and it’ll take care of the heavy lifting.

I keep my flake up to date and pushed to GitHub so that it’s always recover-able and fetch-able remotely.


By using Nix Darwin, you’re not just saving time - you’re ensuring consistency across all your machines and making your entire setup trackable and reversible. It’s a powerful tool that turns the daunting task of system configuration into a simple, reproducible process.

While there’s a learning curve to using Nix Darwin, the payoff in terms of efficiency and peace of mind is crazy. Say goodbye to the days of painstaking manual setup and hello to a world where your perfect Mac configuration is always just a few commands away.

I have a new video on my channel covering Nix Darwin installation, management and everything you need to know. Make sure to check it out and drop a comment!

As always, thank you for reading, I hope this was valuable, feel free to reply directly with thoughts!

Whenever you’re ready, here’s how I can help you:

ESPRESSO FRIDAYS

Every once in a while I send hand picked things I've learned. Kind of like your filter to the tech internet. No spam, I promise!

Read more from ESPRESSO FRIDAYS

In a world where online privacy is increasingly under threat, and content is being blocked based on geo-location, many of us turn to paid VPNs for help. But what if I told you there's a better way? Paid VPN services promise security and anonymity, but they come with their own set of problems. You're entrusting your data to a third party, often with unclear logging policies and potential vulnerabilities. Not to mention the recurring costs that can add up over time If you have a bit of...

When it comes to terminal shells, many developers (myself included) have stuck with what they know or what they've seen others use online, without exploring other options. It's time to venture out and discover the world of terminal shells. Most developers are likely using Zsh, a POSIX-compatible shell, probably with Oh My Zsh on top. But there's a whole spectrum of shells out there, each with its own strengths and quirks. Today, we're going to explore three major players: Bash, Zsh, and Fish....

6 Neovim Plugins I Use To Troll Code Reviewers The Espresso Fridays is brought to you by: Zero To Running a Kubernetes Application Without Weeks of Studying A hands-on Kubernetes guide to deploy your first scaleable application In under 90 minutes you'll: ✅ Learn all the critical Kubernetes basics from a 10-year industry expert ✅ CUT learning time by 60% with a hands-on application deployment walkthrough ✅ Never feel inexperienced again with the hottest technology in the market Start learning...