diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9ad06e4..75856e2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,7 +10,7 @@ repos: - id: reuse - repo: https://gitlab.com/vojko.pribudic.foss/pre-commit-update - rev: v0.3.3post1 + rev: v0.4.0post1 hooks: - id: pre-commit-update @@ -75,7 +75,7 @@ repos: exclude: *default_excludes - repo: https://github.com/Jayman2000/jasons-pre-commit-hooks - rev: v0.1.0 + rev: v0.2.0 hooks: - id: detect-bad-unicode @@ -145,7 +145,7 @@ repos: - --strict - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.5.7 + rev: v0.6.2 hooks: - id: ruff diff --git a/jasons_pre_commit_hooks/editor_config.ini b/jasons_pre_commit_hooks/editor_config.ini index 9c65baa..6b85e9a 100644 --- a/jasons_pre_commit_hooks/editor_config.ini +++ b/jasons_pre_commit_hooks/editor_config.ini @@ -222,3 +222,12 @@ insert_final_newline = true # [4]: # editorconfig-checker-enable max_line_length = 72 + +[**.nix] +# I’m only using 2 for Nix files because the Nix ecosystem project +# itself uses 2 spaces for indentation [1]. +# +# editorconfig-checker-disable +# [1]: +# editorconfig-checker-enable +indent_size = 2 diff --git a/jasons_pre_commit_hooks/repo_style_checker.py b/jasons_pre_commit_hooks/repo_style_checker.py index 2f743df..98ecf2b 100644 --- a/jasons_pre_commit_hooks/repo_style_checker.py +++ b/jasons_pre_commit_hooks/repo_style_checker.py @@ -197,6 +197,14 @@ class PreCommitRepoInfo(NamedTuple): url='https://github.com/Jayman2000/jasons-pre-commit-hooks', hook_ids=('unreleased-commit-checker',) ) +PCR_NIXFMT: Final = PreCommitRepoInfo( + # Normally, I would use the upstream repo’s URL, but I can’t because + # this pull request [1] hasn’t been merged yet. + # + # [1]: + url='https://github.com/Jayman2000/nixfmt-pr', + hook_ids=('nixfmt',) +) PRE_COMMIT_REPOS_BY_PATH: Final = ( (('**',), PCR_REUSE), (('.pre-commit-hooks.yaml',), PCR_PRE_COMMIT_UPDATE), @@ -214,6 +222,7 @@ class PreCommitRepoInfo(NamedTuple): (PYTHON_GLOBS, PCR_RUFF), (('.pre-commit-hooks.yaml',), PCR_PRE_COMMIT_ITSELF), (('VERSIONING.md',), PCR_UNRELEASED_COMMIT_CHECKER), + (('**.nix',), PCR_NIXFMT), )