Skip to content

feat: add treefmt-nix to dev flake - #708

Open
gabyx wants to merge 6 commits into
juspay:mainfrom
gabyx:feat/treefmt-nix
Open

feat: add treefmt-nix to dev flake#708
gabyx wants to merge 6 commits into
juspay:mainfrom
gabyx:feat/treefmt-nix

Conversation

@gabyx

@gabyx gabyx commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Things Done

Closes: #707

  • Added treefmt setup in dev flake to format treewide all files.
  • Needed to update nixpkgs since treefmt-nix needs a newer input.
  • Flake check in dev with nix flake check runs the formatting check. (Should be integrated in omnix by default?)
  • Replaced nixpkgs-fmt with treefmt on pre-commit.
  • .prettierrc.yaml in root (could be maybe somewhere else ...) to format all markdown files consistently.

How it works:

  • just format will format all files: Once happy with the setup one can format the files on main in one commit. The docs folder with the markdown files look well treated by prettier and there is not much to change I guess.

Note: When merging, one should apply just format on main directly afterwards as chore: formatting all files treewide

Assisted-by: no agent.

@gabyx
gabyx force-pushed the feat/treefmt-nix branch 2 times, most recently from ea9bfc5 to 2f400e9 Compare July 25, 2026 10:07
@gabyx
gabyx force-pushed the feat/treefmt-nix branch from 2f400e9 to ccc00f4 Compare July 25, 2026 10:08
@gabyx
gabyx force-pushed the feat/treefmt-nix branch from 3722901 to 7b66cf6 Compare July 25, 2026 10:18
@gabyx
gabyx marked this pull request as ready for review July 25, 2026 10:22
@gabyx gabyx changed the title feat: add treefmt nix to dev flake feat: add treefmt-nix to dev flake Jul 25, 2026
@gabyx

gabyx commented Jul 25, 2026

Copy link
Copy Markdown
Contributor Author

@shivaraj-bh: Could you maybe run just format on that branch and check how it looks?

@shivaraj-bh

Copy link
Copy Markdown
Member

@gabyx Why use treefmt-nix when pre-commit has a nixfmt hook?

@gabyx

gabyx commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

@shivaraj-bh : Cause running hooks and formatting are two orthogonal things. Running hooks is fine but having one global process which formats treewide (with caching) is something which is not super easy achievable with hooks.

Running the format step (the exact same treefmt build and not again another nixfmt hook) in pre-commit is however the better option IMO.
Also you dont need to worry about other formats, its covered all.

Treefmt is awesome btw :). Once used you will probably deploy it everywhere :) (We did so and its a game changer :))

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.

fix: add treewide formatting with nixfmt and others

3 participants