Skip to content

Commit

Permalink
Merge branch 'rsc-enable-nixfmt-hook'
Browse files Browse the repository at this point in the history
Making this change was unexpectedly annoying (yak saving 🙁). All I
wanted to do was add a flake.nix file to another private Git repo.
Before I could add the flake.nix file, I had to open a pull request for
nixfmt [1] so that I could create four different commits in this repo so
that I could make sure that Nix files get styled properly so that I can
START creating the flake.nix file in that other repo. Plus, there will
probably be more problems that I encounter while creating the flake.nix
file, and I’ll end up having to make more changes to this repo.

In other words, this is just the beginning of the yak shaving.

[1]: <NixOS/nixfmt#238>
  • Loading branch information
Jayman2000 committed Aug 23, 2024
2 parents dc56044 + ea6195b commit 2d5b801
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions jasons_pre_commit_hooks/editor_config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -222,3 +222,12 @@ insert_final_newline = true
# [4]: <https://git-scm.com/docs/git-diff#_combined_diff_format>
# 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]: <https://github.com/NixOS/rfcs/blob/62d1245ec1eae275edb996229585637035c02538/rfcs/0166-nix-formatting.md#indentation>
# editorconfig-checker-enable
indent_size = 2
9 changes: 9 additions & 0 deletions jasons_pre_commit_hooks/repo_style_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]: <https://github.com/NixOS/nixfmt/pull/238>
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),
Expand All @@ -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),
)


Expand Down

0 comments on commit 2d5b801

Please sign in to comment.