whatisgithub

What is pedantix?

swarsel/pedantix — explained in plain English

Analysis updated 2026-05-18

52RustAudience · developerComplexity · 2/5Setup · easy

In one sentence

A formatter for the Nix language that fixes ordering of function arguments and attributes, working alongside your existing Nix formatter.

Mindmap

A visual breakdown will appear here once this repo is fully enriched.

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Automatically order function arguments consistently across a NixOS configuration.

USE CASE 2

Reorder attributes while keeping their comments attached to the right line.

USE CASE 3

Preview how a Nix file would be reformatted without modifying it, using the run command.

USE CASE 4

Turn on optional features like ordering let bindings or merging repeated keys for stricter formatting.

What is it built with?

RustNix

How does it compare?

swarsel/pedantixavelino/mcpmitsuhiko/insta-cmd
Stars525252
LanguageRustRustRust
Last pushed2026-06-14
MaintenanceMaintained
Setup difficultyeasyeasyeasy
Complexity2/53/52/5
Audiencedeveloperops devopsdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min

Runs directly via `nix run github:Swarsel/pedantix` with no separate install step.

So what is it?

pedantix is a formatter for the Nix configuration language, focused specifically on cleaning up ordering issues that regular Nix formatters do not touch. The author built it after being frustrated with inconsistently ordering module arguments across a NixOS configuration, where some functions listed lib, config, pkgs in one order and others listed them differently, and after growing tired of a similar warning from another tool called statix about repeated keys. Rather than replacing your existing formatter, pedantix is designed to work alongside whichever one you already use, and it has been tested with nixfmt, alejandra, and nixpkgs-fmt. It focuses only on reordering things: function arguments and attribute ordering, since the author reasons that custom ordering of attributes rarely matters in the Nix language except in specific cases like let bindings. By default, pedantix turns on two behaviors: ordering function arguments consistently, and ordering attributes while keeping any comment blocks correctly attached to the line they were commenting on. A number of additional behaviors exist but are turned off by default, including ordering of inherits, ordering of let bindings, ordering of lists, merging repeated keys, flattening single entry attribute sets, enforcing blank lines between attribute sets, and custom ordering overrides for specific attribute paths. The README notes that merging repeated keys does not fix a file that fails to evaluate, it only tidies duplicate entries. You can try it without installing anything or modifying your files by running it directly with Nix's run command, piping a Nix file into it to preview how it would be reformatted. Full documentation, including details on customizing which features are enabled, is hosted on a separate documentation site linked from the README.

Copy-paste prompts

Prompt 1
I want to preview how pedantix would reformat my Nix file without changing it, what command do I run?
Prompt 2
Explain the difference between pedantix's default features and its optional off-by-default features like ordering let bindings.
Prompt 3
I already use nixfmt for my NixOS config, how does pedantix work alongside it instead of replacing it?
Prompt 4
What does pedantix's repeated-keys merging feature actually do, and what does the README say it does not fix?

Frequently asked questions

What is pedantix?

A formatter for the Nix language that fixes ordering of function arguments and attributes, working alongside your existing Nix formatter.

What language is pedantix written in?

Mainly Rust. The stack also includes Rust, Nix.

How hard is pedantix to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is pedantix for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.