|
1 |
| -# Personalize your workspace |
| 1 | +# Dotfiles |
2 | 2 |
|
3 |
| -TODO: |
| 3 | +<!-- markdown-link-check-disable --> |
4 | 4 |
|
5 |
| -- dotfiles |
6 |
| -- idk |
| 5 | +Coder offers the `coder dotfiles <repo>` command which simplifies workspace |
| 6 | +personalization. Our behavior is consistent with Codespaces, so |
| 7 | +[their documentation](https://docs.github.com/en/codespaces/customizing-your-codespace/personalizing-codespaces-for-your-account#dotfiles) |
| 8 | +explains how it loads your repo. |
| 9 | + |
| 10 | +<!-- markdown-link-check-enable --> |
| 11 | + |
| 12 | +You can read more on dotfiles best practices [here](https://dotfiles.github.io). |
| 13 | + |
| 14 | +## From templates |
| 15 | + |
| 16 | +Templates can prompt users for their dotfiles repo URL, which will personalize |
| 17 | +your workspace automatically. |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | +<!-- TODO: Template management docs link--> |
| 22 | + |
| 23 | +> Template admins: this can be enabled quite easily with a our |
| 24 | +> [dotfiles module](https://registry.coder.com/modules/dotfiles) using just a |
| 25 | +> few lines in the template. |
| 26 | +
|
| 27 | +## Personalize script |
| 28 | + |
| 29 | +Templates may be configured to support executing a `~/personalize` script on |
| 30 | +startup which users can populate with commands to customize their workspaces. |
| 31 | + |
| 32 | +You can even fill `personalize` with `coder dotfiles <repo>`, but those looking |
| 33 | +for a simpler approach can inline commands like so: |
| 34 | + |
| 35 | +```bash |
| 36 | +#!/bin/bash |
| 37 | +sudo apt update |
| 38 | +# Install some of my favorite tools every time my workspace boots |
| 39 | +sudo apt install -y neovim fish cargo |
| 40 | +``` |
| 41 | + |
| 42 | +<!-- TODO: template admin docs link --> |
| 43 | + |
| 44 | +> Template admins: read the docs on how to enable the `~/personalize` script on |
| 45 | +> templates. |
| 46 | +
|
| 47 | +## Setup script support |
| 48 | + |
| 49 | +User can setup their dotfiles by creating one of the following script files in |
| 50 | +their dotfiles repo: |
| 51 | + |
| 52 | +- `install.sh` |
| 53 | +- `install` |
| 54 | +- `bootstrap.sh` |
| 55 | +- `bootstrap` |
| 56 | +- `script/bootstrap` |
| 57 | +- `setup.sh` |
| 58 | +- `setup` |
| 59 | +- `script/setup` |
| 60 | + |
| 61 | +If any of the above files are found (in the specified order), Coder will try to |
| 62 | +execute the first match. After the first match is found, other files will be |
| 63 | +ignored. |
| 64 | + |
| 65 | +The setup script must be executable, otherwise the dotfiles setup will fail. If |
| 66 | +you encounter this issue, you can fix it by making the script executable using |
| 67 | +the following commands: |
| 68 | + |
| 69 | +```shell |
| 70 | +cd <path_to_dotfiles_repo> |
| 71 | +chmod +x <script_name> |
| 72 | +git commit -m "Make <script_name> executable" <script_name> |
| 73 | +git push |
| 74 | +``` |
0 commit comments