Live data from Hacker News

Using GNU Stow to manage your dotfiles

brandon.invergo.net

11–20 of 73 posts

Re: Using GNU Stow to manage your dotfiles

#13
I would really like to have a dotfile strategy. But I have another goal beyond synchronization: I would like to be able to organize my dotfiles in a modular fashion.

For example, I would like to construct my bashrc using something like run-parts. This system would take bash/★.bashrc, this-machine/local-env.bashrc, and special-app/proxy-env.bashrc and compile them into a single ~/.bashrc. I would also like to be able to build a ~/.nanorc that only includes features supported by the installed version of nano. Some dotfiles include both public and private data -- I'd like to publish my git aliases, but not my GitHub authentication token.

So I basically want a dotfile manager that's a combination of PHP, run-parts, and stow: dotfiles constructed through in-line Perl code (in my nanorc or ssh_config) with assembly of multiple pieces (in my bashrc or gitconfig) and installed into the right place in my home directory.

As far as I can tell there's nothing out there that can do this. (Although I also insist it be written in something classic that I can find anywhere, like Python 2.4 or Perl or something like that. So I didn't look at any of the many dotfile managers written in Ruby or Node.)

    
    set const
    set cut
     2 || $NANO_VER[1] >= 1 ) { # Assume nano 1.x isn't still an issue
    ?>
    bind M-f nextword main
    bind M-b prevword main
    ;
    # Maybe I'll have to write this myself....
    ?>

Re: Using GNU Stow to manage your dotfiles

#14
post #11

If you add more features, like store the settings in a sqlite, universal config r/w interface, and live config change notification to apps, you'll come up with a system like Registry.

The difference is that dotfiles are simple, text based, and human readable.

When you re-install a Windows system, do you overwrite the registery with a backup you had? I doubt it.

Re: Using GNU Stow to manage your dotfiles

#15
post #9
post #2

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 I totally disagree. I love having much of my home directory in git. I have a .gitiignore for the stuff I don't want in there, but the rest. Ahhhhh, so nice to be able to clone somewhere else and use.

I also keep my whole homedir in git, and it's great. My approach isn't to .gitignore, because I want to ignore almost everything -- I just add and commit things when I want to track them. One of my many git aliases[1] is 'git sn' for showing status without untracked files; this helps when dealing with my homedir: status --short --branch --untracked=no [1] https://github.com/cespare/dotfiles/blob/master/.gitconfig#L..…

I actually prefer to .gitignore things explicitly, because then any new dotfiles show up in "git status" until I explicitly disposition them.

Re: Using GNU Stow to manage your dotfiles

#18
post #13

I would really like to have a dotfile strategy. But I have another goal beyond synchronization: I would like to be able to organize my dotfiles in a modular fashion. For example, I would like to construct my bashrc using something like run-parts. This system would take bash/★.bashrc, this-machine/local-env.bashrc, and special-app/proxy-env.bashrc and compile them into a single ~/.bashrc. I would also like to be able…

Hi,

My dotstuff script can do most of that, with a little bit of work. With the current features, you'd put all your bashrc content into a single ~/dotstuff/bashrc file, marked off with preprocessor directives that turned on and off certain sections depending on the content of the "environment" (a simple key-value file).

Adding the ability to query the version of installed software would be easy to add. Adding the ability to concatenate multiple files would be fairly easy too. Although I think an "include" directive might make more sense than run-parts style, since many dotfiles have hierarchical structure.

It's written in 2.4-compatible Python and I'm happy to accept contributions.

https://bitbucket.org/davidn/dotstuff

Re: Using GNU Stow to manage your dotfiles

#19
post #6
post #2

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 I totally disagree. I love having much of my home directory in git. I have a .gitiignore for the stuff I don't want in there, but the rest. Ahhhhh, so nice to be able to clone somewhere else and use.

I take a similar approach. I have a dotfiles git repo in ~/dotfiles/ and have a Makefile which creates symlinks in my home directory. For example, ~/.bashrc is a symlink to ~/dotfiles/bashrc. That way, I can have a whitelist (whatever's in the Makefile) instead of a blacklist (like a .gitignore).

The fake bare approach might be easier: http://mjollnir.org/blog/migrating-my-homedirectory-from-one...
Post reply on HN