- Personal Nix-Darwin Config
Built on the denix library, this configuration uses auto-discovery for all modules. Define unique parameters (monitor resolutions for wallpaper scaling, usernames, git credentials) per MacBook while keeping the core environment identical. No manual imports needed!
A central theme engine that controls the look of the entire system.
- Modes: Switch between a generated Base16 theme or the official Catppuccin implementation.
- Scope: Controls Terminal colors (Alacritty/Kitty), Shell prompts (Starship), and application themes (Bat, Lazygit, Firefox).
Fully declarative management of user dotfiles and applications. It defines terminal, shell, browser, and git settings, which are reproducible across any Mac.
Declarative configuration of macOS behavior:
- Dock: Auto-hide, icon size, and orientation.
- Finder: Show all file extensions, default view modes.
- TouchID: Enabled for
sudocommands (no more typing passwords for admin tasks).
Uses fish as the primary shell with a robust default environment managed by Nix.
This configuration is built for the Determinate Systems Nix installer (which allows nix.enable = false in the config).
Run the installer:
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- installClone this repository to your home directory (usually ~/nix-darwin-macOS or similar).
git clone https://github.com/nicolkrit999/nix-darwin-macOS.git
cd nix-darwin-macOSIf your machine is not Krits-MacBook-Pro, you need to create a host folder for it.
Find your Hostname: Run this command to see what macOS calls your computer:
scutil --get LocalHostNameDuplicate the Template: Copy the existing template folder to a new folder named exactly like your Hostname.
cd hosts
cp -r Krits-MacBook-Pro <Your-Hostname>With the migration to denix and the delib module system, host configuration is centralized.
This file uses delib.host and contains the constants and module enablement for the host.
Variables like theming, hostname, and user are defined here under myconfig.constants. Shared and user modules are enabled here (e.g., programs.bat.enable = true;).
Variables to customize in constants:
- hostname: Needs to match the folder name
- user:: Needs to match the Mac user.
- terminal, shell, browser, editor: Default applications
- theme.base16Theme: The general theming (applied via stylix)
- theme.polarity: Light or dark mode
- theme.catppuccin: Whether to enable catppuccin or not
- gitUserName: Username of github account
- gitUserEmail: E-Mail of github account
An example snippet from default.nix:
{ delib, ... }:
delib.host {
name = "Krits-MacBook-Pro";
type = "desktop";
homeManagerSystem = "aarch64-darwin";
myconfig = { ... }: {
constants = {
hostname = "Krits-MacBook-Pro";
user = "krit";
theme = {
polarity = "dark";
base16Theme = "nord";
catppuccin = false;
};
# ...
};
# Enable shared modules
programs.git.enable = true;
# ...
};
}Contains darwin (system-level) and home-manager (user-level) configurations specific to this host, wrapped in delib.host blocks.
By design, anything within users/<name> or templates/<name> is considered opinionated.
users/<name>: For module logic specific to a given user/workflow. Users can just add a new folder matching their name and import those modules into theirdefault.nixin the host file.templates/<name>: For standard Nix functions that intentionally lack adelibwrapper since they are excluded from the auto-discovery engine. It protects standard structural Nix concepts (like dev environment flakes) from breaking the build process because auto-discovery expectsdelib.module. Any user module requiring non-delib logic should be organized here.
See delib documentation for details on available shared modules.
Build the flake to switch your system to the Nix configuration. Replace <hostname> with the name defined in your flake.
nix run nix-darwin -- switch --flake .#<hostname>Once installed, use the convenient aliases configured to manage your system.
| Command | Description |
|---|---|
sw |
Switch. Rebuilds the System and Home Manager configuration. |
upd |
Update. Updates flake.lock (packages) and then rebuilds the system. |
fmt |
Format. Formats all .nix files in the repo using nixfmt. |
Error: experimental-features 'flakes' is disabled
- Fix: The installer should handle this, but if not, ensure
~/.config/nix/nix.confcontains:experimental-features = nix-command flakes