mirror of
https://github.com/nix-community/nixvim.git
synced 2026-08-24 10:14:03 -05:00
treewide: apply linter suggestions
This commit is contained in:
committed by
Austin Horstman
parent
aca6fcdaff
commit
1d333fc92e
@@ -19,7 +19,7 @@ let
|
|||||||
|> builtins.attrValues
|
|> builtins.attrValues
|
||||||
|> builtins.filter (entry: entry.variant or null == "primary")
|
|> builtins.filter (entry: entry.variant or null == "primary")
|
||||||
|> builtins.filter (entry: builtins.elem entry.status supported)
|
|> builtins.filter (entry: builtins.elem entry.status supported)
|
||||||
|> builtins.map (entry: {
|
|> map (entry: {
|
||||||
name = entry.channel |> builtins.match "nixos-(.+)" |> builtins.head;
|
name = entry.channel |> builtins.match "nixos-(.+)" |> builtins.head;
|
||||||
value = {
|
value = {
|
||||||
inherit (entry) channel status;
|
inherit (entry) channel status;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
docsUrl ? "https://nix-community.github.io/nixvim/",
|
docsUrl ? "https://nix-community.github.io/nixvim/",
|
||||||
}:
|
}:
|
||||||
src:
|
src:
|
||||||
runCommand (src.name or (builtins.baseNameOf src))
|
runCommand (src.name or (baseNameOf src))
|
||||||
{
|
{
|
||||||
inherit src;
|
inherit src;
|
||||||
bindings =
|
bindings =
|
||||||
|
|||||||
@@ -25,10 +25,10 @@ let
|
|||||||
builtins.concatMap (
|
builtins.concatMap (
|
||||||
node:
|
node:
|
||||||
let
|
let
|
||||||
children = builtins.removeAttrs node [ "_page" ];
|
children = removeAttrs node [ "_page" ];
|
||||||
in
|
in
|
||||||
lib.optional (node ? _page) node._page ++ lib.optionals (children != { }) (collectPages children)
|
lib.optional (node ? _page) node._page ++ lib.optionals (children != { }) (collectPages children)
|
||||||
) (builtins.attrValues (builtins.removeAttrs pages [ "_category" ]));
|
) (builtins.attrValues (removeAttrs pages [ "_category" ]));
|
||||||
|
|
||||||
# Normalised page specs
|
# Normalised page specs
|
||||||
pageList = collectPages pages;
|
pageList = collectPages pages;
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ let
|
|||||||
value =
|
value =
|
||||||
let
|
let
|
||||||
file = removeNixvimPrefix location.file;
|
file = removeNixvimPrefix location.file;
|
||||||
line = builtins.toString location.line;
|
line = toString location.line;
|
||||||
text = "${file}:${line}";
|
text = "${file}:${line}";
|
||||||
target = "${urlPrefix}/${file}#L${line}";
|
target = "${urlPrefix}/${file}#L${line}";
|
||||||
in
|
in
|
||||||
@@ -80,6 +80,6 @@ lib.pipe functionSet [
|
|||||||
# No need to include out-of-tree entries
|
# No need to include out-of-tree entries
|
||||||
(builtins.filter (entry: lib.strings.hasPrefix rootPathString entry.location.file))
|
(builtins.filter (entry: lib.strings.hasPrefix rootPathString entry.location.file))
|
||||||
# Convert entries to attrset
|
# Convert entries to attrset
|
||||||
(builtins.map entryToNameValuePair)
|
(map entryToNameValuePair)
|
||||||
builtins.listToAttrs
|
builtins.listToAttrs
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ let
|
|||||||
# whether to nest into a sub-page, so that we can keep the original
|
# whether to nest into a sub-page, so that we can keep the original
|
||||||
# _freeformOptions attr as intended.
|
# _freeformOptions attr as intended.
|
||||||
attrs._freeformOptions or { }
|
attrs._freeformOptions or { }
|
||||||
// builtins.removeAttrs attrs [
|
// removeAttrs attrs [
|
||||||
"_module"
|
"_module"
|
||||||
"_freeformOptions"
|
"_freeformOptions"
|
||||||
"warnings"
|
"warnings"
|
||||||
@@ -96,7 +96,7 @@ let
|
|||||||
let
|
let
|
||||||
info = lib.attrByPath path { } nixvimInfo;
|
info = lib.attrByPath path { } nixvimInfo;
|
||||||
maintainers = lib.unique (configuration.config.meta.maintainers.${info.file} or [ ]);
|
maintainers = lib.unique (configuration.config.meta.maintainers.${info.file} or [ ]);
|
||||||
maintainersNames = builtins.map maintToMD maintainers;
|
maintainersNames = map maintToMD maintainers;
|
||||||
maintToMD = m: if m ? github then "[${m.name}](https://github.com/${m.github})" else m.name;
|
maintToMD = m: if m ? github then "[${m.name}](https://github.com/${m.github})" else m.name;
|
||||||
in
|
in
|
||||||
# Make sure this path has a valid info attrset
|
# Make sure this path has a valid info attrset
|
||||||
@@ -304,7 +304,7 @@ let
|
|||||||
|
|
||||||
# Attrset of { filePath = renderedDocs; }
|
# Attrset of { filePath = renderedDocs; }
|
||||||
platformOptionsFiles = lib.listToAttrs (
|
platformOptionsFiles = lib.listToAttrs (
|
||||||
builtins.map (
|
map (
|
||||||
{ path, file, ... }:
|
{ path, file, ... }:
|
||||||
{
|
{
|
||||||
name = path;
|
name = path;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ let
|
|||||||
modules = [ ./page.nix ];
|
modules = [ ./page.nix ];
|
||||||
};
|
};
|
||||||
|
|
||||||
pages = builtins.removeAttrs config (builtins.attrNames options);
|
pages = removeAttrs config (builtins.attrNames options);
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
freeformType = lib.types.attrsOf pageType;
|
freeformType = lib.types.attrsOf pageType;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ let
|
|||||||
modules = [ ./category.nix ];
|
modules = [ ./category.nix ];
|
||||||
};
|
};
|
||||||
|
|
||||||
categories = builtins.removeAttrs config (builtins.attrNames options);
|
categories = removeAttrs config (builtins.attrNames options);
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
freeformType = lib.types.attrsOf categoryType;
|
freeformType = lib.types.attrsOf categoryType;
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ let
|
|||||||
nextPrefix = if showInMenu then loc else prefix;
|
nextPrefix = if showInMenu then loc else prefix;
|
||||||
nextIndent = if showInMenu && nested then indent + " " else indent;
|
nextIndent = if showInMenu && nested then indent + " " else indent;
|
||||||
|
|
||||||
children = builtins.removeAttrs page optionNames;
|
children = removeAttrs page optionNames;
|
||||||
submenu = lib.pipe children [
|
submenu = lib.pipe children [
|
||||||
builtins.attrValues
|
builtins.attrValues
|
||||||
(map (
|
(map (
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
drv, # The derivation under test
|
drv, # The derivation under test
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
toFile = name: v: if lib.isPath v then v else writeText name v;
|
mkFile = name: v: if lib.isPath v then v else writeText name v;
|
||||||
|
|
||||||
overrideSrc =
|
overrideSrc =
|
||||||
src:
|
src:
|
||||||
@@ -21,8 +21,8 @@ let
|
|||||||
}:
|
}:
|
||||||
testers.testEqualContents {
|
testers.testEqualContents {
|
||||||
assertion = message;
|
assertion = message;
|
||||||
actual = overrideSrc (toFile "${message}-input" input);
|
actual = overrideSrc (mkFile "${message}-input" input);
|
||||||
expected = toFile "${message}-expected" expected;
|
expected = mkFile "${message}-expected" expected;
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
# TODO: introduce some negative cases for input that should fail
|
# TODO: introduce some negative cases for input that should fail
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ You could use the builtin [`map`] function (or similar) to do something like thi
|
|||||||
```nix
|
```nix
|
||||||
{
|
{
|
||||||
keymaps =
|
keymaps =
|
||||||
(builtins.map (key: {
|
(map (key: {
|
||||||
inherit key;
|
inherit key;
|
||||||
action = "<some-action>";
|
action = "<some-action>";
|
||||||
options.desc = "My cool keymapping";
|
options.desc = "My cool keymapping";
|
||||||
|
|||||||
+1
-2
@@ -1,7 +1,6 @@
|
|||||||
{ lib, config, ... }:
|
{ lib, config, ... }:
|
||||||
let
|
let
|
||||||
inherit (lib)
|
inherit (lib)
|
||||||
mapAttrs
|
|
||||||
types
|
types
|
||||||
;
|
;
|
||||||
in
|
in
|
||||||
@@ -39,7 +38,7 @@ in
|
|||||||
|
|
||||||
# Transpose per-system definitions to the top-level
|
# Transpose per-system definitions to the top-level
|
||||||
config.ci = {
|
config.ci = {
|
||||||
buildbot = mapAttrs (_: sysCfg: sysCfg.ci.buildbot) config.allSystems;
|
buildbot = builtins.mapAttrs (_: sysCfg: sysCfg.ci.buildbot) config.allSystems;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ rec {
|
|||||||
# to ensure `lua` isn't evaluated when (e.g.) generating lua code.
|
# to ensure `lua` isn't evaluated when (e.g.) generating lua code.
|
||||||
# Failure to do so will result in "option used but not defined" errors!
|
# Failure to do so will result in "option used but not defined" errors!
|
||||||
deprecatedMapOptionSubmodule = mkMapOptionSubmodule { lua = true; };
|
deprecatedMapOptionSubmodule = mkMapOptionSubmodule { lua = true; };
|
||||||
removeDeprecatedMapAttrs = v: builtins.removeAttrs v [ "lua" ];
|
removeDeprecatedMapAttrs = v: removeAttrs v [ "lua" ];
|
||||||
|
|
||||||
mkModeOption =
|
mkModeOption =
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -138,7 +138,7 @@
|
|||||||
};
|
};
|
||||||
in
|
in
|
||||||
lib.pipe depsToEnable [
|
lib.pipe depsToEnable [
|
||||||
(builtins.map enableDepConditionally)
|
(map enableDepConditionally)
|
||||||
lib.listToAttrs
|
lib.listToAttrs
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -140,7 +140,6 @@ rec {
|
|||||||
pluginLuaConfig = types.submodule (
|
pluginLuaConfig = types.submodule (
|
||||||
{ config, ... }:
|
{ config, ... }:
|
||||||
let
|
let
|
||||||
inherit (builtins) toString;
|
|
||||||
inherit (lib.nixvim.utils) mkBeforeSection mkAfterSection;
|
inherit (lib.nixvim.utils) mkBeforeSection mkAfterSection;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ rec {
|
|||||||
message = "${prefix} ${lib.trim a.message}";
|
message = "${prefix} ${lib.trim a.message}";
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
builtins.map processAssertion (lib.toList assertions);
|
map processAssertion (lib.toList assertions);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Convert one or several conditional warnings to a final warning list.
|
Convert one or several conditional warnings to a final warning list.
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ in
|
|||||||
extraPackages = lib.pipe cfg [
|
extraPackages = lib.pipe cfg [
|
||||||
builtins.attrValues
|
builtins.attrValues
|
||||||
(builtins.filter (p: p.enable))
|
(builtins.filter (p: p.enable))
|
||||||
(builtins.map (p: p.package))
|
(map (p: p.package))
|
||||||
];
|
];
|
||||||
|
|
||||||
__depPackages = {
|
__depPackages = {
|
||||||
|
|||||||
+1
-1
@@ -70,7 +70,7 @@ in
|
|||||||
|
|
||||||
# NOTE: barbar added `mapOptionSubmodule` support shortly _before_ branching off 24.05
|
# NOTE: barbar added `mapOptionSubmodule` support shortly _before_ branching off 24.05
|
||||||
(lib.mapAttrsToList (name: opt: opt.valueMeta) (
|
(lib.mapAttrsToList (name: opt: opt.valueMeta) (
|
||||||
builtins.removeAttrs options.plugins.barbar.keymaps [ "silent" ]
|
removeAttrs options.plugins.barbar.keymaps [ "silent" ]
|
||||||
))
|
))
|
||||||
]
|
]
|
||||||
[
|
[
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ let
|
|||||||
{
|
{
|
||||||
_module.args = lib.pipe options._module.args [
|
_module.args = lib.pipe options._module.args [
|
||||||
lib.modules.mergeAttrDefinitionsWithPrio
|
lib.modules.mergeAttrDefinitionsWithPrio
|
||||||
(lib.flip builtins.removeAttrs [ "name" ])
|
(lib.flip removeAttrs [ "name" ])
|
||||||
(lib.mapAttrs (_: { highestPrio, value }: lib.mkOverride highestPrio value))
|
(lib.mapAttrs (_: { highestPrio, value }: lib.mkOverride highestPrio value))
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ lib.fix (self: {
|
|||||||
defaultPlugin // (if p ? plugin then p else { plugin = p; });
|
defaultPlugin // (if p ? plugin then p else { plugin = p; });
|
||||||
|
|
||||||
# Normalize a list of plugins
|
# Normalize a list of plugins
|
||||||
normalizePlugins = builtins.map self.normalizePlugin;
|
normalizePlugins = map self.normalizePlugin;
|
||||||
|
|
||||||
getAndNormalizeDeps = p: self.normalizePlugins (p.plugin.dependencies or [ ]);
|
getAndNormalizeDeps = p: self.normalizePlugins (p.plugin.dependencies or [ ]);
|
||||||
|
|
||||||
|
|||||||
@@ -21,9 +21,9 @@ let
|
|||||||
};
|
};
|
||||||
|
|
||||||
go =
|
go =
|
||||||
path: name: opt:
|
optPath: name: opt:
|
||||||
let
|
let
|
||||||
loc = path ++ lib.singleton name;
|
loc = optPath ++ lib.singleton name;
|
||||||
in
|
in
|
||||||
if lib.isOption opt then mkAlias loc opt else lib.mapAttrs (go loc) opt;
|
if lib.isOption opt then mkAlias loc opt else lib.mapAttrs (go loc) opt;
|
||||||
in
|
in
|
||||||
|
|||||||
@@ -301,8 +301,8 @@ in
|
|||||||
name:
|
name:
|
||||||
lib.pipe cfg.${name} [
|
lib.pipe cfg.${name} [
|
||||||
(builtins.filter (x: !x.predicate input.${name}))
|
(builtins.filter (x: !x.predicate input.${name}))
|
||||||
(builtins.map (x: x.message))
|
(map (x: x.message))
|
||||||
(builtins.map (msg: if lib.isFunction msg then msg input.${name} else msg))
|
(map (msg: if lib.isFunction msg then msg input.${name} else msg))
|
||||||
(
|
(
|
||||||
x:
|
x:
|
||||||
if x == [ ] then
|
if x == [ ] then
|
||||||
|
|||||||
@@ -186,7 +186,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||||||
(listOf strLua)
|
(listOf strLua)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
apply = builtins.map mapToRawLua;
|
apply = map mapToRawLua;
|
||||||
default = [ ];
|
default = [ ];
|
||||||
example = [
|
example = [
|
||||||
[
|
[
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||||||
(
|
(
|
||||||
lib.attrValues (
|
lib.attrValues (
|
||||||
# Rename aliases added 2025-06-25 in https://github.com/nix-community/nixvim/pull/3503
|
# Rename aliases added 2025-06-25 in https://github.com/nix-community/nixvim/pull/3503
|
||||||
builtins.removeAttrs cfg.languages [
|
removeAttrs cfg.languages [
|
||||||
"warnings"
|
"warnings"
|
||||||
"HTML"
|
"HTML"
|
||||||
"JSON"
|
"JSON"
|
||||||
@@ -208,7 +208,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||||||
(mkToolValue "linters" linter) ++ (mkToolValue "formatters" formatter)
|
(mkToolValue "linters" linter) ++ (mkToolValue "formatters" formatter)
|
||||||
)
|
)
|
||||||
(
|
(
|
||||||
builtins.removeAttrs cfg.languages [
|
removeAttrs cfg.languages [
|
||||||
"all"
|
"all"
|
||||||
# Rename aliases added 2025-06-25 in https://github.com/nix-community/nixvim/pull/3503
|
# Rename aliases added 2025-06-25 in https://github.com/nix-community/nixvim/pull/3503
|
||||||
"warnings"
|
"warnings"
|
||||||
|
|||||||
@@ -19,9 +19,11 @@ lib.nixvim.plugins.mkVimPlugin {
|
|||||||
"plugins.blink-cmp.enable"
|
"plugins.blink-cmp.enable"
|
||||||
"plugins.nvim-snippets.enable"
|
"plugins.nvim-snippets.enable"
|
||||||
];
|
];
|
||||||
enabledConsumers = builtins.filter (path: lib.getAttrFromPath path config) snippetConsumers;
|
enabledConsumers = builtins.filter (
|
||||||
|
consumerPath: lib.getAttrFromPath consumerPath config
|
||||||
|
) snippetConsumers;
|
||||||
enabledConsumersPretty = lib.concatMapStringsSep ", " (
|
enabledConsumersPretty = lib.concatMapStringsSep ", " (
|
||||||
path: lib.getAttrFromPath path options
|
consumerPath: lib.getAttrFromPath consumerPath options
|
||||||
) enabledConsumers;
|
) enabledConsumers;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||||||
if builtins.isString p then
|
if builtins.isString p then
|
||||||
p
|
p
|
||||||
else
|
else
|
||||||
builtins.removeAttrs p [
|
removeAttrs p [
|
||||||
"path"
|
"path"
|
||||||
"requires"
|
"requires"
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -6,7 +6,6 @@
|
|||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
opts = options.plugins.rainbow-delimiters;
|
opts = options.plugins.rainbow-delimiters;
|
||||||
inherit (builtins) any isNull;
|
|
||||||
inherit (lib) mapAttrs' nameValuePair isString;
|
inherit (lib) mapAttrs' nameValuePair isString;
|
||||||
inherit (lib.nixvim) mkRaw toLuaObject nestedLiteralLua;
|
inherit (lib.nixvim) mkRaw toLuaObject nestedLiteralLua;
|
||||||
in
|
in
|
||||||
@@ -103,7 +102,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||||||
];
|
];
|
||||||
|
|
||||||
assertions = lib.nixvim.mkAssertions "plugins.rainbow-delimiters" {
|
assertions = lib.nixvim.mkAssertions "plugins.rainbow-delimiters" {
|
||||||
assertion = any isNull [
|
assertion = builtins.any isNull [
|
||||||
(cfg.settings.whitelist or null)
|
(cfg.settings.whitelist or null)
|
||||||
(cfg.settings.blacklist or null)
|
(cfg.settings.blacklist or null)
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -223,7 +223,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||||||
renamedSettings = lib.foldl' (
|
renamedSettings = lib.foldl' (
|
||||||
acc: optPath:
|
acc: optPath:
|
||||||
let
|
let
|
||||||
snakeCasePath = builtins.map lib.nixvim.toSnakeCase optPath;
|
snakeCasePath = map lib.nixvim.toSnakeCase optPath;
|
||||||
optValue = lib.getAttrFromPath optPath cfg.settings;
|
optValue = lib.getAttrFromPath optPath cfg.settings;
|
||||||
in
|
in
|
||||||
lib.recursiveUpdate acc (lib.setAttrByPath snakeCasePath optValue)
|
lib.recursiveUpdate acc (lib.setAttrByPath snakeCasePath optValue)
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
...
|
...
|
||||||
}@args:
|
}@args:
|
||||||
lib.nixvim.plugins.mkVimPlugin (
|
lib.nixvim.plugins.mkVimPlugin (
|
||||||
builtins.removeAttrs args [
|
removeAttrs args [
|
||||||
"pluginName"
|
"pluginName"
|
||||||
"sourceName"
|
"sourceName"
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -174,7 +174,7 @@ let
|
|||||||
mkCmpSourcePlugin = import ./_mk-cmp-plugin.nix {
|
mkCmpSourcePlugin = import ./_mk-cmp-plugin.nix {
|
||||||
inherit lib pkgs;
|
inherit lib pkgs;
|
||||||
};
|
};
|
||||||
pluginModules = builtins.map mkCmpSourcePlugin sources;
|
pluginModules = map mkCmpSourcePlugin sources;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
# For extra cmp plugins
|
# For extra cmp plugins
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ in
|
|||||||
acc: scope: renamed':
|
acc: scope: renamed':
|
||||||
acc ++ lib.mapAttrsToList (old: new: lib.mkRenamedOptionModule [ scope old ] [ scope new ]) renamed'
|
acc ++ lib.mapAttrsToList (old: new: lib.mkRenamedOptionModule [ scope old ] [ scope new ]) renamed'
|
||||||
) [ ] renamed
|
) [ ] renamed
|
||||||
++ builtins.map (
|
++ map (
|
||||||
name:
|
name:
|
||||||
lib.mkRemovedOptionModule [ "plugins" name "iconsPackage" ] ''
|
lib.mkRemovedOptionModule [ "plugins" name "iconsPackage" ] ''
|
||||||
Please use `plugins.web-devicons` or `plugins.mini.modules.icons` with `plugins.mini.mockDevIcons`, or `plugins.mini-icons` with `plugins.mini-icons.mockDevIcons` instead.
|
Please use `plugins.web-devicons` or `plugins.mini.modules.icons` with `plugins.mini.mockDevIcons`, or `plugins.mini-icons` with `plugins.mini-icons.mockDevIcons` instead.
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||||||
actionStr = action.action or action;
|
actionStr = action.action or action;
|
||||||
mode = action.mode or "n";
|
mode = action.mode or "n";
|
||||||
actionProps = lib.optionalAttrs (builtins.isAttrs action) (
|
actionProps = lib.optionalAttrs (builtins.isAttrs action) (
|
||||||
builtins.removeAttrs action [
|
removeAttrs action [
|
||||||
"action"
|
"action"
|
||||||
"mode"
|
"mode"
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
|||||||
in
|
in
|
||||||
[ (mkEntryFromDrv plugin) ] ++ processDependencies;
|
[ (mkEntryFromDrv plugin) ] ++ processDependencies;
|
||||||
|
|
||||||
processedPlugins = builtins.concatLists (builtins.map processPlugin cfg.plugins);
|
processedPlugins = builtins.concatLists (map processPlugin cfg.plugins);
|
||||||
lazyPath = pkgs.linkFarm "lazy-plugins" processedPlugins;
|
lazyPath = pkgs.linkFarm "lazy-plugins" processedPlugins;
|
||||||
|
|
||||||
pluginToLua =
|
pluginToLua =
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ let
|
|||||||
# Recurse into all directories, extracting files as we find them.
|
# Recurse into all directories, extracting files as we find them.
|
||||||
# This returns a list of { name; file; cases; } attrsets.
|
# This returns a list of { name; file; cases; } attrsets.
|
||||||
fetchTests =
|
fetchTests =
|
||||||
path: namespace:
|
testPath: namespace:
|
||||||
let
|
let
|
||||||
# Handle an entry from readDir
|
# Handle an entry from readDir
|
||||||
# - If it is a regular nix file, import its content
|
# - If it is a regular nix file, import its content
|
||||||
@@ -35,7 +35,7 @@ let
|
|||||||
handleEntry =
|
handleEntry =
|
||||||
name: type:
|
name: type:
|
||||||
let
|
let
|
||||||
file = /${path}/${name};
|
file = /${testPath}/${name};
|
||||||
in
|
in
|
||||||
if type == "regular" then
|
if type == "regular" then
|
||||||
lib.optional (lib.hasSuffix ".nix" name) (
|
lib.optional (lib.hasSuffix ".nix" name) (
|
||||||
@@ -46,7 +46,7 @@ let
|
|||||||
else
|
else
|
||||||
fetchTests file (namespace ++ [ name ]);
|
fetchTests file (namespace ++ [ name ]);
|
||||||
in
|
in
|
||||||
lib.pipe path [
|
lib.pipe testPath [
|
||||||
builtins.readDir
|
builtins.readDir
|
||||||
(lib.filterAttrs (n: v: v != "symlink"))
|
(lib.filterAttrs (n: v: v != "symlink"))
|
||||||
(lib.mapAttrsToList handleEntry)
|
(lib.mapAttrsToList handleEntry)
|
||||||
|
|||||||
+1
-1
@@ -29,7 +29,7 @@ let
|
|||||||
let
|
let
|
||||||
missingFromPkgs = builtins.concatMap (
|
missingFromPkgs = builtins.concatMap (
|
||||||
loc: lib.optional (!lib.hasAttrByPath loc pkgs) (lib.concatStringsSep "." loc)
|
loc: lib.optional (!lib.hasAttrByPath loc pkgs) (lib.concatStringsSep "." loc)
|
||||||
) (builtins.map lib.toList packages);
|
) (map lib.toList packages);
|
||||||
undeclared = lib.filter (name: !(lib.elem name declared)) generated;
|
undeclared = lib.filter (name: !(lib.elem name declared)) generated;
|
||||||
uselesslyDeclared = lib.partition (name: lib.elem name unsupported) (
|
uselesslyDeclared = lib.partition (name: lib.elem name unsupported) (
|
||||||
lib.filter (name: !(lib.elem name generated)) declared
|
lib.filter (name: !(lib.elem name generated)) declared
|
||||||
|
|||||||
+1
-1
@@ -564,7 +564,7 @@ else
|
|||||||
runCommandLocal "lib-tests-failure"
|
runCommandLocal "lib-tests-failure"
|
||||||
{
|
{
|
||||||
results = lib.concatStringsSep "\n" (
|
results = lib.concatStringsSep "\n" (
|
||||||
builtins.map (result: ''
|
map (result: ''
|
||||||
${result.name}:
|
${result.name}:
|
||||||
expected: ${lib.generators.toPretty { } result.expected}
|
expected: ${lib.generators.toPretty { } result.expected}
|
||||||
result: ${lib.generators.toPretty { } result.result}
|
result: ${lib.generators.toPretty { } result.result}
|
||||||
|
|||||||
+2
-2
@@ -45,7 +45,7 @@ let
|
|||||||
configuration.config.build.test.overrideAttrs (old: {
|
configuration.config.build.test.overrideAttrs (old: {
|
||||||
passthru =
|
passthru =
|
||||||
old.passthru or { }
|
old.passthru or { }
|
||||||
// builtins.removeAttrs configuration [
|
// removeAttrs configuration [
|
||||||
"_type"
|
"_type"
|
||||||
"type"
|
"type"
|
||||||
]
|
]
|
||||||
@@ -66,7 +66,7 @@ let
|
|||||||
config = import ../example.nix { inherit pkgs; };
|
config = import ../example.nix { inherit pkgs; };
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
main = builtins.removeAttrs config.programs.nixvim [
|
main = removeAttrs config.programs.nixvim [
|
||||||
# This is not available to standalone modules, only HM & NixOS Modules
|
# This is not available to standalone modules, only HM & NixOS Modules
|
||||||
"enable"
|
"enable"
|
||||||
# This is purely an example, it does not reflect a real usage
|
# This is purely an example, it does not reflect a real usage
|
||||||
|
|||||||
@@ -1,14 +1,12 @@
|
|||||||
{
|
{
|
||||||
lib,
|
|
||||||
nixpkgsLib,
|
nixpkgsLib,
|
||||||
runCommandLocal,
|
runCommandLocal,
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
inherit (lib) attrNames filter length;
|
|
||||||
nixvimList = import ../lib/maintainers.nix;
|
nixvimList = import ../lib/maintainers.nix;
|
||||||
nixpkgsList = nixpkgsLib.maintainers;
|
nixpkgsList = nixpkgsLib.maintainers;
|
||||||
duplicates = filter (name: nixpkgsList ? ${name}) (attrNames nixvimList);
|
duplicates = builtins.filter (name: nixpkgsList ? ${name}) (builtins.attrNames nixvimList);
|
||||||
count = length duplicates;
|
count = builtins.length duplicates;
|
||||||
in
|
in
|
||||||
runCommandLocal "maintainers-test" { inherit count duplicates; } ''
|
runCommandLocal "maintainers-test" { inherit count duplicates; } ''
|
||||||
if [ $count -gt 0 ]; then
|
if [ $count -gt 0 ]; then
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
# toolOptions is an attrsets of the form:
|
# toolOptions is an attrsets of the form:
|
||||||
# { <lang> = { linter = tools; formatter = tools; }; }
|
# { <lang> = { linter = tools; formatter = tools; }; }
|
||||||
# Where tools is the option type representing the valid tools for this language
|
# Where tools is the option type representing the valid tools for this language
|
||||||
toolOptions = builtins.removeAttrs (languages.type.getSubOptions languages.loc) [
|
toolOptions = removeAttrs (languages.type.getSubOptions languages.loc) [
|
||||||
"_freeformOptions"
|
"_freeformOptions"
|
||||||
"_module"
|
"_module"
|
||||||
|
|
||||||
|
|||||||
@@ -19,8 +19,6 @@
|
|||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
inherit (lib)
|
inherit (lib)
|
||||||
listToAttrs
|
|
||||||
map
|
|
||||||
mkIf
|
mkIf
|
||||||
mkMerge
|
mkMerge
|
||||||
optionalAttrs
|
optionalAttrs
|
||||||
@@ -89,7 +87,7 @@ in
|
|||||||
(optionalAttrs (filesOpt != null) (
|
(optionalAttrs (filesOpt != null) (
|
||||||
mkIf (cfg.enable && !cfg.wrapRc) (
|
mkIf (cfg.enable && !cfg.wrapRc) (
|
||||||
setAttrByPath filesOpt (
|
setAttrByPath filesOpt (
|
||||||
listToAttrs (
|
builtins.listToAttrs (
|
||||||
map (
|
map (
|
||||||
{ target, finalSource, ... }:
|
{ target, finalSource, ... }:
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user