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
12 changes: 12 additions & 0 deletions .chezmoi.toml.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# chezmoi configuration template.
# See https://www.chezmoi.io/reference/configuration-file/ for all options.
#
# This file is a Go template evaluated once when chezmoi initialises.
# Sensitive values should use chezmoi secret helpers or environment variables
# rather than being stored in plain text.

[data]
# Git identity used by gitconfig_local template (if present).
# Falls back to empty strings so chezmoi apply --dry-run works in CI.
git_user_name = "{{ env "GIT_AUTHOR_NAME" }}"
git_user_email = "{{ env "GIT_AUTHOR_EMAIL" }}"
101 changes: 101 additions & 0 deletions .github/workflows/dotfiles-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# dotfiles-ci.yml — smoke tests for chezmoi-managed dotfiles.
#
# Runs `chezmoi apply --dry-run` across a matrix of operating systems and
# containers to verify that all managed files can be applied without errors.
# A separate mise verification step runs when mise is available in the runner.

name: dotfiles-ci

on:
push:
branches: ["main", "Mac-shell-mise"]
pull_request:
branches: ["main", "Mac-shell-mise"]

jobs:
# ── Native runners (ubuntu-latest, macos-latest) ─────────────────────────
chezmoi-dry-run:
name: chezmoi dry-run (${{ matrix.os }})
runs-on: ${{ matrix.os }}
permissions:
contents: read
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]

steps:
- uses: actions/checkout@v4

- name: Install chezmoi
run: sh -c "$(curl -fsLS get.chezmoi.io)" -- -b "$HOME/.local/bin"

- name: Add chezmoi to PATH
run: echo "$HOME/.local/bin" >> "$GITHUB_PATH"

- name: chezmoi apply --dry-run
env:
GIT_AUTHOR_NAME: "CI User"
GIT_AUTHOR_EMAIL: "ci@example.com"
run: |
chezmoi apply \
--source "${{ github.workspace }}" \
--dry-run \
--no-tty \
--verbose

- name: mise verification (if available)
run: |
if command -v mise >/dev/null 2>&1; then
echo "Running mise doctor..."
mise doctor || echo "WARN: mise doctor reported issues"
else
echo "mise not found — skipping verification"
fi

# ── Container runners (debian:latest, alpine:latest) ─────────────────────
chezmoi-dry-run-containers:
name: chezmoi dry-run (${{ matrix.container }})
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
fail-fast: false
matrix:
container: [debian:latest, alpine:latest]
container:
image: ${{ matrix.container }}

steps:
- name: Install dependencies (Debian/Ubuntu)
if: startsWith(matrix.container, 'debian')
run: apt-get update && apt-get install -y --no-install-recommends curl git ca-certificates

- name: Install dependencies (Alpine)
if: startsWith(matrix.container, 'alpine')
run: apk add --no-cache curl git ca-certificates

- uses: actions/checkout@v4

- name: Install chezmoi
run: sh -c "$(curl -fsLS get.chezmoi.io)" -- -b /usr/local/bin

- name: chezmoi apply --dry-run
env:
GIT_AUTHOR_NAME: "CI User"
GIT_AUTHOR_EMAIL: "ci@example.com"
run: |
chezmoi apply \
--source "${{ github.workspace }}" \
--dry-run \
--no-tty \
--verbose

- name: mise verification (if available)
run: |
if command -v mise >/dev/null 2>&1; then
echo "Running mise doctor..."
mise doctor || echo "WARN: mise doctor reported issues"
else
echo "mise not found — skipping verification"
fi
46 changes: 43 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,57 @@
Targets Linux, macOS, and Windows with native bootstrap scripts. Environments are configured through the magic of symlinks.

![build](https://github.com/DustinVenegas/dotfiles/actions/workflows/main.yml/badge.svg)
![dotfiles-ci](https://github.com/DustinVenegas/dotfiles/actions/workflows/dotfiles-ci.yml/badge.svg)

## Installation

Bootstrap scripts are located under `./scripts/`. Using native POSIX/PowerShell scripts avoids taking bootstrapping dependencies.
### chezmoi (recommended)

Run a bootstrap script in 'whatif' mode:
[chezmoi](https://www.chezmoi.io/) is the primary tool for applying these dotfiles. It handles per-file
mappings to XDG destinations, templating, and host-specific overrides.

**1. Install chezmoi**

```sh
# macOS (Homebrew)
brew install chezmoi

# Linux / macOS (official installer)
sh -c "$(curl -fsLS get.chezmoi.io)"
```

**2. Apply dotfiles**

```sh
# Initialise chezmoi from this repository and apply in one step
chezmoi init --apply DustinVenegas/dotfiles

# Preview what would change without writing any files
chezmoi init --apply --dry-run DustinVenegas/dotfiles
```

**3. Verify (optional — requires [mise](https://mise.jdx.dev/))**

The post-apply hook `run_once_after_verify.sh` runs automatically after
`chezmoi apply` when mise is on the `PATH`. To run it manually:

```sh
mise doctor
```

### Legacy bootstrap scripts

The original POSIX/PowerShell bootstrap scripts are kept for backward
compatibility. They create symlinks from this repository to `$HOME`.

Run a bootstrap script in *whatif* mode first to preview changes:

- POSIX-Based OS: `./script/bootstrap.sh --whatif --verbose`
- Windows OS: `./script/bootstrap.ps1 -verbose -whatif`

## Health

Perform a basic environment health check with [`./script/check-dotfles-health.sh`](./script/check-dotfiles-health.sh).
Perform a basic environment health check with [`./script/check-dotfiles-health.sh`](./script/check-dotfiles-health.sh).

## Why PowerShell Core?

Expand Down Expand Up @@ -92,6 +130,8 @@ Notable components included in this dotfiles repository.

## Related Projects

* [chezmoi](https://www.chezmoi.io/), the dotfile manager used to apply these configurations.
* [mise](https://mise.jdx.dev/), the dev-tools version manager used for post-apply verification.
* [dotfiles](https://dotfiles.github.io/), your unofficial guide to dotfiles on GitHub.
* [smkent/dotfiles](https://github.com/smkent/dotfiles), dotfiles repository of
Stephen Kent.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
19 changes: 19 additions & 0 deletions run_once_after_verify.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh
# run_once_after_verify.sh - Post-apply verification hook.
#
# chezmoi executes scripts whose names begin with "run_once_after_" exactly
# once, after all managed files have been applied. This script uses mise to
# verify the managed tool environment when mise is available, and exits
# gracefully when it is not.
#
# See https://www.chezmoi.io/reference/scripts/ for chezmoi script details.
# See https://mise.jdx.dev/ for mise documentation.

set -e

if command -v mise >/dev/null 2>&1; then
echo "chezmoi post-apply: running mise doctor..."
mise doctor || echo "WARN: mise doctor reported issues — review the output above"
else
echo "chezmoi post-apply: mise not found, skipping verification"
fi
19 changes: 16 additions & 3 deletions script/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,10 @@ handleLink () {
}

# Environmental prerequisites
[ ! -d "$HOME/.config" ] && mkdir -p "$HOME/.config"; # non-standard xdc path?
[ ! -d "$HOME/.local/share" ] && mkdir -p "$HOME/.local/share"; # non-standard xdc path?

copyTemplate "$dotfiles/git/.gitconfig_local.template" "$dotfiles/dot_gitconfig_local"
copyTemplate "$dotfiles/.config/nvim/local.dotfiles.vim.template" "$dotfiles/.config/nvim/local.dotfiles.vim"
copyTemplate "$dotfiles/dot_config/nvim/local.dotfiles.vim.template" "$dotfiles/dot_config/nvim/local.dotfiles.vim"
copyTemplate "$dotfiles/dot_vim/.vimrc.local.template" "$dotfiles/dot_vimrc.local"

# Local links
Expand All @@ -105,8 +104,13 @@ l="$dotfiles/dot_gitconfig_os"
handleLink "$l" "$f"

# Item list to be symlinked.
for f in "$dotfiles/." "$dotfiles"/dot_* "$dotfiles"/.config/* "$dotfiles/PSScripts"
# dot_config/* is enumerated individually to create per-directory symlinks under
# $HOME/.config/ rather than a single folder-level symlink for the whole directory.
for f in "$dotfiles/." "$dotfiles"/dot_* "$dotfiles/PSScripts"
do
# Skip dot_config directory itself; its contents are handled below.
if [ "$f" = "$dotfiles/dot_config" ]; then continue; fi

# Get item information.
r=$(realpath -s -q --relative-to="$dotfiles" "$f") # don't expand symlinks, quiet
r=$(echo "$r" | sed "s/dot_/./") # transform dot_ to .
Expand All @@ -122,4 +126,13 @@ do
handleLink "$l" "$f"
done

# Symlink each XDG config sub-directory individually (per-directory, not folder-level).
[ ! -d "$HOME/.config" ] && mkdir -p "$HOME/.config"
for f in "$dotfiles"/dot_config/*
do
r=$(realpath -s -q --relative-to="$dotfiles/dot_config" "$f") # relative name within dot_config
l="$HOME/.config/$r"
handleLink "$l" "$f"
done

exit $retc