1{
2 gitMinimal,
3 pre-commit,
4 runCommand,
5 testers,
6}:
7{
8 check-meta-hooks =
9 runCommand "check-meta-hooks"
10 {
11 nativeBuildInputs = [
12 gitMinimal
13 pre-commit
14 ];
15 }
16 ''
17 cd "$(mktemp --directory)"
18 export HOME="$PWD"
19 cat << 'EOF' > .pre-commit-config.yaml
20 repos:
21 - repo: local
22 hooks:
23 - id: echo
24 name: echo
25 entry: echo
26 files: \.yaml$
27 language: system
28 - repo: meta
29 hooks:
30 - id: check-hooks-apply
31 - id: check-useless-excludes
32 - id: identity
33 EOF
34 git config --global user.email "you@example.com"
35 git config --global user.name "Your Name"
36 git init --initial-branch=main
37 git add .
38 pre-commit run --all-files
39 touch $out
40 '';
41
42 version = testers.testVersion {
43 package = pre-commit;
44 };
45}