Kieran's opinionated (and probably slightly dumb) nix config
1# ssh
2
3Declarative SSH config with per-host options and zmx (persistent tmux-like sessions over SSH) integration.
4
5## Options
6
7All options under `atelier.ssh`:
8
9| Option | Type | Default | Description |
10|--------|------|---------|-------------|
11| `enable` | bool | `false` | Enable SSH config management |
12| `extraConfig` | string | `""` | Raw SSH config appended to the end |
13
14### zmx
15
16| Option | Type | Default | Description |
17|--------|------|---------|-------------|
18| `zmx.enable` | bool | `false` | Install zmx and autossh |
19| `zmx.hosts` | list of strings | `[]` | Host patterns to auto-attach via zmx |
20
21When zmx is enabled for a host, the SSH config injects `RemoteCommand`, `RequestTTY force`, and `ControlMaster`/`ControlPersist` settings. Shell aliases are also added: `zmls`, `zmk`, `zma`, `ash`.
22
23### Hosts
24
25Per-host config under `atelier.ssh.hosts.<name>`:
26
27| Option | Type | Default | Description |
28|--------|------|---------|-------------|
29| `hostname` | string | — | SSH hostname or IP |
30| `port` | int or null | `null` | SSH port |
31| `user` | string or null | `null` | SSH user |
32| `identityFile` | string or null | `null` | Path to SSH key |
33| `forwardAgent` | bool | `false` | Forward SSH agent |
34| `zmx` | bool | `false` | Enable zmx for this host |
35| `extraOptions` | attrsOf string | `{}` | Arbitrary SSH options |
36
37## Example
38
39```nix
40atelier.ssh = {
41 enable = true;
42 zmx.enable = true;
43 zmx.hosts = [ "terebithia" "ember" ];
44
45 hosts = {
46 terebithia = {
47 hostname = "terebithia";
48 user = "kierank";
49 forwardAgent = true;
50 zmx = true;
51 };
52 "github.com" = {
53 identityFile = "~/.ssh/id_rsa";
54 };
55 };
56};
57```