Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions eeps/0027-ekapkgs-formatter
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
EEP: 27
Title: Official Ekapkgs formatter
Author: jonringer
Status: Draft
Type: Standards Track
Topic: Tooling
Created: 2025-05-25
---

# Motivation

Formatters help decrease merge conflicts dramatically by having a unified way
to structure code. A good formatter can also increase readability and maintainability
of code.

# Desired formatter

The desired formatter for me would be alejandra if "inner container space" was
restored. For example, `[]` should be `[ ]` and `{a = "foo";}` should be `{ a = "foo"; }`.

To achieve this goal, I will attempt to add an upstream optional flag `--add-container-space`.
If alejandra feels this is misaligned with the goals of the project, then maintain a
soft fork of alejandra for ekapkgs as `ekapkgs-fmt`.

The sole dependency on rust also makes the packaging of alejandra suitable for
corepkgs.

# Alternatives / prior-art

### `nixfmt-rfc-style`:

Pros:
- Official formatter of NixOS ecosystem
- Lessens "nix for ekapkgs" vs "nix for nixpkgs" divergence
- Actively developed in nixpkgs

Cons:
- "Purity over readibility" mindset
- Creates some very "long" code in certain situations
- Generally with many "container types, e.g. `( )` `[ ]` `{ }`"
- Haskell packaging
- This would likely mean it couldn't be available in corepkgs
- Actively hostile maintainers to RFC175 individuals
- RFC175 people (Ekala founders) are unable to interact with project

### `nixpkg-fmt`:

Pros:
- Fairly close to "best practices" in nixpkgs before nixfmt RFC
- Aligns most with the style most "old nixpkgs" hats are used to

Cons:
- Not actively maintained
- Not predictable formatting
- It's more "convergent", rather than deterministic
- Sometimes requires the tool to be ran many times to converge to final state
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, I've never had to do this.

Also, one "pro" of nixpkgs-fmt is that it doesn't break arguments into multiple lines like alejandra does!

image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

neither have I. But I would also write pretty close to what nixpgks-fmt would output

- Other issues as outlined in nixfmt RFC

# Future work (optional)

Apply formatter to ekapkgs repos