Skip to content

The option to use nix fmt (or a wrapper like Mic92/flake-fmt) instead for formatting instead of the configured package #1671

Open

Description

@ItsLiyua

I have verified that this feature request has not been made before

  • I have checked the issues tab, and did not find a similar feature request. I understand that my issue will be closed if it is a duplicate.

Feature Type

Other

Feature description

I'd like to be able to use the formatter provided by a project flake instead of the formatter I configured in nvf if it's available. My nvf configuration is set to format-on-save so the formatter is run quite regularly and I'd like it to use the actual formatter I want to use immediately instead of the "fallback" I configured in the nvf config for the case that there is no project provided formatter output.

Alternatives

Currently I manually run nix fmt manually every once in a while. I also configured some of the formatters in nvf directly but those might not comply with the project provided formatter settings (when using treefmt for example)

Additional Context

Thanks for building nvf! It's a really useful tool to me.

Activity

  1. snoweuph commented on Jun 26, 2026

    @snoweuph
    Collaborator

    Do you mean run a different bin, so like:
    running the gofmt in PATH instead of from a specific nix store?

    in that case, you can just override the cmd to use the path instead for your formatters.

  2. added
    TBD
    on Jun 26, 2026
  3. ItsLiyua commented on Jun 27, 2026

    @ItsLiyua
    Author

    My idea was to have formatOnSave try to identify a flake.nix in the file and check whether it has a formatter configured for the architecture we're on. If yes, use that formatter when the keybind is used or formatOnSave is triggered. If not then just fall back to the configured formatter by conform.nvim

  4. snoweuph commented on Jun 27, 2026

    @snoweuph
    Collaborator

    I dont think this is in the scope of generaly nvf.

    You could write a conform formatter like that, and enable it via project level .nvimrc.

    heck the formatter itself could also live in nvf. But I don't think it should be a default but an optional one. also making it to intrusive into the maintenance of other modules, would be bad as well.

    Also nothing garantues that nix fmt is actually a compatible format for conform, as it can just be artbitrary scripts, of which you wouldnt get the logs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    TBD

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions