Home

Awesome

<h1 align="center">Alejandra 💅</h2> <p align="center">The Uncompromising Nix Code Formatter</p> <p align="center"> <a href="https://buildkite.com/kamadorueda/alejandra" > <img alt="CI/CD" src="https://badge.buildkite.com/67d170860f5630bbc776a97fb0be9c88a97c92860c91f77aa0.svg?branch=main" > </img> </a> <a href="https://coveralls.io/github/kamadorueda/alejandra?branch=main" > <img alt="Coverage" src="https://coveralls.io/repos/github/kamadorueda/alejandra/badge.svg?branch=main" > </img> </a> <a href="https://github.com/kamadorueda/alejandra/blob/main/UNLICENSE" > <img alt="License: The Unlicense" src="https://img.shields.io/badge/license-The Unlicense-green.svg" > </a> <a href="https://github.com/kamadorueda/alejandra" > <img alt="style: Alejandra" src="https://img.shields.io/badge/code%20style-Alejandra-green.svg" > </a> </p> <p align="center"> Try it on your browser! <a href="https://kamadorueda.github.io/alejandra/" > here </a> </p>

Features

Getting started

On the web editor

Please visit: kamadorueda.github.io/alejandra.

Prebuilt binaries

You can download a binary for your platform:

Make it executable ($ chmod +x) and run Alejandra with:

$ ./alejandra --help

or:

$ /path/to/alejandra --help

From Nixpkgs

Please visit: search.nixos.org/packages?query=alejandra.

Nix installation

Then run Alejandra with:

$ alejandra --help

NixOS installation

(experimental) Configuration Options

You can configure Alejandra through a file named alejandra.toml. This file will be automatically detected if found in the same directory where Alejandra is being run from, or you can tell Alejandra to use a different location by using the --experimental-config ./path/to/alejandra.toml flag in the CLI.

You can find a full configuration file and the supported options here: alejandra.toml.

Cool libraries

Alternatives

Versioning

We use semver to version Alejandra.

Our public API consists of:

With the exception of those explicitly marked as "experimental".

Changelog

Please read: CHANGELOG.

Contributors

The following people have helped improving Alejandra.

Thank you ❤️

Connor Baker, David Arnold, David Hauer, Fabian Möller, Florian Finkernagel, Jamie Quigley, Joachim Ernst, Jörg Thalheim, Kevin Amado (Email, LinkedIn), Loïc Reynier, Matthew Kenigsberg, Michael Utz, Mr Hedgehog, Nathan Henrie, Norbert Melzer, Pablo Ovelleiro Corral, Patrick Stevens, Piegames, Rebecca Turner, Rehno Lindeque, Rok Garbas, Ryan Mulligan, Thomas Bereknyei, Tobias Bora, Tristan Maat, UserSv4, Victor Engmark, Vincent Ambo, Vladimir Fetisov, and Yorick van Pelt.

Footnotes

Footnotes

  1. Running on a machine with:

    • CPU: 4 physical, 4 logical, 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
    • MHz: from 400 to 4700 MHz
    • BogoMips: 5606.40
    • Cache L3: 12 MiB

    Using:

    # x86_64-unknown-linux-gnu
    $ time alejandra --threads $threads /path/to/nixpkgs
    

    Results:

    $threadsSeconds
    145
    225
    414
  2. The methodology to claim this is:

    1. Checkout Nixpkgs and run:

      $ nix-env -qaf . --drv-path --xml > before
      
    2. Now format with Alejandra and run:

      $ nix-env -qaf . --drv-path --xml > after
      

    As of 2022-06-22, there are 41 differences in a set of 38109 derivations because of things like this:

    goDeps = ./deps.nix;
    

    Since ./deps.nix was also formatted you get a semantical difference.

    This is something that should be solved on Nixpkgs and not a bug in Alejandra. For example: