plugins/conform: change state semantics

Didn't realize `darwinOnly` didn't actually warn/fail install on linux
only. It just passes a state message to the auto-install function.
Change the state function to automatically handle the expected
condition.
This commit is contained in:
Austin Horstman 2026-02-11 20:43:52 -06:00
parent ed0424f0b0
commit 9077e2f2bc
3 changed files with 13 additions and 3 deletions

View file

@ -23,7 +23,12 @@ rec {
name:
let
permittedNames = lib.optionals (lib.isAttrs configuredFormatters) (attrNames configuredFormatters);
stateList = map (state: lib.fix (lib.toFunction state)) (attrValues states);
stateList = lib.pipe states [
attrValues
(map lib.toFunction)
(map (fn: fn null))
(filter isString)
];
isState =
maybePackage:
lib.throwIf (isFunction maybePackage) "The '${name}' conform-nvim formatter package is a function" (

View file

@ -6,7 +6,7 @@ with pkgs;
let
states = {
broken = _package: "broken";
darwinOnly = _package: "Darwin only";
darwinOnly = p: if stdenv.hostPlatform.isDarwin then p else "Darwin only";
unpackaged = "unpackaged";
};
in

View file

@ -11,7 +11,12 @@
formatter-packages
states
;
stateList = map (state: lib.fix (lib.toFunction state)) (builtins.attrValues states);
stateList = lib.pipe states [
builtins.attrValues
(map lib.toFunction)
(map (fn: fn null))
(builtins.filter builtins.isString)
];
allFormatters = builtins.filter (
name:
let