Skip to content

feat: diff preview, structured renderers, dag template, test coverage#2

Merged
sini merged 7 commits into
mainfrom
feat/diff-and-renderers
May 23, 2026
Merged

feat: diff preview, structured renderers, dag template, test coverage#2
sini merged 7 commits into
mainfrom
feat/diff-and-renderers

Conversation

@sini
Copy link
Copy Markdown
Owner

@sini sini commented May 23, 2026

Summary

  • Diff preview app (files.diff.drv): shows what the writer would change without writing. Supports --verbose for full diffs. Exits 1 on changes, 0 when synced. Exposed via generateApp as nix run .#diff-files.
  • Structured data renderers: json, toml, yaml options on files.file serialize Nix values directly — no pkgs.writers.* boilerplate. Mutual exclusivity enforced via assertion (only one of text/json/toml/yaml may be set per file).
  • dag demo template (templates/dag/): composing a single file from sections across multiple flake-parts modules using dag for topological ordering. Zero coupling between libraries.
  • 9 new integration test cases: attrset API, json/toml/yaml renderers, executable flag, per-file format, enable=false, diff app, generateApp.
  • Linting cleanup: zero warnings from statix, deadnix, nixf-diagnose. Grouped repeated keys, used inherit, simplified if chains with or.
  • README updated: new API table entries, structured data examples, diff commands in quick start, diff.drv and diff.exeFilename in Other options table.

Test plan

  • nix run .#diff-files reports "All files up to date" when synced
  • nix run .#diff-files exits 1 when files are stale or missing
  • diff-files and write-files apps both exposed via generateApp
  • Assertion fires when multiple content options set on same file
  • flake-parts, bare-flake, dag demo templates evaluate
  • statix check, deadnix, treefmt --ci all pass clean
  • Integration tests pass in CI (require recursive-nix)

sini added 3 commits May 22, 2026 17:15
Diff app (nix run .#diff-files) shows what the writer would change
without writing. Supports --verbose for full diffs via difftastic.

Structured data options on files.file: json, toml, yaml serialize Nix
values directly — no pkgs.writers.* boilerplate needed.
Shows how multiple flake-parts modules can each contribute sections
to a README with ordering constraints (entryBefore, entryAfter,
entryBetween), then wire the dag-rendered output into files.file.
- Remove unused psArgs binding (deadnix)
- Use inherit instead of assignment (statix W04)
- Group repeated keys into attrsets (statix W20)
- Fix dag template URL to denful/dag
- Format all files with treefmt
@sini sini force-pushed the feat/diff-and-renderers branch from a24f6e9 to 268ec05 Compare May 23, 2026 00:31
@sini sini changed the title feat: diff preview and json/toml/yaml renderers feat: diff preview, structured renderers, dag template, test coverage May 23, 2026
@sini sini merged commit e5f2091 into main May 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant