Live data from Hacker News

Using GNU Stow to manage your dotfiles

brandon.invergo.net

51–60 of 69 posts

Re: Using GNU Stow to manage your dotfiles

#51

> but many/most dotfiles reside at the top-level of your home directory, where it wouldn't be a good idea to initialize a VCS repository. Right. Which is why I use git with a workspace detached from the git directory. The git directory is in ~/dotfiles/.git, with "git config core.worktree ~", and I set an alias "dgit=git --git-dir ~/dotfiles/.git". The advantage of this method is that there are no symlinks to maintai…

Since we're all talking about it...

I keep my dotfiles in a sub-directory (doesn't matter where) and use the following Rakefile to manage it:

https://github.com/tvon/dotfiles/blob/master/Rakefile

Then it's just `rake status` or `rake link` to symlink everything. I've only been using this for a few years but I haven't run into any problems yet.

Re: Using GNU Stow to manage your dotfiles

#52
I've been reasonably happy with my solution to this, which is https://github.com/staticshock/seashell

It's a fully contained Makefile that gives my dotfiles repo `make && make install` semantics. `make` initializes whatever needs to initialize locally on that system, and `make install` creates all the necessary symlinks in the $HOME directory.

Re: Using GNU Stow to manage your dotfiles

#53
Stow also goes nicely with managing a directory in Dropbox for syncing game saves, app config data, etc, for apps that don't have any native support for cross-machine syncing but still work well enough when you fake it with symlinks.

Re: Using GNU Stow to manage your dotfiles

#54

> but many/most dotfiles reside at the top-level of your home directory, where it wouldn't be a good idea to initialize a VCS repository. Right. Which is why I use git with a workspace detached from the git directory. The git directory is in ~/dotfiles/.git, with "git config core.worktree ~", and I set an alias "dgit=git --git-dir ~/dotfiles/.git". The advantage of this method is that there are no symlinks to maintai…

The one thing I like about stow is that I can choose to only add configurations that make sense for the machine I am using. If don't have a certain application, I don't 'stow' the configuration for that application in my home directory.

A sibling post mentions a thing called vcsh (with no additional details) that appears to allow you to do just that with the same premise by overlapping multiple repositories onto your homedir.

Re: Using GNU Stow to manage your dotfiles

#55

> but many/most dotfiles reside at the top-level of your home directory, where it wouldn't be a good idea to initialize a VCS repository. Right. Which is why I use git with a workspace detached from the git directory. The git directory is in ~/dotfiles/.git, with "git config core.worktree ~", and I set an alias "dgit=git --git-dir ~/dotfiles/.git". The advantage of this method is that there are no symlinks to maintai…

I'm using the same scheme for some time and it works nice. It started with simple alias as well, but then it expanded into bigger wrapper script over time. You can check it here

https://github.com/marbu/dogit/blob/master/README.md

That said, I'm not sure if it would be direclty usable for anyone other that me in it's current state. It's tailored to my use case and there are few not so well solved use cases.

Few additional advantages of this approach in general:

You can use local branch which is private to the machine and a public branch, Whatewer you commit ends up in the local private branch and if you would like to share it, you need to cherry pick particular commit and rebase (so that you I don't end up sharing private ssh key on github).

You can use any git tool directly on your dotfiles.

One can directly add vim submodules into the dotfiles repo.

Re: Using GNU Stow to manage your dotfiles

#56

> but many/most dotfiles reside at the top-level of your home directory, where it wouldn't be a good idea to initialize a VCS repository. Right. Which is why I use git with a workspace detached from the git directory. The git directory is in ~/dotfiles/.git, with "git config core.worktree ~", and I set an alias "dgit=git --git-dir ~/dotfiles/.git". The advantage of this method is that there are no symlinks to maintai…

The one thing I like about stow is that I can choose to only add configurations that make sense for the machine I am using. If don't have a certain application, I don't 'stow' the configuration for that application in my home directory.

You can have multiple git repositories, each for different application. Or you can use git submodules when suitable (eg. vim plugins, directories in ~/.config).

Re: Using GNU Stow to manage your dotfiles

#57
post #39

What I do is just keep all of the dotfiles in ~/dotfiles and symlink them to the home directory, then I can keep track of them with git. Doesn't have to be any more work than that. Maybe it's not an issue for me because I only use one machine, and when I switch to another, I just pull down my dotfiles from github and symlink them again. I only do this every couple years.

This is what I do as well, and I also have a little script that creates all the symlinks in my home directory as well. Dead simple, and it works. I was hoping Stow would somehow be an improvement over that but I don't really see how it does anything more for you.

I agree and think don't understand why you'd want your dotfiles to depend on Make, Ruby/rake, etc. let alone something like Stow. Git and a shell are enough; you can eliminate the Git dependency by packaging from a post-receive hook too.

Re: Using GNU Stow to manage your dotfiles

#59
post #20

Earlier quoted context omitted.

Not sure if this would work with Stow, but in my .bashrc I just do this: if [ -f ~/config/bashrc_$(hostname -s) ]; then source ~/config/bashrc_$(hostname -s) fi this gives me machine specific configs.

Great idea! It wouldn't work for me though as I tend to call all my machines 'fuckup' (I know...) ;)

In that case, you could have it read or check the existence of something else, like a file in /etc.

Re: Using GNU Stow to manage your dotfiles

#60

I have no desire to use this for dotfiles, but GNU Stow sounds like it solves a real problem for me with the programs I install from source. Being able to uninstall without manually tracking down each file would be wonderful.

For installation from source I use CheckInstall [1]. It will keep track of all the files created during a make install, and create a standard deb or rpm package that can then be installed and removed by the distribution's package manager.

[1] http://www.asic-linux.com.mx/~izto/checkinstall/docs/README

Post reply on HN