Skip to content

Conversation

@TechDufus
Copy link
Owner

@TechDufus TechDufus commented Jan 28, 2026

Inspired by #144 from @noneel - this is a complete implementation of fork-friendly overrides that lets users customize any role without modifying upstream files.

What This Enables

Fork maintainers can now:

  1. Override variables without touching role defaults
  2. Replace config files while keeping role logic
  3. Completely replace role behavior when needed
  4. Customize the bootstrap script to clone their fork

All customizations live in overrides/ (gitignored), so pulling upstream is always clean.

Directory Schema

overrides/
├── README.md                      # Documentation (tracked)
├── roles/                         # Per-role overrides (gitignored)
│   └── {role}/
│       ├── vars/main.yml          # Variable overrides
│       ├── files/                 # Config file overrides
│       └── tasks/main.yml         # Full role replacement
└── config/
    ├── dotfiles.conf.example      # Example settings (tracked)
    └── dotfiles.conf              # User settings (gitignored)

Implementation

Uses a wrapper task that intercepts every role execution:

  • tasks/run_role_with_overrides.yml checks for overrides before each role
  • Sets _files_path variable so roles use override files when present
  • Updated 25 roles to use _files_path instead of implicit role_path/files
  • Bootstrap script supports DOTFILES_GITHUB_USER for fork cloning

Override Levels

Level Path Effect
Vars overrides/roles/{role}/vars/main.yml Merged before role runs
Files overrides/roles/{role}/files/ Role uses these files instead
Tasks overrides/roles/{role}/tasks/main.yml Replaces role entirely
Bootstrap overrides/config/dotfiles.conf Customize clone URL

Documentation

  • README.md: Prominent "Fork This Project" section with quick start
  • overrides/README.md: Complete guide with debugging, migration, and bootstrap docs
  • CLAUDE.md: Updated with override references

Changes

  • 7 commits, 35+ files changed
  • 25 roles updated to support file overrides
  • ~200 lines of new documentation
  • Bootstrap script fork support

Closes #144

Introduces a wrapper task that checks for three override levels before
running each role:
- vars: loads overrides/{role}/vars/main.yml to merge/override variables
- files: sets _files_path for file operations
- tasks: replaces role entirely with override tasks

Based on approach from PR #144 but centralized in a single wrapper.
Replace direct include_role with include_tasks calling the new wrapper.
Tag filtering continues to work via tags: always on wrapper tasks.
Update 7 roles to use _files_path variable with fallback to role_path:
- neovim, claude, opencode, glab: symlink source paths
- zsh, bash, taskfile: stat path checks for OS-specific configs

Pattern: {{ _files_path | default(role_path ~ '/files') }}
Maintains backward compatibility when _files_path is not set.
Create gitignored overrides directory for fork customizations:
- README.md documents three override levels (vars, files, tasks)
- .gitkeep ensures directory is tracked
- Fork users can customize without modifying upstream files
Ignore override content while preserving structure files:
- overrides/*/ ignored (user customizations)
- .gitkeep and README.md preserved for structure
Convert all roles with implicit file references to use explicit
_files_path variable, enabling fork users to override any role's
config files via overrides/{role}/files/ directory.

Changes across 25 roles:
- Simplify 7 roles that had verbose fallback pattern
- Add _files_path to 18 new roles with copy/synchronize tasks
- Update wrapper to always set _files_path before role execution

Roles updated: 1password, alacritty, awesomewm, bash, bat, borders,
btop, claude, gh, ghostty, git, glab, hammerspoon, kitty, lsd,
neofetch, neovim, opencode, sesh, system, taskfile, tmux, zsh
Make the override system discoverable with prominent documentation:

- README.md: Add "Fork This Project" section after Quick Start
  with override types table and common customizations
- overrides/README.md: Expand from 66 to 143 lines with Quick Start
  workflow, debugging guide, partial override warnings, migration
  guide for existing forkers
- CLAUDE.md: Add override row to "Where to Look" table
- docs/README.md: Add Forking & Customization section with link
Ignore personal Claude Code files while preserving custom content:
- Ignore: settings, projects/, notepads/, temp .md files
- Keep: agents/, skills/, commands/ for repo-specific customizations
Allow forkers to customize the bootstrap script without merge conflicts:

- Add DOTFILES_GITHUB_USER and DOTFILES_REPO_NAME variables
- Source overrides/dotfiles.conf if present for runtime overrides
- Update clone URL to use variables instead of hardcoded values
- Update help/version output to reflect configured user
- Add dotfiles.conf.example with documented settings
- Document bootstrap customization in overrides/README.md

Forkers can either edit bin/dotfiles directly or use the config file
approach for cleaner upstream merges.
Reorganize overrides directory for clarity and extensibility:

Structure:
  overrides/
  ├── roles/{role}/        # Per-role overrides (vars, files, tasks)
  ├── config/              # Bootstrap configuration
  │   └── dotfiles.conf    # User settings (gitignored)
  └── README.md

Changes:
- Move role overrides under overrides/roles/ subdirectory
- Move dotfiles.conf to overrides/config/
- Update wrapper task, bin/dotfiles, and all documentation
- Update gitignore patterns for new structure

This schema allows clean separation between role overrides, config,
and future override types (group_vars, pre_tasks, etc).
Wrap file glob patterns in backticks to prevent markdownlint from
interpreting them as emphasis markers (*, __tests__, etc).
@TechDufus TechDufus force-pushed the feat/fork-friendly-overrides branch from fbf1340 to a4963c3 Compare January 28, 2026 18:04
The freedesktop.org documentation site returns 418 status to automated
link checkers (bot detection). Add to ignore patterns since the link
is valid but blocked for CI bots.
@TechDufus TechDufus force-pushed the feat/fork-friendly-overrides branch from a4963c3 to 28a4d99 Compare January 28, 2026 18:09
Document how to create new roles that only exist in overrides/,
run via the -t flag. Useful for personal tools or workflows that
don't need to be upstreamed.
Document that vars overrides persist in play scope for all subsequent
roles. Includes best practices for avoiding variable name collisions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants