chore(flake): Split flake.nix into multiple sub-modules#136
Conversation
sshine
commented
Jul 9, 2026
- Add flake-parts, import-tree
- Renamed treefmt -> treefmt-nix input
- Moved all flake.nix output content to flake/
There was a problem hiding this comment.
Pull request overview
This PR refactors the repository’s Nix flake definition by adopting flake-parts and splitting the previous monolithic flake.nix outputs into dedicated sub-modules under flake/, with module auto-discovery via import-tree.
Changes:
- Add
flake-partsandimport-tree, and switchflake.nixoutputs toflake-parts.lib.mkFlake. - Move flake outputs into focused
flake/*.nixmodules (systems, evalModules, packages, checks, apps, devshell, overlays, formatter). - Rename the
treefmtinput totreefmt-nixand update the lockfile accordingly.
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| flake.nix | Switch flake outputs to flake-parts and import flake modules via import-tree. |
| flake.lock | Add/lock flake-parts, import-tree, nixpkgs-lib; rename treefmt node to treefmt-nix; update systems source. |
| flake/systems.nix | Define supported systems list via inputs.systems. |
| flake/eval-modules.nix | Provide evalModules per system and export it for other per-system modules via _module.args. |
| flake/overlays.nix | Reintroduce the default overlay exporting kubenix.evalModules into pkgs. |
| flake/packages.nix | Define default, docs, generators, and example packages per system. |
| flake/checks.nix | Define test/check derivations per system (plus versioned K8s checks). |
| flake/apps.nix | Provide docs and generate apps per system. |
| flake/devshell.nix | Provide a default dev shell per system. |
| flake/formatter.nix | Wire treefmt-nix into flake-parts (formatter and formatting check) and configure formatters/excludes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Let me know what you think. I'm basically just moving stuff around here. |
Haven't had time to read the entire diff but on the surface looks fine. Assuming that this is a nix code refactor, I guess hashes of flake outputs should remain the same as before the refactor? |
Good point. The changes in flake.lock are:
So the only hash that has changed is |
3f99bb9 to
d4aadf7
Compare
- Add flake-parts and import-tree inputs to bootstrap the dendritic layout - Wrap outputs in mkFlake importing ./flake, merged with the existing outputs - Add flake/systems.nix so flake-parts has its required systems set
- Pin systems explicitly to nix-systems/default instead of the indirect registry - Rename treefmt -> treefmt-nix to match upstream and the flakeModule name
- Replace the manual treefmtEval + formatter wiring with the treefmt-nix flakeModule - perSystem formatter (nix fmt) now comes from the flakeModule's treefmt options - Drop the raw checks.formatting entry along with treefmtEval Note: the pinned treefmt-nix flakeModule does not register a checks.formatting, so `nix flake check` no longer runs the formatter as a check; only `nix fmt` remains.
d4aadf7 to
79eb11a
Compare
|
I've restructured the pull request so instead of one big refactor commit, it is done in parts. This should make reviewing easier. Cases where I have done more than just move things:
Let me know if you disagree with this refactor. |
|
Sorry for the delay. I've been away attending to some family matters. Should have some time for it tomorrow. |