-
Notifications
You must be signed in to change notification settings - Fork 66
/
treefmt.nix
52 lines (46 loc) · 1.43 KB
/
treefmt.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
{ inputs, ... }:
{
imports = [
inputs.treefmt-nix.flakeModule
];
perSystem =
{ pkgs, ... }:
let
extraPythonFiles = [
"bin/nix-review"
"bin/nixpkgs-review"
];
in
{
treefmt = {
# Used to find the project root
projectRootFile = "flake.lock";
programs.deno.enable =
pkgs.lib.meta.availableOn pkgs.stdenv.hostPlatform pkgs.deno && !pkgs.deno.meta.broken;
programs.ruff.format = true;
programs.ruff.check = true;
programs.actionlint.enable = true;
programs.yamlfmt.enable = true;
programs.shellcheck.enable = pkgs.lib.meta.availableOn pkgs.stdenv.buildPlatform pkgs.shellcheck.compiler;
programs.shfmt.enable = true;
programs.mypy.enable = true;
programs.nixfmt.enable = pkgs.lib.meta.availableOn pkgs.stdenv.buildPlatform pkgs.nixfmt-rfc-style.compiler;
programs.deadnix.enable = true;
settings.formatter.shfmt.includes = [ "*.envrc" ];
settings.formatter.ruff-check.includes = extraPythonFiles;
settings.formatter.ruff-format.includes = extraPythonFiles;
settings.global.excludes = [
"tests/assets/*"
"pyproject.toml"
];
programs.mypy.directories = {
"." = {
directory = ".";
extraPythonPackages = [
pkgs.python3.pkgs.pytest
];
};
};
};
};
}