mirror of
https://github.com/nix-community/nixvim.git
synced 2025-08-03 01:25:22 +02:00
dev: Add a script to generate the none-ls builtins
This commit is contained in:
parent
517648dac0
commit
0b93815db5
3 changed files with 261 additions and 2 deletions
|
@ -9,14 +9,18 @@
|
|||
repo_root=$(git rev-parse --show-toplevel)
|
||||
generated_dir=$repo_root/generated
|
||||
|
||||
# Rust-Analyzer
|
||||
echo "Rust-Analyzer"
|
||||
nix build .#rust-analyzer-options
|
||||
cat ./result >"$generated_dir"/rust-analyzer.nix
|
||||
|
||||
# efmls-configs
|
||||
echo "efmls-configs"
|
||||
nix build .#efmls-configs-sources
|
||||
cat ./result >"$generated_dir"/efmls-configs.nix
|
||||
|
||||
echo "none-ls"
|
||||
nix build .#none-ls-builtins
|
||||
cat ./result >"$generated_dir"/none-ls.nix
|
||||
|
||||
nix fmt
|
||||
'';
|
||||
};
|
||||
|
@ -24,6 +28,7 @@
|
|||
packages = {
|
||||
rust-analyzer-options = pkgs.callPackage ./rust-analyzer.nix { };
|
||||
efmls-configs-sources = pkgs.callPackage ./efmls-configs.nix { };
|
||||
none-ls-builtins = pkgs.callPackage ./none-ls.nix { };
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
32
flake-modules/updates/none-ls.nix
Normal file
32
flake-modules/updates/none-ls.nix
Normal file
|
@ -0,0 +1,32 @@
|
|||
{
|
||||
vimPlugins,
|
||||
lib,
|
||||
writeText,
|
||||
pkgs,
|
||||
}:
|
||||
let
|
||||
inherit (import ../../plugins/none-ls/packages.nix pkgs) packaged noPackage unpackaged;
|
||||
|
||||
builtinSources = lib.trivial.importJSON "${vimPlugins.none-ls-nvim.src}/doc/builtins.json";
|
||||
|
||||
builtinSourceNames = lib.mapAttrs (_: lib.attrNames) builtinSources;
|
||||
|
||||
toolNames = lib.unique (lib.flatten (lib.attrValues builtinSourceNames));
|
||||
|
||||
undeclaredTool = lib.filter (
|
||||
name: !(lib.hasAttr name packaged || lib.elem name noPackage || lib.elem name unpackaged)
|
||||
) toolNames;
|
||||
|
||||
uselesslyDeclaredTool = lib.filter (name: !(lib.elem name toolNames)) (
|
||||
unpackaged ++ noPackage ++ (lib.attrNames packaged)
|
||||
);
|
||||
in
|
||||
assert lib.assertMsg (lib.length undeclaredTool == 0)
|
||||
"Undeclared tools: ${lib.generators.toPretty { } undeclaredTool}";
|
||||
assert lib.assertMsg (lib.length uselesslyDeclaredTool == 0)
|
||||
"Tool is not supported upstream: ${lib.generators.toPretty { } uselesslyDeclaredTool}";
|
||||
writeText "efmls-configs-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)
|
||||
)
|
Loading…
Add table
Add a link
Reference in a new issue