Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(nix): Remove treefmt #393

Merged
merged 1 commit into from
Nov 19, 2024
Merged

chore(nix): Remove treefmt #393

merged 1 commit into from
Nov 19, 2024

Conversation

srid
Copy link
Member

@srid srid commented Nov 19, 2024

We already use pre-commit and that supports nixpkgs-fmt.

cf. srid/haskell-template#144

Also, this PR updates git-hooks.nix while making a non-flake thereby reducing the number of lock file (dev/flake.lock) entries.

We already use pre-commit and that supports nixpkgs-fmt.
@srid srid merged commit e491696 into main Nov 19, 2024
2 checks passed
@srid srid deleted the drop-treefmt branch November 19, 2024 14:45
@shivaraj-bh
Copy link
Member

shivaraj-bh commented Nov 20, 2024

The stdout when there is something to be formatted:

services-flake on  main [$!] via ❄️  impure (nix-shell-env) took 6s
❯ just fmt
pre-commit run -a
nixpkgs-fmt..............................................................Failed
- hook id: nixpkgs-fmt
- files were modified by this hook

flake.nix
1 / 8 have been reformatted
0 / 8 have been reformatted
0 / 8 have been reformatted
0 / 8 have been reformatted
0 / 8 have been reformatted
0 / 8 have been reformatted
0 / 8 have been reformatted
0 / 3 have been reformatted

error: Recipe `fmt` failed on line 29 with exit code 1

The error at the end is a bit misleading because it makes one think that formatting didn’t run successfully.

@srid
Copy link
Member Author

srid commented Nov 20, 2024

I should have thought more on this.

pre-commit does not have a notion of "run all hooks unconditionally". Let's just get rid of the fmt target entirely, and briefly document pre-commit in the README like haskell-template now does:

srid/haskell-template@b224c24

Besides, fmt naming is now inaccurate anyway - since you can do more than formatting (e.g.: run hlint).

srid added a commit that referenced this pull request Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants