-
-
Notifications
You must be signed in to change notification settings - Fork 18
/
theme.nix
47 lines (42 loc) · 1.22 KB
/
theme.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
{
config,
lib,
...
}:
with lib;
with lib.attrsets;
with builtins; let
cfg = config.vim.theme;
supported_themes = import ./supported_themes.nix {inherit lib;};
in {
options.vim.theme = {
enable = mkOption {
type = types.bool;
description = "Enable theming";
};
name = mkOption {
type = types.enum (attrNames supported_themes);
description = "Supported themes can be found in `supported_themes.nix`";
};
style = mkOption {
type = with types; enum supported_themes.${cfg.name}.styles;
description = "Specific style for theme if it supports it";
};
transparent = mkOption {
type = with types; bool;
default = false;
description = "Whether or not transparency should be enabled. Has no effect for themes that do not support transparency";
};
extraConfig = mkOption {
type = with types; lines;
description = "Additional lua configuration to add before setup";
};
};
config = mkIf cfg.enable {
vim.startPlugins = [cfg.name];
vim.luaConfigRC.themeSetup = nvim.dag.entryBefore ["theme"] cfg.extraConfig;
vim.luaConfigRC.theme = supported_themes.${cfg.name}.setup (with cfg; {
inherit style transparent;
});
};
}