{"id":13647660,"url":"https://github.com/kamadorueda/alejandra","last_synced_at":"2025-05-14T04:08:03.049Z","repository":{"id":37256111,"uuid":"452466924","full_name":"kamadorueda/alejandra","owner":"kamadorueda","description":"The Uncompromising Nix Code Formatter","archived":false,"fork":false,"pushed_at":"2025-04-10T23:24:20.000Z","size":2639,"stargazers_count":1046,"open_issues_count":55,"forks_count":46,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-04-11T00:44:29.768Z","etag":null,"topics":["fmt","format","formatter","formatting","nix","rust","style-guide","styleguide"],"latest_commit_sha":null,"homepage":"https://kamadorueda.github.io/alejandra/","language":"Nix","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kamadorueda.png","metadata":{"funding":{"github":"kamadorueda","patreon":null,"open_collective":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null},"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-01-26T22:52:25.000Z","updated_at":"2025-04-10T23:09:06.000Z","dependencies_parsed_at":"2024-01-08T08:02:21.979Z","dependency_job_id":"8a830bec-311a-4873-a400-c04bb1806cfc","html_url":"https://github.com/kamadorueda/alejandra","commit_stats":{"total_commits":428,"total_committers":23,"mean_commits":"18.608695652173914","dds":"0.11448598130841126","last_synced_commit":"d7552fef2ccf1bbf0d36b27f6fddb19073f205b7"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kamadorueda%2Falejandra","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kamadorueda%2Falejandra/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kamadorueda%2Falejandra/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kamadorueda%2Falejandra/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kamadorueda","download_url":"https://codeload.github.com/kamadorueda/alejandra/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254069476,"owners_count":22009557,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fmt","format","formatter","formatting","nix","rust","style-guide","styleguide"],"created_at":"2024-08-02T01:03:41.724Z","updated_at":"2025-05-14T04:07:58.037Z","avatar_url":"https://github.com/kamadorueda.png","language":"Nix","funding_links":["https://github.com/sponsors/kamadorueda"],"categories":["Nix","nix","Rust","Command-Line Tools","rust"],"sub_categories":["Discovery"],"readme":"\u003ch1 align=\"center\"\u003eAlejandra 💅\u003c/h2\u003e\n\n\u003cp align=\"center\"\u003eThe Uncompromising Nix Code Formatter\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca\n    href=\"https://buildkite.com/kamadorueda/alejandra\"\n  \u003e\n    \u003cimg\n      alt=\"CI/CD\"\n      src=\"https://badge.buildkite.com/67d170860f5630bbc776a97fb0be9c88a97c92860c91f77aa0.svg?branch=main\"\n    \u003e\n    \u003c/img\u003e\n  \u003c/a\u003e\n  \u003ca\n    href=\"https://coveralls.io/github/kamadorueda/alejandra?branch=main\"\n  \u003e\n    \u003cimg\n      alt=\"Coverage\"\n      src=\"https://coveralls.io/repos/github/kamadorueda/alejandra/badge.svg?branch=main\"\n    \u003e\n    \u003c/img\u003e\n  \u003c/a\u003e\n  \u003ca\n    href=\"https://github.com/kamadorueda/alejandra/blob/main/UNLICENSE\"\n  \u003e\n    \u003cimg\n      alt=\"License: The Unlicense\"\n      src=\"https://img.shields.io/badge/license-The Unlicense-green.svg\"\n    \u003e\n  \u003c/a\u003e\n  \u003ca\n    href=\"https://github.com/kamadorueda/alejandra\"\n  \u003e\n    \u003cimg\n      alt=\"style: Alejandra\"\n      src=\"https://img.shields.io/badge/code%20style-Alejandra-green.svg\"\n    \u003e\n  \u003c/a\u003e\n\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  Try it on your browser!\n  \u003ca\n    href=\"https://kamadorueda.github.io/alejandra/\"\n  \u003e\n    here\n  \u003c/a\u003e\n\u003c/p\u003e\n\n## Features\n\n- ✔️ **Fast**\n\n  It's written in [Rust](https://www.rust-lang.org/)\n  and formats [Nixpkgs](https://github.com/NixOS/nixpkgs)\n  in just a few seconds.\n  [^benchmark-specs]\n\n- ✔️ **Powerful**\n\n  We define a comprehensive style\n  for all possible combinations of the Nix expression language.\n\n- ✔️ **Reliable**\n\n  High coverage, battle tested.\n\n  From Nix's eyes, code is _just_ the same.\n  [^semantic-changes]\n\n- ✔️ **Beautiful**\n\n  Beauty is subjective, right?\n\n  We started from the original style of\n  [Nixpkgs](https://github.com/NixOS/nixpkgs),\n  and then we applied the feedback of developers\n  who have used [Nix](https://nixos.org) at scale\n  for several years,\n  producing a very **well-grounded** [**style guide**](./STYLE.md).\n  For everything else, some pieces of the style are [configurable](#experimental-configuration-options).\n\n- ✔️ **Transparent**\n\n  You won't notice the formatter after a while.\n\n  Humans care about the content,\n  machines about the style!\n\n- ✔️ **Native**\n\n  We integrate with common code editors and workflows:\n\n  - [Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=kamadorueda.alejandra)\n  - [Neovim](./integrations/neovim/README.md)\n  - [Vim](./integrations/vim/README.md)\n  - [GNU Emacs](./integrations/gnu-emacs/README.md)\n  - [Doom Emacs](./integrations/doom-emacs/README.md)\n  - [Pre-commit](./integrations/pre-commit/README.md)\n  - [Pre-commit-hooks.nix](./integrations/pre-commit-hooks-nix/README.md)\n\n## Getting started\n\n### On the web editor\n\nPlease visit:\n[kamadorueda.github.io/alejandra](https://kamadorueda.github.io/alejandra/).\n\n### Prebuilt binaries\n\nYou can download a binary for your platform:\n\n- [aarch64-unknown-linux-musl](https://github.com/kamadorueda/alejandra/releases/download/4.0.0/alejandra-aarch64-unknown-linux-musl)\n- [x86_64-unknown-linux-musl](https://github.com/kamadorueda/alejandra/releases/download/4.0.0/alejandra-x86_64-unknown-linux-musl)\n\nMake it executable (`$ chmod +x`)\nand run Alejandra with:\n\n```bash\n$ ./alejandra --help\n```\n\nor:\n\n```bash\n$ /path/to/alejandra --help\n```\n\n### From [Nixpkgs](https://github.com/nixos/nixpkgs)\n\nPlease visit: [search.nixos.org/packages?query=alejandra](https://search.nixos.org/packages?channel=unstable\u0026show=alejandra\u0026from=0\u0026size=50\u0026sort=relevance\u0026type=packages\u0026query=alejandra).\n\n### Nix installation\n\n- Nix stable:\n\n  ```bash\n  $ nix-env -ivf https://github.com/kamadorueda/alejandra/tarball/4.0.0\n  ```\n\n- Nix with [Flakes](https://wiki.nixos.org/wiki/Flakes):\n\n  ```bash\n  $ nix profile install github:kamadorueda/alejandra/4.0.0\n  ```\n\nThen run Alejandra with:\n\n```bash\n$ alejandra --help\n```\n\n### NixOS installation\n\n- Nix stable:\n\n  ```nix\n  let\n    alejandra =\n      (import (builtins.fetchTarball {\n        url = \"https://github.com/kamadorueda/alejandra/tarball/4.0.0\";\n        sha256 = \"0000000000000000000000000000000000000000000000000000\";\n      }) {})\n      .outPath;\n  in {\n    environment.systemPackages = [alejandra];\n  }\n  ```\n\n- Nix with [Flakes](https://wiki.nixos.org/wiki/Flakes):\n\n  ```nix\n  {\n    inputs = {\n      nixpkgs.url = \"github:nixos/nixpkgs/nixpkgs-unstable\";\n\n      alejandra.url = \"github:kamadorueda/alejandra/4.0.0\";\n      alejandra.inputs.nixpkgs.follows = \"nixpkgs\";\n    };\n\n    outputs = {alejandra, nixpkgs, ...}: {\n      nixosConfigurations = {\n        example = nixpkgs.lib.nixosSystem rec {\n          # We support: aarch64-darwin, aarch64-linux, i686-linux, x86_64-darwin, x86_64-linux\n          system = \"x86_64-linux\";\n\n          modules = [\n            {\n              environment.systemPackages = [alejandra.defaultPackage.${system}];\n            }\n            # Import your other modules here\n            # ./path/to/my/module.nix\n            # ...\n          ];\n        };\n      };\n    };\n  }\n  ```\n\n## (experimental) Configuration Options\n\nYou can configure Alejandra through a file named `alejandra.toml`.\nThis file will be automatically detected if found in the same directory\nwhere Alejandra is being run from,\nor you can tell Alejandra to use a different location by using the\n`--experimental-config ./path/to/alejandra.toml` flag in the CLI.\n\nYou can find a full configuration file and the supported options here: [alejandra.toml](./alejandra.toml).\n\n## Cool libraries\n\n- [NixEL](https://github.com/kamadorueda/nixel)\n- [Santiago](https://github.com/kamadorueda/santiago)\n- [rnix-parser](https://github.com/nix-community/rnix-parser)\n\n## Alternatives\n\n- [NixOS/nixfmt](https://github.com/NixOS/nixfmt)\n- [serokell/nixfmt](https://github.com/serokell/nixfmt)\n- [nixpkgs-fmt](https://github.com/nix-community/nixpkgs-fmt)\n\n## Versioning\n\nWe use [semver](https://semver.org/) to version Alejandra.\n\nOur public API consists of:\n\n- The formatting rules (a.k.a. the style).\n- The CLI tool (`$ alejandra`),\n  command line flags,\n  positional arguments,\n  exit codes,\n  and stdout.\n\nWith the exception of those explicitly marked as \"experimental\".\n\n## Changelog\n\nPlease read: [CHANGELOG](./CHANGELOG.md).\n\n## Contributors\n\nThe following people have helped improving Alejandra.\n\nThank you ❤️\n\n[Bobbe](https://github.com/30350n),\n[Connor Baker](https://github.com/ConnorBaker),\n[Daniel Bast](https://github.com/dbast),\n[David Arnold](https://github.com/blaggacao),\n[David Hauer](https://github.com/DavHau),\n[esf](https://github.com/exscientiafortis),\n[Fabian Möller](https://github.com/B4dM4n),\n[Florian Finkernagel](https://github.com/TyberiusPrime),\n[Jamie Quigley](https://github.com/Sciencentistguy),\n[Joachim Ernst](https://github.com/0x4A6F),\n[Johannes Kirschbauer](https://github.com/hsjobeki),\n[Jörg Thalheim](https://github.com/Mic92),\n[Kevin Amado](https://github.com/kamadorueda)\n([Email](mailto:kamadorueda@gmail.com),\n[LinkedIn](https://www.linkedin.com/in/kamadorueda)),\n[Loïc Reynier](https://github.com/loicreynier),\n[Matthew Kenigsberg](https://github.com/mkenigs),\n[Michael Utz](https://github.com/theutz),\n[Mr Hedgehog](https://github.com/ModdedGamers),\n[Nathan Henrie](https://github.com/n8henrie),\n[Norbert Melzer](https://github.com/NobbZ),\n[Pablo Ovelleiro Corral](https://github.com/pinpox),\n[Patrick Stevens](https://github.com/Smaug123),\n[Piegames](https://github.com/piegamesde),\n[Rebecca Turner](https://github.com/9999years),\n[Rehno Lindeque](https://github.com/rehno-lindeque),\n[Rok Garbas](https://github.com/garbas),\n[Ryan Mulligan](https://github.com/ryantm),\n[Thomas Bereknyei](https://github.com/tomberek),\n[Tobias Bora](https://github.com/tobiasBora),\n[Tristan Maat](https://github.com/TLATER),\n[UserSv4](https://github.com/UserSv4),\n[Victor Engmark](https://github.com/l0b0),\n[Vincent Ambo](https://github.com/tazjin),\n[Vladimir Fetisov](https://github.com/3timeslazy),\nand [Yorick van Pelt](https://github.com/yorickvP).\n\n## Footnotes\n\n[^benchmark-specs]:\n    Running on a [machine](https://github.com/kamadorueda/machine) with:\n\n    - CPU: 4 physical, 4 logical, 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz\n    - MHz: from 400 to 4700 MHz\n    - BogoMips: 5606.40\n    - Cache L3: 12 MiB\n\n    Using:\n\n    ```bash\n    # x86_64-unknown-linux-gnu\n    $ time alejandra --threads $threads /path/to/nixpkgs\n    ```\n\n    Results:\n\n    | $threads | Seconds |\n    | :------: | :-----: |\n    |    1     |   45    |\n    |    2     |   25    |\n    |    4     |   14    |\n\n[^semantic-changes]: The methodology to claim this is:\n\n    1.  Checkout [Nixpkgs](https://github.com/nixos/nixpkgs) and run:\n\n        ```bash\n        $ nix-env -qaf . --drv-path --xml \u003e before\n        ```\n\n    1.  Now format with Alejandra and run:\n\n        ```bash\n        $ nix-env -qaf . --drv-path --xml \u003e after\n        ```\n\n    As of 2022-06-22,\n    there are 41 differences in a set of 38109 derivations\n    because of things like this:\n\n    ```\n    goDeps = ./deps.nix;\n    ```\n\n    Since `./deps.nix` was also formatted\n    you get a semantical difference.\n\n    This is something that should be solved on Nixpkgs\n    and not a bug in Alejandra.\n    For example:\n\n    - https://github.com/NixOS/nixpkgs/pull/178378\n    - https://github.com/NixOS/nixpkgs/pull/157760\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkamadorueda%2Falejandra","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkamadorueda%2Falejandra","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkamadorueda%2Falejandra/lists"}