diff --git a/.forgejo/workflows/check.yml b/.forgejo/workflows/check.yml index 09688329..5d03cdc0 100644 --- a/.forgejo/workflows/check.yml +++ b/.forgejo/workflows/check.yml @@ -46,6 +46,10 @@ jobs: authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' useDaemon: false + - name: Check formatting + run: | + nix --accept-flake-config --access-tokens '' develop --command treefmt --fail-on-change + - name: Run flake checks run: | # Prevent cache garbage collection by creating GC roots diff --git a/treefmt.toml b/treefmt.toml new file mode 100644 index 00000000..0186e6a1 --- /dev/null +++ b/treefmt.toml @@ -0,0 +1,24 @@ +[formatter.nix] +command = "nix" +options = ["fmt"] +includes = ["*.nix"] +excludes = [] + +[formatter.prettier] +command = "prettier" +options = ["--write"] +includes = [ + "*.json", + "*.yaml", + "*.md", +] + +[formatter.shell] +command = "shfmt" +options = [ + "-s", + "-w", + "-i", + "2", +] +includes = ["*.sh"]