Skip to content

chore(flake): Split flake.nix into multiple sub-modules#136

Open
sshine wants to merge 9 commits into
hall:mainfrom
sshine:chore/dendritic-flake
Open

chore(flake): Split flake.nix into multiple sub-modules#136
sshine wants to merge 9 commits into
hall:mainfrom
sshine:chore/dendritic-flake

Conversation

@sshine

@sshine sshine commented Jul 9, 2026

Copy link
Copy Markdown
Contributor
  • Add flake-parts, import-tree
  • Renamed treefmt -> treefmt-nix input
  • Moved all flake.nix output content to flake/

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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-parts and import-tree, and switch flake.nix outputs to flake-parts.lib.mkFlake.
  • Move flake outputs into focused flake/*.nix modules (systems, evalModules, packages, checks, apps, devshell, overlays, formatter).
  • Rename the treefmt input to treefmt-nix and 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.

@sshine

sshine commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

Let me know what you think. I'm basically just moving stuff around here.

@adrian-gierakowski

Copy link
Copy Markdown
Collaborator

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?

@sshine

sshine commented Jul 11, 2026

Copy link
Copy Markdown
Contributor Author

I guess hashes of flake outputs should remain the same as before the refactor?

Good point. The changes in flake.lock are:

  • Added flake-parts (+ nixpkgs-lib indirectly)
  • Added import-tree
  • Renamed treefmt into treefmt-nix and accidentally bumped its version

So the only hash that has changed is treefmt-nix's.

@sshine sshine force-pushed the chore/dendritic-flake branch from 3f99bb9 to d4aadf7 Compare July 15, 2026 12:42
sshine added 9 commits July 15, 2026 14:45
- 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.
@sshine sshine force-pushed the chore/dendritic-flake branch from d4aadf7 to 79eb11a Compare July 15, 2026 12:45
@sshine

sshine commented Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

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:

  • Replace the treefmtEval + formatter wiring with the treefmt-nix flakeModule (a0bbcfb)
  • Added flake-parts and import-tree (0fea7b8)

Let me know if you disagree with this refactor.

@adrian-gierakowski

Copy link
Copy Markdown
Collaborator

Sorry for the delay. I've been away attending to some family matters. Should have some time for it tomorrow.

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.

3 participants