使用 nix-darwin 和 home-manager 以声明式方式管理个人 Mac 配置,通过一条命令即可实现可重复的系统设置。

Stars

251

7 天增长

暂无数据

Fork 数

133

开放 Issue

3

开源协议

MIT-0

最近更新

2026-07-24

AI 仓库情报摘要
FR-AI / ANALYSIS

为什么值得关注

展示了如何利用 Nix 以简洁声明式的方法配置 macOS,提供一键初始化以及符号链接的配置文件,确保配置与实际使用不脱节。

适合谁使用

  • 追求可复现环境的 macOS 开发者
  • Nix 和 nix-darwin 用户
  • 寻找完整 dotfiles 模板的用户
  • 对 Neovim 和 WezTerm 配置感兴趣的人

典型使用场景

  • 从空克隆实现全新 Mac 的可重复设置
  • 学习基于 Nix 的 dotfiles 管理方式
  • Fork 作为个人 dotfiles 的起点
  • 声明式管理系统设置、软件包和用户级配置

项目优势

  • bootstrap.sh 一键完成 Nix 安装并应用配置
  • 配置文件采用符号链接(Neovim、WezTerm 等),编辑即时生效,无需重建
  • 支持 Apple Silicon 和 Intel Mac,仅需修改一行
  • 声明式管理 macOS 默认设置、Homebrew casks 和 Nix 包

使用前须知

  • 未针对多用户或多机器环境设计
  • Homebrew 的 ‘zap’ 清理会移除未在 configuration.nix 中列出的软件包
  • Fork 者会继承作者的 AGENTS.md,需自行编辑或删除

README 快速开始

dotfiles

Watch the walkthrough: https://youtu.be/5N-okeDdIuI

My personal Mac setup, managed with nix-darwin and home-manager. One repo, one command, and a fresh Mac ends up configured the same way every time.

Contributing / Using This Repo

These are my personal dotfiles, shared publicly so people can read them, learn from them, and fork them freely. Feature requests and pull requests are not accepted here, and PRs are auto-closed. If you find a bug, please open a GitHub Issue using the bug report template.

What you get

Running the switch builds:

  • System settings (dark mode, key repeat, dock, Finder, trackpad)
  • Homebrew apps (casks and CLI tools)
  • Nix user packages (ripgrep, fd, fzf, jq, lazygit, Neovim, Hack Nerd Font)
  • Shell (zsh, aliases, starship prompt)
  • Editor (Neovim config with the rose-pine moon theme)
  • Terminal (WezTerm config with the rose-pine moon theme)
  • Agent configs (Claude, Codex, opencode all share one AGENTS.md)

Prerequisites

  • Apple Silicon Mac, by default.
  • Intel Mac: change one line. In configuration.nix, set nixpkgs.hostPlatform = "x86_64-darwin"; (the comment right there tells you the same thing).

Fresh-machine setup

On a brand new Mac, from a bare clone of this repo:

git clone https://github.com/kunchenguid/dotfiles.git
cd dotfiles

Before you run it: review "Make it yours" below. Change the host label or CPU architecture if needed, and read the Homebrew cleanup warning. bootstrap.sh applies the config to your machine, so do this first.

./bootstrap.sh

bootstrap.sh does four things, in order:

  1. Installs Determinate Nix, if it isn't already installed.
  2. Symlinks this repo to ~/.dotfiles. This has to happen before the first build, because home.nix points at config files through ~/.dotfiles.
  3. Checks the user configured in flake.nix against your actual macOS username, and offers to fix it for you if they differ.
  4. Runs the first darwin-rebuild switch. It fetches the darwin-rebuild tool from the nix-darwin 26.05 release branch, then applies this repo's locked flake config.

After that, darwin-rebuild exists and you're on the normal workflow below.

Validate without applying

Once Nix is installed (bootstrap.sh step 1 handles that), you can check that the config builds without touching your system - handy when you have edited something:

相关仓库与替代方案

根据分类、Topic 和编程语言匹配的相似项目。

DigitalBrewStudios
DigitalBrewStudios GitHub avatar

darwin-modular-services

This repository adds support for NixOS-style modular services to nix-darwin, enabling declarative service management on macOS.

Nix
6