nix-darwin: declarative macOS system management with Nix
Manage your macOS using Nix
At a glance
- What is it?
- nix-darwin brings a NixOS-style module system to macOS, managing system defaults, launchd services and packages from a single configuration. It is for Mac users already inside the Nix ecosystem, not for anyone looking for a lighter Homebrew replacement.
- Who is it for?
- Adopt nix-darwin if you already run Nix on macOS and want system-level state, not just packages, expressed in modules you can review and rebuild. Skip it if you are not prepared to keep a Nix installation healthy, or if you only need CLI tools, where Home Manager or Homebrew alone is a smaller commitment.
- Can I use it commercially?
- Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 15 days ago.
- What is it written in?
- Mainly Nix, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on November 15, 2026, and from our analysis. They are not legal advice.
Star history
- nix-darwin/nix-darwin6,079 ★ · +133
| Repository | 2026-09-23 | 2026-11-15 |
|---|---|---|
| nix-darwin/nix-darwin | 5.9k | 6.1k |
133 Stars in the last 53 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
The problem nix-darwin solves on macOS
macOS has no declarative system layer. You configure defaults with defaults write, schedule background work with launchd plists, and install command line tools with Homebrew, and none of that state is described in one place you can rebuild from. nix-darwin is the project that fills that gap. Its README describes it as "Nix modules for darwin, /etc/nixos/configuration.nix for macOS," and states that it aims to bring the convenience of a declarative system approach to macOS, built around Nixpkgs and quite similar to NixOS.
The audience follows from that framing. This is for people who already accept Nix as their package manager and want the same evaluation model applied to system defaults, launchd services and user configuration. It is not a friendlier Homebrew. If you have never written a Nix expression, the configuration language is the first obstacle, not the installer.
How the module system and darwin-rebuild fit together
The architecture is a Nix module evaluation, the same shape NixOS uses. The repository ships a modules/ directory, an eval-config.nix, a flake.nix, and a flake-module.nix at the top level, and the README points to a simple example at modules/examples/simple.nix. A configuration is a set of module files; nix-darwin evaluates them against Nixpkgs and produces a system closure.
The entry point for applying that closure is darwin-rebuild. The README shows that after installation you run darwin-rebuild switch to apply changes, and that the -I flag can override inputs such as darwin-config or nixpkgs, which is also how contributors build against a local checkout. Flake users get a second path: inputs passed into darwinSystem through specialArgs are then available as an inputs argument inside the configuration, alongside pkgs and lib. That is the mechanism that lets a configuration reference its own flake inputs rather than hardcoding URLs.
Documentation is generated from the options themselves. The README lists three ways to read it: the online nix-darwin reference, the darwin-help command locally in a browser, and man 5 configuration.nix. That last one matters because it means the option set is available offline on the machine you are configuring.
Installing nix-darwin and running a first switch
The README is explicit that nix-darwin has no installer, unlike NixOS. The only prerequisite is a Nix implementation, and both Nix and Lix are supported. The README recommends the Lix installer because the official Nix installer has no automated uninstaller and manual removal on macOS is complex.
The flake path is what the README recommends for beginners. Create the directory, generate a flake from the template, and replace the placeholder hostname with your local hostname:
sudo mkdir -p /etc/nix-darwin
sudo chown $(id -nu):$(id -ng) /etc/nix-darwin
cd /etc/nix-darwin
nix flake init -t nix-darwin/master
sed -i '' "s/simple/$(scutil --get LocalHostName)/" flake.nixBefore building, check that nixpkgs.hostPlatform is set to x86_64-darwin on Intel or aarch64-darwin on Apple Silicon. This is a common failure point: the README calls it out in both the from-scratch and migration instructions.
Because darwin-rebuild is not yet on your PATH, the first switch runs through nix run:
sudo nix run nix-darwin/master#darwin-rebuild -- switchAfter that, darwin-rebuild is installed and subsequent rebuilds are just sudo darwin-rebuild switch. The channel-based path exists as an alternative: add the nix-darwin channel, update it, then nix-build '<darwin>' -A darwin-rebuild and run the result with an explicit -I darwin-config pointing at /etc/nix-darwin/configuration.nix.
If you want Lix rather than upstream Nix, the README states that nix-darwin manages the Nix installation by default and defaults to upstream Nix, and that you change this with nix.package = pkgs.lix in your configuration. The installer you used does not decide which interpreter the system uses later.
Where nix-darwin stops short
The README's own prerequisite section is the clearest limitation. There is no automated uninstaller from the official Nix installer, and manual uninstallation on macOS is described as a complex process. nix-darwin does provide a removal path, but it is a separate command rather than part of the install flow, and the README offers a fallback to a locally installed darwin-uninstaller if the remote one fails.
The second constraint is that flakes, which the README recommends for beginners, are described there as an experimental feature in Nix. Recommending an experimental feature as the default on-ramp is a real trade-off, and the channel path is the documented alternative.
Finally, the scope is system-level. If what you actually want is per-user dotfiles and CLI tooling, nix-darwin alone is more machinery than the problem requires.
nix-darwin versus Home Manager and Homebrew
Against Home Manager, the difference is the layer each one targets. nix-darwin configures the machine: system defaults, launchd services, and the packages and state that belong to the host. Home Manager configures a user's environment, typically dotfiles and per-user packages. They are complementary.
Against Homebrew the split is different. Homebrew installs and upgrades software imperatively, one command at a time, and its state is whatever the machine has accumulated. nix-darwin evaluates a configuration and builds a system closure from it, so the description of the system lives in files you can read. The cost is that you are now maintaining a Nix configuration and a Nix installation, which is a larger ongoing commitment than brew bundle.
Maintenance, licence and upgrade path
The last push to the repository was on 2026-10-31, and the repository is not archived. The repository has no published GitHub releases.
The project is MIT licensed. In practice that means you can use, modify and redistribute it with the licence text, and it imposes no copyleft obligation on your configuration. That is a statement about the licence text, not legal advice for your situation.
The upgrade model is channel or flake input. Channel users run sudo nix-channel --update to move both Nixpkgs and nix-darwin. Flake users bump the inputs in flake.nix; the README shows both a master track and a nix-darwin-26.05 track for Nixpkgs 26.05, and the same split appears in the nix flake init templates and the nix run command. Pinning to a release branch rather than master is the lower-variance choice, and the README supports both.
Contributors have a documented local build path: sudo darwin-rebuild switch -I darwin=. builds against a local checkout, and new modules are expected to add their author to meta.maintainers, with an or fallback for when lib from Nixpkgs drifts out of sync. Basic module tests run through nix-build release.nix -A tests, or a subset such as tests.environment-path.
Editorial conclusion
Adopt nix-darwin if you already run Nix on macOS and want system-level state, not just packages, expressed in modules you can review and rebuild. Skip it if you are not prepared to keep a Nix installation healthy, or if you only need CLI tools, where Home Manager or Homebrew alone is a smaller commitment. Before committing, verify that nixpkgs.hostPlatform is set correctly for your hardware, that your hostname matches the darwinConfigurations attribute you build, and that you can run the uninstaller command from the README on a machine you are willing to reset.
Frequently asked questions
What is nix-darwin?
It is a set of Nix modules for macOS, described in the README as "/etc/nixos/configuration.nix for macOS." It brings a declarative system approach to macOS and is built around Nixpkgs, similar to NixOS.
How do I install nix-darwin?
There is no installer. After creating a flake.nix or configuration.nix, run sudo nix run nix-darwin/master#darwin-rebuild -- switch for the first switch, since darwin-rebuild is not yet on your PATH. Later rebuilds are just sudo darwin-rebuild switch.
How do I remove nix-darwin?
The README gives a command for the latest uninstaller: sudo nix --extra-experimental-features "nix-command flakes" run nix-darwin#darwin-uninstaller. If that fails, it suggests the locally installed sudo darwin-uninstaller.
What is the difference between nix-darwin and Home Manager?
nix-darwin manages the machine, including system defaults, launchd services and host-level configuration, while Home Manager targets a user's environment such as dotfiles and per-user packages.
How do I use nix-darwin after installing it?
Edit your configuration and apply it with sudo darwin-rebuild switch. Inputs from your flake can also be passed into darwinSystem via specialArgs and are then available as an inputs argument inside the configuration.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/nix-darwin-nix-darwin)Star history chart for your README
[](https://hysenlabs.com/projects/nix-darwin-nix-darwin)Was this useful?