Live data from Hacker News

Using GNU Stow to manage your dotfiles (2012)

brandon.invergo.net

21–30 of 116 posts

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

#21
post #15
post #14

Earlier quoted context omitted.

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.

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, printer, samba, 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, in…

I am you in the past then, I am still trying to find the balance. Thank you for the insights!

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

#22

I am sure there is a better way but I just do this. It works well enough for my purposes. cd ~ git init git remote add origin [URL] git fetch git checkout -f master

Can confirm this works extremely well. Here's how I do it:

    git clone --bare  ~/.dotfiles
    git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME checkout
    git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME config --local status.showUntrackedFiles no
And then I add an alias:

    alias cfg='git --git-dir=$HOME/.dotfiles --work-tree=$HOME'
Now I can just manage my dotfiles as a git repo, and I don't have to worry about accidentally adding local secrets to the repo.

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

#23

I am sure there is a better way but I just do this. It works well enough for my purposes. cd ~ git init git remote add origin [URL] git fetch git checkout -f master

Recommend you also add "*" to your $HOME/.gitignore in this setup. Then you simply need to use `git add -f` to force-add files to your dotfiles store, so that you don't accidentally add files you don't intend to keep there.

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

#24

I am sure there is a better way but I just do this. It works well enough for my purposes. cd ~ git init git remote add origin [URL] git fetch git checkout -f master

Yeah, that's what I do. And I have an ever-growing .gitignore file with all the dot files and things I don't care about like ~/Downloads...

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

#25
post #17

I love stow. My only complaint is that I cannot seem to remember the name of the command: Is it "grab", "collect", "pirate", "organize", "install", "push", "pull", ...? So I added a note to myself into my .bashrc about this command, and patted myself on the back. The next time I reinstalled Linux, I couldn't remember the name, but I remembered that I wrote a note to myself about it. So opened up my .bashrc, and... I…

stow needs a GUI frontend

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

#26

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.

I've tried both. I was using stow before I switched to nix (on mac) and nix-darwin + home-manager. I use home-manager for everything except my vim config (I don't want to bury it in nix config and loose portability). home-manager is very nice when you want to create configuration that depends on other programs, e.g complex gitconfigs or crazy mutt setups.

I'm not sure if it's all worth it. I recently got a new machine, and it sure reduced the pain of setting it up. But I get a new laptop every four years or so. Bike shedding is fun.

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

#27

I am sure there is a better way but I just do this. It works well enough for my purposes. cd ~ git init git remote add origin [URL] git fetch git checkout -f master

Yeah, that's what I do. And I have an ever-growing .gitignore file with all the dot files and things I don't care about like ~/Downloads...

If you put * in the gitignore file you don't have to deal with ignoring the downloads directory. When you want to add a new file / directory just add the -f flag (git add -f) and everything else works as normal.

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

#28

I am sure there is a better way but I just do this. It works well enough for my purposes. cd ~ git init git remote add origin [URL] git fetch git checkout -f master

Recommend you also add "*" to your $HOME/.gitignore in this setup. Then you simply need to use `git add -f` to force-add files to your dotfiles store, so that you don't accidentally add files you don't intend to keep there.

I also do this. I would highly recommend doing it otherwise you may accidentally commit your ssh keys or other secrets.

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

#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 across 2 systems (such as WSL 2 and Windows) where on a Windows box you consider certain Windows files dotfiles even though technically they exist elsewhere.

I've been managing my dotfiles like this for a few years and it seems to be working out well not just for myself but others who have want to use them either partially or in full. I open sourced them here: https://github.com/nickjj/dotfiles

I purposely broke up some of the commands because I know that not everyone will want a 100% replica of my dotfiles. Folks copy / paste only the commands they want.

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

#30
I reinstalled my OS (actually, a jump to an adjacent distro) just last night and was thankful I had set up a dotfiles manager (yadm [0]). yadm is a git wrapper, so a yadm repository is pretty much a git repository.

`yay -Qe | cut -f 1 -d " " > .config/packages.txt` to back up my packages (without version), push to remote, and then `cd ~ && yadm clone -f && yay -S $(cat .config/packages.txt)` to reinstall everything. Piece of cake.

The only thing I am missing is tracking system files, like /etc/pacman.conf, and it looks like there's a way to do it with yadm, but it looks a bit clunky and I haven't tried.

[0] https://yadm.io/

Post reply on HN