Live data from Hacker News

Using GNU Stow to manage your dotfiles

brandon.invergo.net

61–69 of 69 posts

Re: Using GNU Stow to manage your dotfiles

#61

> 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 could have a separate git branch for each machine :-)

Re: Using GNU Stow to manage your dotfiles

#64
Recently spent some time organizing my dotfiles and discovered fresh[1] which I've been using to great success. Both for servers I manage and on my mac.

The fact is that most people are going to be reusing (and probably be better of) a lot of code from other well tested dotfiles. `fresh` lets you pick and choose what you want directly from other's repos in addition to adding whatever you want and produces a single bundle (or multiple if you need it).

As far as I can tell, its a self contained shell script and does not have any dependencies (if that is a concern). Its definitely worth checking out.

[1] https://github.com/freshshell/fresh

Re: Using GNU Stow to manage your dotfiles

#65
I use a similar construct for managing config files (mostly the stuff that goes to /etc/*): put all the config for a specific program (or problem) into a VCS-handled directory, then add a Makefile with an "install" target that copies everything into its place. Using GNU install (instead of ln or cp) allows for copying files (and creating directories) with fine control about permissions and ownership.

This can also be done recursively: toplevel Makefile for a machine's configuration files calls the sub-makefiles that install apache, asterisk, openvpn configurations etc.

Re: Using GNU Stow to manage your dotfiles

#66

> 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've once thought of something similar for hg, but a bit bigger, in that:

1. There could be many "hg-dirs" for a one regular "workdir" (e.g. .hg_foo, .hg_bar, .hg_baz, ...)

2. There'd be a wrapper tool, that on any hg command would autodetect to which hg-dir any given affected file belongs, if already committed earlier (with ability to override the autodetection by hand, including for adding brand new files to the repo).

However, didn't care enough to try implementing this yet. Also, not quite sure how/whether it could work with git, given the existence of staging area.

(full story: http://stackoverflow.com/a/5789827/98528)

Re: Using GNU Stow to manage your dotfiles

#67

I gave GNU Stow a try, but thought it did too much. Ended up using dotfiles ( https://pypi.python.org/pypi/dotfiles ). My dotfiles ( https://github.com/cjoelrun/dotfiles ). I handle system specific stuff in each config: OS checks in zsh, emacs, tmux configs. Allows me to move between OSX and Arch linux.

> I gave GNU Stow a try, but thought it did too much.

Not to argue with your experience, but it's hard to see how it could do less—it literally just creates a bunch of symlinks. (It seems to have grown a bunch of options since I last looked at it, but it seems that they can all be ignored if you want simplicity. (I've only ever used `-d`, `-t`, and `-D`.)

Re: Using GNU Stow to manage your dotfiles

#68
Note that this was an official use case for Stow for at least a year before the linked post:

    This is particularly useful for keeping track of system-wide and per-user installations of software built from source, but can also facilitate a more controlled approach to management of configuration files in the user's home directory, especially when coupled with version control systems.
(from https://www.gnu.org/software/stow), where "especially …" links to http://lists.gnu.org/archive/html/info-stow/2011-12/msg00000....

(There's nothing wrong with re-discovering it, of course!)

Re: Using GNU Stow to manage your dotfiles

#69

A while back I got very interested in cleaning up my configuration files. I wanted to figure out out a way to store all of the configurations I use across multiple machines into a single repository, while at the same time not having to worry about symlinking and installing configurations for things I don't need on a particular machine. I looked at a lot of different things like Stow and homeshick and the like and rea…

Hi, I'm the maintainer of homeshick and would be very interested in knowing which shortcomings of homeshick motivated you to write your own tool. Could you elaborate?
Post reply on HN