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
@ -1,8 +1,7 @@
|
|||||||
# Deprecated aliases - for backward compatibility
|
# Deprecated aliases - for backward compatibility
|
||||||
|
lib:
|
||||||
|
|
||||||
lib: overriden:
|
final: prev:
|
||||||
|
|
||||||
with overriden;
|
|
||||||
|
|
||||||
let
|
let
|
||||||
# Removing recurseForDerivation prevents derivations of aliased attribute
|
# Removing recurseForDerivation prevents derivations of aliased attribute
|
||||||
@ -21,12 +20,12 @@ let
|
|||||||
|
|
||||||
# Make sure that we are not shadowing something from
|
# Make sure that we are not shadowing something from
|
||||||
# all-packages.nix.
|
# 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"
|
then throw "Alias ${n} is still in vim-plugins"
|
||||||
else alias;
|
else alias;
|
||||||
|
|
||||||
mapAliases = aliases:
|
mapAliases = aliases:
|
||||||
lib.mapAttrs (n: alias: removeDistribute
|
lib.mapAttrs (n: alias: removeDistribute
|
||||||
(removeRecurseForDerivations
|
(removeRecurseForDerivations
|
||||||
(checkInPkgs n alias)))
|
(checkInPkgs n alias)))
|
||||||
aliases;
|
aliases;
|
||||||
@ -36,7 +35,7 @@ let
|
|||||||
) (builtins.fromJSON (builtins.readFile ./deprecated.json));
|
) (builtins.fromJSON (builtins.readFile ./deprecated.json));
|
||||||
|
|
||||||
in
|
in
|
||||||
mapAliases ({
|
mapAliases (with prev; {
|
||||||
airline = vim-airline;
|
airline = vim-airline;
|
||||||
alternative = a-vim; # backwards compat, added 2014-10-21
|
alternative = a-vim; # backwards compat, added 2014-10-21
|
||||||
bats = bats-vim;
|
bats = bats-vim;
|
||||||
|
@ -5,8 +5,12 @@ let
|
|||||||
|
|
||||||
inherit (vimUtils.override {inherit vim;}) buildVimPluginFrom2Nix;
|
inherit (vimUtils.override {inherit vim;}) buildVimPluginFrom2Nix;
|
||||||
|
|
||||||
|
inherit (lib) extends;
|
||||||
|
|
||||||
|
initialPackages = self: {};
|
||||||
|
|
||||||
plugins = callPackage ./generated.nix {
|
plugins = callPackage ./generated.nix {
|
||||||
inherit buildVimPluginFrom2Nix overrides;
|
inherit buildVimPluginFrom2Nix;
|
||||||
};
|
};
|
||||||
|
|
||||||
# TL;DR
|
# TL;DR
|
||||||
@ -21,8 +25,13 @@ let
|
|||||||
inherit llvmPackages;
|
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
|
in
|
||||||
|
extensible-self
|
||||||
plugins // aliases
|
|
||||||
|
@ -47,9 +47,9 @@ def generate_nix(plugins: List[Tuple[str, str, pluginupdate.Plugin]], outfile: s
|
|||||||
f.write(HEADER)
|
f.write(HEADER)
|
||||||
f.write(
|
f.write(
|
||||||
"""
|
"""
|
||||||
{ lib, buildVimPluginFrom2Nix, fetchFromGitHub, overrides ? (self: super: {}) }:
|
{ lib, buildVimPluginFrom2Nix, fetchFromGitHub }:
|
||||||
let
|
|
||||||
packages = ( self:
|
final: prev:
|
||||||
{"""
|
{"""
|
||||||
)
|
)
|
||||||
for owner, repo, plugin in sorted_plugins:
|
for owner, repo, plugin in sorted_plugins:
|
||||||
@ -75,8 +75,7 @@ let
|
|||||||
)
|
)
|
||||||
f.write(
|
f.write(
|
||||||
"""
|
"""
|
||||||
});
|
}
|
||||||
in lib.fix' (lib.extends overrides packages)
|
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
print(f"updated {outfile}")
|
print(f"updated {outfile}")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user