1
0
Fork 0
mirror of https://github.com/nix-community/nixvim.git synced 2025-11-08 11:36:07 +01:00

treewide: generate JSON instead of Nix

Signed-off-by: saygo-png <saygo.mail@proton.me>
This commit is contained in:
saygo-png 2025-10-19 01:24:26 +02:00 committed by zowoq
parent f8c32d1094
commit c89994b0ac
17 changed files with 3209 additions and 4296 deletions

View file

@ -1,13 +1,12 @@
{ {
vimPlugins, vimPlugins,
writers,
lib, lib,
writeText,
}: }:
lib.pipe "${vimPlugins.conform-nvim}/lua/conform/formatters" [ lib.pipe "${vimPlugins.conform-nvim}/lua/conform/formatters" [
builtins.readDir builtins.readDir
builtins.attrNames builtins.attrNames
(builtins.filter (lib.hasSuffix ".lua")) (builtins.filter (lib.hasSuffix ".lua"))
(map (lib.removeSuffix ".lua")) (map (lib.removeSuffix ".lua"))
builtins.toJSON (writers.writeJSON "conform-formatters.json")
(writeText "conform-formatters")
] ]

View file

@ -1,10 +1,10 @@
{ {
lib, lib,
writers,
vimPlugins, vimPlugins,
writeText,
}: }:
let let
tools = lib.trivial.importJSON "${vimPlugins.efmls-configs-nvim.src}/doc/supported-list.json"; tools = lib.importJSON "${vimPlugins.efmls-configs-nvim.src}/doc/supported-list.json";
languages = lib.attrNames tools; languages = lib.attrNames tools;
toLangTools' = lang: kind: lib.map (lib.getAttr "name") (tools.${lang}.${kind} or [ ]); toLangTools' = lang: kind: lib.map (lib.getAttr "name") (tools.${lang}.${kind} or [ ]);
@ -54,8 +54,4 @@ let
}; };
}; };
in in
writeText "efmls-configs-sources.nix" ( writers.writeJSON "efmls-configs-sources.json" sources
"# 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)
)

View file

@ -33,25 +33,21 @@ writeShellApplication {
shift shift
done done
generate_nix() {
echo "$2"
cp "$1" "$generated_dir/$2.nix"
nixfmt "$generated_dir/$2.nix"
}
generate_json() { generate_json() {
echo "$2" # Get file part from filepath and remove hash prefix
prettier --parser=json "$1" >"$generated_dir/$2.json" output_name=$(basename "$1" | cut -d "-" -f "2-")
basename "$1" ".json"
prettier "$1" > "$generated_dir/$output_name"
} }
mkdir -p "$generated_dir" mkdir -p "$generated_dir"
generate_nix "${rust-analyzer-options}" "rust-analyzer"
generate_nix "${efmls-configs-sources}" "efmls-configs"
generate_nix "${none-ls-builtins}" "none-ls"
generate_json "${conform-formatters}" "conform-formatters" generate_json "${rust-analyzer-options}"
generate_json "${lspconfig-servers}" "lspconfig-servers" generate_json "${efmls-configs-sources}"
generate_json "${lspconfig-servers.unsupported}" "unsupported-lspconfig-servers" generate_json "${none-ls-builtins}"
generate_json "${conform-formatters}"
generate_json "${lspconfig-servers}"
generate_json "${lspconfig-servers.unsupported}"
if [ -n "$commit" ]; then if [ -n "$commit" ]; then
cd "$generated_dir" cd "$generated_dir"

View file

@ -1,14 +1,10 @@
{ {
vimPlugins, vimPlugins,
writers,
lib, lib,
writeText,
}: }:
let lib.pipe "${vimPlugins.none-ls-nvim.src}/doc/builtins.json" [
builtinSources = lib.trivial.importJSON "${vimPlugins.none-ls-nvim.src}/doc/builtins.json"; lib.importJSON
builtinSourceNames = lib.mapAttrs (_: lib.attrNames) builtinSources; (lib.mapAttrs (_: lib.attrNames))
in (writers.writeJSON "none-ls-sources.json")
writeText "none-ls-sources.nix" ( ]
"# WARNING: DO NOT EDIT\n"
+ "# This file is generated with packages.<system>.none-ls-builtins, which is run automatically by CI\n"
+ (lib.generators.toPretty { } builtinSourceNames)
)

View file

@ -5,7 +5,7 @@
pandoc, pandoc,
jq, jq,
}: }:
runCommand "lspconfig-servers" runCommand "lspconfig-servers.json"
{ {
lspconfig = vimPlugins.nvim-lspconfig; lspconfig = vimPlugins.nvim-lspconfig;
nativeBuildInputs = [ nativeBuildInputs = [

View file

@ -10,7 +10,7 @@
I.e., files in the old `lua/lspconfig/configs/` directory, that aren't I.e., files in the old `lua/lspconfig/configs/` directory, that aren't
present in the new `lsp/` directory. present in the new `lsp/` directory.
*/ */
runCommand "unsupported-lspconfig-servers" runCommand "unsupported-lspconfig-servers.json"
{ {
nativeBuildInputs = [ jq ]; nativeBuildInputs = [ jq ];
lspconfig = vimPlugins.nvim-lspconfig; lspconfig = vimPlugins.nvim-lspconfig;

View file

@ -1,22 +1,22 @@
# #
# This derivation creates a Nix file that describes the Nix module that needs to be instantiated # This derivation creates a JSON file that describes the Nix module that needs to be instantiated
# #
# The create file is of the form: # The create file is of the form:
# #
# { # {
# "<rust-analyzer.option.name>" = { # "<rust-analyzer.option.name>": {
# description = "<option description>"; # "description": "<option description>",
# type = { # "type": {
# kind = "<name of the type>"; # "kind": "<name of the type>"
# # Other values depending on the kind, like values for enum or subTypes for oneOf # <Other values depending on the kind, like values for enum or subTypes for oneOf>
# }; # }
# }; # }
# } # }
# #
{ {
lib, lib,
writers,
rust-analyzer, rust-analyzer,
writeText,
pandoc, pandoc,
runCommand, runCommand,
}: }:
@ -227,8 +227,4 @@ let
} }
) rustAnalyzerProperties; ) rustAnalyzerProperties;
in in
writeText "rust-analyzer-options.nix" ( writers.writeJSON "rust-analyzer-options.json" (lib.mergeAttrsList rustAnalyzerOptions)
"# WARNING: DO NOT EDIT\n"
+ "# This file is generated with packages.<system>.rust-analyzer-options, which is run automatically by CI\n"
+ (lib.generators.toPretty { } (lib.mergeAttrsList rustAnalyzerOptions))
)

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,241 @@
{
"code_actions": [
"gitrebase",
"gitsigns",
"gomodifytags",
"impl",
"proselint",
"refactoring",
"regal",
"statix",
"textlint",
"ts_node_action"
],
"completion": ["luasnip", "nvim_snippets", "spell", "tags", "vsnip"],
"diagnostics": [
"actionlint",
"alex",
"ansiblelint",
"bean_check",
"bslint",
"buf",
"buildifier",
"cfn_lint",
"checkmake",
"checkstyle",
"clazy",
"clj_kondo",
"cmake_lint",
"codespell",
"commitlint",
"cppcheck",
"credo",
"cue_fmt",
"deadnix",
"djlint",
"dotenv_linter",
"editorconfig_checker",
"erb_lint",
"fish",
"gccdiag",
"gdlint",
"gitlint",
"glslc",
"golangci_lint",
"hadolint",
"haml_lint",
"ktlint",
"kube_linter",
"ltrs",
"markdownlint",
"markdownlint_cli2",
"markuplint",
"mdl",
"mlint",
"mypy",
"npm_groovy_lint",
"opacheck",
"opentofu_validate",
"perlimports",
"phpcs",
"phpmd",
"phpstan",
"pmd",
"proselint",
"protolint",
"puppet_lint",
"pydoclint",
"pylint",
"qmllint",
"reek",
"regal",
"revive",
"rpmspec",
"rstcheck",
"rubocop",
"saltlint",
"selene",
"semgrep",
"solhint",
"spectral",
"sqlfluff",
"sqruff",
"staticcheck",
"statix",
"stylelint",
"stylint",
"swiftlint",
"teal",
"terraform_validate",
"terragrunt_validate",
"textidote",
"textlint",
"tfsec",
"tidy",
"todo_comments",
"trail_space",
"trivy",
"twigcs",
"vacuum",
"vale",
"verilator",
"vint",
"write_good",
"yamllint",
"zsh"
],
"formatting": [
"alejandra",
"asmfmt",
"astyle",
"atlas_fmt",
"bean_format",
"bibclean",
"biome",
"black",
"blackd",
"blade_formatter",
"bsfmt",
"buf",
"buildifier",
"cbfmt",
"clang_format",
"cljfmt",
"cljstyle",
"cmake_format",
"codespell",
"crystal_format",
"csharpier",
"cue_fmt",
"cueimports",
"d2_fmt",
"dart_format",
"dfmt",
"djhtml",
"djlint",
"duster",
"dxfmt",
"elm_format",
"emacs_scheme_mode",
"emacs_vhdl_mode",
"erb_format",
"erb_lint",
"erlfmt",
"fantomas",
"findent",
"fish_indent",
"fnlfmt",
"forge_fmt",
"format_r",
"fprettify",
"gdformat",
"gersemi",
"gleam_format",
"gn_format",
"gofmt",
"gofumpt",
"goimports",
"goimports_reviser",
"golines",
"google_java_format",
"haxe_formatter",
"hclfmt",
"htmlbeautifier",
"isort",
"isortd",
"joker",
"just",
"ktlint",
"leptosfmt",
"markdownlint",
"mdformat",
"meson_format",
"mix",
"nginx_beautifier",
"nimpretty",
"nix_flake_fmt",
"nixfmt",
"nixpkgs_fmt",
"npm_groovy_lint",
"ocamlformat",
"ocdc",
"opentofu_fmt",
"packer",
"pg_format",
"phpcbf",
"phpcsfixer",
"pint",
"prettier",
"prettierd",
"pretty_php",
"prisma_format",
"protolint",
"ptop",
"puppet_lint",
"purs_tidy",
"pyink",
"qmlformat",
"racket_fixw",
"raco_fmt",
"rego",
"remark",
"rescript",
"rubocop",
"rubyfmt",
"rufo",
"rustywind",
"scalafmt",
"shellharden",
"shfmt",
"smlfmt",
"sql_formatter",
"sqlfluff",
"sqlfmt",
"sqlformat",
"sqruff",
"stylelint",
"styler",
"stylua",
"surface",
"swift_format",
"swiftformat",
"swiftlint",
"terraform_fmt",
"terragrunt_fmt",
"textlint",
"tidy",
"topiary",
"treefmt",
"typstfmt",
"typstyle",
"uncrustify",
"usort",
"verible_verilog_format",
"xmllint",
"yamlfix",
"yamlfmt",
"yapf",
"zprint"
],
"hover": ["dictionary", "printenv"]
}

View file

@ -1,252 +0,0 @@
# WARNING: DO NOT EDIT
# This file is generated with packages.<system>.none-ls-builtins, which is run automatically by CI
{
code_actions = [
"gitrebase"
"gitsigns"
"gomodifytags"
"impl"
"proselint"
"refactoring"
"regal"
"statix"
"textlint"
"ts_node_action"
];
completion = [
"luasnip"
"nvim_snippets"
"spell"
"tags"
"vsnip"
];
diagnostics = [
"actionlint"
"alex"
"ansiblelint"
"bean_check"
"bslint"
"buf"
"buildifier"
"cfn_lint"
"checkmake"
"checkstyle"
"clazy"
"clj_kondo"
"cmake_lint"
"codespell"
"commitlint"
"cppcheck"
"credo"
"cue_fmt"
"deadnix"
"djlint"
"dotenv_linter"
"editorconfig_checker"
"erb_lint"
"fish"
"gccdiag"
"gdlint"
"gitlint"
"glslc"
"golangci_lint"
"hadolint"
"haml_lint"
"ktlint"
"kube_linter"
"ltrs"
"markdownlint"
"markdownlint_cli2"
"markuplint"
"mdl"
"mlint"
"mypy"
"npm_groovy_lint"
"opacheck"
"opentofu_validate"
"perlimports"
"phpcs"
"phpmd"
"phpstan"
"pmd"
"proselint"
"protolint"
"puppet_lint"
"pydoclint"
"pylint"
"qmllint"
"reek"
"regal"
"revive"
"rpmspec"
"rstcheck"
"rubocop"
"saltlint"
"selene"
"semgrep"
"solhint"
"spectral"
"sqlfluff"
"sqruff"
"staticcheck"
"statix"
"stylelint"
"stylint"
"swiftlint"
"teal"
"terraform_validate"
"terragrunt_validate"
"textidote"
"textlint"
"tfsec"
"tidy"
"todo_comments"
"trail_space"
"trivy"
"twigcs"
"vacuum"
"vale"
"verilator"
"vint"
"write_good"
"yamllint"
"zsh"
];
formatting = [
"alejandra"
"asmfmt"
"astyle"
"atlas_fmt"
"bean_format"
"bibclean"
"biome"
"black"
"blackd"
"blade_formatter"
"bsfmt"
"buf"
"buildifier"
"cbfmt"
"clang_format"
"cljfmt"
"cljstyle"
"cmake_format"
"codespell"
"crystal_format"
"csharpier"
"cue_fmt"
"cueimports"
"d2_fmt"
"dart_format"
"dfmt"
"djhtml"
"djlint"
"duster"
"dxfmt"
"elm_format"
"emacs_scheme_mode"
"emacs_vhdl_mode"
"erb_format"
"erb_lint"
"erlfmt"
"fantomas"
"findent"
"fish_indent"
"fnlfmt"
"forge_fmt"
"format_r"
"fprettify"
"gdformat"
"gersemi"
"gleam_format"
"gn_format"
"gofmt"
"gofumpt"
"goimports"
"goimports_reviser"
"golines"
"google_java_format"
"haxe_formatter"
"hclfmt"
"htmlbeautifier"
"isort"
"isortd"
"joker"
"just"
"ktlint"
"leptosfmt"
"markdownlint"
"mdformat"
"meson_format"
"mix"
"nginx_beautifier"
"nimpretty"
"nix_flake_fmt"
"nixfmt"
"nixpkgs_fmt"
"npm_groovy_lint"
"ocamlformat"
"ocdc"
"opentofu_fmt"
"packer"
"pg_format"
"phpcbf"
"phpcsfixer"
"pint"
"prettier"
"prettierd"
"pretty_php"
"prisma_format"
"protolint"
"ptop"
"puppet_lint"
"purs_tidy"
"pyink"
"qmlformat"
"racket_fixw"
"raco_fmt"
"rego"
"remark"
"rescript"
"rubocop"
"rubyfmt"
"rufo"
"rustywind"
"scalafmt"
"shellharden"
"shfmt"
"smlfmt"
"sql_formatter"
"sqlfluff"
"sqlfmt"
"sqlformat"
"sqruff"
"stylelint"
"styler"
"stylua"
"surface"
"swift_format"
"swiftformat"
"swiftlint"
"terraform_fmt"
"terragrunt_fmt"
"textlint"
"tidy"
"topiary"
"treefmt"
"typstfmt"
"typstyle"
"uncrustify"
"usort"
"verible_verilog_format"
"xmllint"
"yamlfix"
"yamlfmt"
"yapf"
"zprint"
];
hover = [
"dictionary"
"printenv"
];
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -6,7 +6,7 @@
... ...
}: }:
let let
tools = import ../../../generated/efmls-configs.nix; tools = lib.importJSON ../../../generated/efmls-configs-sources.json;
inherit (import ./packages.nix lib) packaged; inherit (import ./packages.nix lib) packaged;
in in
{ {

View file

@ -1,6 +1,6 @@
{ config, lib, ... }: { config, lib, ... }:
let let
noneLsBuiltins = import ../../../generated/none-ls.nix; noneLsBuiltins = lib.importJSON ../../../generated/none-ls-sources.json;
mkSourcePlugin = import ./_mk-source-plugin.nix; mkSourcePlugin = import ./_mk-source-plugin.nix;
in in
{ {

View file

@ -4,7 +4,7 @@ let
inherit (lib.nixvim) defaultNullOpts; inherit (lib.nixvim) defaultNullOpts;
inherit (lib) types; inherit (lib) types;
rustAnalyzerOptions = import ../../../generated/rust-analyzer.nix; rustAnalyzerOptions = lib.importJSON ../../../generated/rust-analyzer-options.json;
mkRustAnalyzerType = mkRustAnalyzerType =
{ kind, ... }@typeInfo: { kind, ... }@typeInfo:

View file

@ -71,8 +71,8 @@ let
declared = noPackage ++ lib.attrsets.attrNames packaged; declared = noPackage ++ lib.attrsets.attrNames packaged;
generated = lib.pipe ../generated/none-ls.nix [ generated = lib.pipe ../generated/none-ls-sources.json [
import lib.importJSON
lib.attrsets.attrValues lib.attrsets.attrValues
lib.lists.concatLists lib.lists.concatLists
lib.lists.unique lib.lists.unique
@ -91,8 +91,8 @@ let
declared = unpackaged ++ lib.attrsets.attrNames packaged; declared = unpackaged ++ lib.attrsets.attrNames packaged;
generated = lib.pipe ../generated/efmls-configs.nix [ generated = lib.pipe ../generated/efmls-configs-sources.json [
import lib.importJSON
lib.attrsets.attrValues lib.attrsets.attrValues
(lib.map ({ linter, formatter }: linter.possible ++ formatter.possible)) (lib.map ({ linter, formatter }: linter.possible ++ formatter.possible))
lib.lists.concatLists lib.lists.concatLists