{ pkgs, ... }: let config = pkgs.writeText "depot-treefmt-config" '' [formatter.go] command = "${pkgs.go}/bin/gofmt" includes = ["*.go"] [formatter.nix] command = "${pkgs.nixpkgs-fmt}/bin/nixpkgs-fmt" options = [ "--check"] includes = [ "*.nix" ] ''; in rec { mkFmtScript = src: let script = pkgs.writeScript "format" '' set -euo pipefail ROOT=$(${pkgs.git}/bin/git rev-parse --show-toplevel) ${pkgs.treefmt}/bin/treefmt --clear-cache --fail-on-change --config-file ${config} --tree-root $ROOT ''; in { type = "app"; program = "${script}"; }; }