1{
 2  pkgs,
 3  excludes ? [ ],
 4  ...
 5}:
 6{
 7  projectRootFile = "flake.nix";
 8
 9  programs = {
10    gofmt = {
11      enable = true;
12    };
13
14    mdformat = {
15      enable = true;
16
17      package = pkgs.mdformat.withPlugins (
18        p: with p; [
19          # add support for github flavored markdown
20          mdformat-gfm
21          mdformat-gfm-alerts
22
23          # add support for markdown tables
24          mdformat-tables
25
26          # add the following comment before running `nix fmt` to generate a
27          # table of contents in markdown files:
28          #     <!-- mdformat-toc start -->
29          mdformat-toc
30        ]
31      );
32
33      settings = {
34        end-of-line = "lf";
35        number = true;
36        wrap = 80;
37      };
38    };
39
40    nixfmt = {
41      enable = true;
42      strict = true;
43    };
44
45    # this is disabled due to `//webui` not yet being integrated with the flake.
46    # the entire package directory is ignored below in
47    # `settings.global.excludes`.
48    prettier = {
49      enable = false;
50
51      settings = {
52        singleQuote = true;
53        trailingComma = "es5";
54      };
55    };
56
57    shfmt = {
58      enable = true;
59    };
60
61    yamlfmt = {
62      enable = true;
63
64      settings.formatter = {
65        eof_newline = true;
66        include_document_start = true;
67        retain_line_breaks_single = true;
68        trim_trailing_whitespace = true;
69      };
70    };
71  };
72
73  settings.global.excludes =
74    pkgs.lib.lists.unique [
75      "*.graphql"
76      "*.png"
77      "*.svg"
78      "*.txt"
79      "doc/man/*.1" # generated via //doc:generate.go
80      "doc/md/*" # generated via //doc:generate.go
81      "misc/completion/*/*"
82      "webui/*" # not currently supported, //webui is not yet flakeified
83      "Makefile"
84    ]
85    ++ excludes;
86}