From ee7c4ee17790712db5f741ce16b39b8978bb52ff Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Mon, 11 Mar 2024 12:34:32 +0100 Subject: [PATCH] feat: add `fmt` nix package ```shell $ nix run .#fmt ``` does all the automatic formatting the CI checks for. Signed-off-by: Harald Hoyer --- packages/fmt/default.nix | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 packages/fmt/default.nix diff --git a/packages/fmt/default.nix b/packages/fmt/default.nix new file mode 100644 index 0000000..8c05df1 --- /dev/null +++ b/packages/fmt/default.nix @@ -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 + ''; +}