blob: 4d22883ee71b667a313b553e79b0305c2919c94e (
plain)
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
|
#──────────────────────────────────────────────────────────────────────────────┐
# SPDX-FileCopyrightText: 2025 toastal <https://toast.al/contact/> │
# SPDX-License-Identifier: LGPL-2.1-or-later │
#──────────────────────────────────────────────────────────────────────────────┘
{
lib,
runDashCommand,
parallel,
nixfmt,
keepLogOrder ? true,
}:
runDashCommand
{
name = "check-nixfmt";
runtimeInputs = [
parallel
nixfmt
];
env.src =
let
fs = lib.fileset;
in
fs.toSource {
root = ../..;
fileset =
fs.intersection (fs.fileFilter (file: file.hasExt "nix") ../..)
(fs.difference (fs.fromSource (lib.cleanSource ../..)) ../tamal);
};
}
/* sh */ ''
if [ -z "$src" ]; then
echo "Missing \$src" >&2
exit 1
fi
find "$src" -type f \
| parallel --will-cite \
${lib.optionalString keepLogOrder "--keep-order"} \
--jobs "''${NIX_BUILD_CORES:-1}" \
nixfmt --check {} \
| tee "$out"
''
|