Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.)

    <? @NANO_VER = `nano -V` =~ m/version (\d+)\.(\d+)/ ?>
    set const
    set cut
    <? if ( $NANO_VER[0] > 2 || $NANO_VER[1] >= 1 ) { # Assume nano 1.x isn't still an issue
    ?>
    bind M-f nextword main
    bind M-b prevword main
    <? }
    print "include \"$_\"\n" foreach </usr/share/nano/*.nanorc>;
    # Maybe I'll have to write this myself....
    ?>


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


I hae something like this in my ~/.bashrc file:

    for i in ~/.bash.d/* ~/.local.bash.d/; do
         test -e $i && source $i
    done
Which functionally does what you want, loading everything from a directory. Though it doesn't do version-testing, or actual concatenation.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: