Recommend touchup if formatter hack fails

This commit is contained in:
Robert Hensing 2025-05-27 14:45:51 +02:00
parent 9d0762c18a
commit 0abe17c05d
2 changed files with 11 additions and 10 deletions

View file

@ -583,7 +583,7 @@ in
in
result.formatter.aarch64-darwin;
expectedError.type = "ThrownError";
expectedError.msg = "could not determine statically(.|\n)*disabledModules(.|\n)*inputs\\.flake-parts\\.modules\\.formatter";
expectedError.msg = "could not determine statically(.|\n)*touchup\\.attr\\.formatter\\.enable = false";
};
"test: empty when never defined" = {

View file

@ -85,16 +85,17 @@ in
This whole situation should be temporary. `nix flake check`/`show` can be changed to allow `null` values, which gives flake-parts and other frameworks a way to avoid this situation.
If you don't want a `formatter` output attribute, you may remove it in your `mkFlake` call.
(`disabledModules` must not be used in modules that are intended for reuse)
To change the `formatter` output attribute, you can control it precisely with the `touchup` module, for example:
{ inputs, ... }:
{
disabledModules = [
inputs.flake-parts.modules.formatter
];
# perSystem = ...; etc
}
imports = [ inputs.flake-parts.flakeModules.touchup ];
# Remove it
touchup.attr.formatter.enable = false;
# ... or only have it for listed systems
touchup.attr.formatter.any.enable = lib.mkDefault false;
touchup.attr.formatter.attr.x86_64-linux.enable = true;
touchup.attr.formatter.attr.aarch64-darwin.enable = true;
'')
config.allSystems);