What dotfiles manager do you use?

daddyjones@lemmy.world to Linux@lemmy.ml – 70 points –

I'm looking for recommendations for a dotfile manager - there are so many out there I've got a bit of options paralysis!

I'd like a system that can backup all my dotfiles - with version management - and, if I nuked my home directory, could restore them all for me with a simple command.

Thanks in advance for you suggestions!

80

Git and a script file that's basically just a ton of ln - s commands

I honestly don't think I've ever found myself wanting more

I do basically the same, but using GNU Stow instead of doing the ln myself

I didn't even know that was a thing, I just keep it in a git repo

Home-manager on NixOs. It handles more than just dotfiles, as it also manages installed programs.

It works outside of NixOS too! Just need to have the nix package manager installed.

6 more...

I'm extremely happy with chezmoi. It's very simple to use, but when you need more advanced features, it has them. It can do templates, ignoring and other stuff allowing you to easily manage dotfiles on multiple machines or even multiple operating systems (like windows on PC, Linux on laptop). Here is a comparison table of some dotfiles manager (it's on chezmoi's website, so it may be biased) Also here are my dotfiles (as a Linux user, I cannot resist the urge to share my dotfiles whenever I have the opportunity)

I used yadm for a while and liked it. It is a git wrapper that makes git'ing your home folder for config files less messy

https://yadm.io/

Now I don't care so much for keeping settings anymore and use mainly vanilla settings, therefore I stopped using it

Second this, works great for multiple OSs as well, Linux and OSX in the same repo.

cp -r to an external drive. And cp -r back in case something goes wrong.

I know, it's boring and no way "modern". But hey, it works and it does not require internet access!

home-manager. a divine tool for maniacs Nix users that lets you do declarative dotfile management

a git repository configured to ignore basically everything except the dotfiles. For my sway config I load configs from a symlinked folder, which points to a different config depending on the machine being configured.

nuking your home directory

Imho, in that case, you should look int a more proper backup strategy to restore all your files, not just your configs.

Thanks - yes I do have that, but I also wanted something specific to my dotfiles to make management and restoration a bit easier.

I have a vorta backup, running on a regular basis for my home dir which has GBs of data.

Mounting and restoring files is literally a matter of seconds.

But if you want something that you can easily take with you, you can go with a symlink/git approach:

  • have a folder "configs"
  • move all your dotfiles thst have NO sensitive data like credentials into that folder
  • symlink them into their proper place
  • use GIT to track them and push them to a git repo

Once you need them somewhere else, it's just a git pull away... easy as that.

What I dislike about existing solutions, is they come with their own binaries, conventions, and stuff, but basically do almost the same... this is the "raw way" that will hold up on any system, and almost all of them have git.

Or at the very least partition ~ as btrfs/zfs and do regular snapshots. The downside is, of course, that a rollback won't just roll back the dotfiles. But I guess if the scenario is "nuking [the] home directory" then that's probably not an issue.

I've tried several dotfile managers, but after adding my files I interact with them so infrequently I forget how to use them.

The thing which finally stuck is this method from Atlassian: https://www.atlassian.com/git/tutorials/dotfiles

Your entire home directory is a bare git repo which ignores untracked files. It's just plain git so there is no additional tool to learn or forget.

I've put my vim plugins as git submodules so they're easily and efficiently tracked and updated too.

I used to use this but nowadays I prefer the single, declarative file approach of Guix Home and Home Manager.

I didn't know this was a thing. I just use a USB and my nextcloud and copy my home folder with distro and date appended to the name.

I use chezmoi for mine. I haven't had to restore after a nuke yet (hopefully not anytime) but its really simple IMO. Its basically a git wrapper, so there you have your version control. You create a dotfiles repo in your GitHub, initialise your home as a local repo and point it there using chezmoi, and then its as simple as typing "chezmoi add myfile" to start tracking the file in the repo. Then I simply do "chezmoi cd" followoed by the standard git commands to commit and push changes to remote.

Check it out, I'm happy working with it across my desktop and laptop (working on the same config files across both pcs).

+1 for chezmoi

It makes syncing my dotfiles between my different systems fairly painless. It just works.

I use git and nix (home-manager) for most of my dotfiles. The main advantage of this is that if manages dotfiles, but also you whole user environment, so you can install some software that you need for your rice for example. It's very powerfull, but it takes time to get it to work properly since you have to learn nix expressions !

I use git-annex and Guix (particularly Guix Home in this case) for managing all of my data, including dotfiles. git-annex handles syncing (and backups via delivery to a Borg repo) and version management as git does, while Guix takes care of installing programs and setting up configuration files.

I previously wrote a custom Guix service that utilized Stow as well for managing writable files, but have since replaced it with another custom Guix service that handles some cleanup processes better.

Depending on how much you want simplicity of restoration, this approach might be on the heavier side since it's concerned with a lot more than just dotfiles. You could replace git-annex with git to simplify the syncing part if you're only interested in managing configuration files, though. Here's what my Guix config looks like; the readme file shows how I would set up a system from scratch.

I use Guix Home too and love it! Never been able to figure out how to get git-annex to work, especially on an Android device.

Manager? I just use a good old shell script that mirrors a tree structure into my home folder.

Manage your 'dot' files??

Been doing Linux since Caldera OpenLinux 2.2 and I don't think I have ever bothered back-ups except pinerc and maybe ~/.i3/config

dotdrop, because different dotfiles per OS/hist is supported (I am usingfedora, Ubuntu, Debian, macOS but you can configure it as you wish).

chezmoi, although I am not sure I like it. Its the first I tried and some stuff seems very complicated.

What do you find complicated? I'm happy to help you with it. It also seemed complicated to me, but once I understood it it was pretty simple to use (unless you wanna do advanced stuff.)

The way the autocommiting works is weird, have to use regular git commands for that. Also templating doesn't work for me. I was trying to establish a file with the same content across multiple devices in different subfolders but it kind of didn't work out.

That's unfortunate, because I commit manually (I want to write the messages) and I never needed to template the filepaths. I'm using file templates and it works flawlessly tho.

3 more...
3 more...

My own intricate system of 4 git repos to manage dotfiles, bash initialization, cli tools/scripts, and system state.

The last one keeps track of installed packages and "dotfiles" out of the home directory (system config files like /etc/hosts).

My home directory is a git repo with a .gitignore that contains something like


*

!.config/sway

!.config/sway/*

!.config/sway/**/*

I thought about this, but doesn't this make problems when working with other git repos in subfolders of your home directory?

Not at all. For two reasons: the ignore file and git recognizes when a sub directory is a git repo

I wrote my own. Though it's not just for dot files, it sets up my full environment including installing packages, running scripts, neovim plugins, cloning repos etc. Here's where it's used.

That said it isn't really documented and I only work on it if I need something myself, so I wouldn't recommend it 😂

Currently using stow, but in the process of switching to home manager from nix. Syncing via git.

Interesting - can I ask why you prefer home-manager to stow?

It's nice to configure your programs similar to the rest of your system (a lot of programs have modules in home-manager), on the other hand using home-manager always feels somewhat iffy to me because some configurations require root commands to apply your user configuration changes, or you're missing out on certain home-manager features like using global packages I think.

Can't say I'd prefer it yet. Still figuring out how nix works.

I just rsync my home dir to a backup and then rsync it to a new machine

git.

In all honesty, I'd just write a bash script, potentially reading from a file listing all the dotfiles you want to back up, copy them into some directory and pushing to a git repo. Run that script on a systemd timer (or manually) and write another script deploying them into the correct locations

That's basically what dotbot does I think. Can recommend

I use a Git repo for the files, and a simple Makefile to script the correct paths and optional install steps for them

I wrote my own: doti

I used stow for a while but realized it was lacking in some aspects, especially when trying to manage multiple dotfiles separately. For example, I wanted the dotfiles of each application to be contained in its subfolder and the flexibility to pick and choose the dotfiles of which application to place on different computers/phones.

I checked out chezmoi but thought it was overkill for my needs especially since I was a fan of how simple and straightforward my dotfiles layout was with stow was. So I decided to write my own dotfile manager, doti. It's basically a wrapper/manager for using stow. First time I share it online.

Also here are my dotfiles to give you an idea of how the layout looks. (I transitioned from using Sway with the nord theme and many tui/cli apps to using Gnome and mostly gui apps about a year ago)

I just let my dotfiles fall where they may, but any version control software should be able to do what you need—they're just text files, after all. I'd probably go with mercurial, since that's what I use when I need source control for other purposes (I hate git).

Git and stow.

Tried some different things, including a few months on NixOS. Git and stow are as easy as it gets.

$ crontab -e

0 1 * * * tar -cvzf ~/dotfiles-$(date +\%Y\%m\%d).tgz ~/.[^.]* >/dev/null 2>&1

That seems... Overkill? I just have everything I can't easily replace in nextcloud synced to a local directory. If I were to nuke my home dir or the whole machine it would take less than hour to setup it again including clean reinstall debian with gnome