57cf952ea9
* //ops/machines/whitby: Disable grafana, since the grafana module was changed upstream in a way that our configuration no longer works. Since the OpenSSL security update is relatively pressing, adapting the grafana configuration beforehand is not a hard requirement. See https://github.com/NixOS/nixpkgs/pull/191768. * //tools/depotfmt: keep Go at version 1.18 to forgo a reformat of the tree. * //nix/buildGo: keep Go at version 1.18, as 1.19 changed the CLI interface (?) in a way that breaks buildGo. * //3p/overlays/tvl: drop upstreamed tdlib upgrade. * //3p/overlays/tvl: patch buf to work around breakage due to git 2.38.1 TODO items for Go are tracked in b/215. Change-Id: Ie08fef49cf3db12e6b5225a8b992a990ddc5b642 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7141 Tested-by: BuildkiteCI Autosubmit: sterni <sternenseemann@systemli.org> Reviewed-by: grfn <grfn@gws.fyi> Reviewed-by: tazjin <tazjin@tvl.su>
60 lines
1.6 KiB
Nix
60 lines
1.6 KiB
Nix
# Builds treefmt for depot, with a hardcoded configuration that
|
|
# includes the right paths to formatters.
|
|
{ depot, pkgs, ... }:
|
|
|
|
let
|
|
# terraform fmt can't handle multiple paths at once, but treefmt
|
|
# expects this
|
|
terraformat = pkgs.writeShellScript "terraformat" ''
|
|
echo "$@" | xargs -n1 ${pkgs.terraform}/bin/terraform fmt
|
|
'';
|
|
|
|
# TODO: Upgrade to Go 1.19 and reformat tree
|
|
config = pkgs.writeText "depot-treefmt-config" ''
|
|
[formatter.go]
|
|
command = "${pkgs.go_1_18}/bin/gofmt"
|
|
options = [ "-w" ]
|
|
includes = ["*.go"]
|
|
|
|
[formatter.tf]
|
|
command = "${terraformat}"
|
|
includes = [ "*.tf" ]
|
|
|
|
[formatter.nix]
|
|
command = "${pkgs.nixpkgs-fmt}/bin/nixpkgs-fmt"
|
|
includes = [ "*.nix" ]
|
|
excludes = [
|
|
"tvix/eval/src/tests/*",
|
|
]
|
|
|
|
[formatter.rust]
|
|
command = "${pkgs.rustfmt}/bin/rustfmt"
|
|
includes = [ "*.rs" ]
|
|
excludes = [
|
|
"users/tazjin/*",
|
|
]
|
|
'';
|
|
|
|
# helper tool for formatting the depot interactively
|
|
depotfmt = pkgs.writeShellScriptBin "depotfmt" ''
|
|
exec ${pkgs.treefmt}/bin/treefmt ''${@} \
|
|
--config-file ${config} \
|
|
--tree-root $(${pkgs.git}/bin/git rev-parse --show-toplevel)
|
|
'';
|
|
|
|
# wrapper script for running formatting checks in CI
|
|
check = pkgs.writeShellScript "depotfmt-check" ''
|
|
${pkgs.treefmt}/bin/treefmt \
|
|
--clear-cache \
|
|
--fail-on-change \
|
|
--config-file ${config} \
|
|
--tree-root .
|
|
'';
|
|
in
|
|
depotfmt.overrideAttrs (_: {
|
|
passthru.meta.ci.extraSteps.check = {
|
|
label = "depot formatting check";
|
|
command = check;
|
|
alwaysRun = true;
|
|
};
|
|
})
|