2023-05-20 16:51:56 +03:00
|
|
|
{ lib, inputs, ... }: {
|
2023-05-20 10:11:53 +03:00
|
|
|
imports = [
|
|
|
|
inputs.treefmt-nix.flakeModule
|
|
|
|
];
|
|
|
|
|
|
|
|
perSystem = { pkgs, ... }: {
|
|
|
|
treefmt = {
|
|
|
|
# Used to find the project root
|
|
|
|
projectRootFile = "flake.lock";
|
|
|
|
|
|
|
|
programs.prettier.enable = true;
|
2023-08-12 11:12:54 +03:00
|
|
|
programs.mypy.enable = true;
|
2023-05-20 10:11:53 +03:00
|
|
|
|
|
|
|
settings.formatter = {
|
|
|
|
nix = {
|
|
|
|
command = "sh";
|
|
|
|
options = [
|
|
|
|
"-eucx"
|
|
|
|
''
|
|
|
|
# First deadnix
|
2023-05-20 16:51:56 +03:00
|
|
|
${lib.getExe pkgs.deadnix} --edit "$@"
|
2023-05-20 10:11:53 +03:00
|
|
|
# Then nixpkgs-fmt
|
2023-05-20 16:51:56 +03:00
|
|
|
${lib.getExe pkgs.nixpkgs-fmt} "$@"
|
2023-05-20 10:11:53 +03:00
|
|
|
''
|
|
|
|
"--"
|
|
|
|
];
|
|
|
|
includes = [ "*.nix" ];
|
|
|
|
excludes = [ "nix/sources.nix" ];
|
|
|
|
};
|
|
|
|
|
|
|
|
python = {
|
|
|
|
command = "sh";
|
|
|
|
options = [
|
|
|
|
"-eucx"
|
|
|
|
''
|
2023-05-20 16:51:56 +03:00
|
|
|
${lib.getExe pkgs.ruff} --fix "$@"
|
2023-11-02 12:21:07 +03:00
|
|
|
${lib.getExe pkgs.ruff} format "$@"
|
2023-05-20 10:11:53 +03:00
|
|
|
''
|
|
|
|
"--" # this argument is ignored by bash
|
|
|
|
];
|
|
|
|
includes = [ "*.py" ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|