posts | links

The setup

2024-02-26 - 2024-04-06 | computing, admin

How I set up the computer in the objectively correct way.

Directory structure

Where does stuff go?


We are no longer in control of our home directories. So I've set up a ~/hearth/ directory in the home directory that contains all the stuff I know I care about and have put there myself. Backing up should be a matter of taking a snapshot of ~/hearth/. Most of the contents of the hearth directory are git repos for work projects and various personal logs and archives.

Project files

Programming projects are going to generate lots of object files, a Rust project can create multiple gigabytes of them, and none of them are of any interest for backups, so the work directories are going to be over at ~/work/. What I do back up are the git repos, which are stored out-of-directory at ~/hearth/git/[PROJECT] for ~/work/[PROJECT].

You can set up a git project like this like so:

mkdir -p ~/work/PROJECT
cd ~/work/PROJECT
git init --separate-git-dir ~/hearth/git/PROJECT

Media files

I use git-annex to manage media. It has somewhat many moving parts and assumes you're comfortable with regular git. I use git-annex addurl URL --file LOCALNAME whenever I can to store images that are currently online and downloadable without additional hoop-jumping. The URLs may eventually bitrot, but as long as they haven't, my annex will be able to reacquire the file from the web.

Media goes on the biggest hard drive on the machine, which may be different from where the OS root partition is installed. In this case, it should have its own mount point, something like /vol/data0. Use symlinks to point here from home dir.

Media folder structure

Research projects get their own named folders under doc/ that contain references. Since git-annex uses symlinks, the same document can be linked from several places from the file tree without taking up extra space.

Transient files

I probably won't be keeping every random file I download around forever. The nice thing would be to set up a periodic task that cleans up files older than 30 days from ~/tmp/. I do a lazier thing and just put temporary stuff in the system /tmp/ directory that gets wiped every time the machine boots. Also it gets wiped if the machine fails to wake up from suspend which happens every now and then with my desktop, or if I do something that gets the machine hanging badly enough that it needs to be rebooted, so it's not really ideal for anything that needs any degree of permanence beyond the immediate current session.

Dotfile management

I use the homegit idiom for versioning my dotfiles. Tried and abandoned GNU stow (minor annoyances and a feature I wanted to use has had an unfixed bug for years) and Nix Home Manager (not usable without having Nix installed, overcomplicated). Homegit is dead simple, can be deployed anywhere where git is present and does what I need.

Hosts that require local customizations to configs have a local branch that has the host changes in the top commit, this gets rebased anew when it needs changing. Most homegit changes I make on any host belong in the master branch, so wrote homegit-shunt to move general feature commits made on top of the host branch up to the master branch with a single command. Updates can be pulled to customized hosts with homegit pull origin master:master; homegit rebase master without checking out of the host branch.

LAN host naming

Hosts are named after chemical elements, which are also used to derive static local IP addresses for them. The wireless address is the regular address + 100. Host cobalt would have alias co, be over Ethernet and over WiFi. Configuring hosts to have static IP addresses is annoying, so instead I still use DHCP and configure my router to assign the desired specific addresses based on connection MAC.