sh -c "$(curl -fsLS https://get.chezmoi.io)"
sudo mv bin/chezmoi /usr/local/bin/
chezmoi init --apply jon23d
- Edit the file on a host with chezmoi
chezmoi add path/to/file_or_folderchezmoi cd- commit / push
- node
- ripgrep
Secrets are kept in a single file, ~/.config/secrets.env, encrypted as one opaque
GPG blob in the repo (chezmoi names it something like encrypted_dot_config/secrets.env.asc).
Using one file instead of one-per-secret keeps variable/service names out of the
repo entirely — nothing about what secrets exist, or how many, is visible from
outside.
-
Edit the plaintext file locally (create it if it doesn't exist yet):
$EDITOR ~/.config/secrets.envAdd lines like:
export SOME_KEY="..." -
Re-encrypt and re-add it to chezmoi's source state:
chezmoi add --encrypt ~/.config/secrets.env(For quick edits after the first time,
chezmoi edit --apply ~/.config/secrets.envdoes decrypt → open in$EDITOR→ re-encrypt → apply in one step.) -
Commit and push from chezmoi's source directory:
chezmoi cd git add -A git commit -m "Update secrets" git push exit -
Open a new terminal tab so the newly sourced variables take effect.
Decryption requires the GPG private key to be present locally — there is no automated way to deliver it (deliberately; see conversation history for why). On a brand new machine:
- Manually retrieve the private key from 1Password yourself and get it onto
the machine (however you'd like — paste into a file,
multipass transferfor VMs, etc.). - Import it and set trust:
gpg --import key.asc gpg --edit-key <keyid> # at the gpg> prompt: trust, then 5 (ultimate), then quit - Delete the plaintext key file once imported.
- Re-run
chezmoi init jon23d(not justapply) so the encryption config in.chezmoi.toml.tmplgets picked up. chezmoi apply— this can now decryptsecrets.envalong with everything else.