Files
dotfiles/docs/installation.mdx
T

109 lines
4.8 KiB
Plaintext
Raw Normal View History

---
title: Installation
description: Install chezmoi and apply these dotfiles with one command, or pass your own chezmoi arguments.
sidebar:
icon: download
---
## One-liner
```sh
curl -fsSL https://dots.prd.lk/install | sh
```
`/install` is chezmoi's official install script ([get.chezmoi.io/lb](https://get.chezmoi.io/lb)), vendored into this site's `public/` directory with three changes:
1. chezmoi installs to `$HOME/.local/bin`, whatever directory you run it from.
2. With no arguments, it runs `chezmoi init --apply prdlk/dotfiles` after installing.
3. When the script is piped into `sh`, chezmoi's stdin is reattached to `/dev/tty` so the first-run prompts still work.
The script checks the release tarball's SHA-256 before installing, as upstream does.
## Before you run it
<Steps>
<Step title="Package manager">
**Arch**: `sudo` for pacman. AUR packages (`topgrade`, `portop`, and the desktop apps on desktop roles) go through `yay` or `paru`; when neither is installed the package script installs `yay` from a sync repo that ships it (CachyOS) or builds `yay-bin` from the AUR.
**macOS**: [Homebrew](https://brew.sh) is required; the package script exits with an error if `brew` is missing.
</Step>
<Step title="GitHub access">
`prdlk/dotfiles` is a private repository, so the clone needs credentials:
- **HTTPS** (default): git prompts for your GitHub username and a personal access token with `repo` scope.
- **SSH**: add the machine's key to GitHub first, then use the `--ssh` form below.
</Step>
<Step title="age key">
chezmoi is configured for age encryption with the identity at `~/.config/chezmoi/key.txt`. The key is never committed. Copy it from an existing machine before applying:
```sh
mkdir -p ~/.config/chezmoi
scp <existing-machine>:.config/chezmoi/key.txt ~/.config/chezmoi/key.txt
chmod 600 ~/.config/chezmoi/key.txt
```
</Step>
</Steps>
## Options
Arguments after `--` go to chezmoi and replace the default `init --apply prdlk/dotfiles`:
<CodeGroup>
```sh SSH
sh -c "$(curl -fsSL https://dots.prd.lk/install)" -- init --apply --ssh prdlk/dotfiles
```
```sh Dry-run
sh -c "$(curl -fsSL https://dots.prd.lk/install)" -- init prdlk/dotfiles
chezmoi diff
chezmoi apply
```
```sh chezmoi-only
sh -c "$(curl -fsSL https://dots.prd.lk/install)" -- --version
```
</CodeGroup>
| Flag / variable | Effect |
| --- | --- |
| `-b <dir>` | Install directory (default `$HOME/.local/bin`) |
| `-t <tag>` | chezmoi release tag (default `latest`) |
| `-d` | Debug logging |
| `BINDIR` | Same as `-b` |
| `DOTFILES_REPO` | Repo for the default `init --apply` (default `prdlk/dotfiles`) |
## First apply
<Steps>
<Step title="Prompts">
`.chezmoi.toml.tmpl` asks once for **name**, **email**, and **role** (`desktop`, `laptop`, `mac`, `server`). Answers are stored in `~/.config/chezmoi/chezmoi.toml` and not asked again. See [Configuration](/chezmoi/config).
</Step>
<Step title="Packages">
`run_onchange_before_10-packages` installs everything in `.chezmoidata/packages.yaml` with pacman/yay or Homebrew before any file is written. See [Scripts](/chezmoi/scripts).
</Step>
<Step title="Files and externals">
Configs are linked into `$HOME` (symlink mode). The neovim config and a bat syntax are cloned as externals. See [Externals and ignore rules](/chezmoi/externals-and-ignore).
</Step>
<Step title="Post-apply scripts">
rustup and cargo crates, the global mise tools (`ghq`, `bun`, `node`, `uv`, `opencode`, `crush`, omp), strata on Linux desktops, then gh extensions (from a fish session), skills, the bat cache, the font cache, yazi plugins, and the systemd user services on Linux. tpm arrives earlier as an external.
</Step>
</Steps>
:::note
The gh extension script skips with a warning until `gh auth login` has run. A skipped run still exits 0, so a plain `chezmoi apply` does not retry it. See [Scripts](/chezmoi/scripts#20-gh-extensions) for how to re-run it.
:::
## Updating
```sh
chezmoi update # git pull + apply
chezmoi diff # what apply would change
```
## Refreshing the install script
`public/install` is a vendored copy. To pick up upstream changes, download `https://get.chezmoi.io/lb` again and re-apply the three changes listed in the header comment of `public/install`.
## Publishing this site
The site is a [Blume](https://github.com/haydenbleasel/blume) project (`docs/`, `public/`, `blume.config.ts`). `.github/workflows/docs.yml` builds it with `bun run build` and deploys `dist/` to GitHub Pages on every push to `master` that touches the site. Pages uses **GitHub Actions** as its source, and `dots.prd.lk` is the custom domain set in the repository's Pages settings. That domain needs a DNS `CNAME` record pointing to `prdlk.github.io`. None of these files are applied to `$HOME`; `.chezmoiignore.tmpl` excludes them.