diff --git a/flake.nix b/flake.nix index e9e98e3f..2c55c330 100644 --- a/flake.nix +++ b/flake.nix @@ -388,7 +388,7 @@ # No amount of formatters will make this codebase nicer but it sure does # feel like it does. formatter = - forAllSystems (system: nixpkgs.legacyPackages.${system}.nixpkgs-fmt); + forAllSystems (system: nixpkgs.legacyPackages.${system}.treefmt); # nixops-lite... in here!?! We got it all, son! # diff --git a/shell.nix b/shell.nix index 0bad9242..b778975b 100644 --- a/shell.nix +++ b/shell.nix @@ -8,10 +8,16 @@ pkgs.mkShell { jq nixpkgs-fmt sops + treefmt # Language servers for various parts of the config that uses a language. sumneko-lua-language-server pyright rnix-lsp + + # Formatters... + stylua # ...for Lua. + black # ...for Python. + nixpkgs-fmt # ...for Nix. ]; } diff --git a/treefmt.toml b/treefmt.toml new file mode 100644 index 00000000..d5a55b72 --- /dev/null +++ b/treefmt.toml @@ -0,0 +1,11 @@ +[formatter.lua] +command = "stylua" +includes = [ "*.lua" ] + +[formatter.nix] +command = "nixpkgs-fmt" +includes = [ "*.nix" ] + +[formatter.python] +command = "black" +includes = [ "*.py" ]