back

by iLemming·7y ago·view on hn ↗
- install git

- install Emacs

- clone my dotemacs repo

- clone dotfiles repo with a single org file (that comprises my entire machine configuration)

- Run M-x org-babel-tangle. That "extracts" all the dotfiles - gitconfig, bash settings, mail, environment variables, language specific settings. Depending on the machine, either Linux or OSX specific settings, etc.

See, my entire machine configuration is an immutable thing - whenever I need to make changes I'd do it in my .org file and run org-babel-tangle.

1 comments
Do you have a link to a description of this? It sounds like a great way to manage dotfiles with actual context.
No, I've been hoping to write a blogpost about the process but been procrastinating for ages. Unfortunately I can't make my dotfile public - there are things in init that I rather keep private. Essentially you just need an .org file with source blocks with headings like this:

#+begin_src gitconfig :tangle ~/.gitconfig

You can even do it for different systems like so:

#+begin_src gitconfig :tangle (when (eq system-type 'darwin) "~/.gitconfig")

if you need file to be tangled in nested dirs you can add this header:

:mkdirp yes

if you need the content to be encrypted:

#+begin_src emacs-lisp :tangle ~/.authinfo.gpg :mkdirp yes # -- epa-file-encrypt-to: ("your-email@email.com") -- #+end_src