buildbot-nix/nix/treefmt/flake-module.nix
2024-01-01 15:38:28 +00:00

34 lines
822 B
Nix

{ inputs, ... }: {
imports = [
inputs.treefmt-nix.flakeModule
];
perSystem = { pkgs, ... }: {
treefmt = {
projectRootFile = ".git/config";
programs.nixpkgs-fmt.enable = true;
programs.shellcheck.enable = true;
programs.deno.enable = true;
settings.formatter.shellcheck.options = [ "-s" "bash" ];
programs.mypy = {
enable = true;
directories.".".extraPythonPackages = [
pkgs.python3.pkgs.twisted
];
};
settings.formatter.python = {
command = "sh";
options = [
"-eucx"
''
${pkgs.ruff}/bin/ruff --fix "$@"
${pkgs.ruff}/bin/ruff format "$@"
''
"--" # this argument is ignored by bash
];
includes = [ "*.py" ];
};
};
};
}