nix-community.nixvim/ci/efmls-configs.nix
Matt Sturgeon 2b2b1e6d8f ci: rename update-scriptsci
This changes how we think about this directory; it does not need to be
exclusively for scripts related to updates, but should be a place for
any scripts intended to be run by CI workflows.

This mindset should make it easier to develop and test the business
logic of workflows, without always needing to test "in production" on
the nixvim repo or a fork.
2025-06-15 21:23:58 +00:00

54 lines
1.3 KiB
Nix

{
lib,
vimPlugins,
writeText,
}:
let
tools = lib.trivial.importJSON "${vimPlugins.efmls-configs-nvim.src}/doc/supported-list.json";
languages = lib.attrNames tools;
toLangTools' = lang: kind: lib.map (lib.getAttr "name") (tools.${lang}.${kind} or [ ]);
miscLinters = toLangTools' "misc" "linters";
miscFormatters = toLangTools' "misc" "formatters";
sources =
(lib.listToAttrs (
lib.map (
lang:
let
toLangTools = toLangTools' lang;
in
{
name = lang;
value = {
linter = {
inherit lang;
possible = (toLangTools "linters") ++ miscLinters;
};
formatter = {
inherit lang;
possible = (toLangTools "formatters") ++ miscFormatters;
};
};
}
) languages
))
// {
all = {
linter = {
lang = "all languages";
possible = miscLinters;
};
formatter = {
lang = "all languages";
possible = miscFormatters;
};
};
};
in
writeText "efmls-configs-sources.nix" (
"# WARNING: DO NOT EDIT\n"
+ "# This file is generated with packages.<system>.efmls-configs-sources, which is run automatically by CI\n"
+ (lib.generators.toPretty { } sources)
)