-
Notifications
You must be signed in to change notification settings - Fork 2
[0027] Formatter for Ekapkgs #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jonringer
wants to merge
5
commits into
ekala-project:master
Choose a base branch
from
jonringer:ekapkgs-formatter
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
8dcb4d0
init: ekapkgs-formatter
jonringer 24aefa7
Update eeps/0001-ekapkgs-formatter
jonringer db99921
Bump EEP version
jonringer e79eb8f
Update eeps/0027-ekapkgs-formatter
jonringer 0fd7b91
Update eeps/0027-ekapkgs-formatter
jonringer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| - Other issues as outlined in nixfmt RFC | ||
|
|
||
| # Future work (optional) | ||
|
|
||
| Apply formatter to ekapkgs repos | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
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