Skip to content

marcovega/dotfiles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Dotfiles - Enhanced Stow-Compatible Setup

A completely idempotent, modular dotfiles management system built with full GNU Stow compatibility. This enhanced setup provides true stow package isolation, improved organization, and better maintainability while maintaining all existing functionality.

πŸ—οΈ Architecture Overview

This dotfiles system is built around five core principles:

  1. Full Stow Compatibility - Pure stow packages with clean separation
  2. Idempotency - Run multiple times safely without conflicts
  3. Modularity - Choose exactly what you need via profiles
  4. Security - Template-based configs for sensitive data
  5. Maintainability - Clear separation of concerns and enhanced organization

πŸ“ Enhanced Directory Structure

dotfiles/
β”œβ”€β”€ install.sh                     # Enhanced main installer
β”œβ”€β”€ stow/                          # Pure stow packages β†’ $HOME
β”‚   β”œβ”€β”€ zsh/                       # Shell configuration
β”‚   β”‚   β”œβ”€β”€ .zshrc                 # Complete Zsh config with PATH management
β”‚   β”‚   └── .p10k.zsh             # Powerlevel10k theme config
# Git configuration is applied directly via git config --global (not stowed)
β”‚   β”œβ”€β”€ terminal/                  # Terminal appearance
β”‚   β”‚   └── .dir_colors           # Custom ls colors
β”‚   β”œβ”€β”€ shell/                     # Shell configuration extensions
β”‚   β”‚   └── .config/env-files/    # Environment configuration files
β”‚   β”‚       β”œβ”€β”€ .gitkeep          # Directory structure keeper
β”‚   β”‚       └── .ssh-connections  # SSH connections config (generated, gitignored)
β”‚   β”œβ”€β”€ tmux/                      # tmux configuration (from nikolovlazar)
β”‚   β”‚   └── .config/tmux/
β”‚   β”‚       β”œβ”€β”€ tmux.conf         # Always latest from nikolovlazar/dotfiles
β”‚   β”‚       β”œβ”€β”€ switch-catppuccin-theme.sh
β”‚   β”‚       └── hooks/
β”‚   β”‚           └── update-pane-status.sh
β”‚   β”œβ”€β”€ nvim/                      # Neovim configuration (from nikolovlazar)
β”‚   β”‚   └── .config/nvim/         # Proper XDG structure, latest from nikolovlazar/dotfiles
β”‚   β”œβ”€β”€ vscode/                    # VSCode configuration (XDG compliant)
β”‚   β”‚   └── .config/Code/User/
β”‚   β”‚       └── settings.json     # VSCode settings
β”‚   └── windows/                   # Windows-specific configs
β”‚       └── AppData/Local/Packages/Microsoft.WindowsSubsystemForLinux_*/LocalState/
β”‚           └── .wslconfig        # WSL configuration
β”‚
β”œβ”€β”€ support/                       # Non-stowed support files
β”‚   β”œβ”€β”€ templates/                 # Configuration templates
β”‚   β”‚   └── .ssh-connections.template  # SSH connections template (simple examples)
β”‚   β”œβ”€β”€ examples/                  # Example environment files
β”‚   β”‚   └── (reserved for future examples)
β”‚   β”œβ”€β”€ data/                      # Application data
β”‚   β”‚   β”œβ”€β”€ extensions.linux      # VSCode extensions for Linux
β”‚   β”‚   └── extensions.windows    # VSCode extensions for Windows
β”‚   └── utils/                     # Utility scripts
β”‚       β”œβ”€β”€ ssh-connections.sh    # SSH connection manager utility
β”‚       └── .gitkeep              # Directory structure keeper
β”‚
β”œβ”€β”€ scripts/                       # Installation scripts (enhanced)
β”‚   β”œβ”€β”€ system/
β”‚   β”‚   β”œβ”€β”€ packages.sh           # Idempotent package installation
β”‚   β”‚   └── generate-configs.sh   # Enhanced template processor
β”‚   β”œβ”€β”€ security/
β”‚   β”‚   β”œβ”€β”€ ssh-keys.sh          # SSH key generation and agent setup
β”‚   β”‚   └── gpg-keys.sh          # GPG key generation and git config
β”‚   β”œβ”€β”€ development/
β”‚   β”‚   β”œβ”€β”€ node.sh              # Node.js/fnm setup
β”‚   β”‚   β”œβ”€β”€ php.sh               # PHP 8.4/Laravel setup
β”‚   β”‚   β”œβ”€β”€ neovim.sh              # Neovim installation + config from nikolovlazar/dotfiles
β”‚   β”‚   β”œβ”€β”€ tmux.sh              # Latest config from nikolovlazar/dotfiles β†’ stow/tmux/
β”‚   β”‚   β”œβ”€β”€ lazygit.sh           # LazyGit installation from GitHub releases
β”‚   β”‚   β”œβ”€β”€ wordpress-wsl.sh     # WordPress Local WP dependencies for WSL2
β”‚   β”‚   └── vscode.sh            # Enhanced VSCode extensions installer
β”‚   └── shell/
β”‚       └── zsh-setup.sh         # Zsh + Oh My Zsh + plugins
β”‚
└── profiles/                      # Installation profiles (updated for stow packages)
    β”œβ”€β”€ minimal.conf              # Essential tools only
    β”œβ”€β”€ development.conf          # Full dev environment
    β”œβ”€β”€ full.conf                # Everything including PHP
    β”œβ”€β”€ wordpress.conf           # WordPress development setup
    └── server.conf              # Headless server setup

πŸš€ Quick Start

Fresh Ubuntu Installation

# Clone the repository
git clone https://github.com/yourusername/dotfiles.git
cd dotfiles

# Run the installer (automatically installs gum for beautiful UI)
./install.sh

Automatic Setup

The installer now includes intelligent initial setup and beautiful terminal UI that:

  • βœ… Auto-detects existing GPG keys and extracts your name/email
  • βœ… Auto-configures git globally with proper signing
  • βœ… Handles SSH/GPG key generation if needed
  • βœ… Direct configuration - no intermediate environment files needed
  • βœ… Beautiful UI - Powered by Charm's gum for interactive prompts and styled output
  • βœ… Smart fallbacks - Works with or without gum for maximum compatibility

Simply run:

./install.sh

The installer will automatically:

  1. Install gum for beautiful terminal UI (if not already available)
  2. Present interactive profile selection with styled choosers
  3. Show progress with colored, emoji-enhanced logging
  4. Guide you through component selection with intuitive prompts

Manual Configuration (only if auto-detection fails):

# Git configuration (if auto-detection fails)
git config --global user.name "Your Full Name"
git config --global user.email "your.email@example.com"
git config --global user.signingkey "YOUR_GPG_KEY_ID"

# SSH connections (optional)
./scripts/system/generate-configs.sh  # Generate SSH template
stow -d stow -t $HOME shell           # Deploy config
nano ~/.config/env-files/.ssh-connections  # Add your servers

🎯 Key Enhancements

1. Beautiful Terminal UI with Gum Integration

Experience installation with a modern, interactive interface:

  • 🎨 Styled Output: Colored, emoji-enhanced logging with gum's beautiful formatting
  • ✨ Interactive Prompts: Gum-powered confirmation dialogs and choosers
  • πŸ“‹ Smart Profile Selection: Visual menu for choosing installation profiles
  • πŸ”„ Progress Indicators: Clear feedback during installation steps
  • πŸ›‘οΈ Graceful Fallbacks: Automatically falls back to basic logging if gum unavailable
# The installer automatically sets up gum and provides:
βœ… Success messages in green with checkmarks
ℹ️ Info messages in blue with icons
⚠️ Warnings in yellow with alerts
❌ Errors in red with clear indicators
🎯 Interactive profile chooser
πŸ€” Yes/No confirmations with visual buttons

2. Full GNU Stow Compatibility

Each package in stow/ can be managed independently:

# Install specific packages
stow -d stow -t $HOME zsh terminal

# Install development environment
stow -d stow -t $HOME zsh tmux nvim ssh vscode

# Install everything
stow -d stow -t $HOME */

# Remove specific package
stow -d stow -t $HOME -D nvim

# Replace/update package
stow -d stow -t $HOME -R zsh

3. Simplified Configuration System

  • Templates: support/templates/ - Configuration templates with placeholders
  • Git Configuration: Auto-detected from GPG and applied directly via git config --global
  • SSH Configuration: Utility script + generated config files in ~/.config/env-files/
  • Environment Files: Secure, gitignored configs deployed via stow/shell/
# Configuration workflow
./install.sh                          # Auto-detects GPG and applies git config globally
./scripts/system/generate-configs.sh  # Generate SSH connections template
stow -d stow -t $HOME shell           # Deploy shell configs including env-files
# Edit ~/.config/env-files/.ssh-connections to add your servers
# SSH functions (ssh-to, ssh-reload) available via zshrc

4. XDG Base Directory Compliance

  • VSCode: ~/.config/Code/User/settings.json
  • Neovim: ~/.config/nvim/
  • Proper application data organization
  • Cross-platform path handling

5. Enhanced Organization

  • Pure Stow Packages: Only actual dotfiles in stow/
  • Support Files: Templates, examples, data, and utilities separated
  • No Mixed Content: Clean separation of concerns
  • Independent Packages: Each stow package stands alone

πŸ“‹ Installation Profiles

Profile Description Stow Packages
Minimal Essential tools only zsh, terminal
Development Web development setup + shell, tmux, nvim, vscode
WordPress WordPress development + shell, tmux, nvim, vscode
Full Complete environment + shell, tmux, nvim, vscode
Server Headless server setup zsh, terminal, shell
Custom Interactive selection Pick & choose

Enhanced Profile Configuration

Each profile now uses pure stow package references:

# Example: profiles/development.conf
PROFILE_NAME="Development"
PROFILE_DESCRIPTION="Complete development environment with Node.js, Neovim, tmux, and VSCode"

# Scripts to run (unchanged)
SCRIPTS=(
  "scripts/system/packages.sh"
  "scripts/system/generate-configs.sh"
  "scripts/shell/zsh-setup.sh"
  "scripts/security/ssh-keys.sh"
  "scripts/security/gpg-keys.sh"
  "scripts/development/node.sh"
  "scripts/development/neovim.sh"

  "scripts/development/tmux.sh"
  "scripts/development/lazygit.sh"
  "scripts/development/vscode.sh"
)

# Pure stow packages (enhanced)
CONFIGS=(
  "stow/zsh"
  "stow/terminal"
  "stow/shell"
  "stow/tmux"
  "stow/nvim"
  "stow/vscode"
)
# Note: Git configuration is applied directly via git config --global

πŸ” Enhanced Security Features

Direct Git Configuration

Git configuration is now handled directly without intermediate files:

  • Auto-Detection: Extracts name/email from existing GPG keys
  • Direct Application: Uses git config --global commands immediately
  • No Intermediate Files: No .env.git files needed
  • Secure: No sensitive data in plain text files

SSH Connection System

SSH connections use a utility script + config file approach:

  • Utility: support/utils/ssh-connections.sh - Functions for ssh-to, ssh-reload, tab completion
  • Template: support/templates/.ssh-connections.template - Simple examples (localhost, etc.)
  • Config: ~/.config/env-files/.ssh-connections - User's actual connections (gitignored)
  • Integration: Sourced automatically via .zshrc, deployed via stow/shell/

SSH Key & GPG Management

  • SSH Keys: ed25519 generation with agent integration
  • GPG Keys: 4096-bit RSA for commit signing
  • Automation: Batch generation with git integration
  • Idempotency: Detects and preserves existing keys

πŸ”„ Always Up-to-Date External Configurations

tmux Configuration

  • Source: nikolovlazar/dotfiles
  • Target: stow/tmux/.config/tmux/ (XDG-compliant)
  • Structure: Matches nikolovlazar's repo structure with hooks and utilities
  • Update Method: Downloads latest on every run

Neovim Configuration

  • Source: nikolovlazar/dotfiles
  • Target: stow/nvim/.config/nvim/
  • Method: Git sparse-checkout with proper XDG structure
  • Features: Complete LazyVim setup with modern plugins

πŸ”§ Core Components

Enhanced Template Generation

  • Location: scripts/system/generate-configs.sh
  • Function: Processes templates from support/templates/ using environment files
  • Output: Places generated configs in appropriate stow/ packages
  • Variables: Supports Git, SSH, and custom placeholder expansion

Development Tools Setup

VSCode Integration

  • Extensions: Platform-specific lists in support/data/extensions.{linux,windows}
  • Settings: XDG-compliant deployment via stow/vscode/.config/Code/User/
  • Cross-Platform: Automatic platform detection

External Configuration Management

  • tmux: Auto-downloads latest config to stow/tmux/
  • Neovim: Sparse-checkout to stow/nvim/.config/nvim/
  • Utilities: Theme switchers and tools to support/utils/

System Package Management

  • Idempotent Installation: Checks existing packages before installation
  • Neovim Dependencies: fd-find, ripgrep, build-essential
  • Development Tools: Node.js (via fnm), PHP 8.4, Composer, LazyGit
  • Shell Environment: Zsh, Oh My Zsh, plugins, Powerlevel10k

πŸ”„ Enhanced Idempotency

Every component is designed for safe repeated execution:

Stow Operations

# Enhanced stowing with conflict resolution
stow -d stow -t $HOME -D package_name 2>/dev/null || true  # Unstow first
stow -d stow -t $HOME -S package_name                     # Then stow

Template Generation

  • Checks for environment files before processing
  • Skips generation if environment files missing
  • Overwrites existing generated configs safely

Development Tools

  • Detection: Uses command -v and version checking
  • Updates: Handles existing installations gracefully
  • Extensions: Checks installed VSCode extensions before installing

πŸ› οΈ Adding New Components

Adding New Stow Packages

  1. Create package directory:

    mkdir -p stow/my-new-package
  2. Add configuration files:

    # Add dotfiles with proper home structure
    stow/my-new-package/.my-config
    stow/my-new-package/.config/my-app/settings.json
  3. Update profiles:

    # Add to desired profiles' CONFIGS array
    CONFIGS=(
      # ... existing packages ...
      "stow/my-new-package"
    )
  4. Test deployment:

    stow -d stow -t $HOME my-new-package

Adding Templates

  1. Create template:

    # support/templates/.my-config.template
    api_key = {{MY_API_KEY}}
    username = {{MY_USERNAME}}
  2. Create example:

    # support/examples/env.my-config.example
    MY_API_KEY=your_api_key_here
    MY_USERNAME=your_username_here
  3. Update generator:

    # Add to scripts/system/generate-configs.sh
    if [[ -f "support/templates/.my-config.template" ]]; then
      mkdir -p "stow/my-package"
      generate_config "support/templates/.my-config.template" ".env.my-config" "stow/my-package/.my-config"
    fi

πŸ” Security & Privacy

Gitignored Files

# Generated SSH connections config (contains sensitive data)
stow/shell/.config/env-files/.ssh-connections

# Public keys (contain personal details)
github-public-keys.txt

# Any local customizations
local/

Template Variables

  • SSH: {{SSH_HOST}}, {{SSH_USER}}, {{SSH_PORT}}
  • Custom: Add your own variables to templates and generation script

Note: Git configuration is now handled directly via git config --global commands, no template variables needed.

Best Practices

  • Always provide .example files for sensitive configurations
  • Use descriptive placeholder names in templates
  • Keep environment files in project root (gitignored)
  • Document required variables in template comments

πŸ§ͺ Testing & Validation

Testing Stow Packages

# Test individual packages
stow -d stow -t $HOME -n -S package_name  # Dry run (-n flag)
stow -d stow -t $HOME -v -S package_name  # Verbose output

# Test conflicts
stow -d stow -t $HOME -S package_name 2>&1 | grep -i conflict

Validation Checklist

  • βœ… All files in stow/ packages are actual dotfiles
  • βœ… Templates are in support/templates/
  • βœ… Examples are in support/examples/
  • βœ… Data files are in support/data/
  • βœ… Each stow package can be deployed independently
  • βœ… XDG directory structure is correct
  • βœ… No mixed content in stow packages

🎯 Cross-Platform Support

Windows/WSL Integration

  • WSL Config: Platform-specific configurations handled automatically
  • Platform Detection: Automatic Windows package inclusion
  • Extensions: Platform-specific VSCode extension lists

Server Optimization

  • Minimal Profile: Excludes GUI applications
  • Headless Support: No desktop-specific configurations
  • Essential Tools: Focus on shell, git, and SSH tools

πŸ“ Configuration Files Reference

Enhanced Shell Configuration

  • Location: stow/zsh/.zshrc
  • Deployment: stow -d stow -t $HOME zsh
  • Features: Powerlevel10k, fnm, Neovim paths, fzf integration, SSH connections

Configuration Management

  • Git Config: Auto-detected from GPG keys and applied directly via git config --global
  • SSH Connections: Utility script + config in ~/.config/env-files/.ssh-connections
  • Public Keys: Both SSH and GPG keys exported to github-public-keys.txt with copy tags
  • Deployment: Shell package via stow -d stow -t $HOME shell, Git applied directly

🚨 Enhanced Troubleshooting

Stow Conflicts

# Check for conflicts
stow -d stow -t $HOME -n -S package_name

# Manual conflict resolution
stow -d stow -t $HOME -D package_name  # Unstow
rm $HOME/.conflicting-file             # Remove conflict
stow -d stow -t $HOME -S package_name  # Restow

# Force adoption (use with caution)
stow -d stow -t $HOME --adopt -S package_name

Git Configuration Issues

# Manual git configuration if auto-detection fails
git config --global user.name "Your Full Name"
git config --global user.email "your.email@example.com"
git config --global user.signingkey "YOUR_GPG_KEY_ID"
git config --global commit.gpgsign true

# Check current git configuration
git config --global --list | grep user

SSH Connection Setup

# Generate SSH connections template
./scripts/system/generate-configs.sh  # Creates template in stow/shell/.config/env-files/
stow -d stow -t $HOME shell           # Deploy to ~/.config/env-files/
nano ~/.config/env-files/.ssh-connections  # Edit to add your servers

# Usage (automatically available after sourcing .zshrc)
ssh-to localhost                      # Connect to defined servers
ssh-to                               # List all available connections
ssh-reload                           # Reload connections after editing

Template Generation Issues

# Check template processing
bash -x ./scripts/system/generate-configs.sh

# Verify SSH connections file
cat ~/.config/env-files/.ssh-connections  # Check content

Stow Package Verification

# Check package structure
find stow/package_name -type f

# Test stow simulation
stow -d stow -t /tmp/test_home -n -S package_name

πŸ“Š System Requirements

  • OS: Ubuntu 20.04+ (tested on Ubuntu 22.04/24.04)
  • Dependencies: None (installer automatically installs required packages including stow and gum)
  • Disk Space: ~500MB for full installation
  • Network: Internet connection for external configs and packages
  • Terminal: Any modern terminal (enhanced experience with color support)

🎯 Benefits Summary

For Users

  • Beautiful Interface: Modern, interactive terminal UI powered by gum
  • True Stow Compatibility: Standard GNU Stow commands work perfectly
  • Enhanced Security: Template system prevents credential exposure
  • Better Organization: Clear separation of configs, templates, and data
  • Cross-Platform: Proper Windows and Linux support
  • Intuitive Experience: Visual prompts and clear progress indicators

For Developers/AI

  • Clear Structure: Well-defined purposes for each directory
  • Easy Extension: Adding new packages follows established patterns
  • Maintainable: Template system and idempotent scripts
  • Testable: Each stow package can be tested independently

This enhanced dotfiles system provides a production-ready solution with true GNU Stow compatibility, improved security through templates, better organization for long-term maintainability, and a beautiful terminal interface powered by gum. The modular design ensures reliability while supporting both simple and complex development environments with an intuitive, modern user experience.

About

πŸ’» WSL2 + Ubuntu 24.04 Dotfiles

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 14