fix(state): the "rename it" tip led into the error it was fixing
All checks were successful
Check / eval (push) Successful in 3m51s

Verifying Bernardo's #107 upgrade path (legacy theme-state.json checkout →
new code) turned up a footgun in state-read.nix's own help text. It said:

  • Still on theme-state.json? Rename it to state.json (…)

On a git flake only tracked files exist, so a hand-rename leaves state.json
untracked and therefore invisible — producing exactly the "state file is
missing" error the tip hangs off. Point at the menu write (which stages the
rename via git add --intent-to-add + git rm), name `git add state.json` for
the manual path, and add a bullet for "file is on disk but eval says
missing", which is otherwise a genuinely confusing dead end.

Message verified by rendering the real failure, not by reading the source.

The rename itself is safe and needs no code change: with identical content,
theme-state.json and state.json produce byte-identical derivations (HM
2yqqy8h…, system 9qp9l3g…), so it cannot change what boots. Legacy eval,
the migration write, and re-eval on a dirty/intent-to-add tree all pass.
#133 filed: no check pins the compat shim, so it can rot before we drop it.
This commit is contained in:
2026-07-15 17:41:21 +01:00
parent c05988c6d1
commit 9a280b2e18
3 changed files with 42 additions and 3 deletions

View File

@@ -28,8 +28,12 @@ let
Field-level schema (colors, ui, border, ):
nomarchy-state-sync validate
Eval-time field checks live in modules/home/theme.nix.
Still on theme-state.json? Rename it to state.json (or just run
any menu write / `nomarchy-state-sync set` it migrates).'';
Still on theme-state.json? Easiest is any menu write /
`nomarchy-state-sync set` it migrates and stages the rename
for you. Renaming by hand needs `git add state.json` too.
File IS on disk but eval still says missing? On a git flake only
*tracked* files exist an untracked state.json is invisible:
git add state.json'';
missingMsg = ''
@@ -37,7 +41,7 @@ let
${pathStr}
This file is required (appearance + menu settings). Add state.json to
your flake checkout so evaluation stays pure.
your flake checkout git-tracked so evaluation stays pure.
${tip}'';
emptyMsg = ''