Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Respect Allman-style indentation #330

Open
Andy3153 opened this issue Jun 14, 2024 · 0 comments
Open

Respect Allman-style indentation #330

Andy3153 opened this issue Jun 14, 2024 · 0 comments
Labels
enhancement New feature or request needs triage

Comments

@Andy3153
Copy link

Is your feature request related to a problem? Please describe.
I'd like to use this to automatically format my NixOS configuration, but I don't like that it breaks Allman-style indentation. I know most people, especially in the Nix space, just put their opening curly bracket on the line that requires it, but this is more readable, to me.

I understand why it happens, it's so that code like this

module1 =
  { module2.enable = true; };

looks good and is indented, but, because nixpkgs-fmt does not look for lone curly brackets on a line, it unintentionally turns code that looks like this

module1 =
{
  module2 =
  {
    enable = true;
  };
};

into this

module1 =
  {
    module2 =
      {
        enable = true;
      };
  };

Describe the solution you'd like
I'd like to have it just let it be if it detects code styled like this.

Describe alternatives you've considered
A workaround would be to at least have the option to tell nixpkgs-fmt to let it be like this (a command line argument, an option in some config file etc.)

Additional context
Funnily enough, what this does right now is enforce GNU-style indentation

@Andy3153 Andy3153 added enhancement New feature or request needs triage labels Jun 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request needs triage
Projects
None yet
Development

No branches or pull requests

1 participant