Files
cachyos/docs/installation.md
T

82 lines
3.5 KiB
Markdown
Raw Normal View History

# Installation
Install chezmoi and apply the CachyOS dotfiles with one command.
## One-liner
```sh
sh -c "$(curl -fsLS get.chezmoi.io)" -- init --apply https://prad.codes/env/cachyos.git
```
[get.chezmoi.io](https://get.chezmoi.io) is chezmoi's official install script. It installs the `chezmoi` binary into `./bin` of the current directory by default (pass `-b ~/.local/bin` before `--` to change that), then runs `chezmoi init --apply` with the repo URL. chezmoi clones the repo to `~/.local/share/chezmoi` and initializes its submodules (`dot_config/fish`) as part of `init`.
## Before you run it
### 1. Package manager
`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.
### 2. 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
```
### 3. Repo access
The repo at `https://prad.codes/env/cachyos` is public, so HTTPS needs no credentials. To clone over SSH instead, add the machine's key to the Gitea account and use `git@prad.codes:env/cachyos.git`.
## Options
Arguments after `--` go to chezmoi:
**SSH**
```sh
sh -c "$(curl -fsLS get.chezmoi.io)" -- init --apply git@prad.codes:env/cachyos.git
```
**Dry-run**
```sh
sh -c "$(curl -fsLS get.chezmoi.io)" -- init https://prad.codes/env/cachyos.git
chezmoi diff
chezmoi apply
```
**Install directory**
```sh
sh -c "$(curl -fsLS get.chezmoi.io)" -- -b ~/.local/bin init --apply https://prad.codes/env/cachyos.git
```
**Working on the repo**
The checkout used day to day lives at `~/Code/prad.codes/env/cachyos`. chezmoi expects its source directory at `~/.local/share/chezmoi`, so either clone into that path or point chezmoi at the checkout:
```sh
chezmoi init --source ~/Code/prad.codes/env/cachyos
```
Both give the same model: one git checkout is the chezmoi source, and `mode = "symlink"` links files in `$HOME` back to it.
## First apply
1. **Prompts**: `.chezmoi.toml.tmpl` asks once for **name**, **email**, and **role** (`desktop`, `laptop`, `server`; the default is `desktop`). Answers are stored in `~/.config/chezmoi/chezmoi.toml` and not asked again. See [Configuration](chezmoi/config.md).
2. **Packages**: `run_onchange_before_10-packages` installs everything in `.chezmoidata/packages.yaml` with pacman and yay before any file is written. See [Scripts](chezmoi/scripts.md).
3. **Files and externals**: Configs are linked into `$HOME` (symlink mode). The neovim config, fish, and the other externals are cloned or pulled. See [Externals and ignore rules](chezmoi/externals-and-ignore.md).
4. **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. tpm arrives earlier as an external.
> [!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.md#20-gh-extensions) for how to re-run it.
## Updating
```sh
chezmoi update # git pull + apply
chezmoi diff # what apply would change
```