vimPlugins: generate an overlay
let update.py generates generated.nix as an overlay. This should help maintaining vim-plugins outside of nixpkgs, as one can use update.py to generate an out-of-tree vimPlugins overlay.
This commit is contained in:
parent
ce0cabb49d
commit
8c63ac7893
3 changed files with 22 additions and 15 deletions
|
@ -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
|
||||
|
|
|
@ -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 a new issue