1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# dotfiles

## Bootstrapping

macOS things:

- In System Settings
  - General > Sharing
    - [ ] Set computer name (to make SSH easier)
    - [ ] Enable Remote Login
  - Menu Bar
    - [ ] Automatically hide and show the menu bar: Always
    - [ ] Show menu bar background
  - Displays
    - [ ] More Space
  - Keyboard > Keyboard Shortcuts > Modifier Keys
    - [ ] Caps Lock (⇪) -> Control (⌃)

```sh
git clone https://git.kejadlen.dev/alpha/dotfiles.git ~/.dotfiles
~/.dotfiles/bootstrap.sh
```

`bootstrap.sh` installs Homebrew and DotSlash, then runs `frork` to handle
the rest.

Other non-automatable things:

- [ ] Unlock with Apple Watch
- [ ] 1Password
- [ ] CleanShot X
- [ ] Hamerspoon
- Firefox Developer Edition
  - [ ] [uBlock Origin hard mode](https://github.com/gorhill/uBlock/wiki/Blocking-mode:-hard-mode)
- [ ] MailMate
- [ ] Syncthing

## Packages from nix

CLI tools without a DotSlash file in `bin/` come from the `profile`
package in `flake.nix`. Homebrew still provides the GUI apps and the
formulae that haven't moved to nix.

`bootstrap.sh` doesn't install nix. On a new machine, install it with
the [upstream installer][nix], then add the profile:

[nix]: https://nixos.org/download/

```sh
nix profile add ~/.dotfiles#profile
```

After editing `flake.nix` or running `nix flake update`, apply the
change with `nix profile upgrade profile`. `nix profile rollback`
returns to the previous generation.

The flake only sees files that git tracks, and new files in a jj change
aren't in the git index until they're committed. Commit a new `.nix`
file before the flake refers to it.

## Hammerspoon and Fennel

Hammerspoon embeds Lua 5.4, but Homebrew's `lua` formula tracks the latest
version (currently 5.5). Fennel must be installed for the right Lua version
or Hammerspoon won't find it.

The `frork` provisioner handles this automatically. To set it up manually:

```sh
brew install lua@5.4 luarocks

# Point luarocks at the 5.4 interpreter.
luarocks --lua-version=5.4 --local config variables.LUA /opt/homebrew/opt/lua@5.4/bin/lua
luarocks --lua-version=5.4 --local config variables.LUA_DIR /opt/homebrew/opt/lua@5.4

# Install fennel for Lua 5.4.
luarocks --lua-version=5.4 --local install fennel
```

`init.lua` uses `luarocks path` to add the correct directories to
`package.path` at runtime, so Hammerspoon finds fennel regardless of which Lua
version Homebrew defaults to.

## Useful commands

```
# Adding a submodule
git submodule add -b BRANCH -f --name NAME --depth 1 GIT DIR
```