doc: update references to nixfmt-rfc-style to treefmt

This completes https://github.com/NixOS/nixpkgs/issues/425583.

Rather than putting `nixfmt` everywhere, I opted to teach people to use
`treefmt` instead. This is more correct, as we have formatting rules for
non-nix files, and also may invoke `nixfmt` with non-default options.
This commit is contained in:
Jeremy Fleischman
2026-02-03 11:58:06 -08:00
parent 58b187378d
commit 2b115ef0cc
5 changed files with 9 additions and 7 deletions
+1 -1
View File
@@ -2136,7 +2136,7 @@ The following rules are desired to be respected:
* `pythonImportsCheck` is set. This is still a good smoke test even if `pytestCheckHook` is set.
* `meta.platforms` takes the default value in many cases.
It does not need to be set explicitly unless the package requires a specific platform.
* The file is formatted with `nixfmt-rfc-style`.
* The file is formatted correctly (e.g., `nix-shell --run treefmt`).
* Commit names of Python libraries must reflect that they are Python
libraries (e.g. `python3Packages.numpy: 1.11 -> 1.12` rather than `numpy: 1.11 -> 1.12`).
See also [`pkgs/README.md`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md#commit-conventions).
@@ -7,7 +7,7 @@
* When adding a new extension, place its definition in a `default.nix` file in a directory with the extension's ID (e.g. `publisher.extension-name/default.nix`) and refer to it in `./default.nix`, e.g. `publisher.extension-name = callPackage ./publisher.extension-name { };`.
* Currently `nixfmt-rfc-style` formatter is being used to format the VSCode extensions.
* Use `nix-shell --run treefmt` to format the VSCode extensions.
* Respect `alphabetical order` whenever adding extensions. If out of order, please kindly open a PR re-establishing the order.
+1 -1
View File
@@ -95,7 +95,7 @@ treefmtWithConfig.overrideAttrs {
You can achieve similar results by manually configuring `treefmt`:
```nix
pkgs.treefmt.withConfig {
runtimeInputs = [ pkgs.nixfmt-rfc-style ];
runtimeInputs = [ pkgs.nixfmt ];
settings = {
# Log level for files treefmt won't format
@@ -49,7 +49,7 @@
(truename "imported.nix")))
(defun run-nix-formatter ()
(uiop:run-program '("nixfmt" "imported.nix")))
(uiop:run-program '("treefmt" "imported.nix")))
(defun main ()
(format t "~%")
+5 -3
View File
@@ -1,10 +1,12 @@
let
pkgs = import ../../../. { };
inherit (pkgs) mkShellNoCC sbcl nixfmt-rfc-style;
# Use CI-pinned (Hydra-cached) packages and formatter,
# rather than the local nixpkgs checkout.
inherit (import ../../../ci { }) pkgs fmt;
inherit (pkgs) mkShellNoCC sbcl;
in
mkShellNoCC {
packages = [
nixfmt-rfc-style
fmt.pkg
(sbcl.withPackages (
ps:
builtins.attrValues {