nixfmt-tree
nixfmt-tree 2.6.0 · pkgs/by-name/ni/nixfmt-tree/package.nix
Health
Risk
risk 2 low
- +2 no meta.homepage, no versionCheckHook
Version
Update bot
no attempt logged · not in the queue
Channels
Hydra, nixos-26.11
Advisories
none open
Packaging
no meta.homepage no versionCheckHook
Packagewhat each field means
Description
Official Nix formatter zero-setup starter using treefmt
Long description
A zero-setup [treefmt](https://treefmt.com/) starter to get started using the [official Nix formatter](https://github.com/NixOS/nixfmt).
- For `nix fmt` to format all Nix files, add this to the `flake.nix` outputs:
```nix
formatter.${system} = nixpkgs.legacyPackages.${system}.nixfmt-tree;
```
- The same can be done more efficiently with the `treefmt` command,
which you can get in `nix-shell`/`nix develop` by extending `mkShell` using
```nix
mkShell {
packages = [ pkgs.nixfmt-tree ];
}
```
You can then also use `treefmt` in a pre-commit/pre-push [Git hook](https://git-scm.com/docs/githooks)
and with your editor's format-on-save feature.
- To check formatting in CI, run the following in a checkout of your Git repository:
```
treefmt --ci
```
For more flexibility, you can customise this package using
```nix
pkgs.nixfmt-tree.override {
settings = { /* additional treefmt config */ };
runtimeInputs = [ /* additional formatter packages */ ];
}
```
You can achieve similar results by manually configuring `treefmt`:
```nix
pkgs.treefmt.withConfig {
runtimeInputs = [ pkgs.nixfmt ];
settings = {
# Log level for files treefmt won't format
on-unmatched = "info";
# Configure nixfmt for .nix files
formatter.nixfmt = {
command = "nixfmt";
includes = [ "*.nix" ];
};
};
}
```
Alternatively you can switch to the more fully-featured [treefmt-nix](https://github.com/numtide/treefmt-nix).
Homepage
none
License
Platforms
79 platforms: Linux, Darwin
Main program
treefmtSource provenance
not set: built from source
Outputs
outStatus
not broken, not insecure, free
Maintainers
Teams
Version bumps 0
all open bumpsNone open.
Pull requests 0
None open.
Closed or merged in the last 60 days 6
[Backport #590068] mcp-server-*: bumps treewide · 3,293 packages and 207 modules
#592968 by drupol · closed 5d ago
Update checksums for anydesk package treewide · 3,156 packages and 200 modules
#584605 by HotelLima521 · closed 3w ago
[Backport release-26.05] yaak: fix build with wasm-pack 0.15.1 draft treewide · 3,140 packages and 196 modules
#582862 by dhl · closed 3w ago
[Backport release-26.05] docker-compose: 5.4.0 -> 5.6.1 treewide · 3,138 packages and 194 modules
#582228 by airone01 · closed 4w ago
python3Packages.imageio: disable broken png tests treewide · 3,075 packages and 193 modules
#580329 by OscarLezcano · closed 4w ago
Issues 1
nixfmt-tree: fails to format outside of the nix store 2.status: stale
#473366 by themg95 · opened 11mo ago · 2 comments