I’m wondering if there is a new tool out there that I’m missing out on.

  • adr1an@programming.dev
    link
    fedilink
    English
    arrow-up
    1
    ·
    edit-2
    1 year ago

    I use git (without remote repo, but could be easily added). Actually this simple bare git repo technique is something I enjoy doing in lots of places where config files lie.

    Basically, it’s only: alias config="/usr/bin/git --git-dir=\${HOME}/.myconf/ --work-tree=\${HOME}"

    Of course, a first time setup is required:

    git init --bare $HOME/.myconf
    config config status.showUntrackedFiles no
    

    I got this setup from a comment on HackerNews long ago. OP comment was rather insightful: “No extra tooling, no symlinks, files are tracked on a version control system, you can use different branches for different computers, you can replicate you configuration easily on new installation.”

    But I never used any branches, prefer to keep it extremely KISS. I even avoid commiting, just staging area that I keep updating with each OS upgrade. Only this bit of extension I use… since I don’t push to any remotes (prefer keeping dotfiles private), I needed a way to copy all of the tracked files (e.g. to have my settings on a work laptop, of course I then go ahead and clean any boilerplate before moving such an ‘exported’ folder)…

    config_export() {
        echo "Copying only staged files, it is recommended to run beforehand: $ config add -u ~"
        mkdir -p ~/.config_export/
        CONFIG_FILES=$(config status | /usr/bin/grep 'new file:' | cut -d':' -f2 | sed -E 's/^ +//')
        printf "%s\n" "${CONFIG_FILES[@]}" | xargs -I {} cp --parent '{}' ~/.config_export/
        ls -halt ~/.config_export/
    }
    
  • varsock@programming.dev
    link
    fedilink
    English
    arrow-up
    1
    ·
    edit-2
    1 year ago

    i take a Phoenix approach with my dotfiles.

    Once a decade when my computer crashes and burns, from the ashes emerges a blank slate of dotfiles that is purged of all unnecessary hacks that have accumulated. With a tear and a hopeful outlook, I rush to set the settings I am actually dependent on.

    I really need to take more interest in backing up my dotfiles 😭

  • Gamma@programming.dev
    link
    fedilink
    English
    arrow-up
    0
    arrow-down
    1
    ·
    edit-2
    1 year ago

    I’ve done symlinks into a separate directory before, but by far my favorite method is to just let ~ be a git repo. It’s maximally simple, no other tooling needed besides git.

    There are a few key steps to making this work well:

    • echo '*' > ~/.gitignore: This way git status isn’t full of untracked files. I can still git add -f what I actually want to track.
    • git branch -m dots: For clarity in my shell prompt.
    • [ -d "$HOME/.local/$(hostname)/bin" ] && PATH=$PATH:$HOME/.local/$(hostname)/bin and similar if there’s config I want to apply only to certain hosts.
  • Nate Cox@programming.dev
    link
    fedilink
    English
    arrow-up
    0
    arrow-down
    1
    ·
    1 year ago

    I’m all in on nix with home-manager these days. Really seems like an ideal framework for my dotfiles and of all the systems I’ve tried over the years this is the one I’m happiest with.

    Hell of a learning curve, though.