nix-config

odysseus0's avatarfrom odysseus0

Declarative macOS environment via Nix. Manages CLI packages, GUI apps (Homebrew/MAS), system settings, program configs, dotfiles, and services. Use when: (1) Adding packages, tools, or apps, (2) Configuring programs (Git, SSH, shells, etc.), (3) Modifying dotfiles or system settings, (4) Permission denied on config files (indicates Nix-managed), (5) Rebuilding system.

⭐0stars🔀0forks📁View on GitHub🕐Updated Jan 7, 2026⬇️1downloads

When & Why to Use This Skill

This Claude skill enables declarative macOS environment management via Nix, allowing users to automate the setup of CLI tools, GUI applications, and system configurations. It ensures a reproducible, version-controlled workstation by managing everything from dotfiles to Mac App Store apps through a unified, code-based workflow, eliminating manual setup and configuration drift.

Use Cases

  • Automated Software Provisioning: Seamlessly install and update CLI utilities (like ripgrep, jq) and GUI applications (via Homebrew or MAS) by modifying central Nix configuration files.
  • Declarative Dotfile Management: Centralize and version-control configurations for Git, SSH, shells, and other programs to maintain a consistent development environment across different machines.
  • System Rebuilding and Recovery: Rapidly restore a complete, customized macOS environment on new hardware using a single 'make switch' command to ensure environment reproducibility.
  • Configuration Conflict Resolution: Identify and manage Nix-controlled system files to resolve 'permission denied' issues and ensure all system modifications are tracked and reversible.
namenix-config
description"Declarative macOS config via Nix (packages, apps, dotfiles, system settings). Use when: (1) Permission denied or root-owned on config/dotfiles (indicates Nix-managed), (2) Adding packages or apps, (3) Configuring programs, (4) Rebuilding system (make switch)."

Nix Config

Declarative macOS environment at ~/nix-config. See the repo's CLAUDE.md for full architecture.

Adding Packages

CLI tools → users/tengjizhang/home/packages.nix

home.packages = with pkgs; [
  ripgrep
  jq
  # ...
];

GUI apps → users/tengjizhang/darwin.nix

homebrew.casks = [ "raycast" "obsidian" ];

Third-party taps → Use full tap/cask path:

homebrew.casks = [ "steipete/tap/codexbar" ];

Mac App Store → users/tengjizhang/darwin.nix

homebrew.masApps = { "Things" = 904280696; };

npm Package Pattern

For latest npm packages, use pnpm dlx wrapper:

(writeShellScriptBin "toolname" ''
  exec ${pnpm}/bin/pnpm dlx @scope/package@latest "$@"
'')

Examples in packages.nix: claude, codex, gemini, gccli

Rebuild

cd ~/nix-config && make switch > /tmp/nix-switch.log 2>&1 && echo "✓ Switch succeeded" || echo "✗ Switch failed (see /tmp/nix-switch.log)"

Workflow

  1. Edit the appropriate .nix file
  2. Commit changes (keeps git clean before rebuild)
  3. make switch to rebuild and activate
  4. Push changes

Key Files

  • flake.nix - Inputs/outputs, system definition
  • users/tengjizhang/home/packages.nix - CLI packages
  • users/tengjizhang/home/programs.nix - Program configs (git, neovim, etc.)
  • users/tengjizhang/darwin.nix - Homebrew, macOS settings