mirror of
https://github.com/nix-community/nixvim.git
synced 2025-11-08 19:46:06 +01:00
treewide: generate JSON instead of Nix
Signed-off-by: saygo-png <saygo.mail@proton.me>
This commit is contained in:
parent
f8c32d1094
commit
c89994b0ac
17 changed files with 3209 additions and 4296 deletions
|
|
@ -1,13 +1,12 @@
|
|||
{
|
||||
vimPlugins,
|
||||
writers,
|
||||
lib,
|
||||
writeText,
|
||||
}:
|
||||
lib.pipe "${vimPlugins.conform-nvim}/lua/conform/formatters" [
|
||||
builtins.readDir
|
||||
builtins.attrNames
|
||||
(builtins.filter (lib.hasSuffix ".lua"))
|
||||
(map (lib.removeSuffix ".lua"))
|
||||
builtins.toJSON
|
||||
(writeText "conform-formatters")
|
||||
(writers.writeJSON "conform-formatters.json")
|
||||
]
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
{
|
||||
lib,
|
||||
writers,
|
||||
vimPlugins,
|
||||
writeText,
|
||||
}:
|
||||
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;
|
||||
|
||||
toLangTools' = lang: kind: lib.map (lib.getAttr "name") (tools.${lang}.${kind} or [ ]);
|
||||
|
|
@ -54,8 +54,4 @@ let
|
|||
};
|
||||
};
|
||||
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)
|
||||
)
|
||||
writers.writeJSON "efmls-configs-sources.json" sources
|
||||
|
|
|
|||
|
|
@ -33,25 +33,21 @@ writeShellApplication {
|
|||
shift
|
||||
done
|
||||
|
||||
generate_nix() {
|
||||
echo "$2"
|
||||
cp "$1" "$generated_dir/$2.nix"
|
||||
nixfmt "$generated_dir/$2.nix"
|
||||
}
|
||||
|
||||
generate_json() {
|
||||
echo "$2"
|
||||
prettier --parser=json "$1" >"$generated_dir/$2.json"
|
||||
# Get file part from filepath and remove hash prefix
|
||||
output_name=$(basename "$1" | cut -d "-" -f "2-")
|
||||
basename "$1" ".json"
|
||||
prettier "$1" > "$generated_dir/$output_name"
|
||||
}
|
||||
|
||||
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 "${lspconfig-servers}" "lspconfig-servers"
|
||||
generate_json "${lspconfig-servers.unsupported}" "unsupported-lspconfig-servers"
|
||||
generate_json "${rust-analyzer-options}"
|
||||
generate_json "${efmls-configs-sources}"
|
||||
generate_json "${none-ls-builtins}"
|
||||
generate_json "${conform-formatters}"
|
||||
generate_json "${lspconfig-servers}"
|
||||
generate_json "${lspconfig-servers.unsupported}"
|
||||
|
||||
if [ -n "$commit" ]; then
|
||||
cd "$generated_dir"
|
||||
|
|
|
|||
|
|
@ -1,14 +1,10 @@
|
|||
{
|
||||
vimPlugins,
|
||||
writers,
|
||||
lib,
|
||||
writeText,
|
||||
}:
|
||||
let
|
||||
builtinSources = lib.trivial.importJSON "${vimPlugins.none-ls-nvim.src}/doc/builtins.json";
|
||||
builtinSourceNames = lib.mapAttrs (_: lib.attrNames) builtinSources;
|
||||
in
|
||||
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)
|
||||
)
|
||||
lib.pipe "${vimPlugins.none-ls-nvim.src}/doc/builtins.json" [
|
||||
lib.importJSON
|
||||
(lib.mapAttrs (_: lib.attrNames))
|
||||
(writers.writeJSON "none-ls-sources.json")
|
||||
]
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
pandoc,
|
||||
jq,
|
||||
}:
|
||||
runCommand "lspconfig-servers"
|
||||
runCommand "lspconfig-servers.json"
|
||||
{
|
||||
lspconfig = vimPlugins.nvim-lspconfig;
|
||||
nativeBuildInputs = [
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
I.e., files in the old `lua/lspconfig/configs/` directory, that aren't
|
||||
present in the new `lsp/` directory.
|
||||
*/
|
||||
runCommand "unsupported-lspconfig-servers"
|
||||
runCommand "unsupported-lspconfig-servers.json"
|
||||
{
|
||||
nativeBuildInputs = [ jq ];
|
||||
lspconfig = vimPlugins.nvim-lspconfig;
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
#
|
||||
# {
|
||||
# "<rust-analyzer.option.name>" = {
|
||||
# description = "<option description>";
|
||||
# type = {
|
||||
# kind = "<name of the type>";
|
||||
# # Other values depending on the kind, like values for enum or subTypes for oneOf
|
||||
# };
|
||||
# };
|
||||
# "<rust-analyzer.option.name>": {
|
||||
# "description": "<option description>",
|
||||
# "type": {
|
||||
# "kind": "<name of the type>"
|
||||
# <Other values depending on the kind, like values for enum or subTypes for oneOf>
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
#
|
||||
{
|
||||
lib,
|
||||
writers,
|
||||
rust-analyzer,
|
||||
writeText,
|
||||
pandoc,
|
||||
runCommand,
|
||||
}:
|
||||
|
|
@ -227,8 +227,4 @@ let
|
|||
}
|
||||
) rustAnalyzerProperties;
|
||||
in
|
||||
writeText "rust-analyzer-options.nix" (
|
||||
"# 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))
|
||||
)
|
||||
writers.writeJSON "rust-analyzer-options.json" (lib.mergeAttrsList rustAnalyzerOptions)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue