選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 
 
Mitch Tishmack fccab1dcbf Rename option files osx->macos 9年前
.gitignore Missed some things. 10年前
Makefile Migrate more crap out of readme.org to subfiles. 10年前
bin.org Update iso8601 to output non : separated times 10年前
cray-macos.el Rename option files osx->macos 9年前
cray-macos.nonix.el Rename option files osx->macos 9年前
cray.org Update cray configuration. 9年前
ddiff Migrate git/nix/tmux/x out of readme.el 10年前
defaults.el Migrate git/nix/tmux/x out of readme.el 10年前
dotprofile.org merge conflict 10年前
emacs.org Update emacs configuration. 9年前
etangle Migrate git/nix/tmux/x out of readme.el 10年前
git.org Update git configuration to current. 9年前
haskell.org Migrate more crap out of readme.org to subfiles. 10年前
macos-nonix.el Rename option files osx->macos 9年前
macos.el Rename option files osx->macos 9年前
misc.org Migrate more crap out of readme.org to subfiles. 10年前
nix.org Update nix configuration to current. 9年前
perl.org Migrate more crap out of readme.org to subfiles. 10年前
readme.org Migrate more crap out of readme.org to subfiles. 10年前
tangle.el Migrate git/nix/tmux/x out of readme.el 10年前
tmux.org Update tmux configuration for 2.2 10年前
vim.org Migrate more crap out of readme.org to subfiles. 10年前
x.org Migrate git/nix/tmux/x out of readme.el 10年前
zsh.org Migrate more crap out of readme.org to subfiles. 10年前

readme.org

My Solution To Dotfile Management

In the long long ago (2015), I used xstow and update-dotdee to construct my dotfiles from tiny pieces of files.

I have since evolved to this setup. Originally the intention was to make it easy for me to compile dotfiles based on certain parameters. Aka, my dotfiles are the same for x, y, and z, whatever those are, but for certain cases z should have one section be different or added etc… as the case may be.

Aka it was just a glorified program or templating system.

Since I already use org-mode to build my emacs configuration, why not just do the same for the dotfiles. Bonus, now I can have ALL my dotfiles in one logical file that can build itself.

So now if you want to look at my dotfiles, they're all in here. With one caveat that my emacs configuration is not. That is still separate. Mostly because it is large enough that it can be on its own.

Use/Abuse

Use of this setup is simple. There really is one step in general:

  make

But lets say you want to export things to another directory than $HE. No worries, just specify DEST:

  make DEST=/some/other/directory

But wait, what if you want to export things for an os you're not using? No worries, just copy options.el to name.el and specify that as OPTIONS too:

  make DEST=/some/other/directory OPTIONS=osx

Want to copy a specific generation to somewhere else? Or maybe you tested installing to some DEST, and want to copy that to $HE? No worries:

  make copy GEN=N

Where N is the generation you want to copy.

How does it work?

It is really rather simple, the Makefile isn't that complex. Look at that for details.

This isn't intended to cover everything. This could be considered a template for how you could setup your files in a similar way. Look at this org mode file for details.

NOTE: Removal of files is YOUR job, not this tools. One could theoretically look at what changed between two generations and remove that way. BUT that sounds janky and error prone. Removal of files is the users job, not this setup.

Explanation of what is happening

The file defaults.el controls predicates that change how files get tangled to files.

This allows me to tangle files that would be useful for linux/bsd/etc… without affecting the existing files.

The general idea is this (look at Makefile for details):

  • increment generation count from last generation

  • tangle files to tmp/$fename based on current settings

  • copy tmp to generation/N

  • iff generation/(N-1) exists, diff each file there to what exists at DEST

  • If diffing fails, the destination files have been updated, STOP, might lose hand edited changes. Note, if destination does not exist, this is ignored. Also setting FORCE will ignore this check.

  • If diffing does not fail, hardlink generation/N/$fes to DEST/$fes

  • Update last with current generation.

Note, the destination can be anywhere, not just $HE. This allows one to compile/tangle files that can then be trivially rsynced to remote machines, or to tar/xz the files as needed. The key here is emacs is only required to generate config files, not necessarily to use them.

How would I use this?

Should be easy enough to either clone this repo or copy things to a new repo and hack in what you need. Your call.

But, say you have a heading, take .profile as an example, under an org mode heading you would just add:

  :PROPERTIES:
  :header-args: :tangle tmp/.profile :comments no :padline no :cache yes :mkdirp yes
  :END:

Then any source blocks for that heading will go to tmp/.profile. Its important that you put everything into ./tmp! This is used to generate things before a generation is built. It gives the Makefile a chance to know if the tangling worked or not.

But lets say you don't need to have lots of sub headings, or even control a file in multiple subparts that have predicates to control things.

Pretty simple, just add a source block like normal:

  ,#+BEGIN_SRC conf :tangle tmp/.example.conf
  put contents here!
  ,#+END_SRC

External Tanglers

Putting everything in readme.org was getting annoying. So started to split things apart. Org links to all the

name file
emacs emacs.org
tmux tmux.org
git git.org
x x.org
nix nix.org
zsh zsh.org
vim vim.org
misc misc.org
.profile dotprofile.org
~/bin bin.org

Language specific

name file
haskell haskell.org
perl perl.org

TODO

  • Figure out some way to make code blocks editable with :tangle, it sucks not being able to edit blocks as they are.

  • Need to have some way to autocleanup old generations. Rm works for now so meh.

  • Need to add the ability to detect that make is generating a pointless new generation. Aka generation N and generation N-1 are the same, just leave N and don't increment.

  • Maybe checksum file contents somehow and use that?

  • More? For now its functional.

Reference for babel stuff

Found this STUPID useful for constructing the tangle stuff.

babel scraps link