blob: 1768b6505b9874d84dab0f8be36800948bf910dc (
plain) (
blame)
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
# Back - An extremely simple git bug visualization system. Inspired by TVL's
# panettone.
#
# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
# SPDX-License-Identifier: AGPL-3.0-or-later
#
# This file is part of Back.
#
# You should have received a copy of the License along with this program.
# If not, see <https://www.gnu.org/licenses/agpl.txt>.
{
treefmt-nix,
pkgs,
}:
treefmt-nix.lib.evalModule pkgs (
{pkgs, ...}: {
# Used to find the project root
projectRootFile = "flake.nix";
programs = {
alejandra.enable = true;
rustfmt = {
enable = true;
edition = "2024";
};
clang-format.enable = true;
mdformat.enable = true;
shfmt = {
enable = true;
indent_size = 4;
};
shellcheck.enable = true;
prettier = {
enable = true;
settings = {
arrowParens = "always";
bracketSameLine = false;
bracketSpacing = true;
editorconfig = true;
embeddedLanguageFormatting = "auto";
endOfLine = "lf";
# experimentalTernaries = false;
htmlWhitespaceSensitivity = "css";
insertPragma = false;
jsxSingleQuote = true;
printWidth = 80;
proseWrap = "always";
quoteProps = "consistent";
requirePragma = false;
semi = true;
singleAttributePerLine = true;
singleQuote = false;
trailingComma = "all";
useTabs = false;
vueIndentScriptAndStyle = false;
tabWidth = 2;
};
};
stylua.enable = true;
ruff = {
enable = true;
format = true;
};
taplo.enable = true;
};
settings = {
global.excludes = [
"CHANGELOG.md"
"NEWS.md"
];
formatter = {
clang-format = {
options = ["--style" "GNU"];
};
rustfmt = let
config = builtins.fromTOML (builtins.readFile ./rustfmt_config.toml);
toValue = value:
if builtins.isString value
then value
else if builtins.isInt value
then builtins.toString value
else if builtins.isBool value
then
if value
then "true"
else "false"
else builtins.throw "Unknown value: ${value}";
options = pkgs.lib.mapAttrsToList (name: value: "--config=${name}=${toValue value}") config;
in {
inherit options;
excludes = ["vendored/*"];
};
shfmt = {
includes = ["*.bash"];
};
};
};
}
)
|