feat: add fmt nix package

```shell
$ nix run .#fmt
```

does all the automatic formatting the CI checks for.

Signed-off-by: Harald Hoyer <harald@matterlabs.dev>
This commit is contained in:
Harald Hoyer 2024-03-11 12:34:32 +01:00
parent 5f2fb2c42c
commit ee7c4ee177
Signed by: harald
GPG key ID: F519A1143B3FBE32

28
packages/fmt/default.nix Normal file
View file

@ -0,0 +1,28 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2024 Matter Labs
{ lib
, pkgs
, teepot
, ...
}:
pkgs.writeShellApplication {
name = "fmt-teepot";
runtimeInputs = with pkgs;
[ nixpkgs-fmt coreutils taplo ]
++ teepot.teepot.nativeBuildInputs;
text = ''
# .nix
echo "* Formatting nix files"
nixpkgs-fmt .
# .toml
echo "* Formatting toml files"
taplo fmt
# .rs
echo "* Formatting rust files"
cargo fmt
'';
}