Skip to content

refactor: nested ci flake with minimal root#1

Merged
sini merged 3 commits into
mainfrom
refactor/ci-nested-flake
May 23, 2026
Merged

refactor: nested ci flake with minimal root#1
sini merged 3 commits into
mainfrom
refactor/ci-nested-flake

Conversation

@sini
Copy link
Copy Markdown
Owner

@sini sini commented May 22, 2026

Summary

  • Nested CI flake: root flake.nix reduced to zero inputs, all dev/CI modules relocated to templates/ci/ following the ned pattern. with-inputs.nix bootstraps from the CI lock for shell.nix, Justfile uses the CI flake's treefmt-nix formatter, GH Actions runs nix-shell --run 'just ci' for local/CI parity.

  • Unified formatting pipeline: files.files list API now gets the same formatting treatment as files.file attrset API — treefmt, global formatters, and per-file format all apply uniformly via internal _formattedFiles. Replaced treefmt.toml with treefmt-nix as single source of truth. Fixed treefmtFormat to use file-based invocation instead of --stdin to match direct treefmt output.

  • Demo templates: three templates showing the full API surface — flake-parts (import-tree, treefmt, formatters, onChange, per-file overrides), bare-flake (evalModules, no flake-parts), no-flake (pure default.nix).

Test plan

  • nix flake show on root exports only module, flakeModule, flakeModules.default
  • File-sync checks pass (workflow, .gitignore, LICENSE)
  • treefmt --ci --no-cache is a noop after nix run .#write-files
  • Both flake-parts and bare-flake demo templates evaluate
  • no-flake template evaluates via nix-instantiate
  • Integration tests pass in CI (require recursive-nix)

Copy link
Copy Markdown
Collaborator

@vic vic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

Comment thread Justfile
sini added 2 commits May 22, 2026 16:51
Minimal root flake.nix with zero inputs — exports only module,
flakeModule, flakeModules.default. All dev/CI modules relocated to
templates/ci/ as a nested flake following the ned pattern.

- templates/ci/flake.nix holds all inputs
- with-inputs.nix bootstraps from CI lock for shell.nix
- Justfile uses CI flake's treefmt-nix formatter
- GH Actions workflow uses nix-shell + just ci
- test-cases moved to templates/ci/test-cases/
- README and LICENSE updated
Apply the formatting pipeline (treefmt, global formatters, per-file
format) to files.files list entries, not just files.file attrset
entries.

- Add format option to files.files list API
- New _formattedFiles internal option processes all entries uniformly
- treefmtFormat uses file-based invocation instead of --stdin to match
  direct treefmt output
- Fix unused onChange binding flagged by nixf-diagnose
@sini sini force-pushed the refactor/ci-nested-flake branch 2 times, most recently from 8a4928f to 2ab57e5 Compare May 22, 2026 23:52
Three templates showing the full API surface:
- flake-parts: import-tree, treefmt, formatters, onChange, per-file
  format overrides, enable toggle, both APIs together
- bare-flake: vanilla flake with evalModules, no flake-parts
- no-flake: pure default.nix with import
@sini sini force-pushed the refactor/ci-nested-flake branch from 2ab57e5 to b375161 Compare May 22, 2026 23:54
@sini sini merged commit f1fd8ea 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.

2 participants