Getting started
Try it now
The following gives you a preview of your file, formatted using pedantix. You can run this from any machine that has nix installed:
$ nix run github:swarsel/pedantix < your-file.nix
Normally, you will probably want to format a file in place:
$ pedantix file.nix
With no file arguments (or a single -), pedantix reads from stdin and writes the result to stdout.
Installing
Add pedantix as a flake input:
{
inputs.pedantix.url = "github:swarsel/pedantix";
}
From there you can:
- use it with treefmt;
- run it as a pre-commit hook;
- manage the global config with home-manager;
- use it from Emacs.
A first configuration
pedantix works with zero configuration, but the whole idea is that you tune a pedantix.toml to your own pedantic tastes; a minimal one that turns on let sorting and sets a custom argument order could look like this:
formatter = "nixfmt"
[args]
first = ["self", "lib", "config", "pkgs"]
last = ["<defaulted>", "..."]
[lets]
sort = true
The full set of options is documented in Configuration.