-
-
Notifications
You must be signed in to change notification settings - Fork 43
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
nix fmt
support
#70
Comments
After some digging, I found that you setting formatting command to
I'm afraid not. My suggestion is to set fixed and responsive formatter for |
maybe nil can evaluate |
|
XRef: NixOS/nix#8063 |
["nix", "fmt", "--", "-"] also works :3 |
|
My trick for speeding up devShells.${system}.default = pkgs.mkShell {
shellHook = ''
alias flake-fmt=${self.formatter.${system}.meta.mainProgram}
'';
}; this avoids the need to evaluate the flake on each execution of the formatter and now I can set up Unfortunately, it doesn’t work quite as smoothly with direnv/ |
I’ve modified this a bit. My infra is a bit more involved, but it boils down to devShells.${system}.default = pkgs.mkShell {
shellHook = ''
export PROJECT_FORMATTER=${lib.getExe self.formatter.${system}}
'';
}; and then I have a script on the PATH that does roughly "$PROJECT_FORMATTER" "$@" And this now has no issues with using Direnv. |
Hi there,
I'm using
vscode-nix-ide
which breaks if you asknil
to format withnix fmt
. Instead of formatting the file, it clears it instead. This seems to be caused bynix fmt
not accepting input fromstdin
.On a side note, it would be cool if
nil
could useself.formatter."${system}"
by default.VSCode configuration
App versions
The text was updated successfully, but these errors were encountered: