Skip to content

πŸ’» Dotfiles and macOS dev setup (Homebrew or Nix + Home Manager).

Notifications You must be signed in to change notification settings

kaffolder7/dotfiles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

69 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

dotfiles 🧰

Personal macOS dotfiles with a focus on:

  • ⚑ fast Zsh startup
  • πŸ—‚οΈ XDG-friendly config layout
  • ♻️ reproducible installs via Homebrew
  • πŸ” minimal magic, explicit behavior

βœ… Tested on macOS (Apple Silicon).


⏱️ Quick start

git clone https://github.com/kaffolder7/dotfiles ~/src/dotfiles
cd ~/src/dotfiles
./install.sh --brew

The installer also symlinks the dot helper command into ~/.local/bin.

This will:

  • Install Homebrew (if missing)
  • Install packages from Brewfile
  • Symlink dotfiles into your home directory
  • Back up any existing files before replacing them

To overwrite existing files without backups:

./install.sh --brew --force

After install, you can sanity-check everything with: dot doctor.


🩺 Dotfiles doctor

A small built-in sanity check for this repo.

After installation, you can run:

dot doctor

This verifies:

  • which install route is active (Homebrew vs Home Manager)
  • required XDG paths exist and are writable
  • required cache and history directories are present
  • file-based secrets are set up correctly
  • expected tools (llm, codex, etc.) are available

Think of it like brew doctor, but scoped specifically to this dotfiles repo.

It’s safe to run anytime and is especially useful:

  • after a fresh install
  • when switching machines
  • if something feels β€œoff” with your shell

It does not print secret values β€” only presence and basic health checks.


Installation routes

This repo supports two install styles:

πŸ§ͺ Homebrew (default)

Recommended for most macOS setups.

  • Uses install.sh --brew
  • Zsh config is loaded directly from ~/.zshrc
  • Homebrew manages all packages

🧬 Home Manager (optional / advanced)

For users already using Nix + Home Manager.

  • Zsh is managed via nix/home.nix
  • Dotfiles are still shared, but loaded via Home Manager
  • DOTFILES_ROUTE=hm is set automatically

Setup:

  1. Edit flake.nix and set username to your macOS username (run whoami if unsure)
  2. Run the initial switch:
nix run github:nix-community/home-manager -- switch --flake .#macmini
# or for MacBook Pro:
nix run github:nix-community/home-manager -- switch --flake .#mbp

Both routes share the same Zsh modules and XDG layout.


What gets installed / linked

Zsh

  • ~/.zshrc β†’ home/.zshrc
  • Modular config loaded from:
    ~/.config/zsh/zshrc.d/
    

Features:

Git

  • ~/.gitconfig β†’ home/.gitconfig (used for the Homebrew route, otherwise configuration is managed by Home Manager)
  • Personal settings (e.g. user.name, user.email, etc.) live in ~/.gitconfig.local (not committed)

Create it with:

cp home/.gitconfig.local.example ~/.gitconfig.local

Ghostty

Ghostty is a fast, feature-rich, and cross-platform terminal emulator that uses platform-native UI and GPU acceleration.

  • ~/.config/ghostty/config β†’ xdg/ghostty/config

Includes:

  • One Dark theme
  • Transparent background with blur
  • Sensible padding and defaults

Nano

  • ~/.config/nano/nanorc β†’ xdg/nano/nanorc

πŸ§ͺ Homebrew

Homebrew is the missing package manager for macOS (or Linux).

All packages are managed via Brewfile.

  • Safe by default: installs missing packages only
  • To enforce a clean system (⚠️ destructive):
    brew bundle --cleanup
    

To update the Brewfile after changes:

brew bundle dump --force

πŸ” Secrets

Secrets are stored as files (not env vars) under: ~/.config/secrets/.

Examples:

  • openai_api_key
  • openai_api_key_llm
  • openai_api_key_codex

They are:

  • ignored by git
  • read only when needed
  • injected per-command (not exported globally)

See xdg/zsh/zshrc.d/70-openai.zsh for details.


🧩 Local overrides (recommended)

Zsh

Create a local-only file:

cp home/.zshrc.local.example ~/.zshrc.local

Anything in ~/.zshrc.local is sourced last and ignored by git.

Git

Edit ~/.gitconfig.local for name, email, signing keys, etc.


πŸ—ΊοΈ Repo layout

dotfiles/
β”œβ”€β”€ Brewfile                        # Homebrew bundle: packages, casks, VS Code extensions
β”œβ”€β”€ install.sh                      # Main installer (Homebrew or Nix/Home Manager routes)
β”œβ”€β”€ bin/
β”‚   β”œβ”€β”€ dot                         # Lightweight helper CLI entrypoint
β”‚   └── dot-doctor                  # Sanity-check tool for paths, secrets, and install state
β”œβ”€β”€ codex/
β”‚   └── config.toml                 # Codex CLI provider/model configuration
β”œβ”€β”€ home/
β”‚   β”œβ”€β”€ .gitconfig                  # Base Git config (includes local overrides)
β”‚   β”œβ”€β”€ .gitconfig.local.example    # Example for user-specific Git identity (not committed)
β”‚   β”œβ”€β”€ .zshrc                      # Minimal Zsh entrypoint (loads modular config)
β”‚   └── .zshrc.local.example        # Local-only Zsh overrides (ignored by git)
β”œβ”€β”€ nix/
β”‚   β”œβ”€β”€ hosts/
β”‚   β”‚   β”œβ”€β”€ macmini.nix             # Mac Mini host-specific config
β”‚   β”‚   └── mbp.nix                 # MacBook Pro host-specific config
β”‚   β”œβ”€β”€ overlays/
β”‚   β”‚   └── default.nix             # Nix package overlays
β”‚   β”œβ”€β”€ pkgs/
β”‚   β”‚   └── bbrew.nix               # Custom bbrew package definition
β”‚   └── home.nix                    # Main Home Manager configuration
β”œβ”€β”€ scripts/
β”‚   β”œβ”€β”€ ollama-models.sh            # Pull default Ollama models (gemma3, etc.)
β”‚   └── update-bbrew.sh             # Fetch latest bbrew version + hashes
β”œβ”€β”€ secrets/
β”‚   β”œβ”€β”€ openai_api_key.example        # (Optional) single shared OpenAI key
β”‚   β”œβ”€β”€ openai_api_key_codex.example  # Example Codex-specific OpenAI key
β”‚   └── openai_api_key_llm.example    # Example LLM-specific OpenAI key  # Real secrets live in ~/.config/secrets (not committed)
β”œβ”€β”€ xdg/
β”‚   β”œβ”€β”€ ghostty/
β”‚   β”‚   └── config             # Ghostty terminal configuration
β”‚   β”œβ”€β”€ nano/
β”‚   β”‚   └── nanorc             # Nano editor config (XDG-compliant)
β”‚   └── zsh/
β”‚       β”œβ”€β”€ .p10k.zsh               # Powerlevel10k prompt configuration
β”‚       └── zshrc.d/
β”‚           β”œβ”€β”€ 00-env.zsh          # Core environment setup (XDG, PATH, cache dirs)
β”‚           β”œβ”€β”€ 10-homebrew.zsh     # Homebrew shell environment (brew shellenv)
β”‚           β”œβ”€β”€ 20-completion.zsh   # Zsh completion + caching (non-HM route)
β”‚           β”œβ”€β”€ 30-history.zsh      # History behavior + XDG_STATE_HOME storage
β”‚           β”œβ”€β”€ 40-aliases.zsh      # Shell aliases (non-HM route)
β”‚           β”œβ”€β”€ 50-prompt.zsh       # Powerlevel10k prompt setup
β”‚           β”œβ”€β”€ 60-plugins.zsh      # Zsh plugins (autosuggest, autocomplete, highlighting)
β”‚           β”œβ”€β”€ 70-openai.zsh       # OpenAI / LLM / Codex helpers + file-based secrets
β”‚           β”œβ”€β”€ 80-hooks.zsh        # Hooks (e.g. fastfetch once per session)
β”‚           └── 90-local.zsh        # Local Zsh overrides (~/.zshrc.local)
β”œβ”€β”€ .github/
β”‚   └── workflows/
β”‚       β”œβ”€β”€ ci.yml                  # PR/push checks (nix flake check)
β”‚       β”œβ”€β”€ update-bbrew.yml        # Weekly auto-update for bbrew package
β”‚       └── update-locks.yml        # Monthly auto-update for flake.lock
β”œβ”€β”€ .editorconfig             # Editor settings (indent, charset, line endings)
β”œβ”€β”€ .gitignore
β”œβ”€β”€ flake.lock                # Nix flake lockfile (pins dependencies)
β”œβ”€β”€ flake.nix                 # Nix flake entrypoint for Home Manager
β”œβ”€β”€ Makefile                  # Common tasks (install, update, doctor, switch-*)
└── README.md

πŸ“ Notes

  • Intentionally avoids Oh My Zsh (...Powerlevel10k is Zsh-native / faster)
  • No output is produced before Powerlevel10k instant prompt
  • Designed to be safe to re-run multiple times

Clone it, run it, forget about it. ✨

About

πŸ’» Dotfiles and macOS dev setup (Homebrew or Nix + Home Manager).

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published