Files
dotfiles-public/.tests/lab/fake-private/.chezmoi.toml.tmpl
T
bcherb2 28bcea9850 test: lab 30 checks that each tier has its own chezmoi state
The private init's --persistent-state (chezmoistate-private.boltdb) and its
unit assertion landed in 06b03c9. chezmoi keeps its state next to the config
file, so the tiers used to share chezmoistate.boltdb and each wrote its
config-template hash over the other's: after the private init every public
command warned "config file template has changed".

Lab 30 now asserts the private state file exists, private.toml names it, and
neither tier warns and both statuses are clean after both inits. The fake
private tier is resynced with the real template and cmp alias.
2026-11-18 03:03:24 -05:00

49 lines
3.1 KiB
Cheetah

# chezmoi configuration for the PRIVATE tier.
#
# Seven questions, asked once at `chezmoi init` and never again -- promptStringOnce
# reads the value already in the config if there is one. Nothing here is fetched
# over a network: your own name is not a rotatable secret, and making `apply`
# depend on an API call to learn your email address would be absurd.
#
# There is deliberately no `encryption` key and no [age] section. The one secret
# in this repo is an ordinary 600-mode file; see README.md for why that is the
# cheaper answer than a per-machine root secret that was already 0 bytes on one
# machine in three.
#
# WHERE THIS FILE LANDS -- read before changing the aliases.
# `dotup` runs `chezmoi init --apply --source ~/.local/share/dotfiles-private
# -c ~/.config/chezmoi/private.toml <url>`, so this template renders to
# private.toml and the public tier keeps chezmoi.toml. The `cmp` alias carries
# the same -c. Two sources, two configs, no overlap.
#
# It was not always so, and the bug is worth remembering. Both tiers rendered
# to the DEFAULT config path, so re-running the public installer overwrote this
# file and took the seven answers below with it. Nothing failed at the time:
# the templates degrade politely when their data is missing -- config.local
# emits a comment telling you to re-run init rather than failing the apply --
# so the symptom was `git commit` not knowing who you are, days later, with
# nothing pointing back at the install that caused it. A loud failure would
# have been a smaller bug.
#
# The same goes for the PERSISTENT STATE. chezmoi keeps it next to the config
# file, so both tiers shared ~/.config/chezmoi/chezmoistate.boltdb: each wrote
# its own config-template hash and run_onchange hashes over the other's, and
# after the private init every public command warned "config file template has
# changed". Running the init it suggests only moved the warning to this tier.
# So this tier gets its own state file, beside private.toml. This key covers a
# bare `chezmoi -c private.toml`; `dotup` and `cmp` also pass the same path as
# --persistent-state, because `init` opens the state BEFORE it writes this key,
# so the first init (or a re-init from a config that predates it) would
# otherwise record its hash in the public tier's file.
persistentState = {{ joinPath (dir .chezmoi.configFile) "chezmoistate-private.boltdb" | quote }}
[data]
gitName = {{ promptStringOnce . "gitName" "git user.name" | quote }}
gitEmail = {{ promptStringOnce . "gitEmail" "git user.email" | quote }}
gitSigningKey = {{ promptStringOnce . "gitSigningKey" "git signing key id (blank for none)" "" | quote }}
giteaWanSsh = {{ promptStringOnce . "giteaWanSsh" "gitea WAN ssh prefix" "ssh://git@git.example.invalid:222/" | quote }}
giteaLanSsh = {{ promptStringOnce . "giteaLanSsh" "gitea LAN ssh prefix" "ssh://git@10.99.99.99:2223/" | quote }}
giteaWanWeb = {{ promptStringOnce . "giteaWanWeb" "gitea WAN web url" "https://git.example.invalid/" | quote }}
giteaLanWeb = {{ promptStringOnce . "giteaLanWeb" "gitea LAN web url" "http://10.99.99.99:3001/" | quote }}