plugins/packer: remove (deprecated)

This commit is contained in:
Gaetan Lepage 2025-03-30 12:48:01 +02:00
parent ada161d0bb
commit 5d833a1692
5 changed files with 7 additions and 341 deletions

View file

@ -30,6 +30,7 @@ in
let
ignoredPackages = [
# removed
"packer"
"treesitter-playground"
# renamed
"surround"

View file

@ -27,7 +27,6 @@
./lsp
./pluginmanagers/packer.nix
./pluginmanagers/lazy.nix
./pluginmanagers/lz-n.nix

View file

@ -16,6 +16,12 @@ let
- `:InspectTree` to show the parsed syntax tree ("TSPlayground")
- `:PreviewQuery` to open the Query Editor (Nvim 0.10+)
'';
# Added 2025-03-30
packer = ''
The `packer` plugin manager has been unmaintained for several years.
It is recommended to use `plugins.pckr` or `plugins.lazy` instead.
'';
};
renamed = {
# Added 2024-09-17

View file

@ -1,195 +0,0 @@
{
lib,
helpers,
config,
pkgs,
...
}:
with lib;
let
cfg = config.plugins.packer;
in
{
options = {
plugins.packer = {
enable = mkEnableOption "packer.nvim";
package = lib.mkPackageOption pkgs [
"vimPlugins"
"packer-nvim"
] { };
gitPackage = lib.mkPackageOption pkgs "git" {
nullable = true;
};
plugins =
with types;
let
pluginType = either str (submodule {
options = {
name = mkOption {
type = str;
description = "Name of the plugin to install";
};
disable = helpers.mkNullOrOption bool "Mark plugin as inactive";
as = helpers.mkNullOrOption str "Specifies an alias under which to install the plugin";
installer = helpers.defaultNullOpts.mkLuaFn "nil" "A custom installer";
updater = helpers.defaultNullOpts.mkLuaFn "nil" "A custom updater";
after = helpers.mkNullOrOption (either str (listOf str)) "Plugins to load after this plugin";
rtp = helpers.mkNullOrOption str "Specifies a subdirectory of the plugin to add to runtimepath";
opt = helpers.mkNullOrOption bool "Marks a plugin as optional";
branch = helpers.mkNullOrOption str "Git branch to use";
tag = helpers.mkNullOrOption str "Git tag to use";
commit = helpers.mkNullOrOption str "Git commit to use";
lock = helpers.mkNullOrOption bool "Skip this plugin in updates";
run = helpers.mkNullOrOption (oneOf [
str
rawLua
(listOf (either str rawLua))
]) "Post-install hook";
requires = helpers.mkNullOrOption (eitherRecursive str listOfPlugins) "Plugin dependencies";
rocks = helpers.mkNullOrOption (either str (listOf (either str attrs))) "Luarocks dependencies";
config = helpers.mkNullOrOption (either str rawLua) "Code to run after this plugin is loaded";
setup = helpers.mkNullOrOption (either str rawLua) "Code to be run before this plugin is loaded";
cmd = helpers.mkNullOrOption (either str (listOf str)) "Commands which load this plugin";
ft = helpers.mkNullOrOption (either str (listOf str)) "Filetypes which load this plugin";
keys = helpers.mkNullOrOption (either str (listOf str)) "Keymaps which load this plugin";
event = helpers.mkNullOrOption (either str (listOf str)) "Autocommand events which load this plugin";
fn = helpers.mkNullOrOption (either str (listOf str)) "Functions which load this plugin";
cond = helpers.mkNullOrOption (oneOf [
str
rawLua
(listOf (either str rawLua))
]) "Conditional test to load this plugin";
module = helpers.mkNullOrOption (either str (listOf str)) "Patterns of module names which load this plugin";
};
});
listOfPlugins = types.listOf pluginType;
in
mkOption {
type = listOfPlugins;
default = [ ];
description = "List of plugins";
};
rockPlugins = mkOption {
type = with types; listOf (either str attrs);
description = "List of lua rock plugins";
default = [ ];
example = ''
[
"penlight"
"lua-resty-http"
"lpeg"
]
'';
};
};
};
config = mkIf cfg.enable {
extraPlugins = [ cfg.package ];
extraPackages = [ cfg.gitPackage ];
extraConfigLua =
let
luaRockPluginToLua =
luaRockPlugin:
if isAttrs luaRockPlugin then
mapAttrs' (k: v: {
name = if k == "name" then "__unkeyed" else k;
value = v;
}) luaRockPlugin
else
luaRockPlugin;
luaRockListToLua = map luaRockPluginToLua;
pluginToLua =
plugin:
if isAttrs plugin then
{
"__unkeyed" = plugin.name;
inherit (plugin)
disable
as
installer
updater
after
rtp
opt
branch
tag
commit
lock
run
;
requires = helpers.ifNonNull' plugin.requires (
if isList plugin.requires then (pluginListToLua plugin.requires) else plugin.requires
);
rocks = helpers.ifNonNull' plugin.rocks (
if isList plugin.rocks then luaRockListToLua plugin.rocks else plugin.rocks
);
inherit (plugin)
config
setup
cmd
ft
keys
event
fn
cond
module
;
}
else
plugin;
pluginListToLua = map pluginToLua;
plugins = pluginListToLua cfg.plugins;
packedPlugins = if length plugins == 1 then head plugins else plugins;
luaRockPlugins = luaRockListToLua cfg.rockPlugins;
luaRocksString = optionalString (
cfg.rockPlugins != [ ]
) "use_rocks ${lib.nixvim.toLuaObject luaRockPlugins}";
in
mkIf (cfg.plugins != [ ]) ''
require('packer').startup(function()
use ${lib.nixvim.toLuaObject packedPlugins}
${luaRocksString}
end)
'';
};
}

View file

@ -1,145 +0,0 @@
{
# Empty configuration
empty = {
plugins.packer.enable = true;
};
test = {
plugins.packer = {
enable = true;
plugins = [
# Packer can manage itself
"wbthomason/packer.nvim"
# Simple plugins can be specified as strings
"rstacruz/vim-closer"
# Lazy loading:
# Load on specific commands
{
name = "tpope/vim-dispatch";
opt = true;
cmd = [
"Dispatch"
"Make"
"Focus"
"Start"
];
}
# Load on an autocommand event
{
name = "andymass/vim-matchup";
event = "VimEnter";
}
# Load on a combination of conditions: specific filetypes or commands
# Also run code after load (see the "config" key)
{
name = "w0rp/ale";
ft = [
"sh"
"zsh"
"bash"
"c"
"cpp"
"cmake"
"html"
"markdown"
"racket"
"vim"
"tex"
];
cmd = "ALEEnable";
config = "vim.cmd[[ALEEnable]]";
}
# Plugins can have dependencies on other plugins
{
name = "haorenW1025/completion-nvim";
opt = true;
requires = [
{
name = "hrsh7th/vim-vsnip";
opt = true;
}
{
name = "hrsh7th/vim-vsnip-integ";
opt = true;
}
];
}
# Plugins can also depend on rocks from luarocks.org:
{
name = "my/supercoolplugin";
rocks = [
"lpeg"
{
name = "lua-cjson";
version = "2.1.0";
}
];
}
# Local plugins can be included
"~/projects/personal/hover.nvim"
# Plugins can have post-install/update hooks
{
name = "iamcco/markdown-preview.nvim";
run = "cd app && yarn install";
cmd = "MarkdownPreview";
}
# Post-install/update hook with neovim command
{
name = "nvim-treesitter/nvim-treesitter";
run = ":TSUpdate";
}
# Post-install/update hook with call of vimscript function with argument
{
name = "glacambre/firenvim";
run.__raw = ''function() vim.fn["firenvim#install"](0) end'';
}
# Use specific branch, dependency and run lua file after load
{
name = "glepnir/galaxyline.nvim";
branch = "main";
config.__raw = ''function() require"statusline" end'';
requires = [ "kyazdani42/nvim-web-devicons" ];
}
# Use dependency and run lua function after load
{
name = "lewis6991/gitsigns.nvim";
requires = [ "nvim-lua/plenary.nvim" ];
config.__raw = ''function() require("gitsigns").setup() end'';
}
# You can alias plugin names
{
name = "dracula/vim";
as = "dracula";
}
];
# You can specify rocks in isolation
rockPlugins = [
"penlight"
"lua-resty-http"
"lpeg"
];
};
};
no-packages = {
plugins.packer = {
enable = true;
gitPackage = null;
};
};
}