[HN Gopher] Using GNU Stow to manage your dotfiles (2012)
       ___________________________________________________________________
        
       Using GNU Stow to manage your dotfiles (2012)
        
       Author : matthberg
       Score  : 37 points
       Date   : 2020-12-27 07:19 UTC (1 days ago)
        
 (HTM) web link (brandon.invergo.net)
 (TXT) w3m dump (brandon.invergo.net)
        
       | mongol wrote:
       | I have found that managing dotfiles is not enough. The dotfiles
       | serve no purpose without the software that uses them. My method
       | is to write small scripts, I call them setuplets, that install
       | the software and then symlink the dotfile to its master that I
       | manage in git. In the simplest case, it is just a two line script
       | in a directory, but I have one for each program, and a tool to
       | select which I run when setting up a new linux machine. The more
       | complex ones may install a number of tools and set up environment
       | variables etc. For environment variables, the script drops a
       | script file in a directory, where my bashrc sources it.
        
         | lambda_obrien wrote:
         | I've been logging each install as a markdown document with
         | directions, and manually symlinking my dotfiles, but tiny
         | scripts that do both are a great idea!
        
           | mongol wrote:
           | Yes, as soon as I have installed a program which I like and
           | think is a "keeper", I write my setuplet script, usually by
           | copying and pasting from the bash history.
        
             | iib wrote:
             | I am not an expert in Ansible, or any other software of the
             | kind, but I think this is one of the easier use-cases of
             | such a program. I wrote an ansible script to compile emacs
             | from source, after some initial configuration, and it
             | serves me pretty well.
        
               | mongol wrote:
               | I started with Ansible for automation, and still use it,
               | but have abandoned it for setting up my personal
               | environment. I still use it to set up services, such as
               | sshd, webserver, smartd etc. I found it was more
               | cumbersome for personal environment setup than my script
               | method. My method of re-initializing my environment rests
               | on three pillars:
               | 
               | Ansible, for server/OS setup. Things run by init/systemd,
               | involving anything outside of $HOME basically
               | 
               | Backup, using borgmatic. I use this to restore most
               | things in $HOME, except random dotfiles. My documents, my
               | checked out git repos, etc.
               | 
               | Script "setuplets". These I run on demand, to set up my
               | environment piece by piece. Perhaps I do not want to
               | restore my programming environment just because I want to
               | have my custom prompt on a host, for example.
               | 
               | Finding the balance between these have been difficult.
               | Especially, how to handle credentials. My backup is
               | encrypted, but how would I make sure I had the keys to
               | restore it? I could restore it from my pass password
               | store, but how would I get the gnupg keys in place first?
               | I have not solved this completely satisfactorily yet
        
           | mattalbie wrote:
           | I do this but include the symlink command in the document.
           | That way all the links become one copy and paste.
        
       | kevlar1818 wrote:
       | I really like this method as opposed to using a bare Git
       | repository. For one, it's conceptually simpler in my mind; you
       | don't have to understand Git internals to get this working.
       | Secondly, this lets you pick and choose which config files you
       | want to "install" on a machine.
       | 
       | I feel obligated to share my Bash script, dotfiles.sh[1], that
       | accomplishes what Stow does, but with a few tweaks that I found
       | particularly useful:
       | 
       | dotfiles.sh targets the user's home directory by default (i.e.
       | stow -t $HOME).
       | 
       | dotfiles.sh never symlinks directories, only files (i.e. stow
       | --no-folding). (This was the straw that broke the camel's back
       | and made me roll my own script in the first place.)
       | 
       | dotfiles.sh makes backups of local config files and can restore
       | them if you remove your symlinked version.
       | 
       | My script is quite old now, and I use it so seldomly I'm not
       | convinced there aren't bugs. YMMV.
       | 
       | [1]: https://github.com/kevin-hanselman/dotfiles
        
       | knoebber wrote:
       | I made https://dotfilehub.com as another solution for this.
        
       | lwhsiao wrote:
       | I originally went with the bare git repo technique, but found
       | myself not liking how to store multiple computer's dotfiles in a
       | single repo.
       | 
       | I ended up switching to https://www.chezmoi.io/, after learning
       | about it here on HN.
        
       | turbinerneiter wrote:
       | I use this technique, based on a bare git repo
       | https://www.atlassian.com/git/tutorials/dotfiles
       | 
       | Works quite well ... but I'm really, really ready for a rebuild
       | of how Linux systems are built. I hope systemd-homed will
       | deliver.
       | 
       | Imagine you could ssh into a machine with a flag that forwards
       | your local config. Or even your local bin.
        
         | Arnavion wrote:
         | I don't think systemd-homed does anything for dotfiles, let
         | alone portable dotfiles. The user record only contains a
         | skeleton directory use to create the homedir if it doesn't
         | already exist. Populating such a newly-created homedir with
         | your dotfiles is still your responsibility.
        
         | politelemon wrote:
         | That sounds really convenient. How far away is the homed system
         | from adoption?
        
         | wbl wrote:
         | You mean what we had with project Athena for decades? Or NFS
         | mounted homework? Or plan 9?
        
           | segfaultbuserr wrote:
           | NFS, The Network is the Computer (TM).
           | 
           | It's a bit strange that now it's a Cloudflare trademark.
        
       | jamespwilliams wrote:
       | I've been using stow to manage my dotfiles for a long time, works
       | very well.
       | 
       | Recently I've moved to NixOS and have been considering trying out
       | Nix's home-manager (mostly just out of curiosity - I'm perfectly
       | happy with stow). If anyone has tried both stow and home-manager,
       | I'd be interested to know your thoughts on how they compare.
        
       ___________________________________________________________________
       (page generated 2020-12-28 23:00 UTC)