-
Notifications
You must be signed in to change notification settings - Fork 4
/
plugins.nix
47 lines (45 loc) · 1.34 KB
/
plugins.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
{
buildPythonPackage,
callPackage,
fetchPypi,
lib,
plover,
sources,
}: let
inherit (lib) extends;
getName = plugin: lib.lists.head (builtins.split "-[0-9]" plugin.filename);
plugins = builtins.fromJSON (builtins.readFile ./plugins.json);
makePloverPlugin = plugin: (buildPythonPackage rec {
pname = plugin.name;
version = plugin.version;
src = fetchPypi {
inherit version;
pname = lib.lists.head (builtins.split "-[0-9]" plugin.filename);
sha256 = plugin.sha256;
};
buildInputs = [plover];
});
makeRenamedPloverPlugin = plugin: let
name = getName plugin;
in {
inherit name;
value = throw "The plugin ${name} has been renamed to ${plugin.name}. See the readme for more info.";
};
pluginToAttr = p: {
name = p.pname;
value = p;
};
basicPlugins = final: prev:
builtins.listToAttrs (map (p: makeRenamedPloverPlugin p) plugins)
# Concat the sets and make sure the correct names have priority over the renamed ones
// builtins.listToAttrs (map (p: pluginToAttr (makePloverPlugin p)) plugins);
overrides = callPackage ./overrides.nix {};
initialPackages = self: callPackage ./extra-plugins.nix {inherit plover sources;};
extensible-self =
lib.makeExtensible
(
extends overrides
(extends basicPlugins initialPackages)
);
in
extensible-self