Joshua Cox
•⏳ 2 min read•blog

Modular Dotfiles Management with GNU Stow and stowfiles

Modular Dotfiles Management with GNU Stow and stowfiles

Managing configuration files across multiple Linux installations can quickly turn messy. While monolithic Git repositories tracking ~ directly or throwing everything into ~/.config are common, they often make it difficult to selectively enable or test configurations per machine without polluting your home directory.

That is where stowfiles (GitHub repository) comes in. It provides a modular, declarative dotfile management framework built on top of GNU Stow, supplemented by shell automation to seamlessly ingest, track, and deploy configurations.


How GNU Stow Works Here

GNU Stow acts as a symlink farm manager. Instead of copying files or maintaining fragile custom install scripts, configurations are organized in package folders matching target relative paths. When run, Stow creates symlinks pointing from $HOME into the tracked repository:

~/.stowfiles/
├── hypr/
│   └── .config/
│       └── hypr/
│           └── hyprland.conf  --->  ~/.config/hypr/hyprland.conf
├── waybar/
│   └── .config/
│       └── waybar/            --->  ~/.config/waybar/
├── zsh/
│   └── .zshrc                 --->  ~/.zshrc
└── bin/
    └── bin/
        └── myscript           --->  ~/bin/myscript

Because Stow only manages symlinks, unlinking or swapping out an entire configuration bundle is clean and non-destructive:

stow -D hypr

Key Automation Scripts

Managing Stow packages manually can involve repetitive directory structuring. The stowfiles project includes a set of battle-tested helper utilities:

  1. Meta Stower (./stow_all.sh)
    Symlinks all configured package suites sequentially in a single step (such as Hyprland, Waybar, Neovim / AstroNvim, Tmuxinator, Starship, Zsh, k9s, and lazygit):

    ./stow_all.sh
    
  2. Package Ingestion Helper (./stower.sh <package_name>)
    Takes an existing configuration in ~/.config/<package_name>, moves it into the stow package tree, appends it to stow_all.sh, and establishes the symlink.

  3. Config Directory & File Snatchers

    • ./init_new_config_dir.sh <target>: Safely imports an existing directory from ~/.config into the modular structure with validation.
    • ./init_new_config_file.sh <target>: Extracts a single config file into the tree and creates its symlink.

Quick Setup

Clone the repository into your home directory (typically ~/.stowfiles):

git clone https://github.com/joshuacox/stowfiles.git ~/.stowfiles
cd ~/.stowfiles

To link an individual package with verbose output:

stow -vv hypr

Or deploy all configured packages at once:

./stow_all.sh

Documentation and Resources

For full details, package listings, and interactive guides, visit:

Discussion / Comments

Click “Load Comments” to load the Disqus conversation thread.