mirror of
https://github.com/softinio/nix-config.git
synced 2025-10-18 11:06:41 -07:00
3.3 KiB
3.3 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Overview
This is a nix-darwin and home-manager configuration for managing a macOS system (Apple Silicon M3 Max) declaratively. The configuration uses Nix flakes and manages both system-level packages (via nix-darwin) and user-level packages and dotfiles (via home-manager).
Architecture
Flake Structure
The repository follows a modular architecture:
flake.nix
: Entry point defining inputs (nixpkgs, nix-darwin, home-manager, nur) and outputs. Defines the main darwin configurationsalarm3max
for aarch64-darwin.home.nix
: Main home-manager configuration importing all program modules and defining system-wide packages.programs/default.nix
: List of program module imports (each program has its own subdirectory withdefault.nix
).programs/*/default.nix
: Individual program configurations (fish, git, jujutsu, ghostty, wezterm, zed, etc.).
Key Design Patterns
- Modular Program Configuration: Each program (fish, git, ghostty, etc.) has its own directory under
programs/
with adefault.nix
file. - Allowlist for Unfree Packages: Unfree packages are explicitly allowlisted in
home.nix
usingallowUnfreePredicate
. - External Config Fetching: Neovim config is fetched from external GitHub repo (
softinio/nvim-config
) rather than managed in this repo. - Integration Through Imports:
programs/default.nix
is a simple list that gets imported intohome.nix
, making it easy to enable/disable programs.
Common Commands
Note: User uses Fish shell, not Bash. All commands below work in Fish.
Building and Activating Configuration
# Build and switch to new configuration (PREFERRED - use this alias)
nixre
# Full command (if needed)
darwin-rebuild switch --flake ~/.config/nixpkgs#salarm3max
# Build without switching
darwin-rebuild build --flake ~/.config/nixpkgs#salarm3max
Updating Dependencies
# Update all flake inputs
nix flake update
# Update specific input
nix flake lock --update-input nixpkgs
Testing Changes
# Build configuration locally to test before switching
nix build .#darwinConfigurations.salarm3max.system
Maintenance
# Garbage collection
nix-collect-garbage -d # Also aliased as: nixgc
# Repair Nix store
nix-store --repair --verify --check-contents # Also aliased as: nixstorerepair
# Check system info
nix-shell -p nix-info --run "nix-info -m" # Also aliased as: nixinfo
Adding New Programs
To add a new program configuration:
- Create directory:
programs/newprogram/
- Create
programs/newprogram/default.nix
with configuration - Add
./newprogram
to the list inprograms/default.nix
- Run
nixre
to apply changes
Important Notes
- Platform: This configuration is specifically for
aarch64-darwin
(Apple Silicon Macs). - User: Configuration is for user
salar
with home directory/Users/salar
. - Shell: Fish is the default shell with extensive customizations.
- Nix Features: Experimental features
nix-command
andflakes
are enabled. - Version Control: Uses jujutsu (jj) as the primary VCS alongside git.
- Editor: Neovim is the default editor (
$EDITOR
and$VISUAL
environment variables).