Merge pull request #83809 from teto/vimPlugins_rework
vimPlugins: generated.nix as an overlay
This commit is contained in:
commit
9d4a851c67
|
@ -13,6 +13,7 @@ import http
|
|||
import json
|
||||
import os
|
||||
import subprocess
|
||||
import logging
|
||||
import sys
|
||||
import time
|
||||
import traceback
|
||||
|
@ -34,6 +35,14 @@ ATOM_ENTRY = "{http://www.w3.org/2005/Atom}entry" # " vim gets confused here
|
|||
ATOM_LINK = "{http://www.w3.org/2005/Atom}link" # "
|
||||
ATOM_UPDATED = "{http://www.w3.org/2005/Atom}updated" # "
|
||||
|
||||
LOG_LEVELS = {
|
||||
logging.getLevelName(level): level for level in [
|
||||
logging.DEBUG, logging.INFO, logging.WARN, logging.ERROR ]
|
||||
}
|
||||
|
||||
log = logging.getLogger()
|
||||
log.addHandler(logging.StreamHandler())
|
||||
|
||||
|
||||
def retry(ExceptionToCheck: Any, tries: int = 4, delay: float = 3, backoff: float = 2):
|
||||
"""Retry calling the decorated function using an exponential backoff.
|
||||
|
@ -235,6 +244,7 @@ def prefetch_plugin(
|
|||
alias: Optional[str],
|
||||
cache: "Optional[Cache]" = None,
|
||||
) -> Tuple[Plugin, Dict[str, str]]:
|
||||
log.info("Prefetching plugin %s", repo_name)
|
||||
repo = Repo(user, repo_name, branch, alias)
|
||||
commit, date = repo.latest_commit()
|
||||
has_submodules = repo.has_submodules()
|
||||
|
@ -464,6 +474,11 @@ def parse_args(editor: Editor):
|
|||
"--no-commit", "-n", action="store_true", default=False,
|
||||
help="Whether to autocommit changes"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--debug", "-d", choices=LOG_LEVELS.keys(),
|
||||
default=logging.getLevelName(logging.WARN),
|
||||
help="Adjust log level"
|
||||
)
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
|
@ -503,6 +518,9 @@ def update_plugins(editor: Editor):
|
|||
"""The main entry function of this module. All input arguments are grouped in the `Editor`."""
|
||||
|
||||
args = parse_args(editor)
|
||||
log.setLevel(LOG_LEVELS[args.debug])
|
||||
|
||||
log.info("Start updating plugins")
|
||||
nixpkgs_repo = git.Repo(editor.root, search_parent_directories=True)
|
||||
update = get_update(args.input_file, args.outfile, args.proc, editor)
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
# Deprecated aliases - for backward compatibility
|
||||
lib:
|
||||
|
||||
lib: overriden:
|
||||
|
||||
with overriden;
|
||||
final: prev:
|
||||
|
||||
let
|
||||
# Removing recurseForDerivation prevents derivations of aliased attribute
|
||||
|
@ -21,12 +20,12 @@ let
|
|||
|
||||
# Make sure that we are not shadowing something from
|
||||
# all-packages.nix.
|
||||
checkInPkgs = n: alias: if builtins.hasAttr n overriden
|
||||
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
|
||||
lib.mapAttrs (n: alias: removeDistribute
|
||||
(removeRecurseForDerivations
|
||||
(checkInPkgs n alias)))
|
||||
aliases;
|
||||
|
@ -36,7 +35,7 @@ let
|
|||
) (builtins.fromJSON (builtins.readFile ./deprecated.json));
|
||||
|
||||
in
|
||||
mapAliases ({
|
||||
mapAliases (with prev; {
|
||||
airline = vim-airline;
|
||||
alternative = a-vim; # backwards compat, added 2014-10-21
|
||||
bats = bats-vim;
|
||||
|
|
|
@ -5,8 +5,12 @@ let
|
|||
|
||||
inherit (vimUtils.override {inherit vim;}) buildVimPluginFrom2Nix;
|
||||
|
||||
inherit (lib) extends;
|
||||
|
||||
initialPackages = self: {};
|
||||
|
||||
plugins = callPackage ./generated.nix {
|
||||
inherit buildVimPluginFrom2Nix overrides;
|
||||
inherit buildVimPluginFrom2Nix;
|
||||
};
|
||||
|
||||
# TL;DR
|
||||
|
@ -21,8 +25,13 @@ let
|
|||
inherit llvmPackages;
|
||||
};
|
||||
|
||||
aliases = lib.optionalAttrs (config.allowAliases or true) (import ./aliases.nix lib plugins);
|
||||
aliases = if (config.allowAliases or true) then final: prev: {} else (import ./aliases.nix lib);
|
||||
|
||||
extensible-self = lib.makeExtensible
|
||||
(extends aliases
|
||||
(extends overrides
|
||||
(extends plugins initialPackages)
|
||||
)
|
||||
);
|
||||
in
|
||||
|
||||
plugins // aliases
|
||||
extensible-self
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# This file has been generated by ./pkgs/misc/vim-plugins/update.py. Do not edit!
|
||||
{ lib, buildVimPluginFrom2Nix, fetchFromGitHub, overrides ? (self: super: {}) }:
|
||||
let
|
||||
packages = ( self:
|
||||
{ lib, buildVimPluginFrom2Nix, fetchFromGitHub }:
|
||||
|
||||
final: prev:
|
||||
{
|
||||
a-vim = buildVimPluginFrom2Nix {
|
||||
pname = "a-vim";
|
||||
|
@ -1631,12 +1631,12 @@ let
|
|||
|
||||
ghcid = buildVimPluginFrom2Nix {
|
||||
pname = "ghcid";
|
||||
version = "2021-02-14";
|
||||
version = "2021-05-16";
|
||||
src = fetchFromGitHub {
|
||||
owner = "ndmitchell";
|
||||
repo = "ghcid";
|
||||
rev = "abbb157ac9d06fdfba537f97ab96e197b3bb36cb";
|
||||
sha256 = "008alqgqbrjh9sqgazqq1kk5hnpikd8afnia5lx9rv8c2am1d2fv";
|
||||
rev = "dec6adb151cc5514f8ea99b8568e7a4c94db6318";
|
||||
sha256 = "14k0crk6lvj6qp1rpfmldmw5w9axy7336aacpvfsh7d4a93xdjzv";
|
||||
};
|
||||
meta.homepage = "https://github.com/ndmitchell/ghcid/";
|
||||
};
|
||||
|
@ -3132,12 +3132,12 @@ let
|
|||
|
||||
nnn-vim = buildVimPluginFrom2Nix {
|
||||
pname = "nnn-vim";
|
||||
version = "2021-04-27";
|
||||
version = "2021-05-16";
|
||||
src = fetchFromGitHub {
|
||||
owner = "mcchrish";
|
||||
repo = "nnn.vim";
|
||||
rev = "422cd80e35c81a303d16a600f549dc4d319cecf6";
|
||||
sha256 = "187q3m0llrwmrqskf14cqy9ndvvj8nfnyrw46f8mdkrslkfs9vf2";
|
||||
rev = "a997a8fc9739d1bf1900c66f056e1b11a9f61443";
|
||||
sha256 = "1rdcjnfgk1yi2ick7m7xh07daarfjvxgf3w656hzarbqshpamy2a";
|
||||
};
|
||||
meta.homepage = "https://github.com/mcchrish/nnn.vim/";
|
||||
};
|
||||
|
@ -3300,12 +3300,12 @@ let
|
|||
|
||||
nvim-dap-virtual-text = buildVimPluginFrom2Nix {
|
||||
pname = "nvim-dap-virtual-text";
|
||||
version = "2021-04-26";
|
||||
version = "2021-05-16";
|
||||
src = fetchFromGitHub {
|
||||
owner = "theHamsta";
|
||||
repo = "nvim-dap-virtual-text";
|
||||
rev = "96b8e0423609a23cb971edb1d10c757d7930787b";
|
||||
sha256 = "0z84xisjj4a0blfy7ds5hlwvvr6yc7nwiqglli1h6lp7abxs5xx0";
|
||||
rev = "29a79b7c15e7e15a416bcaa0efddfe67928b7bdd";
|
||||
sha256 = "0wl9dl83cx2hlik7yx6kknb7spsaqlzri2kybf3xcna44mqfq688";
|
||||
};
|
||||
meta.homepage = "https://github.com/theHamsta/nvim-dap-virtual-text/";
|
||||
};
|
||||
|
@ -3388,8 +3388,8 @@ let
|
|||
src = fetchFromGitHub {
|
||||
owner = "neovim";
|
||||
repo = "nvim-lspconfig";
|
||||
rev = "68806113013a5debf382cc069adcf8ff786cefb2";
|
||||
sha256 = "1klvvvyd936gh9ax7a91v750k7a2asq8zwk8fbbha57s8kmca252";
|
||||
rev = "0699e6c16c37c08418339675d142af0e00ccbeaa";
|
||||
sha256 = "0rdqxcrcybvdspl22xzyrvv4rqikhq2liqja0jkf2xavc42j7fxx";
|
||||
};
|
||||
meta.homepage = "https://github.com/neovim/nvim-lspconfig/";
|
||||
};
|
||||
|
@ -3456,12 +3456,12 @@ let
|
|||
|
||||
nvim-toggleterm-lua = buildVimPluginFrom2Nix {
|
||||
pname = "nvim-toggleterm-lua";
|
||||
version = "2021-05-15";
|
||||
version = "2021-05-16";
|
||||
src = fetchFromGitHub {
|
||||
owner = "akinsho";
|
||||
repo = "nvim-toggleterm.lua";
|
||||
rev = "63acbaf2dba462de3501b37efb96f57ec00ed952";
|
||||
sha256 = "0pr9qggp3zdzgj6qgfm9fwqjwi54lvdxicmyfzq0xgqsdn1bdsya";
|
||||
rev = "46ffb283c490f96b31d699b766471f83da0bc0cf";
|
||||
sha256 = "0pimi8hm213n17lkiyz7ib4d804grzv3pzv060nh3qagdvi5rvnx";
|
||||
};
|
||||
meta.homepage = "https://github.com/akinsho/nvim-toggleterm.lua/";
|
||||
};
|
||||
|
@ -3480,12 +3480,12 @@ let
|
|||
|
||||
nvim-treesitter = buildVimPluginFrom2Nix {
|
||||
pname = "nvim-treesitter";
|
||||
version = "2021-05-11";
|
||||
version = "2021-05-16";
|
||||
src = fetchFromGitHub {
|
||||
owner = "nvim-treesitter";
|
||||
repo = "nvim-treesitter";
|
||||
rev = "efbb1c66d27eb5b4bfbcc1f59d3384e0641c8214";
|
||||
sha256 = "1sfc7890v4lgc7r4a5k922qbnc1lpjp3i8sj1jqqxd4a73x1nsvm";
|
||||
rev = "71247a4a658a7678328fa6224ede103dcf1268fc";
|
||||
sha256 = "05f90s36nzk13s2rdyrzalwv4psz9pjccw89ihxbik1ndg8iwz18";
|
||||
};
|
||||
meta.homepage = "https://github.com/nvim-treesitter/nvim-treesitter/";
|
||||
};
|
||||
|
@ -4093,12 +4093,12 @@ let
|
|||
|
||||
rust-tools-nvim = buildVimPluginFrom2Nix {
|
||||
pname = "rust-tools-nvim";
|
||||
version = "2021-05-10";
|
||||
version = "2021-05-16";
|
||||
src = fetchFromGitHub {
|
||||
owner = "simrat39";
|
||||
repo = "rust-tools.nvim";
|
||||
rev = "2de94fc88d6382e5f0b61f1c619c8919fd45aea3";
|
||||
sha256 = "14fg0qs1y2xszpdsnp8gcynqj9fx5c47ckbpgr48hv5df8xncasf";
|
||||
rev = "6f92ba636c06069592c64f85888b452da7e81cfd";
|
||||
sha256 = "1ng259hs6l6q17hc3y2iyd7v9xm6mkfg0jbpwgrbk4pf2clpn2aa";
|
||||
};
|
||||
meta.homepage = "https://github.com/simrat39/rust-tools.nvim/";
|
||||
};
|
||||
|
@ -4683,12 +4683,12 @@ let
|
|||
|
||||
telescope-nvim = buildVimPluginFrom2Nix {
|
||||
pname = "telescope-nvim";
|
||||
version = "2021-05-15";
|
||||
version = "2021-05-16";
|
||||
src = fetchFromGitHub {
|
||||
owner = "nvim-telescope";
|
||||
repo = "telescope.nvim";
|
||||
rev = "4da66dab44f37d0de4b88cedf9e114c5b0855c20";
|
||||
sha256 = "1xpns9dxik239ipzic2kih4zkb5wwvzgbc8pxd60wgqi2021n7vn";
|
||||
rev = "69eb5eacff421e05aeb1e02ff97ef64bfd955c53";
|
||||
sha256 = "1yn5hzv57lld6zpxd7cqnjhj3qb5l9ngnnrb9kfp6c6gy137wlj8";
|
||||
};
|
||||
meta.homepage = "https://github.com/nvim-telescope/telescope.nvim/";
|
||||
};
|
||||
|
@ -7871,8 +7871,8 @@ let
|
|||
src = fetchFromGitHub {
|
||||
owner = "thinca";
|
||||
repo = "vim-quickrun";
|
||||
rev = "aea6538c8ddd15e5df368911341f7989ecc49615";
|
||||
sha256 = "0pbi884fcnigb7wwr9w0sjs7w6713wsp01d3v7njnph70bfs1mx5";
|
||||
rev = "7685488adfbd2950a8ef4ecaedafef8a036f9275";
|
||||
sha256 = "1jsdxm2cgd5aqir3g7jbyq17xsslc8a5xmpmlsyci5hprrhnnv2c";
|
||||
};
|
||||
meta.homepage = "https://github.com/thinca/vim-quickrun/";
|
||||
};
|
||||
|
@ -9405,5 +9405,4 @@ let
|
|||
meta.homepage = "https://github.com/troydm/zoomwintab.vim/";
|
||||
};
|
||||
|
||||
});
|
||||
in lib.fix' (lib.extends overrides packages)
|
||||
}
|
||||
|
|
|
@ -47,9 +47,9 @@ def generate_nix(plugins: List[Tuple[str, str, pluginupdate.Plugin]], outfile: s
|
|||
f.write(HEADER)
|
||||
f.write(
|
||||
"""
|
||||
{ lib, buildVimPluginFrom2Nix, fetchFromGitHub, overrides ? (self: super: {}) }:
|
||||
let
|
||||
packages = ( self:
|
||||
{ lib, buildVimPluginFrom2Nix, fetchFromGitHub }:
|
||||
|
||||
final: prev:
|
||||
{"""
|
||||
)
|
||||
for owner, repo, plugin in sorted_plugins:
|
||||
|
@ -75,8 +75,7 @@ let
|
|||
)
|
||||
f.write(
|
||||
"""
|
||||
});
|
||||
in lib.fix' (lib.extends overrides packages)
|
||||
}
|
||||
"""
|
||||
)
|
||||
print(f"updated {outfile}")
|
||||
|
|
Loading…
Reference in New Issue