treefmt: add ruff + black

This commit is contained in:
Jörg Thalheim 2023-07-21 11:21:09 +02:00
parent e4fbb08f91
commit 88295ce77d

View File

@ -1,4 +1,4 @@
{ self
{ lib
, inputs
, ...
}: {
@ -11,5 +11,17 @@
treefmt.flakeFormatter = true;
treefmt.programs.nixpkgs-fmt.enable = true;
treefmt.programs.shellcheck.enable = true;
treefmt.settings.formatter.python = {
command = "sh";
options = [
"-eucx"
''
${lib.getExe pkgs.ruff} --fix "$@"
${lib.getExe pkgs.black} "$@"
''
"--" # this argument is ignored by bash
];
includes = [ "*.py" ];
};
};
}