Skip to content

Work Machine

A work kit lives alongside your personal one. It can share folders and common config while overriding anything specific to your work context.

The simplest version is two dotkit files in the same directory:

  • Directorydotkit/
    • personal.dotkit
    • work.dotkit
    • dotkit.env
    • Directoryconfigs/
    • Directorypackages/
      • brew.md
      • brew-work.md
    • Directorygit/
    • Directorydotfiles/
work.dotkit
DOTKIT_DEV_DIR=~/work
GITHUB_ORG=acme
---
map dotkit run {{item}}
configs
packages/brew-work
git
---
dotkit link dotfiles

Because neither file is named after the directory, dotkit run ~/dotkit asks which one:

Dotkit files in /home/you/dotkit:
1) personal
2) work
3) entire folder (ignore dotkits)
0) cancel
Which one? [0-3]:

A target can set its own variables in a block before anything else runs. They persist through the rest of the file and into everything it calls:

DOTKIT_DEV_DIR=~/work
GITHUB_ORG=acme
---
map dotkit run {{item}}
git

For values shared by several files in a folder, use an .env file instead. Nearer files win, so git/git.env overrides the kit root’s dotkit.env.

If the two contexts share little, give each its own directory:

  • Directorydotkit/
    • Directorypersonal/
      • personal.dotkit
      • Directorypackages/
    • Directorywork/
      • work.dotkit
      • dotkit.env
      • Directorypackages/

Each directory is now its own kit, so work/dotkit.env is invisible to personal/. That isolation is the point: a variable meant for work can never leak into your personal machine.

# Work packages
## map
- brew install **1**
- awscli
- terraform
- kubectl
## map
- brew install --cask **1**
- zoom
- slack
- docker
git/git.env
WORK_DIR=$DOTKIT_DEV_DIR
GITHUB_ORG=acme
git/config.txt
map git config --global {{key}} {{value}}
user.email = [email protected]
---
map git clone [email protected]:{{key}}/{{2}}.git $WORK_DIR/{{2}}
#acme = backend
#acme = frontend

The installer lists every *.dotkit it finds and prompts:

1) personal
2) work
0) skip
Which dotkit? [0-2]:

Or pass it directly:

Terminal window
curl -fsSL dotkit.run/sh | sh -s -- --username yourname --dotkit work --defaults
Terminal window
dotkit run ~/dotkit/work.dotkit

Naming the file skips the prompt. Alternatively, name one of them default.dotkit and it runs without asking, while the other stays available by path.