nix-eval-jobs/dev/treefmt.nix

45 lines
861 B
Nix
Raw Permalink Normal View History

{ pkgs, ... }: {
2023-07-21 01:23:16 +00:00
# Used to find the project root
projectRootFile = "flake.lock";
programs.deno.enable = true;
2023-07-21 01:23:16 +00:00
programs.clang-format.enable = true;
settings.formatter = {
nix = {
command = "sh";
options = [
"-eucx"
''
2023-08-06 16:49:32 +00:00
${pkgs.deadnix}/bin/deadnix --edit "$@"
2023-07-21 01:24:29 +00:00
for i in "$@"; do
2023-08-06 16:49:32 +00:00
${pkgs.statix}/bin/statix fix "$i"
2023-07-21 01:24:29 +00:00
done
2023-08-06 16:49:32 +00:00
${pkgs.nixpkgs-fmt}/bin/nixpkgs-fmt "$@"
2023-07-21 01:23:16 +00:00
''
"--"
];
includes = [ "*.nix" ];
excludes = [ ];
};
clang-format = { };
python = {
command = "sh";
options = [
"-eucx"
''
2023-08-06 16:49:32 +00:00
${pkgs.python3.pkgs.black}/bin/black "$@"
${pkgs.ruff}/bin/ruff --fix "$@"
2023-07-21 01:23:16 +00:00
''
"--" # this argument is ignored by bash
];
includes = [ "*.py" ];
};
};
}