This repository contains my personal dotfiles, managed with Nix and Home Manager to create a reproducible, declarative, and highly modular development environment. It is tailored for macOS and includes configurations for Zsh, Neovim, and a wide array of command-line tools.
This repo symlinks nix/home-manager/editors/nvim into ~/.config/nvim, so edits to those Lua files apply immediately on the next nvim start (no rebuild needed).
-
Add an LSP server:
- Edit
nix/home-manager/editors/nvim/lua/plugins/mason.luaand add the server to theserverstable. - Mason will auto-install servers/tools declared via
ensure_installedon first launch.
- Edit
-
Add a linter:
- Edit
nix/home-manager/editors/nvim/lua/plugins/lint.luaand add the linter tolinters_by_ft. - If the linter is an external CLI (e.g.,
markdownlint-cli2), install it via Nix by adding it tohome.packagesinnix/home-manager/default.nix.
- Edit
-
When do you need to rebuild?
- Editing Lua config: no rebuild; restart Neovim.
- Adding external binaries via Nix: run
home-manager switch --flake .. - Updating to newer package versions: run
nix flake updatefirst, then switch.
- Declarative & Reproducible: Built on Nix and Home Manager, ensuring a consistent setup across machines.
- Fully Modular: Configurations are broken down into small, single-purpose modules for tools, aliases, and shell settings, making them easy to manage and customize.
- Modern Shell: A powerful Zsh environment managed natively with Home Manager, featuring Starship for a minimal and fast prompt.
- Customized Editors: Tailored configurations for Neovim (based on a streamlined Lua setup) and VSCode.
- Rich Toolset: Includes curated configurations for dozens of popular CLI and development tools like
eza,bat,fzf,git,delta, andlazygit. - Modular config logic lives in
nix/(parameterized by settings) - Pure flake (
flake.nix) with user settings imported fromnix/user.nixfor reproducibility.
The configuration is built around a flake-based Nix setup. The core logic resides in the nix/ directory:
dotfiles/
├── flake.nix # Main Nix Flake entrypoint
├── install.sh # Installation script
├── prompts/ # AI agent prompts and workflows
└── nix/
├── user.nix # User-specific settings
├── mkConfig.nix # Configuration generation logic
├── systems.nix # System definitions (Darwin/Home Manager)
├── darwin/ # macOS-specific system configurations
└── home-manager/ # User-level configurations (managed by Home Manager)
├── modules/ # The heart of the setup:
│ ├── cli/ # CLI tools (e.g., eza, fzf, git, delta, lazygit)
│ ├── dev/ # Development tools (e.g., direnv, language tools)
│ ├── shell/ # Zsh, Tmux, and other shell settings
│ └── system-tools.nix # System monitoring tools (e.g., podman, nmap)
└── default.nix # Aggregates all Home Manager configurations
- Clone the Repository:
git clone https://github.com/your-username/dotfiles.git ~/.dotfiles cd ~/.dotfiles
- Run the Installation Script: This will install Nix and set up your environment.
./install.sh
- Edit User Settings: If needed, edit your user-specific settings in
nix/user.nix. - Apply Changes: After editing your configuration, apply the changes with:
nix run .#hma-switch(for Home Manager)nix run .#dma-switch(for Darwin)
This repo uses flakes. Switching uses the versions pinned in flake.lock.
-
To switch with current pins:
- Darwin:
darwin-rebuild switch --flake . - Home Manager:
home-manager switch --flake .
- Darwin:
-
To update to newer package versions:
- All inputs:
nix flake update - Specific input (e.g., nixpkgs):
nix flake update --update-input nixpkgs - Then run the switch command again.
- All inputs:
User-specific settings (such as username, home directory, git identity) are defined in nix/user.nix. Edit this file to personalize your setup:
{
username = "your_username";
homeDirectory = "/Users/your_username";
gitUser = "Your Name";
gitEmail = "your.email@example.com";
}