chore(flake): format through nixfmt-tree instead of nixfmt - #98
Merged
Conversation
nixfmt 1.4.0 deprecates bare invocation and passing a directory, so both `nix fmt` and `nix fmt .` now warn or fail. The replacement nixfmt points at is a treefmt wrapper, which nixpkgs ships as nixfmt-tree. nixfmt is still the formatter underneath, so nothing gets reformatted.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
formatterispkgs.nixfmt-treeinstead ofpkgs.nixfmt, sonix fmttakes no argument.Why
nixfmt 1.4.0 deprecates both forms this flake's formatter was actually invoked with. Bare
nix fmtpasses no path, so nixfmt reads stdin and now printsBare invocation of nixfmt is deprecated. Use 'nixfmt -' for anonymous stdin.before failing on the empty input.nix fmt .printsPassing directories or non-Nix files (such as ".") is deprecated and will be unsupported soon, and points atpkgs.nixfmt-treeor treefmt-nix.The recent
nixpkgsbump is what moved this flake onto nixfmt 1.4.0, so the deprecation is live here now rather than hypothetical. Pinning nixfmt back would be the wrong direction: the replacement nixfmt names is a treefmt wrapper, andnixfmt-treeis exactly that, packaged in nixpkgs (2.5.0 at the pinned rev).Behaviour
nix fmtnow needs no argument and walks the tree, respecting.gitignore:0 changedis the part worth noting: nixfmt is still the formatter underneath, so nothing gets reformatted by this switch.nixfmt-treeis configured for Nix only, so no other file type is newly in scope.Scope
CI is untouched, because no workflow invokes
nix fmt. The pre-commitnixfmthook is also unaffected, since git-hooks.nix invokes it per file with an explicit path, which is not one of the deprecated forms.Verification
nix fmtexits 0 with the output above, and every.nixfile is byte-identical afterwards. The only diff in this branch is the one line changed.nix flake check --no-build: rc=0,all checks passed!, evaluating the formatter tonixfmt-tree-2.5.0.drv.