mirror of
https://github.com/nix-community/nixvim.git
synced 2025-07-08 16:24:32 +02:00
parent
49c0853ba5
commit
9f4c9ea7e4
1 changed files with 45 additions and 32 deletions
|
@ -14,6 +14,9 @@ let
|
||||||
{
|
{
|
||||||
# The plugin's name
|
# The plugin's name
|
||||||
name,
|
name,
|
||||||
|
# A list of package paths declared in declarationFile
|
||||||
|
# A path can be either a single string, or a list; as expected by `mkPackageOption`
|
||||||
|
packages,
|
||||||
# A list of names declared in declarationFile
|
# A list of names declared in declarationFile
|
||||||
declared,
|
declared,
|
||||||
# A list of names generated by generate-files
|
# A list of names generated by generate-files
|
||||||
|
@ -22,24 +25,30 @@ let
|
||||||
declarationFile,
|
declarationFile,
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
|
missingFromPkgs = builtins.concatMap (
|
||||||
|
loc: lib.optional (!lib.hasAttrByPath loc pkgs) (lib.concatStringsSep "." loc)
|
||||||
|
) (builtins.map lib.toList packages);
|
||||||
undeclared = lib.filter (name: !(lib.elem name declared)) generated;
|
undeclared = lib.filter (name: !(lib.elem name declared)) generated;
|
||||||
uselesslyDeclared = lib.filter (name: !(lib.elem name generated)) declared;
|
uselesslyDeclared = lib.filter (name: !(lib.elem name generated)) declared;
|
||||||
in
|
in
|
||||||
describeErrors "${name}: The following are not declared in ${declarationFile}:" undeclared
|
describeErrors "${name}: The following are not found in `pkgs`, but are declared in ${declarationFile}:" missingFromPkgs
|
||||||
|
++ describeErrors "${name}: The following are not declared in ${declarationFile}:" undeclared
|
||||||
++ describeErrors "${name}: The following are not listed upstream, but are declared in ${declarationFile}:" uselesslyDeclared;
|
++ describeErrors "${name}: The following are not listed upstream, but are declared in ${declarationFile}:" uselesslyDeclared;
|
||||||
|
|
||||||
# The error message provided to the derivation.
|
# The error message provided to the derivation.
|
||||||
# The test fails if this is non-empty.
|
# The test fails if this is non-empty.
|
||||||
errors = lib.concatStringsSep "\n" (
|
errors = lib.concatStringsSep "\n" (
|
||||||
checkDeclarations {
|
checkDeclarations (
|
||||||
name = "none-ls";
|
|
||||||
declarationFile = "plugins/none-ls/packages.nix";
|
|
||||||
|
|
||||||
declared =
|
|
||||||
let
|
let
|
||||||
inherit (import ../plugins/none-ls/packages.nix lib) noPackage packaged;
|
inherit (import ../plugins/none-ls/packages.nix lib) noPackage packaged;
|
||||||
in
|
in
|
||||||
noPackage ++ lib.attrsets.attrNames packaged;
|
{
|
||||||
|
name = "none-ls";
|
||||||
|
declarationFile = "plugins/none-ls/packages.nix";
|
||||||
|
|
||||||
|
packages = builtins.filter (pkg: pkg != null) (builtins.attrValues packaged);
|
||||||
|
|
||||||
|
declared = noPackage ++ lib.attrsets.attrNames packaged;
|
||||||
|
|
||||||
generated = lib.pipe ../generated/none-ls.nix [
|
generated = lib.pipe ../generated/none-ls.nix [
|
||||||
import
|
import
|
||||||
|
@ -48,15 +57,18 @@ let
|
||||||
lib.lists.unique
|
lib.lists.unique
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
++ checkDeclarations {
|
)
|
||||||
name = "efmls";
|
++ checkDeclarations (
|
||||||
declarationFile = "efmls-configs-pkgs.nix";
|
|
||||||
|
|
||||||
declared =
|
|
||||||
let
|
let
|
||||||
inherit (import ../plugins/lsp/language-servers/efmls-configs-pkgs.nix lib) packaged unpackaged;
|
inherit (import ../plugins/lsp/language-servers/efmls-configs-pkgs.nix lib) packaged unpackaged;
|
||||||
in
|
in
|
||||||
unpackaged ++ lib.attrsets.attrNames packaged;
|
{
|
||||||
|
name = "efmls";
|
||||||
|
declarationFile = "efmls-configs-pkgs.nix";
|
||||||
|
|
||||||
|
packages = builtins.attrValues packaged;
|
||||||
|
|
||||||
|
declared = unpackaged ++ lib.attrsets.attrNames packaged;
|
||||||
|
|
||||||
generated = lib.pipe ../generated/efmls-configs.nix [
|
generated = lib.pipe ../generated/efmls-configs.nix [
|
||||||
import
|
import
|
||||||
|
@ -66,6 +78,7 @@ let
|
||||||
lib.lists.unique
|
lib.lists.unique
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
)
|
||||||
);
|
);
|
||||||
in
|
in
|
||||||
runCommand "generated-sources-test" { inherit errors; } ''
|
runCommand "generated-sources-test" { inherit errors; } ''
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue