Live data from Hacker News

Using GNU Stow to manage your dotfiles (2012)

brandon.invergo.net

71–80 of 116 posts

Re: Using GNU Stow to manage your dotfiles (2012)

#71
post #57
post #56

You don't need symlinks, setup scripts, etc. Try this: 1. Bare git repo in your home directory ($HOME/.files) 2. Alias for prefixing git commands ("env GIT_WORK_TREE=$HOME GIT_DIR=$HOME/.files") 3. Strict .gitignore file (that ignores all files by default) Simple to add files: `h git add .vimrc` Have this set up for myself. Works great https://github.com/tmm/dotfiles

This is similar to a resource that atlassian has put out on storing dotfiles [1]. It is also similar to what I use and I can vouch for this method as well. [1] https://www.atlassian.com/git/tutorials/dotfiles

Not sure if I got it from the atlassian post or the original hacker news post - I am aware of both. It don't see the need for anything more complex. My first config commit is in early 2017.

Re: Using GNU Stow to manage your dotfiles (2012)

#72
post #29

Call me old fashioned but what's wrong with having a regular git repo anywhere you want with all of your dotfiles and them symlink those files to where they need to go? If you wanted to you could && a few symlinks and other commands into 1 copy / paste'able command to get up and running really quickly. It's also painless to manage secrets by sourcing in optional files. It also works nicely when you want files living…

> but what's wrong with having a regular git repo anywhere you want with all of your dotfiles and them symlink those files to where they need to go?

Nothing wrong with tracking dotfiles with Git. It's probably the simplest and easiest approach without requiring any fancy tools other than Git. However, as mentioned in ArchLinux's wiki page, the disadvantage of Git approach is that "host-specific configuration generally requires merging changes into multiple branches."[1]

[1]: https://wiki.archlinux.org/index.php/Dotfiles#Tracking_dotfi...

Re: Using GNU Stow to manage your dotfiles (2012)

#73
post #60
post #7

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…

I don't want to sound condescendant, but are you not basically doing packages ? Instead of standard packages your distro gives you, you have "custom" packages that also contain more specific installation instructions (write file with specific content, set environment variables, ...). I know that PKGBUILDs in Arch allow you to do such things if needed. Bonus: now even configuration files can be linked to the software…

No. My script calls the package manager, sudo zypper install..., and symlinks a dotfile. That is usually all.

Re: Using GNU Stow to manage your dotfiles (2012)

#74
post #7

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…

> My method is to write small scripts, I call them setuplets, Finally I have a proper term for what I, too, have been doing all these years! :-) It's indeed the best-possible approach I've found, though there are a number of things that I haven't yet solved for myself in a satisfactory manner: - With shell scripts there are no idempotency guarantees and there is no easy undoing / uninstalling / clean-up, especially a…

Have you played with NixOS or Guix at all? They attempt to solve this problem from the ground up for the entire OS. It obviously has trade offs, but IMO it is the best solution around today (other than Kubernetes, but that is an abstraction level higher).

Re: Using GNU Stow to manage your dotfiles (2012)

#75
post #19

STOW is great, it is simple and works well especially combined with git. That's what I do [0], and recently combined it with org-mode for literate programming, so each program has just a README.org that then generates all the files via org tangle [1] [2]. For example, here is my file that generates my Xorg configuration [3] over several files, nicely readable on GitHub, in Emacs, or just as plain text. [0] https://gi…

I really like the idea! Thanks for mentioning it. I thought about converting my dotfiles to org-mode files but managing the tangling is always the step where I stop. I think I'd rather automate the tangling. I see you commit the tangled "results". Is this by choice or is it a compromise?

Re: Using GNU Stow to manage your dotfiles (2012)

#76

Earlier quoted context omitted.

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!

I do this but include the symlink command in the document. That way all the links become one copy and paste.

May I recommend Makefiles? Nothing fancy, just a bunch of .PHONY targets. It's a converient way to bundle a bunch of scripts (or single arcane commands) into one file, with autocompletion.

Re: Using GNU Stow to manage your dotfiles (2012)

#77
post #29

Call me old fashioned but what's wrong with having a regular git repo anywhere you want with all of your dotfiles and them symlink those files to where they need to go? If you wanted to you could && a few symlinks and other commands into 1 copy / paste'able command to get up and running really quickly. It's also painless to manage secrets by sourcing in optional files. It also works nicely when you want files living…

> Call me old fashioned but what's wrong with having a regular git repo anywhere you want with all of your dotfiles and them symlink those files to where they need to go? I prefer to skip the symlinks, and just directly use the git repository as my home directory. (I have a sizable .gitignore for things I don't want to track.)

I do the same, but I just have a single '*' in my .gitignore.

The only drawback to the homedir-as-git-repo approach I've found is that you're always in a git repo, so you have to be careful not adding stuff which was really supposed to go in another repo.

Re: Using GNU Stow to manage your dotfiles (2012)

#78
post #7

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…

I used to do this for macOS and Linux but it was a fragile approach, since using Nix and NixOS I've had great success using home-manager[0] which takes care of what software is installed and any overrides or patches I desire.

I also use GNU stow in my dotfiles[1] especially so that my setup still works on systems without Nix installed.

[0] https://github.com/nix-community/home-manager

[1] https://github.com/siraben/dotfiles

Re: Using GNU Stow to manage your dotfiles (2012)

#79
post #41
post #29

Call me old fashioned but what's wrong with having a regular git repo anywhere you want with all of your dotfiles and them symlink those files to where they need to go? If you wanted to you could && a few symlinks and other commands into 1 copy / paste'able command to get up and running really quickly. It's also painless to manage secrets by sourcing in optional files. It also works nicely when you want files living…

> Call me old fashioned but what's wrong with having a regular git repo anywhere you want with all of your dotfiles and them symlink those files to where they need to go? Well, that's what you end up with. Stow just automates the "symlink those files part".

[deleted]

Re: Using GNU Stow to manage your dotfiles (2012)

#80
post #29

Call me old fashioned but what's wrong with having a regular git repo anywhere you want with all of your dotfiles and them symlink those files to where they need to go? If you wanted to you could && a few symlinks and other commands into 1 copy / paste'able command to get up and running really quickly. It's also painless to manage secrets by sourcing in optional files. It also works nicely when you want files living…

[deleted]
Post reply on HN