1 #!/usr/bin/env nix-shell
2 #!nix-shell update-shell.nix -i python3
5 # $ nix run nixpkgs#python3Packages.ruff -- update.py
7 # $ nix run nixpkgs#python3Packages.mypy -- update.py
9 # $ nix run nixpkgs#python3Packages.flake8 -- --ignore E501,E265,E402 update.py
14 from pathlib
import Path
15 from typing
import List
, Tuple
17 # Import plugin update library from maintainers/scripts/pluginupdate.py
18 ROOT
= Path(os
.path
.dirname(os
.path
.abspath(inspect
.getfile(inspect
.currentframe())))) # type: ignore
20 0, os
.path
.join(ROOT
.parent
.parent
.parent
.parent
.parent
, "maintainers", "scripts")
25 with import <localpkgs> {{ }};
27 inherit (kakouneUtils.override {{ }}) buildKakounePluginFrom2Nix;
28 generated = callPackage {ROOT}/generated.nix {{
29 inherit buildKakounePluginFrom2Nix;
34 && lib.hasAttrByPath [
40 if hasChecksum value then
42 submodules = value.src.fetchSubmodules or false;
43 sha256 = value.src.outputHash;
48 checksums = lib.mapAttrs getChecksum generated;
50 lib.filterAttrs (n: v: v != null) checksums
53 HEADER
= "# This file has been @generated by ./pkgs/applications/editors/kakoune/plugins/update.py. Do not edit!"
56 class KakouneEditor(pluginupdate
.Editor
):
59 plugins
: List
[Tuple
[pluginupdate
.PluginDesc
, pluginupdate
.Plugin
]],
62 with
open(outfile
, "w+") as f
:
66 { lib, buildKakounePluginFrom2Nix, fetchFromGitHub, overrides ? (self: super: {}) }:
71 for pluginDesc
, plugin
in plugins
:
74 {plugin.normalized_name} = buildKakounePluginFrom2Nix {{
75 pname = "{plugin.normalized_name}";
76 version = "{plugin.version}";
77 src = {pluginDesc.repo.as_nix(plugin)};
78 meta.homepage = "{pluginDesc.repo.url("")}";
85 in lib.fix' (lib.extends overrides packages)
88 print(f
"updated {outfile}")
90 def update(self
, args
):
91 pluginupdate
.update_plugins(self
, args
)
95 editor
= KakouneEditor("kakoune", ROOT
, GET_PLUGINS
)
99 if __name__
== "__main__":