An uncompromising, fast Nix code formatter written in Rust with a comprehensive style guide.
Alejandra is an uncompromising code formatter for the Nix expression language, automatically applying a consistent and comprehensive style to Nix code. It solves the problem of inconsistent formatting in Nix projects by enforcing a single, well-grounded style guide, allowing developers to focus on logic rather than formatting debates.
Nix developers and teams working on Nix projects, especially those managing large codebases like Nixpkgs or complex Nix configurations.
Developers choose Alejandra for its speed (written in Rust), reliability (high test coverage), and comprehensive style that covers all Nix language constructs, eliminating formatting discussions and ensuring consistency across projects.
The Uncompromising Nix Code Formatter
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Written in Rust, it formats large codebases like Nixpkgs in seconds, with benchmarks showing multi-threaded performance scaling from 45 to 14 seconds on standard hardware.
Handles all possible combinations of the Nix expression language, ensuring no syntax is left unformatted, based on a well-grounded style guide refined from Nixpkgs conventions.
High test coverage ensures formatting does not introduce semantic changes to Nix code, except in edge cases like file path references, as detailed in the methodology footnote.
Native support for popular editors (VSCode, Neovim, Emacs) and CI tools (pre-commit), making it easy to adopt in development pipelines without disruption.
Configuration options are marked as experimental, offering minimal control over the opinionated style, which may not suit teams with specific formatting preferences.
As an uncompromising formatter, updates to the style guide could force widespread code changes, potentially disrupting existing projects or requiring careful version management.
Tightly integrated with the Nix ecosystem, it lacks support for mixed-language projects or non-standard Nix tooling, limiting its applicability outside pure Nix environments.