vimPlugins: reject aliases that shadow plugins

An alias that shadows a plugin only threw when that attribute was
evaluated with aliases enabled. CI evaluates with allowAliases = false,
so a shadowing alias passed review and left rust-tools-nvim unevaluable
for users. Check the alias names against the plugin set whenever
vimPlugins is evaluated, as mpvScripts does, and drop the per-alias check
this replaces.
This commit is contained in:
Austin Horstman
2026-09-28 16:03:03 -05:00
parent 9ae9d76e89
commit 5387b308ea
2 changed files with 9 additions and 10 deletions

View File

@@ -17,16 +17,8 @@ let
# sets from building on Hydra.
removeDistribute = alias: if lib.isDerivation alias then lib.dontDistribute alias else alias;
# Make sure that we are not shadowing something from
# all-packages.nix.
checkInPkgs =
n: alias: if builtins.hasAttr n prev then throw "Alias ${n} is still in vim-plugins" else alias;
mapAliases =
aliases:
lib.mapAttrs (
n: alias: removeDistribute (removeRecurseForDerivations (checkInPkgs n alias))
) aliases;
aliases: lib.mapAttrs (_: alias: removeDistribute (removeRecurseForDerivations alias)) aliases;
deprecations = lib.mapAttrs (
old: info:

View File

@@ -55,7 +55,14 @@ let
inherit llvmPackages;
};
aliases = if config.allowAliases then (import ./aliases.nix lib) else final: prev: { };
aliases =
final: prev:
let
defined = import ./aliases.nix lib final prev;
shadowed = builtins.attrNames (builtins.intersectAttrs prev defined);
in
assert lib.assertMsg (shadowed == [ ]) "vimPlugins aliases shadow plugins: ${toString shadowed}";
lib.optionalAttrs config.allowAliases defined;
in
lib.pipe initialPackages [
(extends plugins)