nix-darwin¶
Overview¶
nix-darwin is the main macOS module ecosystem in the Nix stack: a large set of NixOS-style modules plus darwinSystem / darwin-rebuild, so you declare system packages, launchd jobs, defaults, and related settings in Nix on top of Apple’s OS. Upstream frames it as “/etc/nixos/configuration.nix for macOS.”
It sits beside nixpkgs NixOS modules (full Linux OS) and Home Manager (per-user environments). Same module mechanics (options, imports, mkIf); different option set and activation backend. It is not NixOS—no systemd, no kernel/rootfs rebuild.
How-to depth (activation, flakes, Home Manager wiring, option coverage): nix-darwin (home and user). This page is the landscape slot among module ecosystems.
Details¶
Role in the module landscape¶
| Ecosystem | Scope | Typical entry |
|---|---|---|
| nixpkgs NixOS modules | Full NixOS system | nixosSystem / nixos-rebuild |
| nix-darwin | macOS host config layered on Darwin | darwinSystem / darwin-rebuild |
| Home Manager | User home / dotfiles | standalone or NixOS/Darwin module |
| flake-parts | Flake-shaped module composition | mkFlake / flake modules |
nix-darwin consumes Nixpkgs packages and the shared module evaluation model; it does not replace NixOS’s option tree. Many Darwin options are macOS-specific—use the nix-darwin manual, not NixOS option names by assumption.
What the ecosystem provides¶
- A maintained module tree for system profile packages, environment, launchd, macOS defaults, fonts, nix daemon settings, optional Homebrew hooks, and more.
- Flake output
darwinConfigurationsvianix-darwin.lib.darwinSystem(channels/configuration.nixstill work). - Activation CLI
darwin-rebuild(first install often vianix run …#darwin-rebuild). - Release branches aligned with Nixpkgs (e.g.
nix-darwin-26.05next to unstable/master, as of 2026-07)—pin flake inputs so both stay compatible. Flakes remain experimental; upstream still recommends them for new setups.
Composition with Home Manager¶
Home Manager is a separate ecosystem that commonly plugs into nix-darwin via home-manager.darwinModules.home-manager, so system and user config activate together. That does not make HM part of nix-darwin’s upstream tree; treat them as composed stacks. Details: nix-darwin deep dive and Home Manager.
Prerequisites and implementations¶
Any Nix implementation that can evaluate the modules and drive the store works; upstream documents both Nix and Lix. nix-darwin can manage the Nix install on the Mac; interpreter choice is orthogonal to the module set itself.
Examples¶
Ecosystem shape only—minimal flake attr (hostname illustrative):
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nix-darwin.url = "github:nix-darwin/nix-darwin/master";
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = inputs@{ self, nix-darwin, nixpkgs }: {
darwinConfigurations."example-host" = nix-darwin.lib.darwinSystem {
modules = [ ./configuration.nix ];
};
};
}
That is the Darwin analogue of NixOS’s nixosConfigurations: one named system module graph, applied with darwin-rebuild switch --flake .#example-host. Full install and HM module snippets: nix-darwin.
See also¶
- nix-darwin (home and user) — activation, flakes, HM integration, option docs
- Home Manager — user-level module ecosystem (often composed with Darwin)
- nixpkgs NixOS modules — Linux OS module ecosystem counterpart
- flake-parts — flake module framework (orthogonal layer)
- Module ecosystems — sibling stacks in this domain
References¶
- nix-darwin/nix-darwin — source, README, install/uninstall; templates
nix-darwin/masterandnix-darwin/nix-darwin-26.05(verified 2026-07) - nix-darwin reference manual — options reference
- nix-darwin site — project landing page