Skip to content
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

readme: updated formatterPath for nix fmt #421

Merged
merged 1 commit into from
Sep 20, 2024
Merged

readme: updated formatterPath for nix fmt #421

merged 1 commit into from
Sep 20, 2024

Conversation

lriesebos
Copy link
Contributor

@lriesebos lriesebos commented Sep 13, 2024

nix fmt -- - does not seem to work with nixpkgs-fmt. nix fmt -- -- seems to work fine with nixpkgs-fmt and nixfmt-rfc-style.

closes #413

`nix fmt -- -` does not seem to work with `nixpkgs-fmt`. `nix fmt -- --` seems to work fine with `nixpkgs-fmt` and `nixfmt-rfc-style`.

Signed-off-by: Leon Riesebos <[email protected]>
@jnoortheen
Copy link
Collaborator

jnoortheen commented Sep 16, 2024

is there any documentation available for the arguments to nix fmt --?

@eclairevoyant
Copy link

https://nix.dev/manual/nix/2.18/command-ref/new-cli/nix3-fmt is as much as I've seen

@jnoortheen jnoortheen merged commit 29b93ec into nix-community:main Sep 20, 2024
4 checks passed
@jnoortheen
Copy link
Collaborator

Thanks @lriesebos !

@lriesebos
Copy link
Contributor Author

ah sorry for the late response, I was out last week. but I see the change was already merged!

the -- is an "end of command options" command. it is used in case there is ambiguity. for example if you have a file called -v then cat -- -v is needed to signal that -v is not the option but a file. for nix fmt, it seems that the first -- signals that the following arguments are passed to the underlying command used by nix fmt (i.e. your outputs.formatter). the second -- is passed to the formatter and seems to be needed to ensure some formatters go to stdin mode which is used by this plugin to format files. I think that is the gist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Formatting with nix fmt deletes content of file
3 participants