config: add treefmt as formatter tool

This commit is contained in:
Gabriel Arazas 2022-11-19 11:00:53 +08:00
parent 025e506499
commit 5ea8fcb0cf
3 changed files with 18 additions and 1 deletions

View File

@ -388,7 +388,7 @@
# No amount of formatters will make this codebase nicer but it sure does # No amount of formatters will make this codebase nicer but it sure does
# feel like it does. # feel like it does.
formatter = formatter =
forAllSystems (system: nixpkgs.legacyPackages.${system}.nixpkgs-fmt); forAllSystems (system: nixpkgs.legacyPackages.${system}.treefmt);
# nixops-lite... in here!?! We got it all, son! # nixops-lite... in here!?! We got it all, son!
# #

View File

@ -8,10 +8,16 @@ pkgs.mkShell {
jq jq
nixpkgs-fmt nixpkgs-fmt
sops sops
treefmt
# Language servers for various parts of the config that uses a language. # Language servers for various parts of the config that uses a language.
sumneko-lua-language-server sumneko-lua-language-server
pyright pyright
rnix-lsp rnix-lsp
# Formatters...
stylua # ...for Lua.
black # ...for Python.
nixpkgs-fmt # ...for Nix.
]; ];
} }

11
treefmt.toml Normal file
View File

@ -0,0 +1,11 @@
[formatter.lua]
command = "stylua"
includes = [ "*.lua" ]
[formatter.nix]
command = "nixpkgs-fmt"
includes = [ "*.nix" ]
[formatter.python]
command = "black"
includes = [ "*.py" ]