An open API service indexing awesome lists of open source software.

https://github.com/kaffolder7/dotfiles

πŸ’» Dotfiles and macOS dev setup (Homebrew or Nix + Home Manager).
https://github.com/kaffolder7/dotfiles

bash bootstrap developer-environment dotfiles home-manager homebrew macos nix nix-flakes

Last synced: about 2 months ago
JSON representation

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

Awesome Lists containing this project

README

          

# dotfiles 🧰

Personal macOS dotfiles with a focus on:
- ⚑ fast [Zsh](https://www.zsh.org/) startup
- πŸ—‚οΈ XDG-friendly config layout
- ♻️ reproducible installs via [Homebrew](https://brew.sh/)
- πŸ” minimal magic, explicit behavior

βœ… Tested on [macOS (Apple Silicon)](https://support.apple.com/en-us/116943).

---

## ⏱️ Quick start

```bash
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](https://brew.sh/) (if missing)
- Install packages from [`Brewfile`](Brewfile)
- Symlink dotfiles into your home directory
- Back up any existing files before replacing them

To overwrite existing files without backups:
```shell
./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:

```bash
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

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:
- [Powerlevel10k](https://github.com/romkatv/powerlevel10k) _([instant prompt](https://github.com/romkatv/powerlevel10k?tab=readme-ov-file#instant-prompt) enabled)_ πŸš€
- Cached completions
- [Autosuggestions](https://github.com/zsh-users/zsh-autosuggestions) + [autocomplete](https://github.com/marlonrichert/zsh-autocomplete)
- [Syntax highlighting](https://github.com/zsh-users/zsh-syntax-highlighting/) (loaded last)
- History + cache under XDG paths
- [`fastfetch`](https://github.com/fastfetch-cli/fastfetch) runs once per session (after prompt)

### Git
- `~/.gitconfig` β†’ `home/.gitconfig`
- Personal settings live in `~/.gitconfig.local` (not committed)

Create it with:
```
cp home/.gitconfig.local.example ~/.gitconfig.local
```

### Ghostty

[Ghostty](https://ghostty.org/) 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:
- [JetBrains Mono Nerd Font](https://www.jetbrains.com/lp/mono/)
- [Ayu](https://github.com/ayu-theme/ayu-vim) theme
- Transparent background with blur
- Sensible padding and defaults

### Nano
- `~/.config/nano/nanorc` β†’ `xdg/nano/nanorc`

---

## πŸ§ͺ Homebrew

[Homebrew](https://brew.sh/) 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_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
```shell
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/
β”‚ └── home.nix # Home Manager configuration (optional / advanced)
β”œβ”€β”€ 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/
β”‚ └── 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)
β”œβ”€β”€ .gitignore
β”œβ”€β”€ flake.lock # Nix flake lockfile (pins dependencies)
β”œβ”€β”€ flake.nix # Nix flake entrypoint for Home Manager
└── README.md
```

---

## πŸ“ Notes
- Intentionally avoids [Oh My Zsh](https://ohmyz.sh/) _(...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. ✨