1{
2 runCommand,
3 markdown-code-runner,
4 nixfmt-rfc-style,
5}:
6
7runCommand "manual_check-nix-code-blocks"
8 {
9 nativeBuildInputs = [
10 markdown-code-runner
11 nixfmt-rfc-style
12 ];
13 }
14 ''
15 set +e
16
17 mdcr --check --config ${./mdcr-config.toml} ${./..}
18
19 if [ $? -ne 0 ]; then
20 cat <<EOF
21 Error: `mdcr` command failed. Please make sure the Nix code snippets in Markdown files are correctly formatted.
22
23 Run this command from the Nixpkgs repository root for automatic formatting:
24
25 mdcr --log debug --config ${toString ./..}/tests/mdcr-config.toml ${toString ./..}
26
27 EOF
28 exit 1
29 fi
30
31 touch "$out"
32 ''