Personal Nix home-manager configuration for macOS (Apple Silicon) that manages user environment, packages, and dotfiles using Nix flakes.
- 🏠 Declarative Environment: Complete user environment managed through Nix
- 📦 Package Management: Reproducible package installation across machines
- 🔧 Development Tools: Comprehensive development environment setup
- 🚀 Flake-based: Modern Nix flakes for better reproducibility
- 🍎 macOS Optimized: Specifically configured for Apple Silicon Macs
- 💾 Binary Caches: Fast package installation with pre-built binaries
-
Install Nix (if not already installed):
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install
-
Install Home Manager:
nix run home-manager/master -- init --switch
-
Clone this repository:
git clone https://github.com/sadjow/home-manager ~/.config/home-manager cd ~/.config/home-manager
-
Apply the configuration:
home-manager switch --flake .
├── flake.nix # Flake definition with inputs and outputs
├── flake.lock # Locked dependency versions
├── home.nix # Main home-manager configuration
├── home/
│ ├── nix/
│ │ └── default.nix # Nix-specific settings and binary caches
│ ├── claude-code.nix # Claude Code integration
│ └── shell.nix # Shell configuration (zsh with asdf-vm)
├── docs/
│ └── CHANNEL_STRATEGY.md # Nixpkgs channel strategy and alternatives
├── overlays/
│ └── README.md # Information about custom overlays
├── CLAUDE.md # AI assistant guidance
└── README.md # This file
- Languages: Ruby, Dart, Node.js (via asdf)
- Editors: Neovim
- Version Control: Git, GitHub CLI
- Build Tools: CocoaPods, FFmpeg
- Shell: tmux, direnv, ripgrep, bat
- Security: AWS Vault, GPG
- Network: nmap
- AI Tools: Claude Code (via external flake)
- Package Management: Cachix, asdf-vm
- devenv: Fast, declarative development environments
- claude-code: AI coding assistant with dedicated Node.js runtime
This configuration uses several binary caches for faster package installation:
- cache.nixos.org: Official Nix cache
- devenv.cachix.org: Devenv package cache
- nix-community.cachix.org: Community packages
- claude-code.cachix.org: Custom Claude Code builds
To ensure flake operations (including devenv
updates) use the right caches without rebuilding locally, caches are declared at the flake level and accepted non-interactively:
- Flake-level caches are set in
flake.nix
vianixConfig.extra-substituters
andnixConfig.extra-trusted-public-keys
. - Non-interactive acceptance is enabled in
home/nix/default.nix
via:nix.settings.experimental-features = [ "nix-command" "flakes" ];
nix.settings.accept-flake-config = true;
Verification:
# Show effective daemon config (should list cachix and devenv caches)
nix config show | grep -E 'substituters|trusted.*keys'
# Run flake commands without prompts
nix --accept-flake-config flake check
Troubleshooting:
- If prompts still appear, pass
--accept-flake-config
on the command, or ensure Home Manager has applied the config:
home-manager switch --flake .
- If packages still rebuild, the exact inputs may not be present in caches for your platform; otherwise, caching is correctly configured.
# Apply configuration changes
home-manager switch --flake .
# Build configuration without switching
home-manager build --flake .
# Preview changes (dry run)
home-manager switch --flake . -n
# Update flake dependencies
nix flake update
# Check configuration validity
nix flake check
# Show flake outputs
nix flake show
# Update specific input
nix flake lock --update-input <input-name>
# Run garbage collection
nix-collect-garbage -d
Edit home.nix
and add packages to the home.packages
list:
home.packages = [
pkgs.your-package
# ... other packages
];
The configuration is modular. Key files to modify:
home.nix
: Main package list and basic settingshome/nix/default.nix
: Nix daemon settings and binary cachesflake.nix
: Add new input flakes or change system configurations
To add a new binary cache, edit home/nix/default.nix
:
caches = {
"cache.nixos.org" = "6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=";
"your-cache.cachix.org" = "your-public-key=";
# ... other caches
};
- Flake-based: Uses Nix flakes for improved reproducibility and dependency management
- Modular: Configuration split into logical modules for easier maintenance
- macOS Optimized: Specifically configured for Apple Silicon (aarch64-darwin)
- External Dependencies: Important tools like Claude Code managed as separate flakes
- Binary Caching: Multiple cache sources for fast package installation
- Channel Strategy: Uses nixpkgs-unstable for latest packages (see Channel Strategy Documentation)
- Platform: macOS (Apple Silicon / aarch64-darwin)
- Nix Version: Compatible with Nix 2.19+
- Home Manager: Uses latest stable release
-
Flake evaluation errors:
nix flake check --show-trace
-
Binary cache issues:
nix store ping --store https://cache-url.org
-
Home Manager conflicts:
home-manager switch --flake . --show-trace
- Check the Home Manager manual
- Review the Nix flakes documentation
- See
CLAUDE.md
for AI assistant specific guidance
- claude-code-nix: Dedicated Nix package for Claude Code
- devenv: Fast, declarative development environments
This configuration is provided as-is for personal use. Feel free to adapt it for your own needs.
Note: This configuration is personalized for user "sadjow". You'll need to update usernames, paths, and personal preferences when adapting it for your own use.