Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 33 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Dotfiles Managed with chezmoi

This repository contains my personal dotfiles managed with [chezmoi](https://www.chezmoi.io).
The goal is a clean, portable, reproducible setup across macOS, Linux, and GitHub Codespaces.
The goal is a clean, portable, reproducible setup across macOS, Linux, Windows, and GitHub Codespaces.

The repository is designed to support **three installation modes**:
The repository is designed to support **four installation modes**:

- GitHub Codespaces (automatic)
- Personal machines (full setup)
- Personal machines (full setup) - macOS, Linux, Windows
- Temporary or shared machines (lite setup)

---
Expand All @@ -26,6 +26,9 @@ This relies on GitHub’s official dotfiles mechanism and does not require `inst

### 2. Personal machine (full setup)

#### macOS / Linux


Use this on a personal macOS or Linux machine where you want the full environment:
shell configuration, tools, 1Password integration, SSH agent wiring, and VS Code setup.

Expand All @@ -39,6 +42,30 @@ Notes:
- You’ll be prompted to sign into 1Password (once)
- This is the recommended path for long‑lived personal machines

#### Windows

Use this on Windows machines where you want Git Bash with zsh, VS Code, and development tools.

**PowerShell (as regular user):**
```powershell
iwr -useb https://raw.githubusercontent.com/mkhnsn/dotfiles/main/install.ps1 | iex
```

Or download and run:
```powershell
Invoke-WebRequest -Uri https://raw.githubusercontent.com/mkhnsn/dotfiles/main/install.ps1 -OutFile install.ps1
.\install.ps1
```

This will:
- Install winget (if needed)
- Install Git for Windows (includes Git Bash)
- Install chezmoi
- Apply dotfiles configuration
- Set up Git Bash to auto-launch zsh

After installation, open **Git Bash** from your Start Menu and it will automatically launch zsh with your dotfiles configuration.

---

### 3. Temporary or shared machine (lite setup)
Expand Down Expand Up @@ -73,7 +100,9 @@ chezmoi apply -R

- `dot_*/` — canonical configuration templates managed by chezmoi
- `.chezmoiexternal.toml` — external git‑based dependencies (zsh plugins, etc.)
- `install.sh` — full bootstrap for personal machines
- `install.sh` — full bootstrap for personal machines (macOS/Linux)
- `install.ps1` — full bootstrap for Windows machines
- `manifests/windows/` — winget package manifests for Windows
- `bootstrap/` — helper scripts for containers or special environments
- `private_*.tmpl` — secret-backed or machine-specific templates

Expand Down
15 changes: 15 additions & 0 deletions dot_bashrc.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{{- if eq .chezmoi.os "windows" -}}
# ~/.bashrc (managed by chezmoi) - Git Bash on Windows
# Auto-launch zsh if available and running interactively

# If not running interactively, don't do anything
if [ -t 1 ] && command -v zsh >/dev/null 2>&1; then
# Check if we're not already in zsh (prevent loops)
if [ -z "$ZSH_VERSION" ]; then
exec zsh
fi
fi
{{- else -}}
# ~/.bashrc (managed by chezmoi)
# This file is only used on Windows. On macOS/Linux, use your system's default .bashrc
{{- end -}}
38 changes: 38 additions & 0 deletions dot_config/shell/env.windows.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Windows/Git Bash specific environment settings (managed by chezmoi)
# This file is sourced by env.zsh when running on Windows/MSYS

# ---- Windows-specific PATH additions ----
# Git Bash uses Unix-style paths (/c/Users/...), but some tools need Windows paths

# Ensure Windows binaries are accessible
# Git Bash usually handles this, but we can add common locations if needed
if [[ -d "/c/Program Files/PowerShell/7" ]]; then
export PATH="/c/Program Files/PowerShell/7:$PATH"
fi

# ---- Windows pnpm home ----
# On Windows, pnpm uses a different default location
export PNPM_HOME="$HOME/AppData/Local/pnpm"
case ":$PATH:" in
*":$PNPM_HOME:"*) ;;
*) export PATH="$PNPM_HOME:$PATH" ;;
esac

# ---- Handle missing tools gracefully ----
# Homebrew doesn't exist on Windows, so we need to skip brew-dependent logic

# Override the fpath_prepend calls for brew if it doesn't exist
# (env.zsh already checks for brew, but we're being extra cautious)

# ---- Windows Terminal specific settings ----
# Windows Terminal handles some things differently

# Disable SSH agent override since 1Password SSH on Windows uses different paths
# (env.zsh already checks for macOS specifically, so this is just a note)

# ---- Git Bash specific fixes ----
# Git Bash has some quirks with certain tools

# ---- Optional: Windows-specific aliases ----
# Add any Windows-specific aliases here if needed
# alias open='start' # Use 'start' to open files in default apps
9 changes: 9 additions & 0 deletions dot_config/shell/env.zsh
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Environment / PATH (managed by chezmoi)

# ---- Windows/MSYS specific setup ----
# Load Windows-specific environment if running on Windows/Git Bash
# Check OSTYPE first (no subprocess), fallback to uname only if OSTYPE is unclear
if [[ "$OSTYPE" =~ ^(msys|cygwin|mingw) ]]; then
[[ -r "$HOME/.config/shell/env.windows.zsh" ]] && source "$HOME/.config/shell/env.windows.zsh"
elif [[ -z "$OSTYPE" && "$(uname -s 2>/dev/null)" =~ ^(MINGW|MSYS) ]]; then
[[ -r "$HOME/.config/shell/env.windows.zsh" ]] && source "$HOME/.config/shell/env.windows.zsh"
fi

export EDITOR="code --wait"

# PATH basics
Expand Down
Loading