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
2.6.0 no newer release known to repology
Channels
Hydra
succeeded 2d ago
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 0all open bumps
None open.
Pull requests 0
None open.
Issues 1
nixfmt-tree: fails to format outside of the nix store 2.status: stale
#473366 by themg95 · opened 9mo ago · 2 comments