diff --git a/flake.nix b/flake.nix index d124aa37..34e4b7ed 100644 --- a/flake.nix +++ b/flake.nix @@ -94,9 +94,20 @@ devShells = forAllSystems (system: { default = nixpkgsFor.${system}.mkShell { buildInputs = with nixpkgsFor.${system}; [ + deadnix nixfmt-rfc-style + nodePackages.prettier ruby ruby.devdoc + rufo + shellcheck + shfmt + taplo + (pkgs.writeShellScriptBin "statix-fix" '' + for file in "''$@"; do + ${lib.getExe statix} fix "$file" + done + '') (python3.withPackages (pyPkgs: [ pyPkgs.python-lsp-server pyPkgs.black diff --git a/treefmt.toml b/treefmt.toml index db6f8a1b..62ff599a 100644 --- a/treefmt.toml +++ b/treefmt.toml @@ -2,6 +2,15 @@ command = "nixfmt" includes = ["*.nix"] +[formatter.deadnix] +command = "deadnix" +options = ["--edit"] +includes = ["*.nix"] + +[formatter.statix] +command = "statix-fix" +includes = ["*.nix"] + [formatter.black] command = "black" includes = ["*.py", "*.pyi"] @@ -9,3 +18,45 @@ includes = ["*.py", "*.pyi"] [formatter.isort] command = "isort" includes = ["*.py", "*.pyi"] + +[formatter.taplo] +command = "taplo" +options = ["format"] +includes = ["*.toml"] + +[formatter.shellcheck] +command = "shellcheck" +includes = ["*.sh", "*.bash", "*.envrc", "*.envrc.*"] +priority = 0 + +[formatter.shfmt] +command = "shfmt" +options = [ + "--write", + "--simplify", + "--indent=2", + "--binary-next-line", + "--case-indent", + "--space-redirects", + "--apply-ignore", +] +includes = ["*.sh", "*.bash", "*.envrc", "*.envrc.*"] +priority = 1 + +[formatter.rufo] +command = "rufo" +options = ["--simple-exit"] +includes = [ + "*.rb", + "*.arb", + "*.rbx", + "*.rbw", + "*.gemfile", + "*.gemspec", + "*.ruby", +] + +[formatter.prettier] +command = "prettier" +options = ["--write"] +includes = ["*.css", "*.json", "*.md", "*.yml"]