Skip to content
tomtom103Public

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

Repository files navigation

Dotfiles

A Linux-focused, config-driven dotfiles manager with a simple Python CLI.

Quick Start

git clone https://github.com/yourusername/dotfiles.git ~/.dotfiles
cd ~/.dotfiles
./install.sh

That's it! The installer will automatically install uv if needed and set up your dotfiles.

What This Does

  • Symlinks dotfiles from home/ to your $HOME
  • Manages PATH centrally via ~/.config/shell/path.conf
  • Sets up shell environments for bash and zsh
  • Configures essential tools like git, ssh, and readline
  • Supports tool integration for cargo, nvm, pnpm, and more

Installation

Standard Installation

./install.sh

Installation Options

./install.sh --dry-run    # Preview what will be installed
./install.sh --force      # Replace existing files (creates backups)
./install.sh --schema     # Regenerate config schema

Configuration

The entire setup is driven by config.yaml. Key features:

  • Declarative: Everything is defined in YAML
  • Environment variables: Support ${HOME} and other variables
  • Conditional links: Install files only when certain conditions are met
  • Collision handling: Skip, backup, or replace existing files

PATH Management

PATH is managed centrally in ~/.config/shell/path.conf:

# Add custom paths (one per line)
$HOME/.local/bin
$HOME/bin
$HOME/.opencode/bin

External tools (cargo, nvm) manage their own PATH entries automatically.

Repository Structure

.dotfiles/
├── install.sh              # Main installer
├── config.yaml             # Declarative configuration  
├── config.schema.json      # Generated JSON schema
├── bin/dotfiles             # Python CLI tool
├── home/                    # Source dotfiles
│   ├── .profile            # Login shell setup
│   ├── .bashrc/.zshrc      # Interactive shell setup
│   ├── .config/
│   │   ├── git/config      # Git configuration
│   │   ├── ssh/config      # SSH configuration  
│   │   └── shell/          # Shell snippets and PATH config
│   └── .local/bin/         # Helper scripts
└── AGENTS.md               # Development documentation

CLI Commands

The bin/dotfiles script provides several commands:

# Apply dotfiles configuration
uv run --script bin/dotfiles apply

# Validate configuration
uv run --script bin/dotfiles validate

# Print expanded configuration
uv run --script bin/dotfiles print-effective

# Generate JSON schema
uv run --script bin/dotfiles schema-json

Shell Philosophy

  • ~/.profile: Login shell entrypoint
    • Initializes tools (cargo, nvm, etc.)
    • Sets up PATH via centralized system
    • Sources profile snippets
  • ~/.bashrc/~/.zshrc: Interactive shell setup
    • Sources interactive snippets (aliases, completion, prompt)
  • Local overrides: Use *.local files for machine-specific customization

Customization

Adding Custom Paths

Edit ~/.config/shell/path.conf:

# Your custom paths
$HOME/my-tools/bin
/opt/custom/bin

Local Overrides

Create local override files that won't be managed by dotfiles:

  • ~/.profile.local - Login shell overrides
  • ~/.bashrc.local - Bash interactive overrides
  • ~/.config/git/config.local - Git configuration overrides
  • ~/.config/shell/path.local.conf - Additional PATH entries

Adding New Tools

To add support for a new tool:

  1. Add initialization logic to home/.config/shell/profile.d/20-tools.sh
  2. If the tool needs PATH entries, add them to home/.config/shell/path.conf
  3. Update config.yaml if new files need to be symlinked

Requirements

  • Python 3.11+ (for the CLI tool)
  • uv (automatically installed by install.sh)
  • Linux/POSIX environment (bash, zsh, basic utilities)

Advanced Usage

Dry Run

Preview changes without making them:

./install.sh --dry-run
uv run --script bin/dotfiles apply --dry-run

Force Install

Replace existing files (with backup):

./install.sh --force
uv run --script bin/dotfiles apply --force

Conditional Installation

Use environment variables or shell commands to conditionally install files:

links:
  - src: "home/.config/work/config"
    dst: "${HOME}/.config/work/config"
    when:
      env: "WORK_SETUP"  # Only install if WORK_SETUP is set
links:
  - src: "home/.config/development/config"  
    dst: "${HOME}/.config/development/config"
    when:
      shell: "command -v docker"  # Only install if docker is available

Design Principles

  • Single way of doing things: Avoid multiple methods for the same task
  • Centralized configuration: One source of truth for settings
  • Minimal dependencies: Only essential tools required
  • Local override support: Easy per-machine customization
  • POSIX compatibility: Works across Linux distributions

Development

See AGENTS.md for development guidelines and architecture details.

Schema Management

When modifying the configuration model, regenerate the schema:

uv run --script bin/dotfiles schema-json

Validation

Always validate configuration changes:

uv run --script bin/dotfiles validate

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages