mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-09-30 03:39:59 +00:00
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:
@@ -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:
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user