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

Respect Allman-style indentation #330

@Andy3153

Description

@Andy3153

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions