fix(nix): check the macOS formatting with rustfmt over the macOS files

The kfm fmt check ran stable `cargo fmt -p ...` on the stubbed workspace
source and failed twice: rustfmt follows the `mod windows;` of the shared
entry files (komorebi-bar, komorebi-client; their windows modules are not in
the macOS source), and the stable rustfmt ignores the nightly options of
this tree's rustfmt.toml. The check is now a runCommand: the nightly rustfmt
(already in the flake for treefmt) with --edition 2024 (the edition of the
macOS manifests; cargo fmt uses it too) and komorebi-for-mac/rustfmt.toml,
over komorebi-for-mac/**/*.rs, komorebic/src/macos, komorebi-bar/src/macos and
komorebi-client/src/macos.rs. The entry files of the shared crates are not
checked; their macos modules are. The macOS code is not clean under it: the
next revision formats it.

Verified: the command reproduced locally with the nightly rustfmt (11 files
differ). The nix attribute is evaluated in the final eval table. Not built.
This commit is contained in:
LGUG2Z committed 2026-11-05 15:03:26 -08:00
1 parent e7cb3be598
commit 081e373782
1 file changed
+18 -1
+18 -1
View File
@@ -256,7 +256,24 @@
checks = {
komorebi-workspace-clippy = build.craneLib.cargoClippy build.individualCrateArgs;
komorebi-workspace-fmt = build.craneLib.cargoFmt (build.workspaceArgs // { inherit (build) src; cargoExtraArgs = build.packages; });
# rustfmt over the macOS files only, with the nightly rustfmt this tree's rustfmt.toml
# needs and the 2024 edition of the manifests. `cargo fmt` would follow the `mod windows;`
# of the shared entry files (komorebi-bar, komorebi-client), which the macOS source does
# not have. The entry files of the shared crates are not checked; their macos modules are.
komorebi-workspace-fmt =
pkgs.runCommand "komorebi-workspace-fmt"
{
nativeBuildInputs = [ nightlyRustfmt ];
src = build.real;
}
''
cd $src
files=$( { find komorebi-for-mac -name '*.rs'; \
find komorebic/src/macos komorebi-bar/src/macos -name '*.rs'; \
echo komorebi-client/src/macos.rs; } )
rustfmt --edition 2024 --config-path komorebi-for-mac/rustfmt.toml --check $files
touch $out
'';
komorebi-workspace-toml-fmt = build.craneLib.taploFmt (
build.workspaceArgs