mirror of
https://github.com/nix-community/nix-direnv.git
synced 2024-10-26 19:50:14 +03:00
4d326252ae
simplifies treefmt.nix and adds `direnvrc` to treefmt includes for shellcheck
46 lines
1015 B
Nix
46 lines
1015 B
Nix
{ lib, inputs, ... }: {
|
|
imports = [
|
|
inputs.treefmt-nix.flakeModule
|
|
];
|
|
|
|
perSystem = { pkgs, ... }: {
|
|
treefmt = {
|
|
# Used to find the project root
|
|
projectRootFile = "flake.lock";
|
|
|
|
programs = {
|
|
deadnix.enable = true;
|
|
deno.enable = true;
|
|
mypy.enable = true;
|
|
nixpkgs-fmt.enable = true;
|
|
shellcheck.enable = true;
|
|
shfmt.enable = true;
|
|
statix.enable = true;
|
|
};
|
|
|
|
settings.formatter =
|
|
let
|
|
sh-includes = [ "*.sh" "direnvrc" ];
|
|
in
|
|
{
|
|
python = {
|
|
command = "sh";
|
|
options = [
|
|
"-eucx"
|
|
''
|
|
${lib.getExe pkgs.ruff} --fix "$@"
|
|
${lib.getExe pkgs.ruff} format "$@"
|
|
''
|
|
"--" # this argument is ignored by bash
|
|
];
|
|
includes = [ "*.py" ];
|
|
};
|
|
|
|
shellcheck.includes = sh-includes;
|
|
|
|
shfmt.includes = sh-includes;
|
|
};
|
|
};
|
|
};
|
|
}
|