diff --git a/nix/general/formatting.nix b/nix/general/formatting.nix index 40c16b7..745628f 100644 --- a/nix/general/formatting.nix +++ b/nix/general/formatting.nix @@ -13,6 +13,15 @@ excludes = config.filegen.generatedFiles; }; + + # We include shfmt in general, because all projects probably use shell scripts + programs.shfmt = { + enable = true; + # Setting the indent_size to 0 uses tabs for indentation + indent_size = 0; + }; + settings.formatter.shfmt.command = "shfmt"; + }; filegen.settings.files = [ diff --git a/treefmt.toml b/treefmt.toml index b06e925..1ecd6cc 100644 --- a/treefmt.toml +++ b/treefmt.toml @@ -29,3 +29,9 @@ command = "rustfmt" excludes = [] includes = ["*.rs"] options = ["--config", "skip_children=true", "--edition", "2024"] + +[formatter.shfmt] +command = "shfmt" +excludes = [] +includes = ["*.sh", "*.bash", "*.envrc", "*.envrc.*"] +options = ["-w", "-i", "0", "-s"]